mirror of
https://github.com/BerriAI/litellm.git
synced 2026-10-09 03:18:44 +00:00
if merge_reasoning_content_in_choices
This commit is contained in:
parent
f6535ae6ad
commit
ea2c805d93
2 changed files with 11 additions and 0 deletions
|
|
@ -282,6 +282,7 @@ priority_reservation: Optional[Dict[str, float]] = None
|
|||
force_ipv4: bool = (
|
||||
False # when True, litellm will force ipv4 for all LLM requests. Some users have seen httpx ConnectionError when using ipv6.
|
||||
)
|
||||
merge_reasoning_content_in_choices: bool = True
|
||||
module_level_aclient = AsyncHTTPHandler(
|
||||
timeout=request_timeout, client_alias="module level aclient"
|
||||
)
|
||||
|
|
|
|||
|
|
@ -21,6 +21,8 @@ from openai.types.moderation_create_response import Moderation, ModerationCreate
|
|||
from pydantic import BaseModel, ConfigDict, Field, PrivateAttr
|
||||
from typing_extensions import Callable, Dict, Required, TypedDict, override
|
||||
|
||||
import litellm
|
||||
|
||||
from ..litellm_core_utils.core_helpers import map_finish_reason
|
||||
from .guardrails import GuardrailEventHooks
|
||||
from .llms.openai import (
|
||||
|
|
@ -582,6 +584,14 @@ 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
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue