Shago commited on
Commit
a7ba354
·
verified ·
1 Parent(s): 84c0505

Update agents/agents_nodes.py

Browse files
Files changed (1) hide show
  1. agents/agents_nodes.py +17 -2
agents/agents_nodes.py CHANGED
@@ -1,14 +1,29 @@
1
  import json
2
  from langchain_core.messages import AIMessage, ToolMessage
3
  from langgraph.prebuilt import ToolNode
 
4
  from utils.state_utils import AgentState
5
  from tools.financial_tools import time_value_tool
6
- from langchain_ollama import ChatOllama
 
7
 
8
 
9
  # LLL instantation
10
 
11
- llm = ChatOllama(model="qwen3:4b", temperature=0)
 
 
 
 
 
 
 
 
 
 
 
 
 
12
  llm_instantiated = llm.bind_tools(
13
  [time_value_tool],
14
  tool_choice={"type": "function", "function": {"name": "time_value_tool"}}
 
1
  import json
2
  from langchain_core.messages import AIMessage, ToolMessage
3
  from langgraph.prebuilt import ToolNode
4
+ from langchain_community.llms.huggingface_pipeline import HuggingFacePipeline
5
  from utils.state_utils import AgentState
6
  from tools.financial_tools import time_value_tool
7
+ from transformers import pipeline
8
+ import torch
9
 
10
 
11
  # LLL instantation
12
 
13
+ text_generator = pipeline(
14
+ "text-generation", # Task type
15
+ model="deepseek-ai/DeepSeek-R1-0528-Qwen3-8B",
16
+ # model="google/gemma-3n-E2B-it",
17
+ # model="google/gemma-3n-e4b-it",
18
+ # model="Qwen/Qwen3-Embedding-0.6B",
19
+ # device="cuda" if torch.cuda.is_available() else "cpu",
20
+ device= "cpu",
21
+ torch_dtype=torch.bfloat16,
22
+ max_new_tokens=700 # Limit output length
23
+ )
24
+
25
+
26
+ llm = HuggingFacePipeline(pipeline=text_generator)
27
  llm_instantiated = llm.bind_tools(
28
  [time_value_tool],
29
  tool_choice={"type": "function", "function": {"name": "time_value_tool"}}