1- from pydantic import Field
1+ from pydantic import Field , model_validator
22
3- from statgpt .common .config import EmbeddingModelsEnum , LLMModelsEnum
3+ from statgpt .common .config import (
4+ EmbeddingModelsEnum ,
5+ LLMModelsEnum ,
6+ ReasoningEffortEnum ,
7+ VerbosityEnum ,
8+ )
49from statgpt .common .settings .langchain import langchain_settings
510
611from .base import BaseYamlModel
@@ -10,7 +15,8 @@ class BaseModelConfig(BaseYamlModel):
1015 """Base config for LLM and embeddings models configs."""
1116
1217 api_version : str = Field (
13- default = langchain_settings .default_api_version , description = "API version for the model"
18+ default = langchain_settings .default_api_version ,
19+ description = "API version for the model" ,
1420 )
1521
1622
@@ -30,16 +36,47 @@ class LLMModelConfig(BaseModelConfig):
3036 default = langchain_settings .default_model ,
3137 description = "The deployment of the model in DIAL" ,
3238 )
33- temperature : float = Field (
39+ temperature : float | None = Field (
3440 default = langchain_settings .default_temperature ,
3541 description = (
3642 "The temperature of the model. 0.0 means deterministic output, higher values mean more"
37- " randomness."
43+ " randomness. Note: For reasoning models (except reasoning_effort=none) should be set to 1 "
3844 ),
3945 )
4046 seed : int | None = Field (
4147 default = langchain_settings .default_seed ,
4248 description = (
43- "The seed of the model. If set, the model will produce the same output for the same input."
49+ "The seed of the model. If set, the model will produce the same output for the same input. "
50+ "Note: Not supported by GPT-5 models."
4451 ),
4552 )
53+ reasoning_effort : ReasoningEffortEnum | None = Field (
54+ default = None ,
55+ description = (
56+ "Reasoning effort level for GPT-5 models. "
57+ "Supports: none, minimal, low, medium, high, xhigh. "
58+ "All models before gpt-5.1 default to medium reasoning effort, and do not support none."
59+ ),
60+ )
61+ verbosity : VerbosityEnum | None = Field (
62+ default = None ,
63+ description = "Output verbosity for GPT-5 models (low/medium/high)." ,
64+ )
65+
66+ @model_validator (mode = "after" )
67+ def _validate_model_family_params (self ) -> "LLMModelConfig" :
68+ if self .deployment .is_gpt_5_family :
69+ if self .seed is not None :
70+ raise ValueError ("seed is not supported for GPT-5 models" )
71+ if self .reasoning_effort is None :
72+ raise ValueError ("reasoning_effort is required for GPT-5 models" )
73+ if self .reasoning_effort is not ReasoningEffortEnum .NONE and self .temperature != 1 :
74+ raise ValueError (
75+ "temperature must be set to 1 when reasoning_effort is enabled for GPT-5 models"
76+ )
77+ else :
78+ if self .reasoning_effort is not None :
79+ raise ValueError ("reasoning_effort is only supported for GPT-5 models" )
80+ if self .verbosity is not None :
81+ raise ValueError ("verbosity is only supported for GPT-5 models" )
82+ return self
0 commit comments