Platform for stateful agents: AI with advanced memory that can learn and self-improve over time.
feat: add reasoning effort in LLMConfig (#1697)
Kevin Lin4f3d05e6a6aa
diff --git a/letta/llm_api/openai.py b/letta/llm_api/openai.pyindex 6179d5445..ffb64a99c 100644--- a/letta/llm_api/openai.py+++ b/letta/llm_api/openai.py@@ -136,6 +136,7 @@ def build_openai_chat_completions_request(user=str(user_id),max_completion_tokens=llm_config.max_tokens,temperature=1.0 if llm_config.enable_reasoner else llm_config.temperature,+ reasoning_effort=llm_config.reasoning_effort,)else:data = ChatCompletionRequest(@@ -146,6 +147,7 @@ def build_openai_chat_completions_request(user=str(user_id),max_completion_tokens=llm_config.max_tokens,temperature=1.0 if llm_config.enable_reasoner else llm_config.temperature,+ reasoning_effort=llm_config.reasoning_effort,)# https://platform.openai.com/docs/guides/text-generation/json-mode# only supported by gpt-4o, gpt-4-turbo, or gpt-3.5-turbodiff --git a/letta/schemas/llm_config.py b/letta/schemas/llm_config.pyindex d4493dee6..4c17ab665 100644--- a/letta/schemas/llm_config.py+++ b/letta/schemas/llm_config.py@@ -67,6 +67,10 @@ class LLMConfig(BaseModel):enable_reasoner: bool = Field(False, description="Whether or not the model should use extended thinking if it is a 'reasoning' style model")+ reasoning_effort: Optional[Literal["low", "medium", "high"]] = Field(+ None,+ description="The reasoning effort to use when generating text reasoning models",+ )max_reasoning_tokens: int = Field(0, description="Configurable thinking budget for extended thinking, only used if enable_reasoner is True. Minimum value is 1024.")@@ -115,7 +119,7 @@ class LLMConfig(BaseModel):@classmethoddef default_config(cls, model_name: str):"""- Convinience function to generate a default `LLMConfig` from a model name. Only some models are supported in this function.+ Convenience function to generate a default `LLMConfig` from a model name. Only some models are supported in this function.Args:model_name (str): The name of the model (gpt-4, gpt-4o-mini, letta).