-
Notifications
You must be signed in to change notification settings - Fork 4.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: groq added #1047
fix: groq added #1047
Changes from all commits
70b2406
35121a5
a8fea45
7b96ca9
976ac14
4f03909
6355298
6ce83a5
bb84325
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
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"; | ||
|
@@ -36,7 +37,7 @@ async function executeAgent(entityName) { | |
|
||
// Generate text using the model and tools | ||
const output = await generateText({ | ||
model: openai("gpt-4o"), | ||
model: groq("llama-3.3-70b-versatile"), | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Consider adding a comment explaining why the model was switched from GPT-4 to LLaMA and any expected behavioral differences. This will help future maintainers understand the reasoning behind this change. |
||
streamText: false, | ||
tools: tools, | ||
prompt: ` | ||
Comment on lines
37
to
43
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🤖 Bug Fix:
By following these steps, you can mitigate the risks associated with this high-impact change. 🚀
Comment on lines
37
to
43
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Comment on lines
37
to
43
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Comment on lines
37
to
43
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Actionable Steps:
This change is critical and should be handled with caution to avoid potential disruptions in functionality. |
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
OPENAI_API_KEY=KEY | ||
COMPOSIO_API_KEY=KEY | ||
AGENTOPS_API_KEY=KEY |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
from composio_llamaindex import ComposioToolSet, App, Action | ||
from llama_index.core.agent import FunctionCallingAgentWorker | ||
from llama_index.core.llms import ChatMessage | ||
from llama_index.llms.openai import OpenAI | ||
from dotenv import load_dotenv | ||
import os | ||
|
||
|
||
load_dotenv() | ||
import agentops | ||
agentops.init(os.getenv("AGENTOPS_API_KEY")) | ||
|
||
|
||
toolset = ComposioToolSet(api_key=os.getenv("COMPOSIO_API_KEY")) | ||
tools = toolset.get_tools(apps=[App.PEOPLEDATALABS, App.GOOGLESHEETS]) | ||
|
||
llm = OpenAI(model="gpt-4o") #Groq(model="llama3-groq-70b-8192-tool-use-preview") | ||
|
||
spreadsheetid = '14T4e0j1XsWjriQYeFMgkM2ihyvLAplPqB9q8hytytcw' | ||
# Set up prefix messages for the agent | ||
prefix_messages = [ | ||
ChatMessage( | ||
role="system", | ||
content=( | ||
f""" | ||
Use the Google Sheets Action to add data to the google sheet | ||
You are a recruiter agent. Based on user input, identify 10 highly qualified candidates using People Data Labs. | ||
After identifying the candidates, create a Google Sheet and add their details for the provided candidate description, and spreadsheet ID: ${spreadsheetid}. | ||
Print the list of candidates and their details along with the link to the Google Sheet. | ||
""" | ||
), | ||
) | ||
] | ||
|
||
agent = FunctionCallingAgentWorker( | ||
tools=tools, | ||
llm=llm, | ||
prefix_messages=prefix_messages, | ||
max_function_calls=10, | ||
allow_parallel_tool_calls=False, | ||
verbose=True, | ||
).as_agent() | ||
|
||
candidate_description = '10 Senior Backend developers in San Francisco' | ||
user_input = f"Create a candidate list based on the description: {candidate_description}. Include all the important details required for the job. Add all of it the google sheet." | ||
response = agent.chat(user_input) | ||
print(response) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# Recruiter Agent | ||
|
||
This guide offers comprehensive instructions for creating a Recruiter Agent that utilizes Composio and agentic frameworks like LlamaIndex and ChatGPT. This agent is designed to effectively identify candidates for your business and compile all candidate data into a spreadsheet. | ||
|
||
## Steps to Run | ||
|
||
**Navigate to the Project Directory:** | ||
Change to the directory where the `setup.sh`, `main.py`, `requirements.txt`, and `README.md` files are located. For example: | ||
```sh | ||
cd path/to/project/directory | ||
``` | ||
|
||
### 1. Run the Setup File | ||
Make the setup.sh Script Executable (if necessary): | ||
On Linux or macOS, you might need to make the setup.sh script executable: | ||
```shell | ||
chmod +x setup.sh | ||
``` | ||
Execute the setup.sh script to set up the environment and install dependencies: | ||
```shell | ||
./setup.sh | ||
``` | ||
Now, fill in the `.env` file with your secrets. | ||
|
||
### 2. Run the Python Script | ||
```shell | ||
python cookbook/python-examples/advanced_agents/recruiter_agent/main.py | ||
``` |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
composio-llamaindex | ||
gradio |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
#!/bin/bash | ||
|
||
# Create a virtual environment named sqlagent | ||
echo "Creating virtual environment..." | ||
python3 -m venv recruiter | ||
|
||
# Activate the virtual environment | ||
echo "Activating virtual environment..." | ||
source recruiter/bin/activate | ||
|
||
# Install libraries from requirements.txt | ||
echo "Installing libraries from requirements.txt..." | ||
pip install -r requirements.txt | ||
|
||
# Copy env backup to .env file | ||
if [ -f ".env.example" ]; then | ||
echo "Copying .env.example to .env..." | ||
cp .env.example .env | ||
else | ||
echo "No .env.example file found. Creating a new .env file..." | ||
touch .env | ||
fi | ||
|
||
# Prompt the user to enter the OPENAI_API_KEY | ||
read -p "Enter your OPENAI_API_KEY: " OPENAI_API_KEY | ||
|
||
# Update the .env file with the entered OPENAI_API_KEY | ||
sed -i "s/^OPENAI_API_KEY=.*$/OPENAI_API_KEY=$OPENAI_API_KEY/" .env | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The |
||
|
||
echo "OPENAI_API_KEY has been set in the .env file" | ||
|
||
echo "Please fill in the .env file with any other necessary environment variables." | ||
|
||
echo "Setup completed successfully!" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider maintaining consistent quote style in imports. The file uses double quotes for other imports but single quotes here. For consistency, suggest using:
import { groq } from "@ai-sdk/groq";