Update tools.py
Browse files
tools.py
CHANGED
@@ -136,17 +136,27 @@ def build_graph(csv_file_path: str = "embeddings.csv"):
|
|
136 |
|
137 |
import os
|
138 |
|
139 |
-
from langchain_huggingface import
|
140 |
-
|
141 |
-
|
142 |
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
148 |
)
|
149 |
-
|
|
|
|
|
|
|
|
|
150 |
|
151 |
|
152 |
|
|
|
136 |
|
137 |
import os
|
138 |
|
139 |
+
from langchain_huggingface import ChatHuggingFace, HuggingFacePipeline
|
140 |
+
import getpass
|
141 |
+
import os
|
142 |
|
143 |
+
os.environ["agents_token"] = getpass.getpass(
|
144 |
+
"Enter your Hugging Face API key: "
|
145 |
+
)
|
146 |
+
llm = HuggingFacePipeline.from_model_id(
|
147 |
+
model_id="meta-llama/Meta-Llama-3-8B-Instruct",
|
148 |
+
task="text-generation",
|
149 |
+
pipeline_kwargs=dict(
|
150 |
+
max_new_tokens=512,
|
151 |
+
do_sample=False,
|
152 |
+
repetition_penalty=1.03,
|
153 |
+
),
|
154 |
)
|
155 |
+
|
156 |
+
chat_model = ChatHuggingFace(llm=llm)
|
157 |
+
|
158 |
+
|
159 |
+
llm_with_tools = chat_model.bind_tools(tools=tools)
|
160 |
|
161 |
|
162 |
|