Commit
·
93317dd
1
Parent(s):
cd5a36a
Remove unsupported response_mime_type parameter from Gemini API call
Browse files- The old google.generativeai package doesn't support image/png in response_mime_type
- Images are returned naturally in response parts as inline_data
- This fixes the 400 error: allowed mimetypes are text/plain, application/json, etc.
- src/core.py +2 -6
src/core.py
CHANGED
|
@@ -163,15 +163,11 @@ def _call_gemini_edit(
|
|
| 163 |
{"mime_type": "image/png", "data": mask_bytes},
|
| 164 |
]
|
| 165 |
|
| 166 |
-
#
|
| 167 |
-
|
| 168 |
-
"response_mime_type": "image/png",
|
| 169 |
-
}
|
| 170 |
-
|
| 171 |
try:
|
| 172 |
response = model.generate_content(
|
| 173 |
content,
|
| 174 |
-
generation_config=generation_config,
|
| 175 |
stream=False
|
| 176 |
)
|
| 177 |
except Exception as gen_err:
|
|
|
|
| 163 |
{"mime_type": "image/png", "data": mask_bytes},
|
| 164 |
]
|
| 165 |
|
| 166 |
+
# Note: response_mime_type doesn't support image/png in the old google.generativeai package
|
| 167 |
+
# Images are returned in response parts as inline_data
|
|
|
|
|
|
|
|
|
|
| 168 |
try:
|
| 169 |
response = model.generate_content(
|
| 170 |
content,
|
|
|
|
| 171 |
stream=False
|
| 172 |
)
|
| 173 |
except Exception as gen_err:
|