Spaces:
Runtime error
Runtime error
fix chat error
Browse files- LG_agent.py +6 -3
LG_agent.py
CHANGED
|
@@ -1,16 +1,19 @@
|
|
| 1 |
-
from langchain_huggingface import ChatHuggingFace
|
| 2 |
from typing import Annotated, TypedDict
|
| 3 |
from langgraph.graph.message import add_messages
|
| 4 |
from langchain_core.messages import HumanMessage, AIMessage
|
| 5 |
from tools import search_duckduckgo
|
| 6 |
from langgraph.prebuilt import tools_condition
|
| 7 |
|
| 8 |
-
|
| 9 |
-
|
|
|
|
| 10 |
temperature=0,
|
| 11 |
model_kwargs={"max_new_tokens": 512}
|
| 12 |
)
|
| 13 |
|
|
|
|
|
|
|
| 14 |
tools = [search_duckduckgo]
|
| 15 |
chat_with_tools = chat.bind_tools(tools)
|
| 16 |
|
|
|
|
| 1 |
+
from langchain_huggingface import HuggingFaceEndpoint, ChatHuggingFace
|
| 2 |
from typing import Annotated, TypedDict
|
| 3 |
from langgraph.graph.message import add_messages
|
| 4 |
from langchain_core.messages import HumanMessage, AIMessage
|
| 5 |
from tools import search_duckduckgo
|
| 6 |
from langgraph.prebuilt import tools_condition
|
| 7 |
|
| 8 |
+
|
| 9 |
+
llm_endpoint = HuggingFaceEndpoint(
|
| 10 |
+
repo_id="google/flan-t5-small",
|
| 11 |
temperature=0,
|
| 12 |
model_kwargs={"max_new_tokens": 512}
|
| 13 |
)
|
| 14 |
|
| 15 |
+
chat = ChatHuggingFace(llm=llm_endpoint, verbose=True)
|
| 16 |
+
|
| 17 |
tools = [search_duckduckgo]
|
| 18 |
chat_with_tools = chat.bind_tools(tools)
|
| 19 |
|