-
-
Notifications
You must be signed in to change notification settings - Fork 505
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
Add search based tools using wikipedia, serper, serp, brave, exa, duckduckgo #412
Changes from all commits
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,3 +1,4 @@ | ||
workspace.code-workspace | ||
.vscode | ||
crewai | ||
.cache | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
```python | ||
from praisonaiagents import Agent, PraisonAIAgents | ||
from praisonaiagents.tools import duckduckgo | ||
|
||
data_agent = Agent(instructions="Search and Read Research Papers on DNA Mutation", tools=[duckduckgo]) | ||
editor_agent = Agent(instructions="Write a scientifically researched outcome and findings about DNA Mutation") | ||
agents = PraisonAIAgents(agents=[data_agent, editor_agent]) | ||
agents.start() | ||
``` |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
```python | ||
from praisonaiagents import Agent, PraisonAIAgents | ||
from exa_py import Exa | ||
import os | ||
|
||
exa = Exa(api_key=os.environ["EXA_API_KEY"]) | ||
|
||
def search_and_contents(query: str): | ||
"""Search for webpages based on the query and retrieve their contents.""" | ||
# This combines two API endpoints: search and contents retrieval | ||
return str(exa.search_and_contents( | ||
query, use_autoprompt=False, num_results=5, text=True, highlights=True | ||
)) | ||
|
||
data_agent = Agent(instructions="Find the latest jobs for Video Editor in New York at startups", tools=[search_and_contents]) | ||
editor_agent = Agent(instructions="Curate the available jobs at startups and their email for the candidate to apply based on his skills on Canva, Adobe Premiere Pro, and Adobe After Effects") | ||
agents = PraisonAIAgents(agents=[data_agent, editor_agent], process='hierarchical') | ||
agents.start() | ||
``` |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
```python | ||
from praisonaiagents import Agent, PraisonAIAgents | ||
from langchain_community.utilities import GoogleSerperAPIWrapper | ||
import os | ||
from dotenv import load_dotenv | ||
|
||
load_dotenv() | ||
|
||
os.environ['SERPER_API_KEY'] = os.getenv('SERPER_API_KEY') | ||
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. There's an inconsistency in how the
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. @asiffarhankhan there are few suggestions here. You could fix this may be in the next update. For now i will merge |
||
|
||
search = GoogleSerperAPIWrapper() | ||
|
||
data_agent = Agent(instructions="Suggest me top 5 most visited websites for Dosa Recipe", tools=[search]) | ||
editor_agent = Agent(instructions="List out the websites with their url and a short description") | ||
agents = PraisonAIAgents(agents=[data_agent, editor_agent]) | ||
agents.start() | ||
``` |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
```python | ||
from praisonaiagents import Agent, PraisonAIAgents | ||
from langchain_community.utilities import SerpAPIWrapper | ||
|
||
data_agent = Agent(instructions="Search about decline of recruitment across various industries with the rise of AI", tools=[SerpAPIWrapper]) | ||
editor_agent = Agent(instructions="Write a blog article pointing out the jobs most at rish due to the rise of AI") | ||
agents = PraisonAIAgents(agents=[data_agent, editor_agent]) | ||
agents.start() | ||
``` |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
```python | ||
from praisonaiagents import Agent, PraisonAIAgents | ||
from langchain_community.utilities import WikipediaAPIWrapper | ||
|
||
data_agent = Agent(instructions="Gather all of Messi's record in LaLiga", tools=[WikipediaAPIWrapper]) | ||
summarise_agent = Agent(instructions="Summarize the data into a well structured format") | ||
agents = PraisonAIAgents(agents=[data_agent, summarise_agent]) | ||
agents.start() | ||
``` |
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.
It's good to load the API key from the environment, but it's critical to handle the case where the
EXA_API_KEY
environment variable is not set. Without this, the program will crash. Consider adding a check to ensure the environment variable is set and provide a helpful error message if it's not.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.
@asiffarhankhan there are few suggestions here. You could fix this may be in the next update. For now i will merge