Spaces:
Running
Running
fix: login in hf_hub instead of putting the token in all agents.
Browse files
src/insurance_assistants/agents.py
CHANGED
@@ -2,7 +2,7 @@ from pathlib import Path
|
|
2 |
|
3 |
# from dotenv import find_dotenv, load_dotenv
|
4 |
import os
|
5 |
-
from huggingface_hub import InferenceClient
|
6 |
from smolagents import (
|
7 |
CodeAgent,
|
8 |
DuckDuckGoSearchTool,
|
@@ -22,7 +22,7 @@ from src.insurance_assistants.consts import PROMPT_PREFIX
|
|
22 |
rag_app = RAG()
|
23 |
# FIXME Comment the following if you want to reprocess everything
|
24 |
rag_app.vectordb_id = "policy_wordings"
|
25 |
-
|
26 |
|
27 |
class InsuranceInfoRetriever(Tool):
|
28 |
name = "InsuranceInfoRetriever"
|
@@ -36,7 +36,7 @@ class InsuranceInfoRetriever(Tool):
|
|
36 |
client = InferenceClient(
|
37 |
provider="hyperbolic",
|
38 |
bill_to="VitalNest",
|
39 |
-
token=os.getenv("HF_TOKEN")
|
40 |
)
|
41 |
results = rag_app.search_documents(query)
|
42 |
img_paths = [Path(res[0]) for res in results]
|
@@ -87,7 +87,7 @@ insurance_agent = CodeAgent(
|
|
87 |
websearch_agent = ToolCallingAgent(
|
88 |
model=InferenceClientModel(
|
89 |
model_id="Qwen/Qwen3-30B-A3B", bill_to="VitalNest", temperature=0.1,
|
90 |
-
token=os.getenv("HF_TOKEN")
|
91 |
),
|
92 |
tools=[
|
93 |
VisitWebpageTool(max_output_length=20_000),
|
@@ -104,7 +104,7 @@ websearch_agent = ToolCallingAgent(
|
|
104 |
wikipedia_agent = ToolCallingAgent(
|
105 |
model=InferenceClientModel(
|
106 |
model_id="Qwen/Qwen3-30B-A3B", bill_to="VitalNest", temperature=0.1,
|
107 |
-
token=os.getenv("HF_TOKEN")
|
108 |
),
|
109 |
tools=[
|
110 |
WikipediaSearchTool(user_agent="WikiAssistant (merlin@example.com)"),
|
@@ -123,7 +123,7 @@ manager_agent = CodeAgent(
|
|
123 |
model_id="Qwen/Qwen3-235B-A22B",
|
124 |
bill_to="VitalNest",
|
125 |
temperature=0.1,
|
126 |
-
token=os.getenv("HF_TOKEN")
|
127 |
),
|
128 |
managed_agents=[websearch_agent, wikipedia_agent, insurance_agent],
|
129 |
max_steps=10,
|
|
|
2 |
|
3 |
# from dotenv import find_dotenv, load_dotenv
|
4 |
import os
|
5 |
+
from huggingface_hub import InferenceClient, login
|
6 |
from smolagents import (
|
7 |
CodeAgent,
|
8 |
DuckDuckGoSearchTool,
|
|
|
22 |
rag_app = RAG()
|
23 |
# FIXME Comment the following if you want to reprocess everything
|
24 |
rag_app.vectordb_id = "policy_wordings"
|
25 |
+
login(os.getenv("HF_TOKEN"))
|
26 |
|
27 |
class InsuranceInfoRetriever(Tool):
|
28 |
name = "InsuranceInfoRetriever"
|
|
|
36 |
client = InferenceClient(
|
37 |
provider="hyperbolic",
|
38 |
bill_to="VitalNest",
|
39 |
+
# token=os.getenv("HF_TOKEN")
|
40 |
)
|
41 |
results = rag_app.search_documents(query)
|
42 |
img_paths = [Path(res[0]) for res in results]
|
|
|
87 |
websearch_agent = ToolCallingAgent(
|
88 |
model=InferenceClientModel(
|
89 |
model_id="Qwen/Qwen3-30B-A3B", bill_to="VitalNest", temperature=0.1,
|
90 |
+
# token=os.getenv("HF_TOKEN")
|
91 |
),
|
92 |
tools=[
|
93 |
VisitWebpageTool(max_output_length=20_000),
|
|
|
104 |
wikipedia_agent = ToolCallingAgent(
|
105 |
model=InferenceClientModel(
|
106 |
model_id="Qwen/Qwen3-30B-A3B", bill_to="VitalNest", temperature=0.1,
|
107 |
+
# token=os.getenv("HF_TOKEN")
|
108 |
),
|
109 |
tools=[
|
110 |
WikipediaSearchTool(user_agent="WikiAssistant (merlin@example.com)"),
|
|
|
123 |
model_id="Qwen/Qwen3-235B-A22B",
|
124 |
bill_to="VitalNest",
|
125 |
temperature=0.1,
|
126 |
+
# token=os.getenv("HF_TOKEN")
|
127 |
),
|
128 |
managed_agents=[websearch_agent, wikipedia_agent, insurance_agent],
|
129 |
max_steps=10,
|