@danhachuel/thunderbolt 0.5.45 → 0.5.46
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.
|
@@ -160,9 +160,8 @@ def _vision_prompt(video: Mapping[str, Any]) -> str:
|
|
|
160
160
|
|
|
161
161
|
def analyse_thumbnail_with_paligemma(path: str, card: Mapping[str, Any]) -> dict[str, Any]:
|
|
162
162
|
key = str(card.get("api_key") or "").strip()
|
|
163
|
-
base = str(card.get("base_url") or "https://
|
|
164
|
-
if base.endswith("/
|
|
165
|
-
base = f"{base}/vlm/google/paligemma"
|
|
163
|
+
base = str(card.get("base_url") or "https://integrate.api.nvidia.com/v1").rstrip("/")
|
|
164
|
+
endpoint = base if base.endswith("/chat/completions") else f"{base}/chat/completions"
|
|
166
165
|
model = str(card.get("model") or "google/paligemma").strip()
|
|
167
166
|
if not key:
|
|
168
167
|
return {"score": 50, "diagnosis": "API key NVIDIA NIM Paligemma não configurada.", "status": "sem_dados"}
|
|
@@ -171,7 +170,7 @@ def analyse_thumbnail_with_paligemma(path: str, card: Mapping[str, Any]) -> dict
|
|
|
171
170
|
{"type": "text", "text": "Evaluate this thumbnail for YouTube Growth. Return JSON with score, diagnosis, contrast, mobile_readability, text_words, hierarchy, emotion, overlap_risk."},
|
|
172
171
|
{"type": "image_url", "image_url": {"url": f"data:image/jpeg;base64,{data}"}},
|
|
173
172
|
]}], "max_tokens": 500, "temperature": 0.1}
|
|
174
|
-
response = requests.post(
|
|
173
|
+
response = requests.post(endpoint, headers={"Authorization": f"Bearer {key}", "Accept": "application/json", "Content-Type": "application/json"}, json=payload, timeout=120)
|
|
175
174
|
response.raise_for_status()
|
|
176
175
|
content = response.json().get("choices", [{}])[0].get("message", {}).get("content", "")
|
|
177
176
|
match = re.search(r"\{.*\}", str(content), flags=re.S)
|
|
@@ -55,7 +55,7 @@ LLM_PROVIDER_CATALOG: tuple[LlmProviderDefinition, ...] = (
|
|
|
55
55
|
"nvidia_nim_paligemma",
|
|
56
56
|
"OpenAI / NVIDIA NIM (Paligemma)",
|
|
57
57
|
show_base_url=True,
|
|
58
|
-
default_base_url="https://
|
|
58
|
+
default_base_url="https://integrate.api.nvidia.com/v1",
|
|
59
59
|
supports_model_discovery=False,
|
|
60
60
|
excluded_from_normal_pool=True,
|
|
61
61
|
description="Provider exclusivo do Analista Growth YouTube para análise visual de thumbnails.",
|
package/package.json
CHANGED