Agno : コンセプト : 推論 – 推論モデル

推論モデルは、回答前に思考するように強化学習でトレーニングされた大規模言語モデルの新しいクラスです。それらは応答前に内部的な思考の長い連鎖を生成します。

Agno : ユーザガイド : コンセプト : 推論 – 推論モデル

作成 : クラスキャット・セールスインフォメーション
作成日時 : 08/13/2025
バージョン : Agno 1.7.7

* 本記事は docs.agno.com の以下のページを独自に翻訳した上で、補足説明を加えてまとめ直しています :

* サンプルコードの動作確認はしておりますが、必要な場合には適宜、追加改変しています。
* ご自由にリンクを張って頂いてかまいませんが、sales-info@classcat.com までご一報いただけると嬉しいです。

 

 

Agno ユーザガイド : コンセプト : 推論 – 推論モデル

推論モデルは、回答前に思考するように強化学習でトレーニングされた大規模言語モデルの新しいクラスです。それらは応答前に内部的な思考の長い連鎖を生成します。推論モデルの例は以下のようなものです :

  • OpenAI o1-pro と o3-mini

  • 拡張思考モードの Claude 3.7 sonnet

  • Gemini 2.0 flash thinking

  • DeepSeek-R1

推論モデルは行動を起こす前に、計画を深く考慮して検討します。応答を生成し始める前にモデルが何をするかがすべてです。推論モデルはシングルショットのユースケースに優れています。複数回のターンや、シークエンシャルなツール呼び出しを必要としない、困難な問題 (コーディング、数学、物理) を解くために最適です。

 

o3-mini

o3_mini.py

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

agent = Agent(model=OpenAIChat(id="o3-mini"))
agent.print_response(
    "Solve the trolley problem. Evaluate multiple ethical frameworks. "
    "Include an ASCII diagram of your solution.",
    stream=True,
)

 

o3-mini with tools

o3_mini_with_tools.py

from agno.agent import Agent
from agno.models.openai import OpenAIChat
from agno.tools.yfinance import YFinanceTools

agent = Agent(
    model=OpenAIChat(id="o3-mini"),
    tools=[YFinanceTools(stock_price=True, analyst_recommendations=True, company_info=True, company_news=True)],
    instructions="Use tables to display data.",
    show_tool_calls=True,
    markdown=True,
)
agent.print_response("Write a report comparing NVDA to TSLA", stream=True)

 

o3-mini with reasoning effort

o3_mini_with_reasoning_effort.py

from agno.agent import Agent
from agno.models.openai import OpenAIChat
from agno.tools.yfinance import YFinanceTools

agent = Agent(
    model=OpenAIChat(id="o3-mini", reasoning_effort="high"),
    tools=[YFinanceTools(stock_price=True, analyst_recommendations=True, company_info=True, company_news=True)],
    instructions="Use tables to display data.",
    show_tool_calls=True,
    markdown=True,
)
agent.print_response("Write a report comparing NVDA to TSLA", stream=True)

 

DeepSeek-R1 using Groq

deepseek_r1_using_groq.py

from agno.agent import Agent
from agno.models.groq import Groq

agent = Agent(
    model=Groq(
        id="deepseek-r1-distill-llama-70b", temperature=0.6, max_tokens=1024, top_p=0.95
    ),
    markdown=True,
)
agent.print_response("9.11 and 9.9 -- which is bigger?", stream=True)

 

推論モデル + 応答モデル

上記の DeepSeek-R1 エージェントを実行すると、応答がそれほど良くないことに気づくでしょう。これは、DeepSeek-R1 は問題解決には優れていますが、自然な方法で応答するのはそれほどでもないからです (like claude sonnet or gpt-4o)。

推論には推論モデルを使用し、しかし応答を生成するためには異なるモデルを使用したいならどうでしょうか?

Great news! Agno は推論モデルと異なる応答モデルを一緒に使用することを可能にします。推論用の独立したモデルと応答用の異なるモデルを使用することで、両者の最良のものを利用できます。

 

DeepSeek-R1 + Claude Sonnet

deepseek_plus_claude.py

from agno.agent import Agent
from agno.models.anthropic import Claude
from agno.models.groq import Groq

deepseek_plus_claude = Agent(
    model=Claude(id="claude-3-7-sonnet-20250219"),
    reasoning_model=Groq(
        id="deepseek-r1-distill-llama-70b", temperature=0.6, max_tokens=1024, top_p=0.95
    ),
)
deepseek_plus_claude.print_response("9.11 and 9.9 -- which is bigger?", stream=True)

 

以上