vissot commited on
Commit
fce2886
·
verified ·
1 Parent(s): ae7d38f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +24 -9
app.py CHANGED
@@ -23,15 +23,30 @@ from tensorflow.keras.models import load_model
23
 
24
  # Below is an example of a tool that does nothing. Amaze us with your creativity!
25
  @tool
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
26
  #openfile = "./book.txt"
27
- def csvfile(csv: str) -> str:
28
- #os.makedirs("data",exist_ok=True)
29
- #!wget https://covidtracking.com/data/download/all-states-history.csv -P ./data/
30
- from datasets import load_dataset
31
- dataset = load_dataset('csv', script_version="master", data_files=['BostonHousing.csv'], delimiter=",")
32
- print(dataset["train"][0]
33
- f#ile_url = "./BostonHousing.csv"
34
- #df = pd.read_csv(file_url).fillna(value = 0)
35
 
36
  #@tool
37
  #openfile = "./book.txt"
@@ -98,7 +113,7 @@ with open("prompts.yaml", 'r') as stream:
98
 
99
  agent = CodeAgent(
100
  model=model,
101
- tools=[final_answer,csvfile,get_current_time_in_timezone], # add your tools here (don't remove final_answer)
102
  max_steps=6,
103
  verbosity_level=1,
104
  grammar=None,
 
23
 
24
  # Below is an example of a tool that does nothing. Amaze us with your creativity!
25
  @tool
26
+ @tool
27
+ def duckduckgo_search(query: str) -> str:
28
+ """Searches DuckDuckGo for a given query and returns the top result.
29
+ Args:
30
+ query: The search query string.
31
+ Returns:
32
+ A short summary with the top DuckDuckGo result.
33
+ """
34
+ search_tool = DuckDuckGoSearchTool()
35
+ results = search_tool.run(query)
36
+
37
+ if results:
38
+ return f"Top search result: {results[0]['title']} - {results[0]['link']}"
39
+ else:
40
+ return "No results found."
41
  #openfile = "./book.txt"
42
+ #def csvfile(csv: str) -> str:
43
+ # #os.makedirs("data",exist_ok=True)
44
+ # #!wget https://covidtracking.com/data/download/all-states-history.csv -P ./data/
45
+ # from datasets import load_dataset
46
+ # dataset = load_dataset('csv', script_version="master", data_files=['BostonHousing.csv'], delimiter=",")
47
+ # print(dataset["train"][0]
48
+ # f#ile_url = "./BostonHousing.csv"
49
+ # #df = pd.read_csv(file_url).fillna(value = 0)
50
 
51
  #@tool
52
  #openfile = "./book.txt"
 
113
 
114
  agent = CodeAgent(
115
  model=model,
116
+ tools=[final_answer,csvfile,get_current_time_in_timezone,duckduckgo_search], # add your tools here (don't remove final_answer)
117
  max_steps=6,
118
  verbosity_level=1,
119
  grammar=None,