Spaces:
Sleeping
Sleeping
Gaurav vashistha commited on
Commit ·
3f2e31a
1
Parent(s): 87b646c
Bugfix: Resolve GenAI SDK Pydantic validation and embedding model 404 errors
Browse files- agents/visual_analyst.py +2 -3
agents/visual_analyst.py
CHANGED
|
@@ -12,7 +12,7 @@ class VisualAnalyst:
|
|
| 12 |
if not self.api_key:
|
| 13 |
raise ValueError("GEMINI_API_KEY not found")
|
| 14 |
|
| 15 |
-
self.client = genai.Client(api_key=self.api_key)
|
| 16 |
self.model_name = "gemini-1.5-flash"
|
| 17 |
print(f"✅ VisualAnalyst stored Gemini model: {self.model_name}")
|
| 18 |
|
|
@@ -37,8 +37,7 @@ class VisualAnalyst:
|
|
| 37 |
# We'll stick to prompt engineering for now to match the "Return ONLY valid JSON" instruction.
|
| 38 |
response = self.client.models.generate_content(
|
| 39 |
model=self.model_name,
|
| 40 |
-
contents=[user_prompt, img]
|
| 41 |
-
config={'timeout': 15.0} # Alternatively, timeouts might be configured at the client level, but we maintain the logic.
|
| 42 |
)
|
| 43 |
|
| 44 |
response_text = response.text
|
|
|
|
| 12 |
if not self.api_key:
|
| 13 |
raise ValueError("GEMINI_API_KEY not found")
|
| 14 |
|
| 15 |
+
self.client = genai.Client(api_key=self.api_key, http_options={'timeout': 15.0})
|
| 16 |
self.model_name = "gemini-1.5-flash"
|
| 17 |
print(f"✅ VisualAnalyst stored Gemini model: {self.model_name}")
|
| 18 |
|
|
|
|
| 37 |
# We'll stick to prompt engineering for now to match the "Return ONLY valid JSON" instruction.
|
| 38 |
response = self.client.models.generate_content(
|
| 39 |
model=self.model_name,
|
| 40 |
+
contents=[user_prompt, img]
|
|
|
|
| 41 |
)
|
| 42 |
|
| 43 |
response_text = response.text
|