Spaces:
Sleeping
Sleeping
suzzyzhen commited on
Commit ·
50938b4
1
Parent(s): 55b1807
litellm
Browse files- app.py +16 -8
- requirements.txt +2 -1
app.py
CHANGED
|
@@ -1,4 +1,4 @@
|
|
| 1 |
-
from smolagents import CodeAgent,DuckDuckGoSearchTool, HfApiModel,load_tool,tool
|
| 2 |
import datetime
|
| 3 |
import requests
|
| 4 |
import pytz
|
|
@@ -39,14 +39,22 @@ 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 = HfApiModel(
|
| 43 |
-
max_tokens=2096,
|
| 44 |
-
temperature=0.5,
|
| 45 |
-
# model_id='Qwen/Qwen2.5-Coder-32B-Instruct',# it is possible that this model may be overloaded
|
| 46 |
-
model_id='https://pflgm2locj2t89co.us-east-1.aws.endpoints.huggingface.cloud',
|
| 47 |
-
custom_role_conversions=None,
|
| 48 |
-
)
|
|
|
|
|
|
|
| 49 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 50 |
|
| 51 |
# Import tool from Hub
|
| 52 |
image_generation_tool = load_tool("agents-course/text-to-image", trust_remote_code=True)
|
|
|
|
| 1 |
+
from smolagents import CodeAgent,DuckDuckGoSearchTool, HfApiModel,load_tool,tool, LiteLLMModel
|
| 2 |
import datetime
|
| 3 |
import requests
|
| 4 |
import pytz
|
|
|
|
| 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 = HfApiModel(
|
| 43 |
+
# max_tokens=2096,
|
| 44 |
+
# temperature=0.5,
|
| 45 |
+
# # model_id='Qwen/Qwen2.5-Coder-32B-Instruct',# it is possible that this model may be overloaded
|
| 46 |
+
# model_id='https://pflgm2locj2t89co.us-east-1.aws.endpoints.huggingface.cloud',
|
| 47 |
+
# custom_role_conversions=None,
|
| 48 |
+
# )
|
| 49 |
+
|
| 50 |
+
import os
|
| 51 |
|
| 52 |
+
OPENROUTER_API_KEY = os.environ.get("OPENROUTER_API_KEY")
|
| 53 |
+
|
| 54 |
+
model = LiteLLMModel(
|
| 55 |
+
model_id="openrouter/deepseek/deepseek-r1:free",
|
| 56 |
+
api_key=OPENROUTER_API_KEY,
|
| 57 |
+
)
|
| 58 |
|
| 59 |
# Import tool from Hub
|
| 60 |
image_generation_tool = load_tool("agents-course/text-to-image", trust_remote_code=True)
|
requirements.txt
CHANGED
|
@@ -1,5 +1,6 @@
|
|
| 1 |
markdownify
|
| 2 |
-
smolagents==1.13.0
|
| 3 |
requests
|
| 4 |
duckduckgo_search
|
| 5 |
pandas
|
|
|
|
|
|
| 1 |
markdownify
|
| 2 |
+
smolagents[litellm]==1.13.0
|
| 3 |
requests
|
| 4 |
duckduckgo_search
|
| 5 |
pandas
|
| 6 |
+
|