9jini commited on
Commit
e1ba0b8
·
verified ·
1 Parent(s): b83a188

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +1 -16
app.py CHANGED
@@ -13,21 +13,6 @@ from langchain_core.tools import tool
13
  DEFAULT_API_URL = "https://agents-course-unit4-scoring.hf.space"
14
 
15
 
16
- @tool
17
- def web_search(query: str) -> str:
18
- """Search Tavily for a query and return maximum 3 results.
19
-
20
- Args:
21
- query: The search query."""
22
- search_docs = TavilySearchResults(max_results=3).invoke(query=query)
23
- formatted_search_docs = "\n\n---\n\n".join(
24
- [
25
- f'<Document source="{doc.metadata["source"]}" page="{doc.metadata.get("page", "")}"/>\n{doc.page_content}\n</Document>'
26
- for doc in search_docs
27
- ])
28
- return {"web_results": formatted_search_docs}
29
-
30
-
31
 
32
 
33
  # --- Basic Agent Definition ---
@@ -40,7 +25,7 @@ class BasicAgent:
40
  )
41
  self.agent = CodeAgent(
42
  model=model,
43
- tools=[DuckDuckGoSearchTool(), WikipediaSearchTool(),web_search()],
44
  add_base_tools=True,
45
  )
46
  print("BasicAgent initialized.")
 
13
  DEFAULT_API_URL = "https://agents-course-unit4-scoring.hf.space"
14
 
15
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
16
 
17
 
18
  # --- Basic Agent Definition ---
 
25
  )
26
  self.agent = CodeAgent(
27
  model=model,
28
+ tools=[DuckDuckGoSearchTool(), WikipediaSearchTool()],
29
  add_base_tools=True,
30
  )
31
  print("BasicAgent initialized.")