Skip to content

test(streaming): cover partial JSON on max_tokens#1517

Open
wilyan09007 wants to merge 1 commit intoanthropics:mainfrom
wilyan09007:issue-794-partial-json-max-tokens
Open

test(streaming): cover partial JSON on max_tokens#1517
wilyan09007 wants to merge 1 commit intoanthropics:mainfrom
wilyan09007:issue-794-partial-json-max-tokens

Conversation

@wilyan09007
Copy link
Copy Markdown

What

Adds regression coverage for streaming tool-use input that stops because of max_tokens while the JSON input is still incomplete.

The tests assert that partial input_json deltas remain available in the stream and that the final tool-use snapshot preserves the parsed partial input seen before the stop.

Why

Refs #794.

The current SDK behavior already preserves the partial JSON for this repro, so this PR records that behavior and protects it from regressing.

Verification / How to test

  • uv run pytest tests\lib\streaming\test_messages.py tests\lib\streaming\test_beta_messages.py tests\lib\streaming\test_partial_json.py -q
  • uv run ruff check tests\lib\streaming\test_messages.py tests\lib\streaming\test_beta_messages.py
  • uv run ruff format --check tests\lib\streaming\test_messages.py tests\lib\streaming\test_beta_messages.py
  • git diff --check HEAD~1..HEAD

@wilyan09007 wilyan09007 requested a review from a team as a code owner May 8, 2026 00:31
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.

1 participant