ffreemt commited on
Commit
38e83c0
·
1 Parent(s): 4072c23

Fix OPEN_API_BASE OPEN_API_KEY litellm_api_key

Browse files
Files changed (4) hide show
  1. app.py +5 -4
  2. requirements.txt +2 -1
  3. set-env.bat +11 -0
  4. try-litellm.py +25 -0
app.py CHANGED
@@ -40,8 +40,8 @@ from smolagents import (
40
  Model,
41
  ToolCallingAgent,
42
  )
43
- from smolagents.agent_types import AgentText, AgentImage, AgentAudio
44
- from smolagents.gradio_ui import pull_messages_from_step, handle_agent_output_types
45
 
46
 
47
  AUTHORIZED_IMPORTS = [
@@ -115,7 +115,8 @@ os.makedirs(f"./{BROWSER_CONFIG['downloads_folder']}", exist_ok=True)
115
 
116
  model = LiteLLMModel(
117
  # "gpt-4o",
118
- os.getenv("MODEL_ID", "gpt-4o-mini"),
 
119
  custom_role_conversions=custom_role_conversions,
120
  api_base=os.getenv("OPENAI_API_BASE"),
121
  api_key=os.getenv("OPENAI_API_KEY"),
@@ -294,7 +295,7 @@ You can try a simplified version below. 👇""")
294
  None,
295
  "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/smolagents/mascot_smol.png",
296
  ),
297
- resizeable=True,
298
  scale=1,
299
  )
300
  # If an upload folder is provided, enable the upload feature
 
40
  Model,
41
  ToolCallingAgent,
42
  )
43
+ from smolagents.agent_types import AgentText, AgentImage, AgentAudio, handle_agent_output_types
44
+ from smolagents.gradio_ui import pull_messages_from_step # , handle_agent_output_types
45
 
46
 
47
  AUTHORIZED_IMPORTS = [
 
115
 
116
  model = LiteLLMModel(
117
  # "gpt-4o",
118
+ # os.getenv("MODEL_ID", "gpt-4o-mini"),
119
+ os.getenv("MODEL_ID", "deepseek-ai/DeepSeek-V3"),
120
  custom_role_conversions=custom_role_conversions,
121
  api_base=os.getenv("OPENAI_API_BASE"),
122
  api_key=os.getenv("OPENAI_API_KEY"),
 
295
  None,
296
  "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/smolagents/mascot_smol.png",
297
  ),
298
+ resizable=True,
299
  scale=1,
300
  )
301
  # If an upload folder is provided, enable the upload feature
requirements.txt CHANGED
@@ -46,4 +46,5 @@ litellm
46
 
47
  google-api-python-client
48
  google-auth-httplib2
49
- google-auth-oauthlib
 
 
46
 
47
  google-api-python-client
48
  google-auth-httplib2
49
+ google-auth-oauthlib
50
+ gradio
set-env.bat ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ set OPENAI_BASE_URL=h=tps://api.siliconflow.cn/v1
2
+ set OPENAI_API_BASE=https://api.siliconflow.cn/v1
3
+ set OPENAI_API_KEY=%SILICONFLOW_API_KEY%
4
+ set MODEL_ID=deepseek-ai/DeepSeek-V3
5
+
6
+ set OPENAI_BASE_URL=https://litellm.dattw.eu.org/v1
7
+ set OPENAI_API_BASE=https://litellm.dattw.eu.org/v1
8
+ set OPENAI_API_KEY=%LITELLM_API_KEY%
9
+ set MODEL_ID=gpt-4o-mini
10
+
11
+ REM set SERPAPI_API_KEY b84...
try-litellm.py ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import os
2
+
3
+ from smolagents import (
4
+ # MANAGED_AGENT_PROMPT,
5
+ CodeAgent,
6
+ HfApiModel,
7
+ LiteLLMModel,
8
+ Model,
9
+ ToolCallingAgent,
10
+ )
11
+
12
+ custom_role_conversions = {"tool-call": "assistant", "tool-response": "user"}
13
+
14
+ model = LiteLLMModel(
15
+ # "gpt-4o",
16
+ # os.getenv("MODEL_ID", "gpt-4o-mini"),
17
+ os.getenv("MODEL_ID", "deepseek-ai/DeepSeek-V3"),
18
+ custom_role_conversions=custom_role_conversions,
19
+ api_base=os.getenv("OPENAI_API_BASE"),
20
+ api_key=os.getenv("OPENAI_API_KEY"),
21
+ )
22
+
23
+ print(model)
24
+
25
+ print(model.invoke("Say this is a test"))