Update app.py
Browse files6 unmodified lines7891011121319 unmodified lines3334353637384 unmodified lines43444546474813 unmodified lines6263646566676 unmodified lines# Import our custom tools from their modulesfrom huggingface_hub import loginfrom smolagents import CodeAgent, InferenceClientModelfrom tools import web_search, visit_webpage, final_answerfrom retriever import load_guest_datasetfrom functools import lru_cache19 unmodified linesself.visit_webpage = visit_webpageself.final_answer = final_answer# Create the modelself.model = InferenceClientModel(model_id="Qwen/Qwen2.5-72B-Instruct")4 unmodified lines# Create the agent with toolsself.agent = CodeAgent(tools=[self.web_search, self.visit_webpage, self.final_answer],model=self.model,max_steps=10 # Limit reasoning steps)13 unmodified linesformatted_question = f"{question}\n\nOnly return the exact answer, no explanation."formatted_question = f"{self.system_prompt}\n\nQuestion: {question}\n\n"answer = self.agent.run(formatted_question)# answer = self.agent.run(question)print(f"Agent returning answer: {answer[:100]}...")fixed_answer = answer6 unmodified lines7891011121319 unmodified lines3334353637383940414243444 unmodified lines4950515253545513 unmodified lines697071727374756 unmodified lines# Import our custom tools from their modulesfrom huggingface_hub import loginfrom smolagents import CodeAgent, InferenceClientModelfrom tools import web_search, visit_webpage, final_answer, go_back, close_popups, search_item_ctrl_ffrom retriever import load_guest_datasetfrom functools import lru_cache19 unmodified linesself.visit_webpage = visit_webpageself.final_answer = final_answerself.go_back = go_back,self.close_popups = close_popups,self.search_item_ctrl_f = search_item_ctrl_f# Create the modelself.model = InferenceClientModel(model_id="Qwen/Qwen2.5-72B-Instruct")4 unmodified lines# Create the agent with toolsself.agent = CodeAgent(tools=[self.web_search, self.visit_webpage, self.final_answer],# tools=[self.web_search, self.visit_webpage, self.final_answer, go_back, close_popups, search_item_ctrl_f],model=self.model,max_steps=10 # Limit reasoning steps)13 unmodified linesformatted_question = f"{question}\n\nOnly return the exact answer, no explanation."formatted_question = f"{self.system_prompt}\n\nQuestion: {question}\n\n"answer = self.agent.run(formatted_question)answer = str(answer).strip() if answer is not None else "No answer produced."# answer = self.agent.run(question)print(f"Agent returning answer: {answer[:100]}...")fixed_answer = answer
app.py+9-1