Update agents/tools/ai_tools.py
Browse files- agents/tools/ai_tools.py +11 -1
agents/tools/ai_tools.py
CHANGED
|
@@ -54,7 +54,17 @@ class AITools():
|
|
| 54 |
client = AITools._get_client()
|
| 55 |
|
| 56 |
file = client.files.upload(file=file_path)
|
| 57 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 58 |
response = client.models.generate_content(
|
| 59 |
model=model,
|
| 60 |
contents=[file, question],
|
|
|
|
| 54 |
client = AITools._get_client()
|
| 55 |
|
| 56 |
file = client.files.upload(file=file_path)
|
| 57 |
+
|
| 58 |
+
###
|
| 59 |
+
while True:
|
| 60 |
+
media_file = client.files.get(name=file.name)
|
| 61 |
+
if media_file.state == "ACTIVE":
|
| 62 |
+
break
|
| 63 |
+
elif media_file.state == "FAILED":
|
| 64 |
+
raise RuntimeError("Media file processing failed")
|
| 65 |
+
time.sleep(1)
|
| 66 |
+
###
|
| 67 |
+
|
| 68 |
response = client.models.generate_content(
|
| 69 |
model=model,
|
| 70 |
contents=[file, question],
|