znacer commited on
Commit
54bd833
·
unverified ·
1 Parent(s): e4a5799

fix syntax

Browse files
Files changed (1) hide show
  1. agent.py +8 -1
agent.py CHANGED
@@ -1,4 +1,5 @@
1
  import math
 
2
 
3
  import numexpr
4
  from langchain_community.document_loaders import ArxivLoader
@@ -10,6 +11,8 @@ from smolagents import (
10
  tool,
11
  )
12
 
 
 
13
 
14
  @tool
15
  def calculator(expression: str) -> str:
@@ -21,6 +24,8 @@ def calculator(expression: str) -> str:
21
  Examples:
22
  "37593 * 67" for "37593 times 67"
23
  "37593**(1/5)" for "37593^(1/5)"
 
 
24
  """
25
  local_dict = {"pi": math.pi, "e": math.e}
26
  return str(
@@ -36,6 +41,8 @@ def calculator(expression: str) -> str:
36
  def arxiv_search_tool(query: str) -> str:
37
  """
38
  Searches Arxiv and returns a summary or full text of the given topic, along with the page URL.
 
 
39
  """
40
  doc = ArxivLoader(query=query, load_max_docs=1).load()
41
  if len(doc) > 0:
@@ -49,7 +56,7 @@ tools = [calculator, arxiv_search_tool, DuckDuckGoSearchTool, WikipediaSearchToo
49
 
50
  model_id = "Qwen/Qwen3-30B-A3B"
51
  model = InferenceClientModel(
52
- model_id=model_id, token="MY_HUGGINGFACEHUB_API_TOKEN"
53
  ) # You can choose to not pass any model_id to InferenceClientModel to use a default model
54
  agent = CodeAgent(
55
  model=model,
 
1
  import math
2
+ import os
3
 
4
  import numexpr
5
  from langchain_community.document_loaders import ArxivLoader
 
11
  tool,
12
  )
13
 
14
+ hf_token = os.getenv("HUGGINGFACEHUB_API_TOKEN")
15
+
16
 
17
  @tool
18
  def calculator(expression: str) -> str:
 
24
  Examples:
25
  "37593 * 67" for "37593 times 67"
26
  "37593**(1/5)" for "37593^(1/5)"
27
+ Args:
28
+ expression: the expression to be compute
29
  """
30
  local_dict = {"pi": math.pi, "e": math.e}
31
  return str(
 
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:
 
56
 
57
  model_id = "Qwen/Qwen3-30B-A3B"
58
  model = InferenceClientModel(
59
+ model_id=model_id, token=hf_token
60
  ) # You can choose to not pass any model_id to InferenceClientModel to use a default model
61
  agent = CodeAgent(
62
  model=model,