schatt commited on
Commit
164cc84
·
verified ·
1 Parent(s): 86d3675

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -12
app.py CHANGED
@@ -20,7 +20,7 @@ def my_custom_tool(arg1:str, arg2:int)-> str: #it's import to specify the return
20
 
21
  @tool
22
  def my_best_deal_tool(arg1: str) -> str: # It's important to specify the return type
23
- """A tool that fetches the best latest deal available in netherlands for the specific products
24
  Args:
25
  arg1: A string that provides the details of the product to be searched.
26
  """
@@ -28,15 +28,10 @@ def my_best_deal_tool(arg1: str) -> str: # It's important to specify the return
28
  duckduckgo_tool = DuckDuckGoSearchTool()
29
 
30
  # Use DuckDuckGo search tool to search for the query
31
- search_results = duckduckgo_tool.search(arg1)
32
-
33
- result_str = "" # Initialize an empty string to accumulate the results
34
-
35
- for result in search_results:
36
- # Add each 'Text' value from the result to result_str
37
- result_str += result.get('Text', '') + '\n' # Adding a newline for each result
38
-
39
- return result_str
40
 
41
  @tool
42
  def get_current_time_in_timezone(timezone: str) -> str:
@@ -53,7 +48,7 @@ def get_current_time_in_timezone(timezone: str) -> str:
53
  except Exception as e:
54
  return f"Error fetching time for timezone '{timezone}': {str(e)}"
55
 
56
- duckduckgo_tool = DuckDuckGoSearchTool()
57
 
58
  final_answer = FinalAnswerTool()
59
 
@@ -77,7 +72,7 @@ with open("prompts.yaml", 'r') as stream:
77
 
78
  agent = CodeAgent(
79
  model=model,
80
- tools=[final_answer,get_current_time_in_timezone], ## add your tools here (don't remove final answer)
81
  max_steps=6,
82
  verbosity_level=1,
83
  grammar=None,
 
20
 
21
  @tool
22
  def my_best_deal_tool(arg1: str) -> str: # It's important to specify the return type
23
+ """A tool that fetches the best latest deal available in the Netherlands for specific products
24
  Args:
25
  arg1: A string that provides the details of the product to be searched.
26
  """
 
28
  duckduckgo_tool = DuckDuckGoSearchTool()
29
 
30
  # Use DuckDuckGo search tool to search for the query
31
+ search_results = duckduckgo_tool(arg1) # Correct method call here
32
+
33
+ # Return the search results (or process them as needed)
34
+ return search_results
 
 
 
 
 
35
 
36
  @tool
37
  def get_current_time_in_timezone(timezone: str) -> str:
 
48
  except Exception as e:
49
  return f"Error fetching time for timezone '{timezone}': {str(e)}"
50
 
51
+
52
 
53
  final_answer = FinalAnswerTool()
54
 
 
72
 
73
  agent = CodeAgent(
74
  model=model,
75
+ tools=[final_answer,my_best_deal_tool], ## add your tools here (don't remove final answer)
76
  max_steps=6,
77
  verbosity_level=1,
78
  grammar=None,