HCho commited on
Commit
23e20d8
·
verified ·
1 Parent(s): 1bf2c7d

Update agent.py

Browse files
Files changed (1) hide show
  1. agent.py +5 -8
agent.py CHANGED
@@ -16,7 +16,7 @@ from langchain.chat_models import ChatHuggingFace
16
 
17
  from langchain_google_genai import ChatGoogleGenerativeAI
18
 
19
- from langchain.llms import HuggingFaceEndpoint
20
  #load_dotenv()
21
  google_api_key = os.environ["GOOGLE_API_KEY"]
22
  hf_api_key = os.environ["HF_TOKEN"]
@@ -108,13 +108,10 @@ def build_graph(provider: str = "huggingface"):
108
  # Google Gemini
109
  llm = ChatGoogleGenerativeAI(model="gemini-2.0-flash", temperature=0,api_key=google_api_key)
110
  elif provider == "huggingface":
111
- # TODO: Add huggingface endpoint
112
- llm = ChatHuggingFace(
113
- llm=HuggingFaceEndpoint(
114
- endpoint_url="https://api-inference.huggingface.co/models/Meta-DeepLearning/llama-2-7b-chat-hf",
115
- model_kwargs={"temperature": 0},
116
- huggingfacehub_api_token=hf_api_key
117
- ),
118
  )
119
  def assistant(state: MessagesState):
120
  """ Use the tools to answer the query. you have add,subtract,multiply,divide,web_search,wikipedia_search,arxiv_search tools."""
 
16
 
17
  from langchain_google_genai import ChatGoogleGenerativeAI
18
 
19
+ from langchain.llms import HuggingFaceHub
20
  #load_dotenv()
21
  google_api_key = os.environ["GOOGLE_API_KEY"]
22
  hf_api_key = os.environ["HF_TOKEN"]
 
108
  # Google Gemini
109
  llm = ChatGoogleGenerativeAI(model="gemini-2.0-flash", temperature=0,api_key=google_api_key)
110
  elif provider == "huggingface":
111
+ llm = HuggingFaceHub(
112
+ repo_id="meta-llama/Llama-2-7b-chat-hf",
113
+ huggingfacehub_api_token=hf_api_key,
114
+ model_kwargs={"temperature": 0}
 
 
 
115
  )
116
  def assistant(state: MessagesState):
117
  """ Use the tools to answer the query. you have add,subtract,multiply,divide,web_search,wikipedia_search,arxiv_search tools."""