-
Notifications
You must be signed in to change notification settings - Fork 4.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
18 changed files
with
5,081 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
import { ChatOpenAI } from "@langchain/openai"; | ||
import { createOpenAIFunctionsAgent, AgentExecutor } from "langchain/agents"; | ||
import { pull } from "langchain/hub"; | ||
import dotenv from 'dotenv'; | ||
import { LangchainToolSet } from "composio-core"; | ||
|
||
dotenv.config(); | ||
|
||
|
||
(async () => { | ||
try { | ||
const llm = new ChatOpenAI({ | ||
model: "gpt-4-turbo", | ||
apiKey: process.env.OPENAI_API_KEY, | ||
}); | ||
|
||
const toolset = new LangchainToolSet({ | ||
apiKey: process.env.COMPOSIO_API_KEY, | ||
}); | ||
|
||
const tools = await toolset.getTools({ | ||
apps: ["tavily"] | ||
}); | ||
|
||
const prompt = await pull("hwchase17/openai-functions-agent"); | ||
|
||
// Debugging logs | ||
//console.log("LLM:", llm); | ||
console.log("Tools:", tools); | ||
//console.log("Prompt:", prompt); | ||
|
||
const additional = `You are a market research agent that finds niche ideas that can be built and marketed. | ||
Your users are primarily indie hackers who want to build something new and are looking for ideas. The input will | ||
be a domain or a category and your job is to research extensively and find ideas that can be marketed. | ||
Also write the content to market a tool built with this idea. It should be very very specific and not too long.`; | ||
|
||
// Check combined_prompt | ||
|
||
const agent = await createOpenAIFunctionsAgent({ | ||
llm, | ||
tools, | ||
prompt, | ||
}); | ||
|
||
const agentExecutor = new AgentExecutor({ | ||
agent, | ||
tools, | ||
verbose: true, | ||
}); | ||
const domain = 'AI SaaS' | ||
const result = await agentExecutor.invoke({ | ||
input: additional + 'This is the domain:' + domain | ||
}); | ||
console.log('🎉Output from agent: ', result.output); | ||
return result.output | ||
} catch (error) { | ||
console.error(error); | ||
} | ||
})(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
{ | ||
"name": "lead-outreach-agent", | ||
"version": "1.0.0", | ||
"description": "", | ||
"main": "index.js", | ||
"scripts": { | ||
"test": "echo \"Error: no test specified\" && exit 1" | ||
}, | ||
"keywords": [], | ||
"author": "", | ||
"license": "ISC", | ||
"type": "module", | ||
"dependencies": { | ||
"composio-core": "^0.4.4", | ||
"dotenv": "^16.4.7", | ||
"express": "^4.19.2", | ||
"langchain": "^0.3.5", | ||
"pusher-js": "8.4.0-rc2" | ||
} | ||
} |
Oops, something went wrong.