Spaces:
Sleeping
Sleeping
tt
Browse files- app.py +18 -2
- requirements.txt +1 -0
app.py
CHANGED
@@ -1,9 +1,25 @@
|
|
1 |
import os
|
2 |
import gradio as gr
|
3 |
import requests
|
4 |
-
from smolagents import CodeAgent, InferenceClientModel, tool,ToolCallingAgent , PythonInterpreterTool,DuckDuckGoSearchTool,VisitWebpageTool
|
5 |
import inspect
|
6 |
import pandas as pd
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
7 |
|
8 |
# (Keep Constants as is)
|
9 |
# --- Constants ---
|
@@ -19,7 +35,7 @@ class BasicAgent:
|
|
19 |
model_id="Qwen/Qwen3-32B",
|
20 |
token=key)
|
21 |
interpreter = PythonInterpreterTool()
|
22 |
-
self.agentic = ToolCallingAgent(model=
|
23 |
print("BasicAgent initialized.")
|
24 |
def __call__(self, question: str) -> str:
|
25 |
print(f"Agent received question (first 50 chars): {question[:50]}...")
|
|
|
1 |
import os
|
2 |
import gradio as gr
|
3 |
import requests
|
4 |
+
from smolagents import CodeAgent, InferenceClientModel, tool,ToolCallingAgent ,LiteLLMModel, PythonInterpreterTool,DuckDuckGoSearchTool,VisitWebpageTool
|
5 |
import inspect
|
6 |
import pandas as pd
|
7 |
+
import litellm
|
8 |
+
|
9 |
+
key = os.environ['access_token']
|
10 |
+
key_mistral = os.environ['mistral_token']
|
11 |
+
|
12 |
+
|
13 |
+
# litellm._turn_on_debug()
|
14 |
+
|
15 |
+
# client = Mistral(api_key="RYZqsXtCJ7fXiZqG4bVtIGqSEP3L8Pxb")
|
16 |
+
|
17 |
+
# 2. Wrapper SmolAgents
|
18 |
+
mistral_model = LiteLLMModel(
|
19 |
+
model_id="mistral/mistral-small-latest",
|
20 |
+
api_key=key_mistral
|
21 |
+
)
|
22 |
+
|
23 |
|
24 |
# (Keep Constants as is)
|
25 |
# --- Constants ---
|
|
|
35 |
model_id="Qwen/Qwen3-32B",
|
36 |
token=key)
|
37 |
interpreter = PythonInterpreterTool()
|
38 |
+
self.agentic = ToolCallingAgent(model=mistral_model,tools = [interpreter,DuckDuckGoSearchTool(),VisitWebpageTool()])
|
39 |
print("BasicAgent initialized.")
|
40 |
def __call__(self, question: str) -> str:
|
41 |
print(f"Agent received question (first 50 chars): {question[:50]}...")
|
requirements.txt
CHANGED
@@ -3,3 +3,4 @@ requests
|
|
3 |
smolagents
|
4 |
mistralai
|
5 |
duckduckgo-search
|
|
|
|
3 |
smolagents
|
4 |
mistralai
|
5 |
duckduckgo-search
|
6 |
+
smolagents[litellm]
|