mirror of
https://github.com/cpacker/MemGPT.git
synced 2025-06-03 04:30:22 +00:00
feat: add reasoning effort in LLMConfig (#1697)
Co-authored-by: cpacker <packercharles@gmail.com>
This commit is contained in:
parent
42bb7fd5eb
commit
7913e793b5
@ -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-turbo
|
||||
|
@ -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):
|
||||
@classmethod
|
||||
def 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).
|
||||
|
Loading…
Reference in New Issue
Block a user