🎭 02. シナリオ制御とLLMの活用

Scenario-Based Control with LLM Integration


本節では、タスクの流れや状況分岐を含む「シナリオ制御」
LLM(大規模言語モデル)と組み合わせて柔軟に設計する方法について解説します。
This section explains how to design scenario-based control, including task flows and conditional branching, in combination with LLMs for greater flexibility.


🎯 シナリオ制御とは? / What is Scenario-Based Control?

形式的には、シナリオ制御は FSM = (S, I, O, δ, λ, s₀) の拡張であり、
LLMによる非形式的判断を追加したものと位置づけられる。
Formally, scenario control can be seen as an extension of FSM = (S, I, O, δ, λ, s₀),
augmented with non-formal reasoning provided by LLMs.


🔄 FSMとLLMによるハイブリッドシナリオ / Hybrid Scenarios with FSM & LLM

構成要素 / Component 役割 / Role
FSM 状態管理と基本遷移制御(if/elseの拡張)
Manages states and basic transitions (extension of if/else)
LLM 状況判断・次状態の推論・新規イベント適応
Contextual reasoning, inference of next state, and adaptation to new events

例:倉庫ロボット / Example: Warehouse Robot

FSM:
  - 状態A: 探索 / SEARCH
  - 状態B: 搬送 / CARRY
  - 状態C: 充電 / CHARGE
LLM:
  - 状況を見て「異常発生」と判断 → 状態D: 故障診断 / DIAGNOSE へ遷移

🧠 LLMが関与する部分 / LLM Involvement


🧪 実験例:シナリオ遷移制御 / Experimental Example: Scenario Transition Control

states = ['IDLE', 'SEARCH', 'CARRY', 'AVOID', 'CHARGE']

def next_state_from_llm(current_state, observation_text):
    # LLM APIまたは組込みモデルに問い合わせ
    # Query an LLM API or an embedded model
    return response_suggested_state

💡 応用可能な分野 / Applicable Domains


🔚 まとめ / Summary


📁 次へ / Next

📄 03_exception_handling.md
Proceed to 03_exception_handling.md


⬅️ 01_fsm_pid_llm.md
Back to 01_fsm_pid_llm.md
🏠 Part 9 トップに戻る
Back to Part 9 Top