Spaces:
Sleeping
Sleeping
Update agent.py
Browse files
agent.py
CHANGED
@@ -170,7 +170,7 @@ def build_graph(provider: str = "huggingface", huggingface_model: str = "mistral
|
|
170 |
else:
|
171 |
raise ValueError("Unsupported Hugging Face model")
|
172 |
|
173 |
-
hf_token = os.getenv("
|
174 |
headers = {"Authorization": f"Bearer {hf_token}"} if hf_token else {}
|
175 |
|
176 |
llm = ChatHuggingFace(
|
@@ -216,13 +216,3 @@ def build_graph(provider: str = "huggingface", huggingface_model: str = "mistral
|
|
216 |
# Compile graph
|
217 |
return builder.compile()
|
218 |
|
219 |
-
# test
|
220 |
-
if __name__ == "__main__":
|
221 |
-
question = "When was a picture of St. Thomas Aquinas first added to the Wikipedia page on the Principle of double effect?"
|
222 |
-
# Build the graph
|
223 |
-
graph = build_graph(provider="groq")
|
224 |
-
# Run the graph
|
225 |
-
messages = [HumanMessage(content=question)]
|
226 |
-
messages = graph.invoke({"messages": messages})
|
227 |
-
for m in messages["messages"]:
|
228 |
-
m.pretty_print()
|
|
|
170 |
else:
|
171 |
raise ValueError("Unsupported Hugging Face model")
|
172 |
|
173 |
+
hf_token = os.getenv("HF_TOKEN")
|
174 |
headers = {"Authorization": f"Bearer {hf_token}"} if hf_token else {}
|
175 |
|
176 |
llm = ChatHuggingFace(
|
|
|
216 |
# Compile graph
|
217 |
return builder.compile()
|
218 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|