Context
The current OllamaChatResponse parser in
crates/infrastructure/providers-ollama/src/lib.rs only extracts:
model
message.role, message.content
done
prompt_eval_count, eval_count
The OpenAPI spec at https://docs.ollama.com/api/chat.md documents several
more fields that the Ollama native API returns but we currently drop:
| Field |
Use case |
done_reason |
Distinguish 'stop' vs 'length' vs 'load' for better finish_reason reporting in StreamChunk and CompletionResponse. |
message.thinking |
Surfacing reasoning traces from thinking models (e.g. gpt-oss, qwen3 with think: true). |
message.tool_calls |
Tool/function calling — required to route Ollama native function calls through Rook. |
message.images |
Multimodal responses (when the model returns inline base64 images). |
total_duration, load_duration, prompt_eval_duration, eval_duration |
Useful for observability. |
logprobs |
Token-level probabilities — needed for some structured-output workflows. |
These are out of scope for the Ollama Cloud bring-up but will need to land
soon for parity with OpenAI/Anthropic adapters and to support thinking models.
Acceptance criteria
Out of scope
- Cloud-side tool calling / thinking-specific model selection — that's a UI follow-up.
- Streaming
x-ndjson schema for /api/chat events is identical to the non-streaming ChatResponse except done_reason is not always present in the final chunk — verify the parser handles that.
Reference
- OpenAPI spec: https://docs.ollama.com/api/chat.md
ChatResponse schema fields: model, created_at, message.{role,content,thinking,tool_calls,images}, done, done_reason, total_duration, load_duration, prompt_eval_count, prompt_eval_duration, eval_count, eval_duration, logprobs.
Context
The current
OllamaChatResponseparser incrates/infrastructure/providers-ollama/src/lib.rsonly extracts:modelmessage.role,message.contentdoneprompt_eval_count,eval_countThe OpenAPI spec at https://docs.ollama.com/api/chat.md documents several
more fields that the Ollama native API returns but we currently drop:
done_reason'stop'vs'length'vs'load'for better finish_reason reporting inStreamChunkandCompletionResponse.message.thinkinggpt-oss,qwen3withthink: true).message.tool_callsmessage.imagestotal_duration,load_duration,prompt_eval_duration,eval_durationlogprobsThese are out of scope for the Ollama Cloud bring-up but will need to land
soon for parity with OpenAI/Anthropic adapters and to support thinking models.
Acceptance criteria
OllamaChatResponsedeserializes all fields listed in the OpenAPIChatResponseschema.StreamChunkcarriesthinkingcontent separately fromdelta(already part ofMessageContent).done_reasonflows intoStreamChunk.finish_reasonandCompletionResponse.finish_reason(mapping the Ollama-specific reasons to the existingFinishReasonenum).tool_callsare deserialized (storage location TBD — likely a new domain field onMessage).crates/infrastructure/providers-ollama/tests/provider.rskeep passing.done_reason: "length", thinking trace, tool calls.Out of scope
x-ndjsonschema for/api/chatevents is identical to the non-streamingChatResponseexceptdone_reasonis not always present in the final chunk — verify the parser handles that.Reference
ChatResponseschema fields:model,created_at,message.{role,content,thinking,tool_calls,images},done,done_reason,total_duration,load_duration,prompt_eval_count,prompt_eval_duration,eval_count,eval_duration,logprobs.