fix streaming handler

This commit is contained in:
Ishaan Jaff 2025-03-06 07:23:19 -08:00
parent 1ce302055a
commit 46caaf97b3

View file

@ -72,8 +72,8 @@ class CustomStreamWrapper:
self.sent_first_chunk = False self.sent_first_chunk = False
self.sent_last_chunk = False self.sent_last_chunk = False
litellm_params: GenericLiteLLMParams = self.logging_obj.model_call_details.get( litellm_params: GenericLiteLLMParams = GenericLiteLLMParams(
"litellm_params", {} **self.logging_obj.model_call_details.get("litellm_params", {})
) )
self.merge_reasoning_content_in_choices = ( self.merge_reasoning_content_in_choices = (
litellm_params.merge_reasoning_content_in_choices litellm_params.merge_reasoning_content_in_choices
@ -976,7 +976,9 @@ class CustomStreamWrapper:
and model_response.choices[0].delta.content and model_response.choices[0].delta.content
): ):
self.thinking_content += "</thinking>" self.thinking_content += "</thinking>"
model_response.choices[0].delta.content += self.thinking_content model_response.choices[0].delta.content = (
self.thinking_content + model_response.choices[0].delta.content
)
self.sent_last_thinking_block = True self.sent_last_thinking_block = True
return model_response return model_response