Update agent.py
Browse files
agent.py
CHANGED
|
@@ -8,25 +8,27 @@ from langgraph.prebuilt import ToolNode
|
|
| 8 |
from langgraph.graph import START, StateGraph
|
| 9 |
from langgraph.checkpoint.memory import MemorySaver
|
| 10 |
from langgraph.prebuilt import tools_condition
|
| 11 |
-
|
| 12 |
-
from langchain_google_genai import ChatGoogleGenerativeAI
|
| 13 |
from smolagents import CodeAgent, HfApiModel
|
| 14 |
|
| 15 |
# Import our custom tools from their modules
|
| 16 |
from tools import hub_stats_tool, search_tool
|
| 17 |
|
| 18 |
-
#
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 22 |
# )
|
| 23 |
-
# chat = ChatHuggingFace(llm=llm, verbose=True)
|
| 24 |
|
| 25 |
-
chat = ChatGoogleGenerativeAI(
|
| 26 |
-
model="gemini-2.0-flash",
|
| 27 |
-
temperature=0.7,
|
| 28 |
-
max_retries=2,
|
| 29 |
-
)
|
| 30 |
tools = [search_tool]
|
| 31 |
chat_with_tools = chat.bind_tools(tools)
|
| 32 |
|
|
|
|
| 8 |
from langgraph.graph import START, StateGraph
|
| 9 |
from langgraph.checkpoint.memory import MemorySaver
|
| 10 |
from langgraph.prebuilt import tools_condition
|
| 11 |
+
from langchain_huggingface import HuggingFaceEndpoint, ChatHuggingFace
|
| 12 |
+
# from langchain_google_genai import ChatGoogleGenerativeAI
|
| 13 |
from smolagents import CodeAgent, HfApiModel
|
| 14 |
|
| 15 |
# Import our custom tools from their modules
|
| 16 |
from tools import hub_stats_tool, search_tool
|
| 17 |
|
| 18 |
+
# HF Chat interface
|
| 19 |
+
llm = HuggingFaceEndpoint(
|
| 20 |
+
repo_id="Qwen/Qwen2.5-Coder-32B-Instruct",
|
| 21 |
+
huggingfacehub_api_token=os.environ["HUGGINGFACEHUB_API_TOKEN"],
|
| 22 |
+
)
|
| 23 |
+
chat = ChatHuggingFace(llm=llm, verbose=True)
|
| 24 |
+
|
| 25 |
+
# Google's chat interface
|
| 26 |
+
# chat = ChatGoogleGenerativeAI(
|
| 27 |
+
# model="gemini-2.0-flash",
|
| 28 |
+
# temperature=0.7,
|
| 29 |
+
# max_retries=2,
|
| 30 |
# )
|
|
|
|
| 31 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 32 |
tools = [search_tool]
|
| 33 |
chat_with_tools = chat.bind_tools(tools)
|
| 34 |
|