Shago commited on
Commit
72f1955
·
verified ·
1 Parent(s): af62357

Update agents/agents_nodes.py

Browse files
Files changed (1) hide show
  1. agents/agents_nodes.py +4 -10
agents/agents_nodes.py CHANGED
@@ -22,23 +22,17 @@ from tools.financial_tools import time_value_tool
22
  # return {"messages": [response]}
23
 
24
  import os
25
- from langchain_community.chat_models import ChatHuggingFace
26
- from langchain_community.llms import HuggingFaceEndpoint
27
- from langchain_core.messages import AIMessage
28
 
29
- # Initialize Hugging Face endpoint (replace with your model)
30
- HF_MODEL = "google/gemma-2b-it"
31
  llm_endpoint = HuggingFaceEndpoint(
32
- endpoint_url=f"https://huggingface.co/models/{HF_MODEL}",
33
- huggingfacehub_api_token=os.environ["HF_TOKEN"],
34
  max_new_tokens=500,
35
  temperature=0
36
  )
37
 
38
- # Wrap in chat model
39
  llm = ChatHuggingFace(llm=llm_endpoint)
40
-
41
- # Bind tools to model
42
  llm_instantiated = llm.bind_tools(
43
  [time_value_tool],
44
  tool_choice={"type": "function", "function": {"name": "time_value_tool"}}
 
22
  # return {"messages": [response]}
23
 
24
  import os
25
+ from langchain_huggingface import ChatHuggingFace, HuggingFaceEndpoint
26
+
 
27
 
 
 
28
  llm_endpoint = HuggingFaceEndpoint(
29
+ endpoint_url="https://api-inference.huggingface.co/models/google/gemma-2b-it",
30
+ huggingfacehub_api_token=os.environ["HF_TOKEN"], # Set in Space secrets
31
  max_new_tokens=500,
32
  temperature=0
33
  )
34
 
 
35
  llm = ChatHuggingFace(llm=llm_endpoint)
 
 
36
  llm_instantiated = llm.bind_tools(
37
  [time_value_tool],
38
  tool_choice={"type": "function", "function": {"name": "time_value_tool"}}