Commit
·
a4234c7
1
Parent(s):
236dc64
added reverse tools
Browse files
app.py
CHANGED
|
@@ -30,33 +30,7 @@ openai_41mini_model = OpenAIServerModel(
|
|
| 30 |
)
|
| 31 |
search_tool = DuckDuckGoSearchTool()
|
| 32 |
|
| 33 |
-
analyst = CodeAgent(
|
| 34 |
-
model=openai_41mini_model,
|
| 35 |
-
tools=[reverse_text],
|
| 36 |
-
add_base_tools=False,
|
| 37 |
-
name="analyst",
|
| 38 |
-
description="You are the Analyst, skilled at decoding mysterious or reversed text. "
|
| 39 |
-
"When given a message, use your tools to reveal its correct form."
|
| 40 |
-
)
|
| 41 |
-
historian = ToolCallingAgent(
|
| 42 |
-
model=openai_41mini_model,
|
| 43 |
-
tools = [],
|
| 44 |
-
add_base_tools=False,
|
| 45 |
-
name="historian",
|
| 46 |
-
description="You are the Historian. If a message seems written backward, consult the Analyst to decode it. "
|
| 47 |
-
"Otherwise, answer directly in clear language."
|
| 48 |
|
| 49 |
-
)
|
| 50 |
-
|
| 51 |
-
universal_agent = CodeAgent(
|
| 52 |
-
model=openai_41mini_model,
|
| 53 |
-
tools=[search_tool, analyze_image, get_youtube_transcript],
|
| 54 |
-
name="web_agent",
|
| 55 |
-
description="Use search engine to find webpages related to a subject and get the page content",
|
| 56 |
-
additional_authorized_imports=["pandas", "numpy", "bs4"],
|
| 57 |
-
verbosity_level=1,
|
| 58 |
-
max_steps=7,
|
| 59 |
-
)
|
| 60 |
|
| 61 |
def run_and_submit_all( profile: gr.OAuthProfile | None):
|
| 62 |
"""
|
|
@@ -95,13 +69,16 @@ def run_and_submit_all( profile: gr.OAuthProfile | None):
|
|
| 95 |
# verbosity_level=1,
|
| 96 |
# max_steps=7,
|
| 97 |
# )
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 98 |
|
| 99 |
-
team = CodeAgent(
|
| 100 |
-
tools=[],
|
| 101 |
-
model=openai_41mini_model,
|
| 102 |
-
managed_agents=[analyst, historian, universal_agent],
|
| 103 |
-
additional_authorized_imports=["time", "numpy", "pandas"],
|
| 104 |
-
)
|
| 105 |
|
| 106 |
except Exception as e:
|
| 107 |
print(f"Error instantiating agent: {e}")
|
|
@@ -143,7 +120,7 @@ def run_and_submit_all( profile: gr.OAuthProfile | None):
|
|
| 143 |
continue
|
| 144 |
try:
|
| 145 |
#submitted_answer = agent(question_text)
|
| 146 |
-
submitted_answer =
|
| 147 |
answers_payload.append({"task_id": task_id, "submitted_answer": submitted_answer})
|
| 148 |
results_log.append({"Task ID": task_id, "Question": question_text, "Submitted Answer": submitted_answer})
|
| 149 |
except Exception as e:
|
|
|
|
| 30 |
)
|
| 31 |
search_tool = DuckDuckGoSearchTool()
|
| 32 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 33 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 34 |
|
| 35 |
def run_and_submit_all( profile: gr.OAuthProfile | None):
|
| 36 |
"""
|
|
|
|
| 69 |
# verbosity_level=1,
|
| 70 |
# max_steps=7,
|
| 71 |
# )
|
| 72 |
+
agent = CodeAgent(
|
| 73 |
+
model=openai_41mini_model,
|
| 74 |
+
tools=[search_tool, analyze_image, get_youtube_transcript],
|
| 75 |
+
name="web_agent",
|
| 76 |
+
description="Use search engine to find webpages related to a subject and get the page content",
|
| 77 |
+
additional_authorized_imports=["pandas", "numpy", "bs4"],
|
| 78 |
+
verbosity_level=1,
|
| 79 |
+
max_steps=7,
|
| 80 |
+
)
|
| 81 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 82 |
|
| 83 |
except Exception as e:
|
| 84 |
print(f"Error instantiating agent: {e}")
|
|
|
|
| 120 |
continue
|
| 121 |
try:
|
| 122 |
#submitted_answer = agent(question_text)
|
| 123 |
+
submitted_answer = agent.run(question_text)
|
| 124 |
answers_payload.append({"task_id": task_id, "submitted_answer": submitted_answer})
|
| 125 |
results_log.append({"Task ID": task_id, "Question": question_text, "Submitted Answer": submitted_answer})
|
| 126 |
except Exception as e:
|