feat(llm): forward configured reasoning_effort to native LLM calls
Add an optional reasoning_effort field to LLMConfig (e.g. low/medium/high/max) and forward it to litellm.acompletion in both chat() and chat_stream() when set. Unset by default so non-OpenAI providers are unaffected. Callers can still override per-call via kwargs.
This commit is contained in:
@@ -273,6 +273,7 @@ class LLMConfig(BaseModel):
|
||||
fallback: dict[str, Any] = Field(default_factory=dict)
|
||||
temperature: float = 0.3
|
||||
max_tokens: int = 32768
|
||||
reasoning_effort: str | None = None
|
||||
# Total input context window (tokens) for the active model. Set this when
|
||||
# the model is not mapped in litellm (e.g. proxy/self-hosted models like
|
||||
# doubao/minimax/glm), so the context-usage ring and compaction thresholds
|
||||
|
||||
@@ -569,6 +569,8 @@ class LLMProvider:
|
||||
"max_tokens": max_tok,
|
||||
**kwargs,
|
||||
}
|
||||
if self.config.reasoning_effort and "reasoning_effort" not in call_kwargs:
|
||||
call_kwargs["reasoning_effort"] = self.config.reasoning_effort
|
||||
if self._api_base:
|
||||
call_kwargs["api_base"] = self._api_base
|
||||
if self._api_key:
|
||||
@@ -715,6 +717,8 @@ class LLMProvider:
|
||||
"stream": True,
|
||||
**kwargs,
|
||||
}
|
||||
if self.config.reasoning_effort and "reasoning_effort" not in call_kwargs:
|
||||
call_kwargs["reasoning_effort"] = self.config.reasoning_effort
|
||||
if self._api_base:
|
||||
call_kwargs["api_base"] = self._api_base
|
||||
if self._api_key:
|
||||
|
||||
Reference in New Issue
Block a user