Renzo
Refactor agent and app modules to enhance functionality and improve response handling
d68986e
raw
history blame
1.86 kB
from agno.agent import Agent
from agno.models.openai import OpenAIChat
from agno.tools.reasoning import ReasoningTools
from agno.tools.duckduckgo import DuckDuckGoTools
from agno.tools.wikipedia import WikipediaTools
test_question = "On June 6, 2023, an article by Carolyn Collins Petersen was published in Universe Today. This article mentions a team that produced a paper about their observations, linked at the bottom of the article. Find this paper. Under what NASA award number was the work performed by R. G. Arendt supported by?"
def get_current_date() -> str:
import datetime
date = datetime.datetime.now().strftime("%Y-%m-%d")
return "The current date is " + date
agent = Agent(
model=OpenAIChat(id="gpt-4.1-nano"),
markdown=False,
debug_mode=True,
instructions="You are a general AI assistant. I will ask you a question. Report your thoughts, but your final answer must be only the answer itself, with nothing else. The answer should be a number OR as few words as possible OR a comma separated list of numbers and/or strings. If you are asked for a number, don't use comma to write your number neither use units such as $ or percent sign unless specified otherwise. If you are asked for a string, don't use articles, neither abbreviations (e.g. for cities), and write the digits in plain text unless specified otherwise. If you are asked for a comma separated list, apply the above rules depending of whether the element to be put in the list is a number or a string.",
tools=[
ReasoningTools(think=True, add_few_shot=True),
DuckDuckGoTools(fixed_max_results=5),
WikipediaTools()
],
context={"current_time": get_current_date},
add_context=True,
show_tool_calls=True
)
# Print the response in the terminal
# agent.print_response("Waht is greater 9.9 or 9.11?", strem=True)