Spaces:
Sleeping
Sleeping
Upload 2 files
Browse files
agent.py
CHANGED
@@ -26,10 +26,6 @@ from langchain_huggingface import (
|
|
26 |
|
27 |
load_dotenv()
|
28 |
|
29 |
-
embddings = HuggingFaceEmbeddings(
|
30 |
-
model_name="sentence-transformers/all-mpnet-base-v2",
|
31 |
-
)
|
32 |
-
|
33 |
|
34 |
# Initialize the DuckDuckGo search tool
|
35 |
search_tool = DuckDuckGoSearchResults()
|
@@ -84,27 +80,28 @@ def arvix_search(query: str) -> str:
|
|
84 |
|
85 |
|
86 |
# Load LLM model
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
# )
|
94 |
-
llm = ChatHuggingFace(
|
95 |
-
llm=HuggingFaceEndpoint(
|
96 |
-
repo_id="microsoft/Phi-3-mini-4k-instruct",
|
97 |
-
temperature=0,
|
98 |
-
# huggingfacehub_api_token=os.environ["HUGGINGFACEHUB_API_TOKEN"],
|
99 |
-
),
|
100 |
-
verbose=True,
|
101 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
102 |
|
103 |
tools = [
|
104 |
arvix_search,
|
105 |
wiki_search,
|
106 |
# web_search,
|
107 |
-
search_tool,
|
108 |
]
|
109 |
# Bind the tools to the LLM
|
110 |
model_with_tools = llm.bind_tools(tools)
|
|
|
26 |
|
27 |
load_dotenv()
|
28 |
|
|
|
|
|
|
|
|
|
29 |
|
30 |
# Initialize the DuckDuckGo search tool
|
31 |
search_tool = DuckDuckGoSearchResults()
|
|
|
80 |
|
81 |
|
82 |
# Load LLM model
|
83 |
+
llm = ChatOpenAI(
|
84 |
+
model="gpt-4o",
|
85 |
+
base_url="https://models.inference.ai.azure.com",
|
86 |
+
api_key=os.environ["GITHUB_TOKEN"],
|
87 |
+
temperature=0.2,
|
88 |
+
max_tokens=4096,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
89 |
)
|
90 |
+
# llm = ChatHuggingFace(
|
91 |
+
# llm=HuggingFaceEndpoint(
|
92 |
+
# # repo_id="microsoft/Phi-3-mini-4k-instruct",
|
93 |
+
# repo_id="Qwen/Qwen3-235B-A22B",
|
94 |
+
# temperature=0,
|
95 |
+
# # huggingfacehub_api_token=os.environ["HUGGINGFACEHUB_API_TOKEN"],
|
96 |
+
# ),
|
97 |
+
# verbose=True,
|
98 |
+
# )
|
99 |
|
100 |
tools = [
|
101 |
arvix_search,
|
102 |
wiki_search,
|
103 |
# web_search,
|
104 |
+
# search_tool,
|
105 |
]
|
106 |
# Bind the tools to the LLM
|
107 |
model_with_tools = llm.bind_tools(tools)
|