Update tools/tools_on_modal_labs.py
Browse files- tools/tools_on_modal_labs.py +11 -9
tools/tools_on_modal_labs.py
CHANGED
|
@@ -82,7 +82,8 @@ def run_research_workflow(queryInput: QueryInput) -> str:
|
|
| 82 |
return result
|
| 83 |
|
| 84 |
NEBIUS_API_KEY = os.getenv("NEBIUS_API_KEY")
|
| 85 |
-
AGENT_MODEL = os.getenv("AGENT_MODEL", "
|
|
|
|
| 86 |
|
| 87 |
# Load an LLM
|
| 88 |
llm = NebiusLLM(
|
|
@@ -140,19 +141,20 @@ async def review_report(ctx: Context, review: str) -> str:
|
|
| 140 |
# - The WriteAgent is responsible for writing the report.
|
| 141 |
# - The ReviewAgent is responsible for reviewing the report.
|
| 142 |
|
| 143 |
-
# The ResearchAgent uses the
|
| 144 |
|
| 145 |
research_agent = FunctionAgent(
|
| 146 |
name="ResearchAgent",
|
| 147 |
description=(
|
| 148 |
-
"
|
| 149 |
-
"It must not exceed 3 searches total
|
| 150 |
-
"Once sufficient information is collected,
|
| 151 |
),
|
| 152 |
system_prompt=(
|
| 153 |
-
"You are the ResearchAgent. Your goal is to
|
| 154 |
-
"Only perform at most
|
| 155 |
-
"handoff to the WriteAgent. Avoid infinite loops! If search throws an error, stop further work and skip WriteAgent and ReviewAgent and return."
|
|
|
|
| 156 |
"Respect invocation limits and cooldown periods."
|
| 157 |
),
|
| 158 |
llm=llm,
|
|
@@ -160,7 +162,7 @@ research_agent = FunctionAgent(
|
|
| 160 |
search_web,
|
| 161 |
save_research
|
| 162 |
],
|
| 163 |
-
max_iterations=3, # Limit to
|
| 164 |
cooldown=5, # Cooldown to prevent rapid re-querying
|
| 165 |
can_handoff_to=["WriteAgent"]
|
| 166 |
)
|
|
|
|
| 82 |
return result
|
| 83 |
|
| 84 |
NEBIUS_API_KEY = os.getenv("NEBIUS_API_KEY")
|
| 85 |
+
AGENT_MODEL = os.getenv("AGENT_MODEL", "Qwen/Qwen2.5-Coder-32B-Instruct")
|
| 86 |
+
print(f"Using LLM model: {AGENT_MODEL}")
|
| 87 |
|
| 88 |
# Load an LLM
|
| 89 |
llm = NebiusLLM(
|
|
|
|
| 141 |
# - The WriteAgent is responsible for writing the report.
|
| 142 |
# - The ReviewAgent is responsible for reviewing the report.
|
| 143 |
|
| 144 |
+
# The ResearchAgent uses the Tavily Client to search the web.
|
| 145 |
|
| 146 |
research_agent = FunctionAgent(
|
| 147 |
name="ResearchAgent",
|
| 148 |
description=(
|
| 149 |
+
"Useful for searching the web for information on a given topic and recording notes on the topic."
|
| 150 |
+
"It must not exceed 3 searches total and must avoid repeating the same query. "
|
| 151 |
+
"Once sufficient information is collected, you should hand off to the WriteAgent."
|
| 152 |
),
|
| 153 |
system_prompt=(
|
| 154 |
+
"You are the ResearchAgent. Your goal is to search the web for information on a given topic and record notes on the topic."
|
| 155 |
+
"Only perform at most 3 distinct searches. If you have enough information or have reached 3 searches, "
|
| 156 |
+
"handoff to the WriteAgent. Avoid infinite loops! If the search throws an error, stop further work and skip WriteAgent and ReviewAgent and return."
|
| 157 |
+
"You should have at least some notes on a topic before handing off control to the WriteAgent."
|
| 158 |
"Respect invocation limits and cooldown periods."
|
| 159 |
),
|
| 160 |
llm=llm,
|
|
|
|
| 162 |
search_web,
|
| 163 |
save_research
|
| 164 |
],
|
| 165 |
+
max_iterations=3, # Limit to 3 iterations to prevent infinite loops
|
| 166 |
cooldown=5, # Cooldown to prevent rapid re-querying
|
| 167 |
can_handoff_to=["WriteAgent"]
|
| 168 |
)
|