Update agent.py
Browse files
agent.py
CHANGED
@@ -220,7 +220,6 @@ analysis_agent = FunctionAgent(
|
|
220 |
""",
|
221 |
llm=multimodal_llm,
|
222 |
tools=[enhanced_rag_tool, cross_document_tool],
|
223 |
-
can_handoff_to=["CodeAgent", "ResearchAgent"]
|
224 |
)
|
225 |
|
226 |
|
@@ -346,7 +345,6 @@ research_agent = FunctionAgent(
|
|
346 |
""",
|
347 |
llm=text_llm,
|
348 |
tools=[enhanced_research_tool_func],
|
349 |
-
can_handoff_to=["AnalysisAgent", "CodeAgent"]
|
350 |
)
|
351 |
|
352 |
|
@@ -397,24 +395,35 @@ code_agent = ReActAgent(
|
|
397 |
""",
|
398 |
llm=text_llm,
|
399 |
tools=[code_execution_tool],
|
400 |
-
can_handoff_to=["ResearchAgent", "AnalysisAgent"]
|
401 |
)
|
402 |
|
403 |
# Créer des outils à partir des agents
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
404 |
analysis_tool = FunctionTool.from_defaults(
|
405 |
-
fn=
|
406 |
name="AnalysisAgent",
|
407 |
description="Advanced multimodal analysis using enhanced RAG"
|
408 |
)
|
409 |
|
410 |
research_tool = FunctionTool.from_defaults(
|
411 |
-
fn=
|
412 |
name="ResearchAgent",
|
413 |
description="Research agent for scientific and general research"
|
414 |
)
|
415 |
|
416 |
code_tool = FunctionTool.from_defaults(
|
417 |
-
fn=
|
418 |
name="CodeAgent",
|
419 |
description="Advanced calculations and data processing"
|
420 |
)
|
|
|
220 |
""",
|
221 |
llm=multimodal_llm,
|
222 |
tools=[enhanced_rag_tool, cross_document_tool],
|
|
|
223 |
)
|
224 |
|
225 |
|
|
|
345 |
""",
|
346 |
llm=text_llm,
|
347 |
tools=[enhanced_research_tool_func],
|
|
|
348 |
)
|
349 |
|
350 |
|
|
|
395 |
""",
|
396 |
llm=text_llm,
|
397 |
tools=[code_execution_tool],
|
|
|
398 |
)
|
399 |
|
400 |
# Créer des outils à partir des agents
|
401 |
+
def analysis_function(query: str, files=None):
|
402 |
+
ctx = Context(analysis_agent)
|
403 |
+
return analysis_agent.run(query, ctx=ctx)
|
404 |
+
|
405 |
+
def research_function(query: str):
|
406 |
+
ctx = Context(research_agent)
|
407 |
+
return research_agent.run(query, ctx=ctx)
|
408 |
+
|
409 |
+
def code_function(query: str):
|
410 |
+
ctx = Context(code_agent)
|
411 |
+
return code_agent.run(query, ctx=ctx)
|
412 |
+
|
413 |
analysis_tool = FunctionTool.from_defaults(
|
414 |
+
fn=analysis_function,
|
415 |
name="AnalysisAgent",
|
416 |
description="Advanced multimodal analysis using enhanced RAG"
|
417 |
)
|
418 |
|
419 |
research_tool = FunctionTool.from_defaults(
|
420 |
+
fn=research_function,
|
421 |
name="ResearchAgent",
|
422 |
description="Research agent for scientific and general research"
|
423 |
)
|
424 |
|
425 |
code_tool = FunctionTool.from_defaults(
|
426 |
+
fn=code_function,
|
427 |
name="CodeAgent",
|
428 |
description="Advanced calculations and data processing"
|
429 |
)
|