Update app.py
Browse files
app.py
CHANGED
@@ -53,13 +53,15 @@ model_id='Qwen/Qwen2.5-Coder-32B-Instruct',# it is possible that this model may
|
|
53 |
custom_role_conversions=None,
|
54 |
)
|
55 |
|
|
|
56 |
final_answer = FinalAnswerTool()
|
|
|
57 |
|
58 |
#Agent
|
59 |
agent_codeagent = CodeAgent(
|
60 |
model=model,
|
61 |
-
tools=[final_answer
|
62 |
-
max_steps=
|
63 |
verbosity_level=1,
|
64 |
grammar=None,
|
65 |
planning_interval=None,
|
@@ -69,49 +71,6 @@ agent_codeagent = CodeAgent(
|
|
69 |
)
|
70 |
|
71 |
|
72 |
-
# #def run_and_submit_one():
|
73 |
-
# # 1. Instantiate Agent ( modify this part to create your agent)
|
74 |
-
# try:
|
75 |
-
# #agent = BasicAgent()
|
76 |
-
# agent = agent_codeagent
|
77 |
-
|
78 |
-
# except Exception as e:
|
79 |
-
# print(f"Error instantiating agent: {e}")
|
80 |
-
# return f"Error initializing agent: {e}", None
|
81 |
-
|
82 |
-
# # 2. Fetch Questions by loading from local json
|
83 |
-
# status_message, questions_data = load_questions_from_file()
|
84 |
-
|
85 |
-
# if questions_data is not None and len(questions_data) > 0:
|
86 |
-
# first_question = questions_data[0]
|
87 |
-
# print("First question object:", first_question)
|
88 |
-
|
89 |
-
# #To test
|
90 |
-
# question_text = first_question.get("question")
|
91 |
-
# task_id = first_question.get("task_id")
|
92 |
-
# print(f"\nTask ID: {task_id}")
|
93 |
-
# print(f"Question: {question_text}")
|
94 |
-
# else:
|
95 |
-
# print("No data found.")
|
96 |
-
|
97 |
-
# # 3. Run your Agent
|
98 |
-
# results_log = []
|
99 |
-
# answers_payload = []
|
100 |
-
|
101 |
-
# try:
|
102 |
-
# submitted_answer = agent(question_text)
|
103 |
-
# answers_payload.append({"task_id": task_id, "submitted_answer": submitted_answer})
|
104 |
-
# results_log.append({"Task ID": task_id, "Question": question_text, "Submitted Answer": submitted_answer})
|
105 |
-
# except Exception as e:
|
106 |
-
# print(f"Error running agent on task {task_id}: {e}")
|
107 |
-
# results_log.append({"Task ID": task_id, "Question": question_text, "Submitted Answer": f"AGENT ERROR: {e}"})
|
108 |
-
|
109 |
-
# if not answers_payload:
|
110 |
-
# print("Agent did not produce any answers to submit.")
|
111 |
-
# return "Agent did not produce any answers to submit.", pd.DataFrame(results_log)
|
112 |
-
|
113 |
-
#run_and_submit_one()
|
114 |
-
|
115 |
# Gradio handler that runs the agent
|
116 |
def run_once(state):
|
117 |
if state is not None:
|
|
|
53 |
custom_role_conversions=None,
|
54 |
)
|
55 |
|
56 |
+
#Tools
|
57 |
final_answer = FinalAnswerTool()
|
58 |
+
duckDuckGoSearch = DuckDuckGoSearchTool()
|
59 |
|
60 |
#Agent
|
61 |
agent_codeagent = CodeAgent(
|
62 |
model=model,
|
63 |
+
tools=[final_answer, duckDuckGoSearch] ## add your tools here (don't remove final answer)
|
64 |
+
max_steps=5,
|
65 |
verbosity_level=1,
|
66 |
grammar=None,
|
67 |
planning_interval=None,
|
|
|
71 |
)
|
72 |
|
73 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
74 |
# Gradio handler that runs the agent
|
75 |
def run_once(state):
|
76 |
if state is not None:
|