znacer commited on
Commit
f312ac3
·
unverified ·
1 Parent(s): de51740

update tools

Browse files
Files changed (1) hide show
  1. agent.py +16 -7
agent.py CHANGED
@@ -5,7 +5,7 @@ import numexpr
5
  from langchain_community.document_loaders import ArxivLoader
6
  from smolagents import (
7
  CodeAgent,
8
- DuckDuckGoSearchTool,
9
  InferenceClientModel,
10
  WikipediaSearchTool,
11
  tool,
@@ -40,19 +40,28 @@ def calculator(expression: str) -> str:
40
  @tool
41
  def arxiv_search_tool(query: str) -> str:
42
  """
43
- Searches Arxiv and returns a summary or full text of the given topic, along with the page URL.
44
  Args:
45
  query: the topic to be searched
46
  """
47
- doc = ArxivLoader(query=query, load_max_docs=1).load()
48
- if len(doc) > 0:
49
- doc = doc[0]
50
- return f'<Document source="{doc.metadata["source"]}" page="{doc.metadata.get("page", "")}"/>\n{doc.page_content[:1000]}\n</Document>'
 
 
 
 
51
 
52
  return "No content found"
53
 
54
 
55
- tools = [calculator, arxiv_search_tool, DuckDuckGoSearchTool(), WikipediaSearchTool()]
 
 
 
 
 
56
 
57
  model_id = "Qwen/Qwen3-235B-A22B"
58
  model = InferenceClientModel(
 
5
  from langchain_community.document_loaders import ArxivLoader
6
  from smolagents import (
7
  CodeAgent,
8
+ GoogleSearchTool,
9
  InferenceClientModel,
10
  WikipediaSearchTool,
11
  tool,
 
40
  @tool
41
  def arxiv_search_tool(query: str) -> str:
42
  """
43
+ Searches Arxiv and returns a summary or full text of the given topic of the 5 most likely related papers, along with the page URL.
44
  Args:
45
  query: the topic to be searched
46
  """
47
+ docs = ArxivLoader(query=query, load_max_docs=5).load()
48
+ if len(docs) > 0:
49
+ return "\n".join(
50
+ [
51
+ f'<Document source="{doc.metadata["source"]}" page="{doc.metadata.get("page", "")}"/>\n{doc.page_content[:1000]}\n</Document>'
52
+ for doc in docs
53
+ ]
54
+ )
55
 
56
  return "No content found"
57
 
58
 
59
+ tools = [
60
+ calculator,
61
+ arxiv_search_tool,
62
+ GoogleSearchTool(provider="serper"),
63
+ WikipediaSearchTool(),
64
+ ]
65
 
66
  model_id = "Qwen/Qwen3-235B-A22B"
67
  model = InferenceClientModel(