Romain Fayoux
commited on
Commit
·
e4abda2
1
Parent(s):
279f51f
Adding gemini model if needed to llm only agent
Browse files- llm_only_agent.py +13 -1
- requirements.txt +1 -0
llm_only_agent.py
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
|
|
| 1 |
import re
|
| 2 |
from smolagents import (
|
| 3 |
AgentMemory,
|
|
@@ -9,6 +10,7 @@ from smolagents import (
|
|
| 9 |
from collections.abc import Callable
|
| 10 |
|
| 11 |
from smolagents.default_tools import VisitWebpageTool, WikipediaSearchTool
|
|
|
|
| 12 |
|
| 13 |
|
| 14 |
class LLMOnlyAgent:
|
|
@@ -21,13 +23,23 @@ class LLMOnlyAgent:
|
|
| 21 |
If you are asked for a comma separated list, apply the above rules depending of whether the element to be put in the list is a number or a string."""
|
| 22 |
|
| 23 |
# Basic inference model
|
| 24 |
-
|
| 25 |
max_tokens=8096,
|
| 26 |
model_id="Qwen/Qwen3-Coder-30B-A3B-Instruct",
|
| 27 |
custom_role_conversions=None,
|
| 28 |
provider="nebius",
|
| 29 |
)
|
| 30 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 31 |
# Code Agent
|
| 32 |
self.agent = CodeAgent(
|
| 33 |
model=model,
|
|
|
|
| 1 |
+
import os
|
| 2 |
import re
|
| 3 |
from smolagents import (
|
| 4 |
AgentMemory,
|
|
|
|
| 10 |
from collections.abc import Callable
|
| 11 |
|
| 12 |
from smolagents.default_tools import VisitWebpageTool, WikipediaSearchTool
|
| 13 |
+
from smolagents.models import OpenAIModel
|
| 14 |
|
| 15 |
|
| 16 |
class LLMOnlyAgent:
|
|
|
|
| 23 |
If you are asked for a comma separated list, apply the above rules depending of whether the element to be put in the list is a number or a string."""
|
| 24 |
|
| 25 |
# Basic inference model
|
| 26 |
+
qwen_model = InferenceClientModel(
|
| 27 |
max_tokens=8096,
|
| 28 |
model_id="Qwen/Qwen3-Coder-30B-A3B-Instruct",
|
| 29 |
custom_role_conversions=None,
|
| 30 |
provider="nebius",
|
| 31 |
)
|
| 32 |
|
| 33 |
+
gemini_model = OpenAIModel(
|
| 34 |
+
max_tokens=8096,
|
| 35 |
+
model_id="gemini-2.5-flash",
|
| 36 |
+
# Google Gemini OpenAI-compatible API base URL
|
| 37 |
+
api_base="https://generativelanguage.googleapis.com/v1beta/openai/",
|
| 38 |
+
api_key=os.environ["GEMINI_API_KEY"],
|
| 39 |
+
)
|
| 40 |
+
|
| 41 |
+
model = gemini_model
|
| 42 |
+
|
| 43 |
# Code Agent
|
| 44 |
self.agent = CodeAgent(
|
| 45 |
model=model,
|
requirements.txt
CHANGED
|
@@ -7,6 +7,7 @@ wikipedia-api
|
|
| 7 |
markdownify
|
| 8 |
requests
|
| 9 |
smolagents[telemetry,toolkit]
|
|
|
|
| 10 |
chess
|
| 11 |
pandas
|
| 12 |
ipykernel
|
|
|
|
| 7 |
markdownify
|
| 8 |
requests
|
| 9 |
smolagents[telemetry,toolkit]
|
| 10 |
+
smolagents[openai]
|
| 11 |
chess
|
| 12 |
pandas
|
| 13 |
ipykernel
|