Spaces:
Sleeping
Sleeping
Update agent.py
Browse files
agent.py
CHANGED
|
@@ -12,7 +12,7 @@ from typing import Any
|
|
| 12 |
from dotenv import load_dotenv
|
| 13 |
from google.generativeai import types, configure
|
| 14 |
|
| 15 |
-
from smolagents import InferenceClientModel, LiteLLMModel, CodeAgent, ToolCallingAgent, Tool, DuckDuckGoSearchTool, HfApiModel
|
| 16 |
|
| 17 |
# Logging
|
| 18 |
#logging.basicConfig(level=logging.INFO, format="%(asctime)s | %(levelname)s | %(message)s")
|
|
@@ -20,6 +20,7 @@ from smolagents import InferenceClientModel, LiteLLMModel, CodeAgent, ToolCallin
|
|
| 20 |
|
| 21 |
# --- Model Configuration ---
|
| 22 |
HF_MODEL_NAME = "Qwen/Qwen2.5-Coder-32B-Instruct"
|
|
|
|
| 23 |
|
| 24 |
# --- Tool Definitions ---
|
| 25 |
class MathSolver(Tool):
|
|
@@ -91,6 +92,7 @@ class BasicAgent:
|
|
| 91 |
def __init__(self):
|
| 92 |
print("BasicAgent initialized.")
|
| 93 |
#model = HF_MODEL_NAME
|
|
|
|
| 94 |
model = HfApiModel(
|
| 95 |
max_tokens=2096,
|
| 96 |
temperature=0.5,
|
|
@@ -98,6 +100,14 @@ class BasicAgent:
|
|
| 98 |
#model_id='https://pflgm2locj2t89co.us-east-1.aws.endpoints.huggingface.cloud',
|
| 99 |
custom_role_conversions=None,
|
| 100 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 101 |
tools = [
|
| 102 |
DuckDuckGoSearchTool(),
|
| 103 |
WikiTitleFinder(),
|
|
|
|
| 12 |
from dotenv import load_dotenv
|
| 13 |
from google.generativeai import types, configure
|
| 14 |
|
| 15 |
+
from smolagents import InferenceClientModel, LiteLLMModel, CodeAgent, ToolCallingAgent, Tool, DuckDuckGoSearchTool, HfApiModel, OpenAIServerModel
|
| 16 |
|
| 17 |
# Logging
|
| 18 |
#logging.basicConfig(level=logging.INFO, format="%(asctime)s | %(levelname)s | %(message)s")
|
|
|
|
| 20 |
|
| 21 |
# --- Model Configuration ---
|
| 22 |
HF_MODEL_NAME = "Qwen/Qwen2.5-Coder-32B-Instruct"
|
| 23 |
+
OPENROUTER_API_KEY = "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"
|
| 24 |
|
| 25 |
# --- Tool Definitions ---
|
| 26 |
class MathSolver(Tool):
|
|
|
|
| 92 |
def __init__(self):
|
| 93 |
print("BasicAgent initialized.")
|
| 94 |
#model = HF_MODEL_NAME
|
| 95 |
+
"""
|
| 96 |
model = HfApiModel(
|
| 97 |
max_tokens=2096,
|
| 98 |
temperature=0.5,
|
|
|
|
| 100 |
#model_id='https://pflgm2locj2t89co.us-east-1.aws.endpoints.huggingface.cloud',
|
| 101 |
custom_role_conversions=None,
|
| 102 |
)
|
| 103 |
+
"""
|
| 104 |
+
model = OpenAIServerModel(
|
| 105 |
+
# You can use any model ID available on OpenRouter
|
| 106 |
+
model_id="mistralai/mistral-small-3.2-24b-instruct:free",
|
| 107 |
+
# OpenRouter API base URL
|
| 108 |
+
api_base="https://openrouter.ai/api/v1",
|
| 109 |
+
api_key=OPENROUTER_API_KEY,
|
| 110 |
+
)
|
| 111 |
tools = [
|
| 112 |
DuckDuckGoSearchTool(),
|
| 113 |
WikiTitleFinder(),
|