feat(rag): retry a failed LLM request before the first token lands — BOR_LLM_RETRIES/BOR_LLM_RETRY_DELAY with a live 'retrying' status
This commit is contained in:
@@ -73,6 +73,13 @@ class Settings(BaseSettings):
|
||||
#: pieces are still counted for the per-turn log line but never
|
||||
#: emitted — the answer stream itself is unchanged.
|
||||
stream_thinking: bool = True
|
||||
#: Retries of a failed LLM request when the endpoint stops responding
|
||||
#: (phase 67, ``BOR_LLM_RETRIES``); ``0`` = no retries (the turn fails
|
||||
#: on the first error, pre-phase-67 behavior).
|
||||
llm_retries: int = 3
|
||||
#: Flat seconds to wait between attempts (phase 67,
|
||||
#: ``BOR_LLM_RETRY_DELAY``); the TODO-locked 5 s, no backoff.
|
||||
llm_retry_delay: float = 5.0
|
||||
|
||||
# --- RAG tuning ---
|
||||
embedding_dim: int = 768 # verified against aipi /v1 (embed model)
|
||||
@@ -261,6 +268,24 @@ class Settings(BaseSettings):
|
||||
raise ValueError("agent_max_rounds must be >= 0 (0 = no tools)")
|
||||
return v
|
||||
|
||||
@field_validator("llm_retries")
|
||||
@classmethod
|
||||
def _llm_retries_non_negative(cls, v: int) -> int:
|
||||
"""``0`` is the no-retry kill switch (pre-phase-67 behavior) — a
|
||||
negative value is a typo (the ``agent_max_rounds`` pattern)."""
|
||||
if v < 0:
|
||||
raise ValueError("llm_retries must be >= 0 (0 = no retries)")
|
||||
return v
|
||||
|
||||
@field_validator("llm_retry_delay")
|
||||
@classmethod
|
||||
def _llm_retry_delay_non_negative(cls, v: float) -> float:
|
||||
"""A negative delay is a typo — fail loud at startup (the
|
||||
``agent_max_rounds`` pattern)."""
|
||||
if v < 0:
|
||||
raise ValueError("llm_retry_delay must be >= 0 (seconds)")
|
||||
return v
|
||||
|
||||
@field_validator("upload_max_mb")
|
||||
@classmethod
|
||||
def _upload_max_mb_positive(cls, v: int) -> int:
|
||||
|
||||
Reference in New Issue
Block a user