change model from hf to gemini
Browse files- app.py +7 -7
- requirements.txt +1 -1
app.py
CHANGED
@@ -1,4 +1,5 @@
|
|
1 |
import os
|
|
|
2 |
|
3 |
from typing import TypedDict, Annotated
|
4 |
from langgraph.graph.message import add_messages
|
@@ -6,18 +7,17 @@ from langchain_core.messages import AnyMessage, HumanMessage, AIMessage
|
|
6 |
from langgraph.prebuilt import ToolNode
|
7 |
from langgraph.graph import START, StateGraph
|
8 |
from langgraph.prebuilt import tools_condition
|
9 |
-
from
|
10 |
|
11 |
from tools import *
|
12 |
|
|
|
|
|
|
|
13 |
# Generate the chat interface, including the tools
|
14 |
-
|
15 |
-
repo_id="Qwen/Qwen2.5-Coder-32B-Instruct",
|
16 |
-
huggingfacehub_api_token=os.environ["HUGGINGFACEHUB_API_TOKEN"],
|
17 |
-
)
|
18 |
|
19 |
-
|
20 |
-
tools = [search_tool, weather_info_tool, hub_stats_tool]
|
21 |
chat_with_tools = chat.bind_tools(tools)
|
22 |
|
23 |
# Generate the AgentState and Agent graph
|
|
|
1 |
import os
|
2 |
+
import getpass
|
3 |
|
4 |
from typing import TypedDict, Annotated
|
5 |
from langgraph.graph.message import add_messages
|
|
|
7 |
from langgraph.prebuilt import ToolNode
|
8 |
from langgraph.graph import START, StateGraph
|
9 |
from langgraph.prebuilt import tools_condition
|
10 |
+
from langchain.chat_models import init_chat_model
|
11 |
|
12 |
from tools import *
|
13 |
|
14 |
+
if not os.environ.get("GOOGLE_API_KEY"):
|
15 |
+
os.environ["GOOGLE_API_KEY"] = getpass.getpass("Enter API key for Google Gemini: ")
|
16 |
+
|
17 |
# Generate the chat interface, including the tools
|
18 |
+
chat = init_chat_model("gemini-2.5-flash", model_provider="google_genai")
|
|
|
|
|
|
|
19 |
|
20 |
+
tools = [guest_info_tool, weather_info_tool, hub_stats_tool, search_tool]
|
|
|
21 |
chat_with_tools = chat.bind_tools(tools)
|
22 |
|
23 |
# Generate the AgentState and Agent graph
|
requirements.txt
CHANGED
@@ -1,5 +1,5 @@
|
|
1 |
datasets
|
2 |
langgraph
|
3 |
-
|
4 |
langchain_community
|
5 |
rank_bm25
|
|
|
1 |
datasets
|
2 |
langgraph
|
3 |
+
langchain-google-genai
|
4 |
langchain_community
|
5 |
rank_bm25
|