DarkRodry commited on
Commit
c547a9c
Β·
1 Parent(s): fca0e83

change model from hf to gemini

Browse files
Files changed (2) hide show
  1. app.py +7 -7
  2. 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 langchain_huggingface import HuggingFaceEndpoint, ChatHuggingFace
10
 
11
  from tools import *
12
 
 
 
 
13
  # Generate the chat interface, including the tools
14
- llm = HuggingFaceEndpoint(
15
- repo_id="Qwen/Qwen2.5-Coder-32B-Instruct",
16
- huggingfacehub_api_token=os.environ["HUGGINGFACEHUB_API_TOKEN"],
17
- )
18
 
19
- chat = ChatHuggingFace(llm=llm, verbose=True)
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
- langchain_huggingface
4
  langchain_community
5
  rank_bm25
 
1
  datasets
2
  langgraph
3
+ langchain-google-genai
4
  langchain_community
5
  rank_bm25