Spaces:
Sleeping
Sleeping
fix using gemini
Browse files- agent.py +14 -6
- requirements.txt +1 -1
agent.py
CHANGED
|
@@ -3,15 +3,23 @@ from smolagents import (
|
|
| 3 |
ToolCallingAgent,
|
| 4 |
InferenceClientModel,
|
| 5 |
WebSearchTool,
|
|
|
|
| 6 |
)
|
| 7 |
from prompts import prompt_templates
|
|
|
|
| 8 |
|
| 9 |
-
model = InferenceClientModel(
|
| 10 |
-
max_tokens=
|
| 11 |
-
temperature=0,
|
| 12 |
-
model_id='
|
| 13 |
-
custom_role_conversions=None,
|
| 14 |
-
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 15 |
|
| 16 |
web_agent = ToolCallingAgent(
|
| 17 |
tools=[WebSearchTool()],
|
|
|
|
| 3 |
ToolCallingAgent,
|
| 4 |
InferenceClientModel,
|
| 5 |
WebSearchTool,
|
| 6 |
+
OpenAIServerModel,
|
| 7 |
)
|
| 8 |
from prompts import prompt_templates
|
| 9 |
+
import os
|
| 10 |
|
| 11 |
+
#model = InferenceClientModel(
|
| 12 |
+
# max_tokens=2096,
|
| 13 |
+
# temperature=0.5,
|
| 14 |
+
# model_id='Qwen/Qwen2.5-Coder-32B-Instruct',
|
| 15 |
+
# custom_role_conversions=None,
|
| 16 |
+
# )
|
| 17 |
+
|
| 18 |
+
model = OpenAIServerModel(
|
| 19 |
+
model_id="gemini-2.0-flash",
|
| 20 |
+
api_base="https://generativelanguage.googleapis.com/v1beta/openai/",
|
| 21 |
+
api_key=os.getenv("GEMINI_API_KEY"),
|
| 22 |
+
)
|
| 23 |
|
| 24 |
web_agent = ToolCallingAgent(
|
| 25 |
tools=[WebSearchTool()],
|
requirements.txt
CHANGED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
gradio
|
| 2 |
requests
|
| 3 |
-
smolagents
|
|
|
|
| 1 |
gradio
|
| 2 |
requests
|
| 3 |
+
smolagents[openai]
|