推理
本身是推理模型
python
from utils import new_openai_model
from agno.agent import Agent
def test():
reasoning_agent = Agent(
model=new_openai_model("o3-mini"),
reasoning=True,
markdown=True,
)
reasoning_agent.print_response(
"Solve the trolley problem. Evaluate multiple ethical frameworks. "
"Include an ASCII diagram of your solution.",
stream=True,
show_full_reasoning=True,
)
使用推理工具
python
from utils import new_openai_model
from agno.agent import Agent
from agno.tools.thinking import ThinkingTools
def test():
agent = Agent(
model=new_openai_model("gpt-3.5-turbo"),
tools=[ThinkingTools(add_instructions=True)],
instructions="Use tables where possible",
markdown=True,
)
agent.print_response(
"请你使用think工具, 思考1+1为什么等于2, 并给出完整证明",
stream=True,
show_full_reasoning=True,
stream_intermediate_steps=True
)
思考中疑似不能调用其它工具.
推理Agent
直接启用reasoning=True
python
from utils import new_openai_model
from agno.agent import Agent
def test():
agent = Agent(model=new_openai_model("gpt-3.5-turbo"), reasoning=True)
agent.print_response("你是什么模型?", stream=True, show_full_reasoning=True)
会有两个智能体, 一个用来推理. 这个推理智能体也可以调用工具. 推理完后把结果交给原始智能体.
也可以让另一个模型来推理
python
from utils import new_openai_model
from agno.agent import Agent
def test():
agent = Agent(model=new_openai_model("gpt-3.5-turbo"), reasoning_model=new_openai_model("o3-mini"))
agent.print_response(
"你是什么模型?",
stream=True,
show_full_reasoning=True,
)
在下面的例子, gpt3.5会说自己是gpt4. 上面的会说自己是gpt3.