working merge_reasoning_content_in_choices with bedrock

This commit is contained in:
Ishaan Jaff 2025-03-06 07:01:59 -08:00
parent d4e6bef7de
commit ae376121e5
2 changed files with 3 additions and 11 deletions

View file

@ -955,7 +955,7 @@ class CustomStreamWrapper:
if reasoning_content:
if self.sent_first_thinking_block is False:
self.thinking_content += (
model_response.choices[0].delta.content or ""
model_response.choices[0].delta.content or "<thinking>"
) + f"{model_response.choices[0].delta.reasoning_content}"
self.sent_first_thinking_block = True
return None
@ -973,8 +973,8 @@ class CustomStreamWrapper:
and not self.sent_last_thinking_block
and model_response.choices[0].delta.content
):
self.thinking_content += ""
model_response.choices[0].delta.content = self.thinking_content
self.thinking_content += "</thinking>"
model_response.choices[0].delta.content += self.thinking_content
self.sent_last_thinking_block = True
return model_response

View file

@ -584,14 +584,6 @@ class Delta(OpenAIObject):
super(Delta, self).__init__(**params)
add_provider_specific_fields(self, params.get("provider_specific_fields", {}))
self.content = content
if litellm.merge_reasoning_content_in_choices:
self.content = (
(self.content or "") + f"<thinking>{reasoning_content}</thinking>"
if reasoning_content
else self.content
)
self.role = role
# Set default values and correct types
self.function_call: Optional[Union[FunctionCall, Any]] = None