LLM max_tokens 1000→8000: reasoning-модели тратили весь лимит на размышления и возвращали пустой ответ

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
jze9
2026-07-14 15:39:47 +05:00
parent c88b0e4f6d
commit 31eb8c3303
4 changed files with 6 additions and 4 deletions

2
.env
View File

@@ -23,5 +23,5 @@ LLM_BASE_URL=
LLM_API_KEY= LLM_API_KEY=
LLM_MODEL= LLM_MODEL=
LLM_TIMEOUT=120 LLM_TIMEOUT=120
LLM_MAX_TOKENS=1000 LLM_MAX_TOKENS=8000
LLM_TEMPERATURE=0.3 LLM_TEMPERATURE=0.3

View File

@@ -20,7 +20,8 @@ class Settings(BaseSettings):
LLM_API_KEY: str = os.getenv("LLM_API_KEY", "") LLM_API_KEY: str = os.getenv("LLM_API_KEY", "")
LLM_MODEL: str = os.getenv("LLM_MODEL", "") LLM_MODEL: str = os.getenv("LLM_MODEL", "")
LLM_TIMEOUT: int = int(os.getenv("LLM_TIMEOUT", "120")) LLM_TIMEOUT: int = int(os.getenv("LLM_TIMEOUT", "120"))
LLM_MAX_TOKENS: int = int(os.getenv("LLM_MAX_TOKENS", "1000")) # reasoning-модели тратят max_tokens и на размышления — 1000 им мало
LLM_MAX_TOKENS: int = int(os.getenv("LLM_MAX_TOKENS", "8000"))
LLM_TEMPERATURE: float = float(os.getenv("LLM_TEMPERATURE", "0.3")) LLM_TEMPERATURE: float = float(os.getenv("LLM_TEMPERATURE", "0.3"))
@property @property

View File

@@ -36,7 +36,8 @@ class LLMConfig(BaseModel):
# before the user has picked one. # before the user has picked one.
model: str = "" model: str = ""
timeout: int = 120 timeout: int = 120
max_tokens: int = 1000 # у reasoning-моделей сюда входят и токены размышлений
max_tokens: int = 8000
temperature: float = 0.3 temperature: float = 0.3
extra_headers: dict[str, str] = Field(default_factory=dict) extra_headers: dict[str, str] = Field(default_factory=dict)

View File

@@ -18,7 +18,7 @@ class LLMOverride(BaseModel):
api_key: str = "" api_key: str = ""
model: str model: str
timeout: int = 120 timeout: int = 120
max_tokens: int = 1000 max_tokens: int = 8000
temperature: float = 0.3 temperature: float = 0.3
extra_headers: dict[str, str] = {} extra_headers: dict[str, str] = {}
system_prompt: str | None = None system_prompt: str | None = None