Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,4 +1,5 @@
|
|
| 1 |
-
|
|
|
|
| 2 |
import datetime
|
| 3 |
import requests
|
| 4 |
import pytz
|
|
@@ -7,6 +8,11 @@ from tools.final_answer import FinalAnswerTool
|
|
| 7 |
|
| 8 |
from Gradio_UI import GradioUI
|
| 9 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10 |
# Below is an example of a tool that does nothing. Amaze us with your creativity !
|
| 11 |
@tool
|
| 12 |
def my_custom_tool(arg1:str, arg2:int)-> str: #it's import to specify the return type
|
|
@@ -39,10 +45,12 @@ final_answer = FinalAnswerTool()
|
|
| 39 |
# 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:
|
| 40 |
# model_id='https://pflgm2locj2t89co.us-east-1.aws.endpoints.huggingface.cloud'
|
| 41 |
|
| 42 |
-
model =
|
| 43 |
max_tokens=2096,
|
| 44 |
temperature=0.5,
|
| 45 |
-
model_id='
|
|
|
|
|
|
|
| 46 |
custom_role_conversions=None,
|
| 47 |
)
|
| 48 |
|
|
|
|
| 1 |
+
import os
|
| 2 |
+
from smolagents import CodeAgent,DuckDuckGoSearchTool, OpenAIServerModel,load_tool,tool
|
| 3 |
import datetime
|
| 4 |
import requests
|
| 5 |
import pytz
|
|
|
|
| 8 |
|
| 9 |
from Gradio_UI import GradioUI
|
| 10 |
|
| 11 |
+
api_key = os.getenv("GOOGLE_API_KEY")
|
| 12 |
+
|
| 13 |
+
if api_key is None:
|
| 14 |
+
raise RuntimeError("Secret GOOGLE_API_KEY is not set in the environment!")
|
| 15 |
+
|
| 16 |
# Below is an example of a tool that does nothing. Amaze us with your creativity !
|
| 17 |
@tool
|
| 18 |
def my_custom_tool(arg1:str, arg2:int)-> str: #it's import to specify the return type
|
|
|
|
| 45 |
# 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:
|
| 46 |
# model_id='https://pflgm2locj2t89co.us-east-1.aws.endpoints.huggingface.cloud'
|
| 47 |
|
| 48 |
+
model = OpenAIServerModel(
|
| 49 |
max_tokens=2096,
|
| 50 |
temperature=0.5,
|
| 51 |
+
model_id='gemini-2.0-flash-exp',# it is possible that this model may be overloaded
|
| 52 |
+
api_base='https://generativelanguage.googleapis.com/v1beta/openai/',
|
| 53 |
+
api_key=api_key,
|
| 54 |
custom_role_conversions=None,
|
| 55 |
)
|
| 56 |
|