Commit
·
34a788d
1
Parent(s):
c581ac0
Fixes
Browse files- agent.py +4 -2
- requirements.txt +1 -0
- tools/audio_tools.py +4 -4
agent.py
CHANGED
|
@@ -112,6 +112,7 @@ class BasicAgent:
|
|
| 112 |
additional_authorized_imports = [
|
| 113 |
'numpy','subprocess', 're', 'pandas',
|
| 114 |
'json', 'os', 'datetime', 'tempfile',
|
|
|
|
| 115 |
],
|
| 116 |
verbosity_level = 1,
|
| 117 |
max_print_outputs_length=1_000_000
|
|
@@ -146,7 +147,7 @@ class GeminiAgent:
|
|
| 146 |
"GOOGLE_API_KEY not found."
|
| 147 |
)
|
| 148 |
self.model = LiteLLMModel(
|
| 149 |
-
model_id = "gemini/gemini-2.5-flash",
|
| 150 |
api_key = GOOGLE_API_KEY,
|
| 151 |
temperature = 0.0,
|
| 152 |
top_p = 1.0,
|
|
@@ -159,10 +160,11 @@ class GeminiAgent:
|
|
| 159 |
model = self.model,
|
| 160 |
tools = self.tools,
|
| 161 |
add_base_tools = True, # probably redundant, but it does not hurt
|
| 162 |
-
max_steps =
|
| 163 |
additional_authorized_imports = [
|
| 164 |
'numpy','subprocess', 're', 'pandas',
|
| 165 |
'json', 'os', 'datetime', 'tempfile',
|
|
|
|
| 166 |
],
|
| 167 |
verbosity_level = 1,
|
| 168 |
max_print_outputs_length=1_000_000
|
|
|
|
| 112 |
additional_authorized_imports = [
|
| 113 |
'numpy','subprocess', 're', 'pandas',
|
| 114 |
'json', 'os', 'datetime', 'tempfile',
|
| 115 |
+
'requests', 'markdownify'
|
| 116 |
],
|
| 117 |
verbosity_level = 1,
|
| 118 |
max_print_outputs_length=1_000_000
|
|
|
|
| 147 |
"GOOGLE_API_KEY not found."
|
| 148 |
)
|
| 149 |
self.model = LiteLLMModel(
|
| 150 |
+
model_id = "gemini/gemini-2.5-flash-lite",
|
| 151 |
api_key = GOOGLE_API_KEY,
|
| 152 |
temperature = 0.0,
|
| 153 |
top_p = 1.0,
|
|
|
|
| 160 |
model = self.model,
|
| 161 |
tools = self.tools,
|
| 162 |
add_base_tools = True, # probably redundant, but it does not hurt
|
| 163 |
+
max_steps = 8,
|
| 164 |
additional_authorized_imports = [
|
| 165 |
'numpy','subprocess', 're', 'pandas',
|
| 166 |
'json', 'os', 'datetime', 'tempfile',
|
| 167 |
+
'requests', 'markdownify',
|
| 168 |
],
|
| 169 |
verbosity_level = 1,
|
| 170 |
max_print_outputs_length=1_000_000
|
requirements.txt
CHANGED
|
@@ -9,6 +9,7 @@ gradio
|
|
| 9 |
|
| 10 |
# Networking & retrieval
|
| 11 |
requests==2.32.5
|
|
|
|
| 12 |
ddgs==9.10.0
|
| 13 |
|
| 14 |
# Data handling
|
|
|
|
| 9 |
|
| 10 |
# Networking & retrieval
|
| 11 |
requests==2.32.5
|
| 12 |
+
markdownify
|
| 13 |
ddgs==9.10.0
|
| 14 |
|
| 15 |
# Data handling
|
tools/audio_tools.py
CHANGED
|
@@ -29,10 +29,6 @@ def youtube_to_text(url: str) -> str:
|
|
| 29 |
return text
|
| 30 |
except Exception:
|
| 31 |
pass # Silent fallback to Whisper
|
| 32 |
-
finally:
|
| 33 |
-
# Cleanup temp file to save space
|
| 34 |
-
if audio_path and os.path.exists(audio_path):
|
| 35 |
-
os.remove(audio_path)
|
| 36 |
|
| 37 |
# ---- Step 2: Fallback to Whisper transcription ----
|
| 38 |
try:
|
|
@@ -52,6 +48,10 @@ def youtube_to_text(url: str) -> str:
|
|
| 52 |
|
| 53 |
except Exception as e:
|
| 54 |
return f"Error transcribing YouTube video: {str(e)}"
|
|
|
|
|
|
|
|
|
|
|
|
|
| 55 |
|
| 56 |
@tool
|
| 57 |
def transcribe_audio(file_path: str) -> str:
|
|
|
|
| 29 |
return text
|
| 30 |
except Exception:
|
| 31 |
pass # Silent fallback to Whisper
|
|
|
|
|
|
|
|
|
|
|
|
|
| 32 |
|
| 33 |
# ---- Step 2: Fallback to Whisper transcription ----
|
| 34 |
try:
|
|
|
|
| 48 |
|
| 49 |
except Exception as e:
|
| 50 |
return f"Error transcribing YouTube video: {str(e)}"
|
| 51 |
+
finally:
|
| 52 |
+
# Cleanup temp file to save space
|
| 53 |
+
if audio_path and os.path.exists(audio_path):
|
| 54 |
+
os.remove(audio_path)
|
| 55 |
|
| 56 |
@tool
|
| 57 |
def transcribe_audio(file_path: str) -> str:
|