Update agent.py
Browse files
agent.py
CHANGED
|
@@ -8,20 +8,26 @@ 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 |
-
from langchain_huggingface import HuggingFaceEndpoint, ChatHuggingFace
|
|
|
|
| 12 |
from smolagents import CodeAgent, HfApiModel
|
| 13 |
|
| 14 |
# Import our custom tools from their modules
|
| 15 |
from tools import hub_stats_tool, search_tool
|
| 16 |
|
| 17 |
# Generate the chat interface, including the tools
|
| 18 |
-
llm = HuggingFaceEndpoint(
|
| 19 |
-
|
| 20 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 21 |
)
|
| 22 |
-
|
| 23 |
-
chat = ChatHuggingFace(llm=llm, verbose=True)
|
| 24 |
-
tools = [search_tool, hub_stats_tool]
|
| 25 |
chat_with_tools = chat.bind_tools(tools)
|
| 26 |
|
| 27 |
# Generate the AgentState and Agent graph
|
|
|
|
| 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 |
# Generate the chat interface, including the tools
|
| 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 |
+
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 |
|
| 33 |
# Generate the AgentState and Agent graph
|