juanxo90 commited on
Commit
2bfcd34
·
verified ·
1 Parent(s): 5a56bb2

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +25 -3
app.py CHANGED
@@ -34,9 +34,27 @@ def get_current_time_in_timezone(timezone: str) -> str:
34
  except Exception as e:
35
  return f"Error fetching time for timezone '{timezone}': {str(e)}"
36
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
37
 
38
- final_answer = FinalAnswerTool()
39
- duck_search = DuckDuckGoSearchTool()
40
 
41
  # If the agent does not answer, the model is overloaded, please use another model or the following Hugging Face Endpoint that also contains qwen2.5 coder:
42
  # model_id='https://pflgm2locj2t89co.us-east-1.aws.endpoints.huggingface.cloud'
@@ -58,7 +76,11 @@ with open("prompts.yaml", 'r') as stream:
58
 
59
  agent = CodeAgent(
60
  model=model,
61
- tools=[duck_search,final_answer], ## add your tools here (don't remove final answer)
 
 
 
 
62
  max_steps=6,
63
  verbosity_level=1,
64
  grammar=None,
 
34
  except Exception as e:
35
  return f"Error fetching time for timezone '{timezone}': {str(e)}"
36
 
37
+ @tool
38
+ def gaussian_distribution_array(mu: float, sigma:float):
39
+ """A tool calculate a numpy array of a normal distribution usong the median and std deviation
40
+ Args:
41
+ mu (float): median
42
+ sigma (float): std deviation
43
+ Returns:
44
+ numpy.ndarray: A NumPy array with with 1000 ramdom samples
45
+
46
+ Raises:
47
+ ImportError: IF `numpy` is not installed, it raises an exception.
48
+ """
49
+ try:
50
+ from numpy.random import normal
51
+ s = normal(mu, sigma, 1000)
52
+ return s
53
+ except ImportError as e:
54
+ raise ImportError(
55
+ "You must install package `numpy` to run this tool."
56
+ ) from e
57
 
 
 
58
 
59
  # If the agent does not answer, the model is overloaded, please use another model or the following Hugging Face Endpoint that also contains qwen2.5 coder:
60
  # model_id='https://pflgm2locj2t89co.us-east-1.aws.endpoints.huggingface.cloud'
 
76
 
77
  agent = CodeAgent(
78
  model=model,
79
+ tools=[
80
+ gaussian_distribution_array,
81
+ duck_search,
82
+ final_answer
83
+ ], ## add your tools here (don't remove final answer)
84
  max_steps=6,
85
  verbosity_level=1,
86
  grammar=None,