mirror of
https://github.com/BerriAI/litellm.git
synced 2026-10-07 02:59:05 +00:00
fix(anthropic adapter): type _handle_choiceless_chunk param as ModelResponseStream
This commit is contained in:
parent
4068b4a2f0
commit
166a97e369
1 changed files with 2 additions and 2 deletions
|
|
@ -348,7 +348,7 @@ class AnthropicStreamWrapper(AdapterCompletionStreamWrapper):
|
|||
merged_chunk["context_management"] = ContextManagementResponse(applied_edits=list(self.applied_edits))
|
||||
return self._augment_message_delta_usage(merged_chunk)
|
||||
|
||||
def _handle_choiceless_chunk(self, chunk: Any) -> bool:
|
||||
def _handle_choiceless_chunk(self, chunk: "ModelResponseStream") -> bool:
|
||||
"""Consume an OpenAI-compatible chunk that carries no ``choices``.
|
||||
|
||||
``choices`` is legitimately empty on metadata-only chunks; the final
|
||||
|
|
@ -361,7 +361,7 @@ class AnthropicStreamWrapper(AdapterCompletionStreamWrapper):
|
|||
into the held stop-reason chunk); False when the chunk should be
|
||||
skipped entirely.
|
||||
"""
|
||||
if self.holding_stop_reason_chunk is not None and getattr(chunk, "usage", None) is not None:
|
||||
if self.holding_stop_reason_chunk is not None and _optional_attr(chunk, "usage") is not None:
|
||||
self.chunk_queue.append(self._merge_usage_into_held_stop_reason_chunk(chunk))
|
||||
self.queued_usage_chunk = True
|
||||
self.holding_stop_reason_chunk = None
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue