mirror of
https://github.com/BerriAI/litellm.git
synced 2025-04-27 11:43:54 +00:00
Return signature
on anthropic streaming + migrate to signature
field instead of signature_delta
[MINOR bump] (#9021)
* Fix missing signature_delta in thinking blocks when streaming from Claude 3.7 (#8797) Co-authored-by: Krish Dholakia <krrishdholakia@gmail.com> * test: update test to enforce signature found * feat(refactor-signature-param-to-be-'signature'-instead-of-'signature_delta'): keeps it in sync with anthropic * fix: fix linting error --------- Co-authored-by: Martin Krasser <krasserm@googlemail.com>
This commit is contained in:
parent
83393cb482
commit
dd79bc000d
6 changed files with 19 additions and 10 deletions
|
@ -527,6 +527,7 @@ class ModelResponseIterator:
|
|||
provider_specific_fields = {}
|
||||
content_block = ContentBlockDelta(**chunk) # type: ignore
|
||||
thinking_blocks: List[ChatCompletionThinkingBlock] = []
|
||||
|
||||
self.content_blocks.append(content_block)
|
||||
if "text" in content_block["delta"]:
|
||||
text = content_block["delta"]["text"]
|
||||
|
@ -544,13 +545,13 @@ class ModelResponseIterator:
|
|||
provider_specific_fields["citation"] = content_block["delta"]["citation"]
|
||||
elif (
|
||||
"thinking" in content_block["delta"]
|
||||
or "signature_delta" == content_block["delta"]
|
||||
or "signature" in content_block["delta"]
|
||||
):
|
||||
thinking_blocks = [
|
||||
ChatCompletionThinkingBlock(
|
||||
type="thinking",
|
||||
thinking=content_block["delta"].get("thinking"),
|
||||
signature_delta=content_block["delta"].get("signature"),
|
||||
thinking=content_block["delta"].get("thinking") or "",
|
||||
signature=content_block["delta"].get("signature"),
|
||||
)
|
||||
]
|
||||
provider_specific_fields["thinking_blocks"] = thinking_blocks
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue