diff options
| author | tanaka takashi <isazaka@gmail.com> | 2026-08-12 00:21:23 +0900 |
|---|---|---|
| committer | tanaka takashi <isazaka@gmail.com> | 2026-08-12 00:21:23 +0900 |
| commit | 98b6a2aeedd591058c1d81e401d24f3ded162926 (patch) | |
| tree | 74cbb38af825526e4fc90b150feed14426d727b4 /doc | |
| parent | ce550a127b7dc972651bd15b9f09979a2c38688f (diff) | |
fix: implement native Ollama thinking semantics
Model Ollama chat thinking separately from final content, preserve it only across assistant tool-call continuation, and keep private reasoning out of user results, session context, and logs.
Accept native boolean and low/medium/high/max think values, normalize YAML booleans, and serialize explicit overrides using the native top-level chat field.
Stop forcing think=false for structured planning, skill selection, and context summaries; corrected retries now retain the configured thinking mode.
Update the specification, design, audit report, and requirement traceability for OLL-14.
Add request/response, configuration, observability, retry, and tool-continuation coverage. Verified with 92 passing Agent.Core tests and a deepseek-v4-flash:cloud think:true MCP operational run.
Diffstat (limited to 'doc')
| -rw-r--r-- | doc/AuditReport.md | 2 | ||||
| -rw-r--r-- | doc/Design.md | 4 | ||||
| -rw-r--r-- | doc/Specifications.md | 1 |
3 files changed, 4 insertions, 3 deletions
diff --git a/doc/AuditReport.md b/doc/AuditReport.md index b1f782f..c98694e 100644 --- a/doc/AuditReport.md +++ b/doc/AuditReport.md @@ -12,7 +12,7 @@ | policy deny | 初回failedと最大3回replanが混在 | 同一呼出しへ再投入しない条件付きreplanへ統一。同一deny、計画未変更、実行不能、replan失敗でfailed | | Skill形式 | READMEにlegacy互換記述 | `<skill-name>/SKILL.md`だけに統一 | | Task完了 | 実行Taskなしでもcompletedになり得た | TaskGraph全件completedだけを完了条件とし、実行不能は理由付きfailedへ変更 | -| Planner fallback | 空/不正planから曖昧なfallback graphを生成 | `think=false`で1回だけ再試行し、再失敗はplanning failureへ変更。planning中のTool callを禁止する明示promptを追加 | +| Planner fallback | 空/不正planから曖昧なfallback graphを生成 | 設定された`think`を維持して訂正instruction付きで1回だけ再試行し、再失敗はplanning failureへ変更。planning中のTool callを禁止する明示promptを追加 | | Tool証跡 | 読取Taskや別Taskの副作用で完了できた | Taskごとの`required_tools`を設計し、必要Tool成功まで完了不可、範囲外副作用はdispatchもsession投入もしない | | task_update | LLMが状態遷移可能 | Tool catalogには維持し、Task追加/dependency追加/estimate変更だけに限定 | | cancel | CancellationToken通知時点でterminal | Task Resource cleanup完了後だけcancelled。cleanup失敗はfailed | diff --git a/doc/Design.md b/doc/Design.md index 68c7dbc..9ad4ae3 100644 --- a/doc/Design.md +++ b/doc/Design.md @@ -241,7 +241,7 @@ top_k, top_p, min_p, typical_p, tfs_z, repeat_last_n, repeat_penalty, presence_penalty, frequency_penalty, mirostat, mirostat_tau, mirostat_eta, stop ``` -Chat API top-levelとして `model`, `think`, `keep_alive`, `format`, `logprobs`, `top_logprobs` を別型で管理する。Ollama API変更時は既知型を更新し、未知optionは `extra_options` で一時対応できる。 +Chat API top-levelとして `model`, `think`, `keep_alive`, `format`, `logprobs`, `top_logprobs` を別型で管理する。`think`はbooleanまたはOllamaが定義するlevel (`low` / `medium` / `high` / `max`) を受け付ける。responseでは最終回答の`message.content`と推論過程の`message.thinking`を分離して取り込み、tool call継続時だけassistant messageの`thinking`をOllamaへ戻す。thinking本文を利用者向け結果、Conversation、Execution Result、LLM Log、Audit Logへ保存・出力しない。Ollama API変更時は既知型を更新し、未知optionは `extra_options` で一時対応できる。 ### 6.3 temperature override ```text effective_temperature = agent_run.temperature ?? config.ollama.options.temperature @@ -379,7 +379,7 @@ topological sort後にforward passで各Taskの累積expected token costを計ç® - Policy denyは同一Tool呼出しへ再投入しない。許可済み能力だけで代替できる可能性がある場合、`running -> planning -> running` と遷移してreplanを最大3回まで試行できる。 - completed TaskのID、状態、usageを保持する。failed Taskをdependency解決済みとして扱わない。 - 同一deny fingerprintの再発、計画未変更、実行可能Taskなし、structured replan失敗は即Failedとする。全Taskがcompletedの場合だけAgent Taskをcompletedにする。 -- structured planが空または不正な場合は`think=false`で1回だけ再試行し、それでも失敗した場合はplanning failureとする。外部効果要否が不明なfallback graphは作成しない。 +- structured planが空または不正な場合は、設定された`think`を維持したまま訂正instruction付きで1回だけ再試行し、それでも失敗した場合はplanning failureとする。外部効果要否が不明なfallback graphは作成しない。 - 利用者が指定したabsolute path、executable、cwd、引数配列、operation、literal値は、それを使用するTask descriptionへそのまま保持する。後続Taskの操作を先行Taskへ混在させない。 ### 8.5 Ollama usage集計 1 Ollama callの `prompt_eval_count` をTask inputへ、`eval_count` をTask outputへ加算する。tool実行そのものにはtoken costを加算しない。context summary生成に使ったtokenはSession maintenance Taskとして別集計する。 diff --git a/doc/Specifications.md b/doc/Specifications.md index 92dc176..9f6e9b8 100644 --- a/doc/Specifications.md +++ b/doc/Specifications.md @@ -213,6 +213,7 @@ command省略時、および先頭引数がoptionの場合は `serve` としてæ | OLL-11 | Tool Guard | 実行が必要なTaskでtool callが行われない場合、未実行を検出して再試行する。 | | OLL-12 | Retry | Ollama通信失敗は既定3回まで再試行する。 | | OLL-13 | Usage | `prompt_eval_count` と `eval_count` をTask実測tokenとして記録する。 | +| OLL-14 | Thinking | `think`はOllama native Chat APIのbooleanまたは対応levelを使用する。推論過程と最終回答を分離し、推論本文を利用者向け結果・Conversation・Execution Result・Logへ出力しない。tool call継続に必要なassistant message内でのみOllamaへ返送する。 | Vision入力は設定可能な画像数、1画像あたりのsize、request合計sizeの上限を持ち、上限超過をOllama呼出し前に拒否しなければならない。具体的な既定値は設計および設定schemaで定義する。 |
