File size: 3,407 Bytes
2b557d7
ac0f9ba
 
 
2b557d7
ac0f9ba
 
 
 
2b557d7
 
 
 
 
 
 
 
 
 
 
 
 
 
 
ac0f9ba
 
 
2b557d7
 
 
 
 
 
 
 
 
 
 
 
 
 
ac0f9ba
2b557d7
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
ac0f9ba
2b557d7
 
 
 
ac0f9ba
2b557d7
 
ac0f9ba
2b557d7
 
ac0f9ba
 
2b557d7
 
 
 
ac0f9ba
2b557d7
 
ac0f9ba
2b557d7
ac0f9ba
 
 
 
2b557d7
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
from smolagents import CodeAgent,ToolCallingAgent, PythonInterpreterTool , VisitWebpageTool, DuckDuckGoSearchTool


from src.final_assignment_template.models import openrouter_qwenCoder_model, modelLiteLLm
from src.final_assignment_template.tools import travily_tool, bm25_query, BM25Tool,extract_filter_textual_info_from_textual_context, summarize_before_final_answer, Video_link_understanding_tool, image_understanding_tool, get_task_file
# (Keep Constants as is)
# --- Constants ---


# retrived_context_qa_agent = ToolCallingAgent(
#     name="retrived_context_qa_agent",
#     description="""
#     You are a simple QA agent for the retrived web contect.
#       1. Pass query and context and avaialbe tools.
#       2. If you can answer directly, respond in plain text.
#       3. Otherwise, return an explicit action JSON, e.g.
#          {"action": "use_tool", "tool_name": "...", "input": "..."}.
#     """,
#     model=modelLiteLLm,
#     tools=[],               # no extra tools by default
#     add_base_tools=False,   # don’t add PythonInterpreterTool, etc.
#     verbosity_level=1,
#     planning_interval=1,
# )



# web_agent = CodeAgent(
#     model=openrouter_qwenCoder_model,
#     tools=[
#         # GoogleSearchTool(provider="serper"),
#         # DuckDuckGoSearchTool(max_results=10),
#         travily_tool,
#         VisitWebpageTool(),
#     ],
#     name="web_agent",
#     description="""Browses the web to find information""",
#     verbosity_level=1,
#     planning_interval=1,
#     max_steps=8,
# )

# code_agent = CodeAgent(
#     model=openrouter_qwenCoder_model,
#     tools=[
#         # GoogleSearchTool(provider="serper"),
#         # DuckDuckGoSearchTool(max_results=10),
#       PythonInterpreterTool(additional_authorized_imports=[
#         "json",
#         "markdown",
#         'numpy',
#         'pandas'
#         'math', 'statistics', 're', 'unicodedata', 'random', 
#         'datetime', 'queue', 'time', 'collections', 'stat', 'itertools',
#     ])
#     ],
#     name="code_agent",
#     description="""You can execute python code using this agent""",
#     verbosity_level=1,
#     max_steps=3,
# )

    # - When using the Video_Link_Understanding_Tool and Image_Understanding_Tool, consider their responses and generate an answer based on the textual understanding they provide.
    #     - Video_Link_Understanding_Tool: This tool can only return textual understanding.
    #     - Image_Understanding_Tool: This tool can only return textual understanding.
Task_agent = CodeAgent(
    name="task_Agent",
    description="""
        - You are the Task Agent.
        - Provide the correct answer
        - Must call 'summarize_before_final_answer' at the end
    """,
    model=modelLiteLLm,
    add_base_tools=True,
    tools=[
        PythonInterpreterTool(),
        Video_link_understanding_tool,
        image_understanding_tool,
        get_task_file,
        travily_tool,
        # DuckDuckGoSearchTool(),
        # bm25_query,
        VisitWebpageTool(),
        extract_filter_textual_info_from_textual_context,
        # summarize_before_final_answer,
    ],
    additional_authorized_imports=[
        'numpy',
        'pandas'
        'math',  
        'datetime',
    ],
            # managed_agents=[web_agent],
    planning_interval=1,
    verbosity_level=1,
    max_steps=7,
    # final_answer_checks=[check_reasoning_and_plot],
)