Spaces:
Running
Running
Update research_tools/web_search.py
Browse files
research_tools/web_search.py
CHANGED
@@ -3,7 +3,7 @@ Web Search Tool using DuckDuckGo via smolagents with Mistral
|
|
3 |
"""
|
4 |
from .base_tool import BaseTool
|
5 |
from typing import Optional
|
6 |
-
from smolagents import CodeAgent, DuckDuckGoSearchTool, FinalAnswerTool, VisitWebpageTool
|
7 |
import os
|
8 |
|
9 |
class WebSearchTool(BaseTool):
|
@@ -15,14 +15,12 @@ class WebSearchTool(BaseTool):
|
|
15 |
|
16 |
try:
|
17 |
# Create custom Mistral model for CodeAgent
|
18 |
-
from smolagents.models import OpenAIModel
|
19 |
-
|
20 |
mistral_key = os.getenv("MISTRAL_API_KEY")
|
21 |
if mistral_key:
|
22 |
-
mistral_model =
|
23 |
api_key=mistral_key,
|
24 |
-
|
25 |
-
|
26 |
)
|
27 |
else:
|
28 |
# Fallback to InferenceClientModel if no Mistral key
|
|
|
3 |
"""
|
4 |
from .base_tool import BaseTool
|
5 |
from typing import Optional
|
6 |
+
from smolagents import CodeAgent, DuckDuckGoSearchTool, FinalAnswerTool, VisitWebpageTool, OpenAIServerModel
|
7 |
import os
|
8 |
|
9 |
class WebSearchTool(BaseTool):
|
|
|
15 |
|
16 |
try:
|
17 |
# Create custom Mistral model for CodeAgent
|
|
|
|
|
18 |
mistral_key = os.getenv("MISTRAL_API_KEY")
|
19 |
if mistral_key:
|
20 |
+
mistral_model = OpenAIServerModel(
|
21 |
api_key=mistral_key,
|
22 |
+
api_base="https://api.mistral.ai/v1",
|
23 |
+
model_id="mistral/mistral-large-latest"
|
24 |
)
|
25 |
else:
|
26 |
# Fallback to InferenceClientModel if no Mistral key
|