style(anthropic-adapter): apply ruff format to pass-through adapters

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
lkapadiya-DO 2026-07-14 15:13:21 -07:00
parent 6ed4eeafb3
commit 027c694a7f
2 changed files with 14 additions and 20 deletions

View file

@ -405,16 +405,15 @@ class AnthropicStreamWrapper(AdapterCompletionStreamWrapper):
"content_block": initial_block,
}
)
processed_first = LiteLLMAnthropicMessagesAdapter().translate_streaming_openai_response_to_anthropic(
response=first_chunk,
current_content_block_index=self.current_content_block_index,
processed_first = (
LiteLLMAnthropicMessagesAdapter().translate_streaming_openai_response_to_anthropic(
response=first_chunk,
current_content_block_index=self.current_content_block_index,
)
)
# Empty / stop-only first chunk: close the block before the
# terminal message_delta so the sequence stays spec-compliant.
if (
isinstance(processed_first, dict)
and processed_first.get("type") == "message_delta"
):
if isinstance(processed_first, dict) and processed_first.get("type") == "message_delta":
self.chunk_queue.append(
{
"type": "content_block_stop",
@ -658,14 +657,13 @@ class AnthropicStreamWrapper(AdapterCompletionStreamWrapper):
"content_block": initial_block,
}
)
processed_first = LiteLLMAnthropicMessagesAdapter().translate_streaming_openai_response_to_anthropic(
response=first_chunk,
current_content_block_index=self.current_content_block_index,
processed_first = (
LiteLLMAnthropicMessagesAdapter().translate_streaming_openai_response_to_anthropic(
response=first_chunk,
current_content_block_index=self.current_content_block_index,
)
)
if (
isinstance(processed_first, dict)
and processed_first.get("type") == "message_delta"
):
if isinstance(processed_first, dict) and processed_first.get("type") == "message_delta":
self.chunk_queue.append(
{
"type": "content_block_stop",

View file

@ -1410,13 +1410,9 @@ class LiteLLMAnthropicMessagesAdapter:
return "thinking", ChatCompletionThinkingBlock(
type="thinking", thinking=thinking, signature=signature
)
elif isinstance(choice, StreamingChoices) and hasattr(
choice.delta, "reasoning_content"
):
elif isinstance(choice, StreamingChoices) and hasattr(choice.delta, "reasoning_content"):
if choice.delta.reasoning_content:
return "thinking", ChatCompletionThinkingBlock(
type="thinking", thinking="", signature=""
)
return "thinking", ChatCompletionThinkingBlock(type="thinking", thinking="", signature="")
return "text", TextBlock(type="text", text="")