模型充当 Agent 的大脑 - 帮助它进行推理、行动并响应用户。模型越好,Agent 就越智能。

from agno.agent import Agent
from agno.models.openai import OpenAIChat

agent = Agent(
    model=OpenAIChat(id="gpt-4o"),
    description="Share 15 minute healthy recipes.",
    markdown=True,
)
agent.print_response("Share a breakfast recipe.", stream=True)

错误处理

您可以在 Agent 上将 exponential_backoff 设置为 True,以自动重试因第三方模型提供程序错误而失败的请求。

agent = Agent(
    model=OpenAIChat(id="gpt-4o"),
    exponential_backoff=True,
    retries=2,
    retry_delay=1,
)

支持的模型

Agno 支持以下模型提供程序: