fix: increase AI timeout to 120s and limit retries to 1
The 45s timeout was too short for generation tasks with full flow context in the system prompt. The Anthropic SDK's default 2 retries caused requests to hang for ~136s before failing. Now: 120s timeout with max 1 retry = faster failure if it does timeout. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -184,6 +184,7 @@ class AnthropicProvider(AIProvider):
|
|||||||
client = anthropic.AsyncAnthropic(
|
client = anthropic.AsyncAnthropic(
|
||||||
api_key=self._api_key,
|
api_key=self._api_key,
|
||||||
timeout=self._timeout,
|
timeout=self._timeout,
|
||||||
|
max_retries=1,
|
||||||
)
|
)
|
||||||
|
|
||||||
response = await client.messages.create(
|
response = await client.messages.create(
|
||||||
|
|||||||
@@ -77,7 +77,7 @@ class Settings(BaseSettings):
|
|||||||
AI_MODEL: str = "claude-sonnet-4-6"
|
AI_MODEL: str = "claude-sonnet-4-6"
|
||||||
AI_CONVERSATION_TTL_HOURS: int = 24
|
AI_CONVERSATION_TTL_HOURS: int = 24
|
||||||
AI_MAX_CALLS_PER_FLOW: int = 10
|
AI_MAX_CALLS_PER_FLOW: int = 10
|
||||||
AI_REQUEST_TIMEOUT_SECONDS: int = 45
|
AI_REQUEST_TIMEOUT_SECONDS: int = 120
|
||||||
# AI Provider selection
|
# AI Provider selection
|
||||||
AI_PROVIDER: str = "anthropic" # "gemini" or "anthropic"
|
AI_PROVIDER: str = "anthropic" # "gemini" or "anthropic"
|
||||||
GOOGLE_AI_API_KEY: Optional[str] = None
|
GOOGLE_AI_API_KEY: Optional[str] = None
|
||||||
|
|||||||
Reference in New Issue
Block a user