-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
update duckduckgo search library version
- Loading branch information
Showing
5 changed files
with
32 additions
and
48 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
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 |
---|---|---|
@@ -1,42 +1,23 @@ | ||
# from bondai.agents import Agent | ||
# from bondai.models.openai import DefaultOpenAIConnectionParams | ||
# from bondai.tools.search import DuckDuckGoSearchTool | ||
# from bondai.tools.website import WebsiteQueryTool | ||
# from bondai.tools.file import FileWriteTool | ||
from bondai.agents import Agent, AgentEventNames | ||
from bondai.tools import PythonREPLTool | ||
from bondai.tools.search import DuckDuckGoSearchTool | ||
from bondai.tools.website import WebsiteQueryTool | ||
from bondai.models.openai import OpenAILLM, OpenAIModelNames | ||
|
||
# DefaultOpenAIConnectionParams.configure_openai_connection(api_key="<OPENAI-API-KEY>") | ||
task = "I want you to find the U.S. GDP from 2000 to 2010 and then use Python to save a line chart to a file named chart.png." | ||
|
||
llm = OpenAILLM(OpenAIModelNames.GPT4_0613) | ||
|
||
# task = """I want you to research the usage of Metformin as a drug to treat aging and aging related illness. | ||
# You should only use reputable information sources, ideally peer reviewed scientific studies. | ||
# I want you to summarize your findings in a document named metformin.md and includes links to reference and resources you used to find the information. | ||
# Additionally, the last section of your document you should provide a recommendation for a 43 year old male, in good health and who regularly exercises as to whether he would benefit from taking Metformin. | ||
# You should explain your recommendation and justify it with sources. | ||
# Finally, you should highlight potential risks and tradeoffs from taking the medication.""" | ||
|
||
# Agent(tools=[ | ||
# DuckDuckGoSearchTool(), | ||
# WebsiteQueryTool(), | ||
# FileWriteTool() | ||
# ]).run(task) | ||
|
||
from bondai.agents import Agent | ||
from bondai.models.openai import ( | ||
OpenAILLM, | ||
OpenAIConnectionParams, | ||
OpenAIConnectionType, | ||
OpenAIModelNames, | ||
agent = Agent( | ||
llm=llm, tools=[DuckDuckGoSearchTool(), WebsiteQueryTool(), PythonREPLTool()] | ||
) | ||
|
||
|
||
connection_params = OpenAIConnectionParams( | ||
connection_type=OpenAIConnectionType.AZURE, | ||
api_key="", | ||
api_version="", | ||
azure_endpoint="", | ||
azure_deployment="", | ||
# agent.on(AgentEventNames.TOOL_SELECTED, lambda _, m: print(f"Selected tool: {m.tool_name}({str(m.tool_arguments)})")) | ||
agent.on( | ||
AgentEventNames.TOOL_COMPLETED, | ||
lambda _, m: print( | ||
f"Tool: {m.tool_name}({str(m.tool_arguments)})\nOutput: {m.tool_output}\nError: {m.error}" | ||
), | ||
) | ||
|
||
llm = OpenAILLM(model=OpenAIModelNames.GPT4_32K, connection_params=connection_params) | ||
|
||
agent = Agent(llm=llm) | ||
result = agent.run(task) | ||
print(result) |