Skip to content

Commit

Permalink
feat: new agents (#1022)
Browse files Browse the repository at this point in the history
  • Loading branch information
Prat011 authored Dec 16, 2024
1 parent 9af274d commit 0d23e3a
Show file tree
Hide file tree
Showing 18 changed files with 5,081 additions and 0 deletions.
59 changes: 59 additions & 0 deletions js/examples/market_research_agent/demo.mjs
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);
}
})();
20 changes: 20 additions & 0 deletions js/examples/market_research_agent/package.json
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"
}
}
Loading

0 comments on commit 0d23e3a

Please sign in to comment.