Repository navigation
Conversation
Merging this PR will not alter performance1 warning
Comparing |
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
|
Security fixes pass OSV, but the fork guard requires uv.lock changes on a canonical branch. Could a maintainer adopt these dependency fixes? |
|
{"body":"Synced with |
A compatible gateway may start a text content block without the empty 'text' field. The streaming handler read content_block['text'] directly, so the stream raised KeyError before any answer text, even though the following text_delta chunks carry a valid answer (the SDK accepts the empty prefix). Missing block-start text now defaults to an empty string, so the deltas are delivered normally. Rebuilt as a minimal patch on current main: the earlier revision also carried an unrelated dev-tooling dependency bump; that is dropped so this PR reviews as the streaming fix alone.
eafa645 to
bdce8f6
Compare
PR overviewNo security issues were found in this pull request. Reviews
|
Streaming through an Anthropic-compatible gateway continues when a text block start omits its empty
textfield. The SDK accepts the empty prefix and delivers the following text deltas; the handler raisedKeyError: 'text'before any answer text.Change
litellm/llms/anthropic/chat/handler.py: thecontent_block_starttext branch readscontent_block.get("text", "")— a missing block-start text is an empty prefix, not an error. Plus one regression test (test_streaming_text_block_start_without_text_field_delivers_deltas) that streams a block start withouttextfollowed by a text delta and asserts the answer text is delivered.Branch state
Rebuilt as a minimal patch on current
main: the earlier revision also carried an unrelated dev-tooling MSAL dependency bump and repeateduv.locksync churn; both are dropped so this PR reviews as the streaming fix alone. That also clears the previous lockfile/fork-guard concern from the thread.Local note: this package now builds a Rust bridge, which does not compile in my Windows sandbox (
maturin/getrandombuild failure), so the regression test is validated by CI rather than locally.