-
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.
Merge branch 'master' into fix/actions-docs
- Loading branch information
Showing
62 changed files
with
14,811 additions
and
200 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
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
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,3 @@ | ||
COMPOSIO_API_KEY=KEY | ||
OPENAI_API_KEY=KEY | ||
GROQ_API_KEY=KEY #if you want to use groq models |
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,49 @@ | ||
import { openai } from "@ai-sdk/openai"; | ||
import { groq } from '@ai-sdk/groq'; | ||
import { VercelAIToolSet } from "composio-core"; | ||
import dotenv from "dotenv"; | ||
import { generateText } from "ai"; | ||
dotenv.config(); | ||
|
||
// Setup toolset | ||
const toolset = new VercelAIToolSet({ | ||
apiKey: process.env.COMPOSIO_API_KEY, | ||
}); | ||
|
||
const appName = "googledocs"; | ||
|
||
async function setupUserConnectionIfNotExists(entityId) { | ||
const entity = await toolset.client.getEntity(entityId); | ||
const connection = await entity.getConnection(appName); | ||
|
||
if (!connection) { | ||
// Initiate a new connection if it doesn't exist | ||
const newConnection = await entity.initiateConnection(appName); | ||
console.log("Log in via: ", newConnection.redirectUrl); | ||
return newConnection.waitUntilActive(60); | ||
} | ||
|
||
return connection; | ||
} | ||
|
||
async function executeAgent(entityName) { | ||
// Setup entity and ensure connection | ||
//const entity = await toolset.client.getEntity(entityName); | ||
//await setupUserConnectionIfNotExists(entity.id); | ||
|
||
// Retrieve tools for the specified app | ||
const tools = await toolset.getTools({ apps: ['codeinterpreter','googledocs'] }); | ||
// Generate text using the model and tools | ||
const info = `I am a software engineer with 5 years of experience in the field. I have worked on multiple projects like a chatbot and a web app. I have a strong understanding of software development. I am currently looking for a new job and am open to opportunities in the San Francisco Bay Area.`; | ||
const output = await generateText({ | ||
model: openai("gpt-4o"),//groq("llama3-8b-8192"), | ||
streamText: false, | ||
tools: tools, | ||
prompt: `Based on my info: ${info} and generate the reactjs code for a portfolio website, also give the folder directory and steps to set it up. Then put all of it in a google doc`, | ||
maxToolRoundtrips: 5, | ||
}); | ||
|
||
console.log("🎉Output from agent: ", output.text); | ||
} | ||
|
||
executeAgent("default_user"); |
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,19 @@ | ||
{ | ||
"name": "vercel", | ||
"version": "1.0.0", | ||
"description": "", | ||
"main": "index.js", | ||
"scripts": { | ||
"test": "echo \"Error: no test specified\" && exit 1" | ||
}, | ||
"keywords": [], | ||
"author": "", | ||
"license": "ISC", | ||
"dependencies": { | ||
"@ai-sdk/openai": "^0.0.36", | ||
"ai": "^3.2.24", | ||
"composio-core": "latest", | ||
"dotenv": "^16.4.5", | ||
"zod": "^3.23.8" | ||
} | ||
} |
Oops, something went wrong.