jarguello76 commited on
Commit
869a8d8
·
verified ·
1 Parent(s): aca9f26

Update tools.py

Browse files
Files changed (1) hide show
  1. tools.py +8 -18
tools.py CHANGED
@@ -133,24 +133,14 @@ def build_graph(provider: str = "groq", csv_file_path: str = "embeddings.csv"):
133
  # System message
134
  sys_msg = SystemMessage(content=system_prompt)
135
 
136
- # Initialize LLM based on provider
137
- if provider == "google":
138
- llm = ChatGoogleGenerativeAI(model="gemini-2.0-flash", temperature=0)
139
-
140
- elif provider == "huggingface":
141
- llm = ChatHuggingFace(
142
- llm=HuggingFaceEndpoint(
143
- url="https://api-inference.huggingface.co/models/Meta-DeepLearning/llama-2-7b-chat-hf",
144
- temperature=0,
145
- ),
146
- )
147
-
148
- elif provider == "groq":
149
- from langchain_groq import ChatGroq
150
- llm = ChatGroq(model="mixtral-8x7b-32768", temperature=0)
151
-
152
- else:
153
- raise ValueError("Invalid provider. Choose 'google', 'huggingface', or 'groq'.")
154
 
155
  # Bind tools to LLM
156
  llm_with_tools = llm.bind_tools(tools)
 
133
  # System message
134
  sys_msg = SystemMessage(content=system_prompt)
135
 
136
+ from langchain_community.llms import HuggingFaceEndpoint
137
+
138
+ llm = HuggingFaceEndpoint(
139
+ endpoint_url="https://api.endpoints.huggingface.co/v1/completions",
140
+ huggingfacehub_api_token="your_huggingface_token",
141
+ model_kwargs={"max_tokens": 512}
142
+ )
143
+
 
 
 
 
 
 
 
 
 
 
144
 
145
  # Bind tools to LLM
146
  llm_with_tools = llm.bind_tools(tools)