@danhachuel/thunderbolt 0.4.39 → 0.4.41
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -45,6 +45,10 @@ class MediaGenerationError(RuntimeError):
|
|
|
45
45
|
"""Raised when an image/video adapter cannot produce a usable artifact."""
|
|
46
46
|
|
|
47
47
|
|
|
48
|
+
AGNES_IMAGE_MODEL = "agnes-image-2.1-flash"
|
|
49
|
+
AGNES_IMAGE_TIMEOUT_SECONDS = 120
|
|
50
|
+
|
|
51
|
+
|
|
48
52
|
def _api_key(card: Mapping[str, Any]) -> str:
|
|
49
53
|
return str(card.get("api_key") or "").strip()
|
|
50
54
|
|
|
@@ -259,6 +263,16 @@ def _image_request(card: dict[str, Any], prompt: str, *, topic: str = "", letter
|
|
|
259
263
|
if style == "replicate":
|
|
260
264
|
body = {"version": _model(card), "input": {"prompt": constrained_prompt}}
|
|
261
265
|
return requests.post(endpoint, headers=_headers(card), json=body, timeout=180)
|
|
266
|
+
if provider == "agnes":
|
|
267
|
+
body = {
|
|
268
|
+
"model": _model(card) or AGNES_IMAGE_MODEL,
|
|
269
|
+
"prompt": constrained_prompt,
|
|
270
|
+
"size": "1K",
|
|
271
|
+
"ratio": "16:9",
|
|
272
|
+
"return_base64": True,
|
|
273
|
+
"extra_body": {"response_format": "b64_json"},
|
|
274
|
+
}
|
|
275
|
+
return requests.post(endpoint, headers=_headers(card), json=body, timeout=AGNES_IMAGE_TIMEOUT_SECONDS)
|
|
262
276
|
body = {"model": _model(card), "prompt": constrained_prompt, "n": 1, "response_format": "b64_json"}
|
|
263
277
|
if provider == "pollinations":
|
|
264
278
|
body["size"] = "1792x1024"
|
|
@@ -228,7 +228,7 @@ def new_media_card(provider: Any, *, card_id: str | None = None) -> dict[str, An
|
|
|
228
228
|
{
|
|
229
229
|
"id": card_id or f"media-{code}-1",
|
|
230
230
|
"provider": code,
|
|
231
|
-
"model": "gemini-3.1-flash-image" if code == "nano_banana" else "",
|
|
231
|
+
"model": "gemini-3.1-flash-image" if code == "nano_banana" else ("agnes-image-2.1-flash" if code == "agnes" else ""),
|
|
232
232
|
"base_url": definition.default_base_url,
|
|
233
233
|
"enabled": True,
|
|
234
234
|
}
|
|
@@ -225,7 +225,7 @@ def acquire_nvidia_rpm_slot(
|
|
|
225
225
|
|
|
226
226
|
|
|
227
227
|
def _status_category(status_code: int) -> tuple[str, bool]:
|
|
228
|
-
if status_code
|
|
228
|
+
if status_code in {402, 429}:
|
|
229
229
|
return "quota", True
|
|
230
230
|
if status_code in {408, 425} or status_code >= 500:
|
|
231
231
|
return "transient", True
|
package/package.json
CHANGED