Spaces:
Sleeping
Sleeping
Add bit coin prices tool
Browse files
app.py
CHANGED
@@ -8,15 +8,16 @@ from tools.final_answer import FinalAnswerTool
|
|
8 |
from Gradio_UI import GradioUI
|
9 |
|
10 |
@tool
|
11 |
-
def
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
|
|
|
20 |
@tool
|
21 |
def get_current_time_in_timezone(timezone: str) -> str:
|
22 |
"""A tool that fetches the current local time in a specified timezone.
|
@@ -33,11 +34,11 @@ def get_current_time_in_timezone(timezone: str) -> str:
|
|
33 |
return f"Error fetching time for timezone '{timezone}': {str(e)}"
|
34 |
|
35 |
|
36 |
-
final_answer = FinalAnswerTool()
|
37 |
model = HfApiModel(
|
38 |
max_tokens=2096,
|
39 |
temperature=0.5,
|
40 |
-
model_id='
|
|
|
41 |
custom_role_conversions=None,
|
42 |
)
|
43 |
|
@@ -50,7 +51,7 @@ with open("prompts.yaml", 'r') as stream:
|
|
50 |
|
51 |
agent = CodeAgent(
|
52 |
model=model,
|
53 |
-
tools=[image_generation_tool,get_current_time_in_timezone,
|
54 |
max_steps=6,
|
55 |
verbosity_level=1,
|
56 |
grammar=None,
|
|
|
8 |
from Gradio_UI import GradioUI
|
9 |
|
10 |
@tool
|
11 |
+
def get_bitcoin_price_in_usd() -> str:
|
12 |
+
""" Fetches the latest Bitcoin price in USD."""
|
13 |
+
try:
|
14 |
+
b = BtcConverter()
|
15 |
+
price = b.get_latest_price('USD')
|
16 |
+
return f"The latest Bitcoin price in USD is: ${price:.2f}"
|
17 |
+
except Exception as e:
|
18 |
+
return f"Error fetching Bitcoin price: {str(e)}"
|
19 |
|
20 |
+
|
21 |
@tool
|
22 |
def get_current_time_in_timezone(timezone: str) -> str:
|
23 |
"""A tool that fetches the current local time in a specified timezone.
|
|
|
34 |
return f"Error fetching time for timezone '{timezone}': {str(e)}"
|
35 |
|
36 |
|
|
|
37 |
model = HfApiModel(
|
38 |
max_tokens=2096,
|
39 |
temperature=0.5,
|
40 |
+
model_id='https://pflgm2locj2t89co.us-east-1.aws.endpoints.huggingface.cloud',
|
41 |
+
#model_id='Qwen/Qwen2.5-Coder-32B-Instruct',# it is possible that this model may be overloaded
|
42 |
custom_role_conversions=None,
|
43 |
)
|
44 |
|
|
|
51 |
|
52 |
agent = CodeAgent(
|
53 |
model=model,
|
54 |
+
tools=[final_answer, image_generation_tool, recipe_finder, get_current_time_in_timezone, get_cocktail_recipe], ## add your tools here (don't remove final answer)
|
55 |
max_steps=6,
|
56 |
verbosity_level=1,
|
57 |
grammar=None,
|