Update agents/agents_nodes.py
Browse files- agents/agents_nodes.py +7 -10
agents/agents_nodes.py
CHANGED
|
@@ -2,7 +2,7 @@ import json
|
|
| 2 |
from transformers import pipeline
|
| 3 |
import torch
|
| 4 |
from langchain_core.messages import AIMessage, ToolMessage
|
| 5 |
-
from langchain_huggingface import HuggingFacePipeline, ChatHuggingFace
|
| 6 |
from langchain_core.runnables import RunnableLambda
|
| 7 |
from langgraph.prebuilt import ToolNode
|
| 8 |
from utils.state_utils import AgentState
|
|
@@ -10,7 +10,7 @@ from tools.financial_tools import time_value_tool
|
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
-
#
|
| 14 |
|
| 15 |
# text_generator = pipeline(
|
| 16 |
# "text-generation", # Task type
|
|
@@ -24,17 +24,14 @@ from tools.financial_tools import time_value_tool
|
|
| 24 |
# max_new_tokens=700 # Limit output length
|
| 25 |
# )
|
| 26 |
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
repo_id="Qwen/Qwen3-Embedding-0.6B",
|
| 30 |
task="text-generation",
|
| 31 |
-
max_new_tokens=
|
| 32 |
-
do_sample=False
|
| 33 |
)
|
| 34 |
-
|
| 35 |
-
|
| 36 |
# llm = HuggingFacePipeline(pipeline=text_generator)
|
| 37 |
-
llm =ChatHuggingFace(llm=
|
| 38 |
|
| 39 |
llm_instantiated = llm.bind_tools(
|
| 40 |
[time_value_tool],
|
|
|
|
| 2 |
from transformers import pipeline
|
| 3 |
import torch
|
| 4 |
from langchain_core.messages import AIMessage, ToolMessage
|
| 5 |
+
from langchain_huggingface import HuggingFacePipeline, ChatHuggingFace,HuggingFaceEndpoint
|
| 6 |
from langchain_core.runnables import RunnableLambda
|
| 7 |
from langgraph.prebuilt import ToolNode
|
| 8 |
from utils.state_utils import AgentState
|
|
|
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
+
# LLM instantation
|
| 14 |
|
| 15 |
# text_generator = pipeline(
|
| 16 |
# "text-generation", # Task type
|
|
|
|
| 24 |
# max_new_tokens=700 # Limit output length
|
| 25 |
# )
|
| 26 |
|
| 27 |
+
llm_endpoint = HuggingFaceEndpoint(
|
| 28 |
+
endpoint_url="<your_endpoint_url>",
|
|
|
|
| 29 |
task="text-generation",
|
| 30 |
+
max_new_tokens=1024,
|
| 31 |
+
do_sample=False
|
| 32 |
)
|
|
|
|
|
|
|
| 33 |
# llm = HuggingFacePipeline(pipeline=text_generator)
|
| 34 |
+
llm = ChatHuggingFace(llm=llm_endpoint)
|
| 35 |
|
| 36 |
llm_instantiated = llm.bind_tools(
|
| 37 |
[time_value_tool],
|