Spaces:
Sleeping
Sleeping
remove HfApiModel after possible imports conflict with duckduckgo-search
Browse files
agent.py
CHANGED
@@ -4,7 +4,7 @@ from smolagents import (
|
|
4 |
DuckDuckGoSearchTool,
|
5 |
VisitWebpageTool,
|
6 |
InferenceClientModel,
|
7 |
-
HfApiModel,
|
8 |
tool
|
9 |
)
|
10 |
from typing import List, Dict, Any, Optional
|
@@ -30,21 +30,23 @@ class QAgent:
|
|
30 |
self.system_prompt = system_prompt
|
31 |
|
32 |
|
33 |
-
if model_type == "HfApiModel":
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
|
|
|
|
48 |
if api_key is None:
|
49 |
api_key = os.getenv("SP_HF_TOK")
|
50 |
if not api_key:
|
|
|
4 |
DuckDuckGoSearchTool,
|
5 |
VisitWebpageTool,
|
6 |
InferenceClientModel,
|
7 |
+
# HfApiModel, # import bug from smolagents after adding duckduckgo-search in requirements
|
8 |
tool
|
9 |
)
|
10 |
from typing import List, Dict, Any, Optional
|
|
|
30 |
self.system_prompt = system_prompt
|
31 |
|
32 |
|
33 |
+
# if model_type == "HfApiModel":
|
34 |
+
# if api_key is None:
|
35 |
+
# api_key = os.getenv("SP_HF_TOK")
|
36 |
+
# if not api_key:
|
37 |
+
# raise ValueError("No API Key found for HuggingFace. Please set SP_HF_TOK or pass api_key.")
|
38 |
+
#
|
39 |
+
# if self.verbose:
|
40 |
+
# print(f"Using Hugging Face token: {api_key[:5]}... (HfApiModel mode)")
|
41 |
+
#
|
42 |
+
# self.model = HfApiModel(
|
43 |
+
# model_id=model_id or "Qwen/Qwen2.5-Coder-32B-Instruct", # précédemment : or "meta-llama/Llama-3-70B-Instruct",
|
44 |
+
# token=api_key
|
45 |
+
# # temperature=temperature
|
46 |
+
# )
|
47 |
+
# el
|
48 |
+
|
49 |
+
if model_type == "InferenceClientModel":
|
50 |
if api_key is None:
|
51 |
api_key = os.getenv("SP_HF_TOK")
|
52 |
if not api_key:
|