Skip to content

fix(types): preserve logprob token bytes from server - #751

Open
vineoy wants to merge 1 commit into
ollama:mainfrom
vineoy:fix/logprob-bytes
Open

vineoy wants to merge 1 commit into
ollama:mainfrom
vineoy:fix/logprob-bytes

Conversation

@vineoy

@vineoy vineoy commented Sep 29, 2026

Copy link
Copy Markdown

Fixes #750.

Server docs/openapi.yaml returns bytes[] per token in Logprob/TokenLogprob, but TokenLogprob only modeled token/logprob, so raw token bytes were silently dropped.

Additive Optional bytes field on TokenLogprob (inherited by Logprob), defaults None so old payloads still parse. Matches existing style (type/input/format already shadow builtins) and follows #601 logprobs pattern.

Verification:

  • parsing with bytes, missing-bytes default, nested GenerateResponse, dict-style access all checked
  • pytest tests/test_client.py -k logprob: 2 passed
  • ruff check + format: clean
  • full tests/test_utils + test_type_serialization: 28 passed, 2 pre-existing image-path failures also present on clean main

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

TokenLogprob/Logprob drop server bytes field

1 participant