update
This commit is contained in:
@@ -27,8 +27,9 @@ class DirectLLMAdapter(AIAdapter):
|
||||
|
||||
provider_name = AIProviderName.DIRECT_LLM
|
||||
|
||||
def __init__(self, settings: Settings):
|
||||
def __init__(self, settings: Settings, *, timeout_seconds: float = 60):
|
||||
self.settings = settings
|
||||
self.timeout_seconds = timeout_seconds
|
||||
|
||||
def ask(self, prompt: str, context: dict[str, Any] | None = None) -> dict[str, Any]:
|
||||
if not self.settings.direct_llm_api_key:
|
||||
@@ -46,7 +47,7 @@ class DirectLLMAdapter(AIAdapter):
|
||||
AIHttpPayloadKey.MODEL: self.settings.direct_llm_model,
|
||||
AIHttpPayloadKey.MESSAGES: _chat_messages(prompt, context),
|
||||
}
|
||||
with httpx.Client(timeout=60, trust_env=False) as client:
|
||||
with httpx.Client(timeout=self.timeout_seconds, trust_env=False) as client:
|
||||
response = client.post(url, json=payload, headers=headers)
|
||||
if response.status_code >= status.HTTP_400_BAD_REQUEST:
|
||||
raise HTTPException(
|
||||
|
||||
Reference in New Issue
Block a user