Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -5,6 +5,7 @@ import inspect
|
|
| 5 |
import pandas as pd
|
| 6 |
from smolagents import CodeAgent, HfApiModel, DuckDuckGoSearchTool
|
| 7 |
from tools import TextTransformerTool
|
|
|
|
| 8 |
|
| 9 |
# (Keep Constants as is)
|
| 10 |
# --- Constants ---
|
|
@@ -18,7 +19,6 @@ import os
|
|
| 18 |
from smolagents import HfApiModel
|
| 19 |
|
| 20 |
|
| 21 |
-
|
| 22 |
class BasicAgent:
|
| 23 |
def __init__(self):
|
| 24 |
print("Initializing BasicAgent with tools...")
|
|
@@ -27,9 +27,10 @@ class BasicAgent:
|
|
| 27 |
hf_token = os.environ.get("HUGGINGFACEHUB_API_TOKEN")
|
| 28 |
if not hf_token:
|
| 29 |
raise ValueError("Missing Hugging Face API token!")
|
| 30 |
-
|
| 31 |
# Pass it into the model
|
| 32 |
-
model = HfApiModel(model="mistralai/Mistral-7B-Instruct-v0.2") #token=hf_token,
|
|
|
|
| 33 |
search_tool = DuckDuckGoSearchTool()
|
| 34 |
text_tool = TextTransformerTool()
|
| 35 |
|
|
|
|
| 5 |
import pandas as pd
|
| 6 |
from smolagents import CodeAgent, HfApiModel, DuckDuckGoSearchTool
|
| 7 |
from tools import TextTransformerTool
|
| 8 |
+
from smolagents import InferenceClientModel
|
| 9 |
|
| 10 |
# (Keep Constants as is)
|
| 11 |
# --- Constants ---
|
|
|
|
| 19 |
from smolagents import HfApiModel
|
| 20 |
|
| 21 |
|
|
|
|
| 22 |
class BasicAgent:
|
| 23 |
def __init__(self):
|
| 24 |
print("Initializing BasicAgent with tools...")
|
|
|
|
| 27 |
hf_token = os.environ.get("HUGGINGFACEHUB_API_TOKEN")
|
| 28 |
if not hf_token:
|
| 29 |
raise ValueError("Missing Hugging Face API token!")
|
| 30 |
+
openai_token = os.environ.get("OPENAI_API_KEY")
|
| 31 |
# Pass it into the model
|
| 32 |
+
# model = HfApiModel(model="mistralai/Mistral-7B-Instruct-v0.2") #token=hf_token,
|
| 33 |
+
model = InferenceClientModel(provider="openai", token=openai_token)
|
| 34 |
search_tool = DuckDuckGoSearchTool()
|
| 35 |
text_tool = TextTransformerTool()
|
| 36 |
|