Spaces:
Runtime error
Runtime error
Commit
·
209f199
1
Parent(s):
711b26d
♻️ LLM change
Browse files
app.py
CHANGED
|
@@ -26,7 +26,6 @@ from tools import (
|
|
| 26 |
normalize_place_name,
|
| 27 |
is_drink,
|
| 28 |
download_youtube_comments,
|
| 29 |
-
get_youtube_transcript,
|
| 30 |
)
|
| 31 |
|
| 32 |
# (Keep Constants as is)
|
|
@@ -38,16 +37,26 @@ final_answer = FinalAnswerTool()
|
|
| 38 |
web_search = DuckDuckGoSearchTool()
|
| 39 |
visit_webpage = VisitWebpageTool()
|
| 40 |
wiki_search = WikipediaSearchTool()
|
| 41 |
-
authorized_imports = ["pandas", "random", "time", "builtins.open"]
|
| 42 |
py_run = PythonInterpreterTool(authorized_imports=authorized_imports)
|
| 43 |
|
| 44 |
model = HfApiModel(
|
| 45 |
max_tokens=2096,
|
| 46 |
temperature=0.5,
|
| 47 |
-
model_id="Qwen/
|
|
|
|
| 48 |
custom_role_conversions=None,
|
| 49 |
)
|
| 50 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 51 |
|
| 52 |
def run_and_submit_all(profile: gr.OAuthProfile | None):
|
| 53 |
"""
|
|
@@ -93,11 +102,14 @@ def run_and_submit_all(profile: gr.OAuthProfile | None):
|
|
| 93 |
normalize_place_name,
|
| 94 |
is_drink,
|
| 95 |
download_youtube_comments,
|
| 96 |
-
get_youtube_transcript,
|
| 97 |
],
|
| 98 |
verbosity_level=2,
|
|
|
|
| 99 |
additional_authorized_imports=authorized_imports,
|
| 100 |
)
|
|
|
|
|
|
|
|
|
|
| 101 |
except Exception as e:
|
| 102 |
print(f"Error instantiating agent: {e}")
|
| 103 |
return f"Error initializing agent: {e}", None
|
|
|
|
| 26 |
normalize_place_name,
|
| 27 |
is_drink,
|
| 28 |
download_youtube_comments,
|
|
|
|
| 29 |
)
|
| 30 |
|
| 31 |
# (Keep Constants as is)
|
|
|
|
| 37 |
web_search = DuckDuckGoSearchTool()
|
| 38 |
visit_webpage = VisitWebpageTool()
|
| 39 |
wiki_search = WikipediaSearchTool()
|
| 40 |
+
authorized_imports = ["pandas", "random", "time", "builtins.open", "bs4"]
|
| 41 |
py_run = PythonInterpreterTool(authorized_imports=authorized_imports)
|
| 42 |
|
| 43 |
model = HfApiModel(
|
| 44 |
max_tokens=2096,
|
| 45 |
temperature=0.5,
|
| 46 |
+
model_id="Qwen/Qwen3-14b",
|
| 47 |
+
# model_id="Qwen/Qwen2.5-Coder-32B-Instruct",
|
| 48 |
custom_role_conversions=None,
|
| 49 |
)
|
| 50 |
|
| 51 |
+
gaia_prompt = """
|
| 52 |
+
---
|
| 53 |
+
You are given tools to explore Wikipedia pages.
|
| 54 |
+
- Use `list_wikipedia_sections(page_title)` whenever you need to know which sections exist.
|
| 55 |
+
- If a section you want (e.g., "Discography") isn’t listed, you *must* call this tool *first*, inspect its output, and choose the closest alternative section name (e.g., "Studio albums" or "Albums").
|
| 56 |
+
- After finding a valid section title, call the appropriate extraction tool (`extract_nth_table_…`, `count_tables_…`, etc.).
|
| 57 |
+
- Do not attempt to parse the entire text manually without verifying section names first.
|
| 58 |
+
"""
|
| 59 |
+
|
| 60 |
|
| 61 |
def run_and_submit_all(profile: gr.OAuthProfile | None):
|
| 62 |
"""
|
|
|
|
| 102 |
normalize_place_name,
|
| 103 |
is_drink,
|
| 104 |
download_youtube_comments,
|
|
|
|
| 105 |
],
|
| 106 |
verbosity_level=2,
|
| 107 |
+
planning_interval=4,
|
| 108 |
additional_authorized_imports=authorized_imports,
|
| 109 |
)
|
| 110 |
+
agent.prompt_templates["system_prompt"] = (
|
| 111 |
+
agent.prompt_templates["system_prompt"] + gaia_prompt
|
| 112 |
+
)
|
| 113 |
except Exception as e:
|
| 114 |
print(f"Error instantiating agent: {e}")
|
| 115 |
return f"Error initializing agent: {e}", None
|