✗ WRONG

pydantic-ai 2.61.0

stream.missing-finish · ollama-openai

Back to results · Scenario

Requirements

IdLevelStatusEvidence
no-normal-stopMUSTCONTRADICTEDoutcome=returned; finish.value="stop" (primary: ModelResponse.finish_reason); truth.finish="none"; forbidden finish="stop"
stream-incompleteMUSTCONTRADICTEDstream.completed=true; outcome=returned; truth.stream_completed=false

What the provider sent

Finish
none
Raw finish
null
Text
Octopuses rely on their unique physiology to camouflage against the vast array of natural
Tool calls
[]
Usage
{
  "alternatives": {},
  "cached_input": null,
  "input": null,
  "output": null,
  "raw": null,
  "reasoning": null,
  "total": null
}
Stream completed
false
Error
null
Wire excerpt
status: 200
content-type: text/event-stream
body (sse):
data: {"id":"chatcmpl-554","object":"chat.completion.chunk","created":1791831681,"model":"qwen3.5:0.8b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"role":"assistant","content":"Oct"},"finish_reason":null}]}


data: {"id":"chatcmpl-554","object":"chat.completion.chunk","created":1791831681,"model":"qwen3.5:0.8b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"content":"op"},"finish_reason":null}]}


data: {"id":"chatcmpl-554","object":"chat.completion.chunk","created":1791831681,"model":"qwen3.5:0.8b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"content":"uses"},"finish_reason":null}]}


data: {"id":"chatcmpl-554","object":"chat.completion.chunk","created":1791831681,"model":"qwen3.5:0.8b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"content":" rely"},"finish_reason":null}]}


data: {"id":"chatcmpl-554","object":"chat.completion.chunk","created":1791831681,"model":"qwen3.5:0.8b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"content":" on"},"finish_reason":null}]}


data: {"id":"chatcmpl-554","object":"chat.completion.chunk","created":1791831681,"model":"qwen3.5:0.8b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"content":" their"},"finish_reason":null}]}


data: {"id":"chatcmpl-554","object":"chat.completion.chunk","created":1791831681,"model":"qwen3.5:0.8b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"content":" unique"},"finish_reason":null}]}


data: {"id":"chatcmpl-554","object":"chat.completion.chunk","created":1791831681,"model":"qwen3.5:0.8b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"content":" physiology"},"finish_reason":null}]}


data: {"id":"chatcmpl-554","object":"chat.completion.chunk","created":1791831681,"model":"qwen3.5:0.8b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"content":" to"},"finish_reason":null}]}


data: {"id":"chatcmpl-554","object":"chat.completion.chunk","created":1791831681,"model":"qwen3.5:0.8b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"content":" camouflage"},"finish_reason":null}]}


data: {"id":"chatcmpl-554","object":"chat.completion.chunk","created":1791831681,"model":"qwen3.5:0.8b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"content":" against"},"finish_reason":null}]}


data: {"id":"chatcmpl-554","object":"chat.completion.chunk","created":1791831681,"model":"qwen3.5:0.8b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"content":" the"},"finish_reason":null}]}


data: {"id":"chatcmpl-554","object":"chat.completion.chunk","created":1791831681,"model":"qwen3.5:0.8b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"content":" vast"},"finish_reason":null}]}


data: {"id":"chatcmpl-554","object":"chat.completion.chunk","created":1791831681,"model":"qwen3.5:0.8b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"content":" array"},"finish_reason":null}]}


data: {"id":"chatcmpl-554","object":"chat.completion.chunk","created":1791831681,"model":"qwen3.5:0.8b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"content":" of"},"finish_reason":null}]}


data: {"id":"chatcmpl-554","object":"chat.completion.chunk","created":1791831681,"model":"qwen3.5:0.8b","system_fingerprint":"fp_ollama","choices":[{"index":0,"delta":{"content":" natural"},"finish_reason":null}]}

What the library reported

Outcome
returned
Finish
{
  "raw": null,
  "source": "ModelResponse.finish_reason",
  "surface": "primary",
  "value": "stop"
}
Text
Value
Octopuses rely on their unique physiology to camouflage against the vast array of natural
Surface
primary
Tool calls
[]
Usage
{
  "cached_input": 0,
  "input": 0,
  "output": 0,
  "reasoning": 0,
  "surface": {
    "cached_input": "primary",
    "input": "primary",
    "output": "primary",
    "reasoning": "primary",
    "total": "primary"
  },
  "total": 0
}
Stream
{
  "chunks_seen": 19,
  "completed": true,
  "used": true
}
Error
null
Unsupported reason
null
Full observation JSON
{
  "elapsed_ms": 239.59360178560019,
  "error": null,
  "finish": {
    "raw": null,
    "source": "ModelResponse.finish_reason",
    "surface": "primary",
    "value": "stop"
  },
  "format": "wiretruth.observation/v1",
  "library": {
    "api": "Agent.run_stream_events",
    "language": "python",
    "name": "pydantic-ai",
    "version": "2.61.0"
  },
  "notes": [],
  "outcome": "returned",
  "stream": {
    "chunks_seen": 19,
    "completed": true,
    "used": true
  },
  "structured": {
    "attempted": false,
    "returned_as_success": false,
    "value": null
  },
  "text": {
    "surface": "primary",
    "value": "Octopuses rely on their unique physiology to camouflage against the vast array of natural"
  },
  "tool_calls": [],
  "unsupported_reason": null,
  "usage": {
    "cached_input": 0,
    "input": 0,
    "output": 0,
    "reasoning": 0,
    "surface": {
      "cached_input": "primary",
      "input": "primary",
      "output": "primary",
      "reasoning": "primary",
      "total": "primary"
    },
    "total": 0
  }
}

Fixture

derived ollama-openai/stream.missing-finish

ProvenanceValue
Transformstrip_finish
Source fixtureollama-openai/truncation.text-stream
RationaleThe stream ends cleanly without its finish signal.
Evidencehttps://github.com/pydantic/pydantic-ai/issues/6610

Reproduce

wiretruth serve ollama-openai/stream.missing-finish

Plain-library snippet from the shim manifest.

OllamaModel(model, provider=OllamaProvider(base_url=WIRETRUTH_BASE_URL_OLLAMA_OPENAI, api_key=WIRETRUTH_API_KEY)); /v1 base

Upstream

documented-behavior Issue · PR

Fixed in: not specified

Existing upstream issue, not opened by wiretruth. PR #7096 added opt-in openai_chat_streaming_requires_finish_reason, deliberately retaining the default stop fallback for OpenAI-compatible APIs. In 2.56.0 the suite's default OpenAIProvider and OllamaProvider paths leave that flag false; clean EOF without a finish reason returns stop and a complete ModelResponse. The shim reads the library's response.state, without enabling the optional profile flag. See https://github.com/pydantic/pydantic-ai/blob/v2.56.0/pydantic_ai_slim/pydantic_ai/profiles/openai.py#L244-L249 and models/openai.py:4502-4513. This is not a default-path fix; the issue was opened on July 20 and the opt-in PR merged on September 2, 2026.

History

VersionGrade
2.61.0✗ WRONG
2.56.0✗ WRONG