Spaces:
Sleeping
Sleeping
Commit
·
ead2a02
1
Parent(s):
9cb51ca
modified hugginfaceendpoint
Browse files
app.py
CHANGED
|
@@ -15,10 +15,10 @@ from typing import TypedDict, Annotated
|
|
| 15 |
from langgraph.prebuilt import ToolNode
|
| 16 |
from langgraph.graph import START, StateGraph, END, Graph
|
| 17 |
# from langgraph.prebuilt import tools_condition
|
| 18 |
-
|
| 19 |
from langchain.agents import initialize_agent, AgentType
|
| 20 |
-
from langchain_community.llms import HuggingFaceHub
|
| 21 |
-
from langchain_community.chat_models import ChatHuggingFace
|
| 22 |
|
| 23 |
## # Load environment variables from .env file
|
| 24 |
# --- Constants ---
|
|
@@ -241,11 +241,13 @@ Instructions:
|
|
| 241 |
|
| 242 |
## --- Initialize Hugging Face Model ---
|
| 243 |
# Generate the chat interface, including the tools
|
| 244 |
-
llm =
|
| 245 |
repo_id="Qwen/Qwen2.5-Coder-32B-Instruct",
|
| 246 |
huggingfacehub_api_token=HF_ACCESS_KEY,
|
| 247 |
-
|
|
|
|
| 248 |
)
|
|
|
|
| 249 |
chat_llm = ChatHuggingFace(llm=llm)
|
| 250 |
# chat = ChatHuggingFace(llm=llm, verbose=True)
|
| 251 |
# tools = [search_tool, fetch_weather]
|
|
|
|
| 15 |
from langgraph.prebuilt import ToolNode
|
| 16 |
from langgraph.graph import START, StateGraph, END, Graph
|
| 17 |
# from langgraph.prebuilt import tools_condition
|
| 18 |
+
from langchain_huggingface import HuggingFaceEndpoint, ChatHuggingFace
|
| 19 |
from langchain.agents import initialize_agent, AgentType
|
| 20 |
+
# from langchain_community.llms import HuggingFaceHub
|
| 21 |
+
# from langchain_community.chat_models import ChatHuggingFace
|
| 22 |
|
| 23 |
## # Load environment variables from .env file
|
| 24 |
# --- Constants ---
|
|
|
|
| 241 |
|
| 242 |
## --- Initialize Hugging Face Model ---
|
| 243 |
# Generate the chat interface, including the tools
|
| 244 |
+
llm = HuggingFaceEndpoint(
|
| 245 |
repo_id="Qwen/Qwen2.5-Coder-32B-Instruct",
|
| 246 |
huggingfacehub_api_token=HF_ACCESS_KEY,
|
| 247 |
+
model_kwargs={'prompt': system_prompt}
|
| 248 |
+
# system_prompt=system_prompt,
|
| 249 |
)
|
| 250 |
+
|
| 251 |
chat_llm = ChatHuggingFace(llm=llm)
|
| 252 |
# chat = ChatHuggingFace(llm=llm, verbose=True)
|
| 253 |
# tools = [search_tool, fetch_weather]
|