feat: implement timeout handling and error messages for image generation
This commit is contained in:
@@ -12,9 +12,10 @@ def _backend(path: str) -> str:
|
||||
|
||||
def _api(method: str, path: str, *, token: str | None = None, **kwargs):
|
||||
headers = kwargs.pop("headers", {})
|
||||
timeout = kwargs.pop("timeout", 30)
|
||||
if token:
|
||||
headers["Authorization"] = f"Bearer {token}"
|
||||
return httpx.request(method, _backend(path), headers=headers, timeout=30, **kwargs)
|
||||
return httpx.request(method, _backend(path), headers=headers, timeout=timeout, **kwargs)
|
||||
|
||||
|
||||
def _model_matches_modality(model: dict, modality: str) -> bool:
|
||||
|
||||
Reference in New Issue
Block a user