feat: implement timeout handling and error messages for image generation
This commit is contained in:
1 parent
c410c2e80d
commit
5794c96c21
4 files changed
+85
-26
No files matched your search
@@ -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