Spaces:
Sleeping
Sleeping
Update agent.py
Browse files
agent.py
CHANGED
|
@@ -1,21 +1,32 @@
|
|
| 1 |
-
from smolagents import CodeAgent, InferenceClientModel
|
| 2 |
from smolagents import VisitWebpageTool, WebSearchTool, WikipediaSearchTool, PythonInterpreterTool,FinalAnswerTool
|
| 3 |
import os
|
|
|
|
| 4 |
|
| 5 |
-
token=os.getenv("HF_API_TOKEN")
|
| 6 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 7 |
class GaiaAgent:
|
| 8 |
def __init__(self):
|
| 9 |
-
import os
|
| 10 |
-
token = os.getenv("HF_API_TOKEN")
|
| 11 |
-
print("DEBUG: HF_API_TOKEN is", token[:6]+ "...")
|
| 12 |
-
self.model =
|
| 13 |
-
max_tokens =
|
| 14 |
temperature = 0.5,
|
| 15 |
-
model_id = '
|
| 16 |
#custom_role_conversions=None,
|
| 17 |
-
provider="hf-inference",
|
| 18 |
-
token=token
|
|
|
|
| 19 |
)
|
| 20 |
|
| 21 |
|
|
@@ -28,6 +39,7 @@ class GaiaAgent:
|
|
| 28 |
WikipediaSearchTool(),
|
| 29 |
PythonInterpreterTool(),
|
| 30 |
FinalAnswerTool(),
|
|
|
|
| 31 |
],
|
| 32 |
max_steps=10,
|
| 33 |
verbosity_level = 2, #or other parameter
|
|
|
|
| 1 |
+
from smolagents import CodeAgent, InferenceClientModel, OpenAIServerModel
|
| 2 |
from smolagents import VisitWebpageTool, WebSearchTool, WikipediaSearchTool, PythonInterpreterTool,FinalAnswerTool
|
| 3 |
import os
|
| 4 |
+
from vision_tool import image_reasoning_tool
|
| 5 |
|
| 6 |
+
#token=os.getenv("HF_API_TOKEN")
|
| 7 |
|
| 8 |
+
OPENROUTER_API_KEY = os.getenv("OPENROUTER_API_KEY")
|
| 9 |
+
if not OPENROUTER_API_KEY:
|
| 10 |
+
raise EnvironmentError("OPENROUTER_API_KEY environment variable not set")
|
| 11 |
+
|
| 12 |
+
common = dict(
|
| 13 |
+
api_base="https://openrouter.ai/api/v1",
|
| 14 |
+
api_key=OPENROUTER_API_KEY,
|
| 15 |
+
extra_body={"usage": {"include": True}}
|
| 16 |
+
)
|
| 17 |
class GaiaAgent:
|
| 18 |
def __init__(self):
|
| 19 |
+
#import os
|
| 20 |
+
#token = os.getenv("HF_API_TOKEN")
|
| 21 |
+
#print("DEBUG: HF_API_TOKEN is", token[:6]+ "...")
|
| 22 |
+
self.model = OpenAIServerModel(
|
| 23 |
+
max_tokens = 8096,
|
| 24 |
temperature = 0.5,
|
| 25 |
+
model_id = 'qwen/qwen-2.5-coder-32b-instruct:free',
|
| 26 |
#custom_role_conversions=None,
|
| 27 |
+
#provider="hf-inference",
|
| 28 |
+
token=token,
|
| 29 |
+
**common
|
| 30 |
)
|
| 31 |
|
| 32 |
|
|
|
|
| 39 |
WikipediaSearchTool(),
|
| 40 |
PythonInterpreterTool(),
|
| 41 |
FinalAnswerTool(),
|
| 42 |
+
image_reasoning_tool,
|
| 43 |
],
|
| 44 |
max_steps=10,
|
| 45 |
verbosity_level = 2, #or other parameter
|