sam522 commited on
Commit
758cb32
·
1 Parent(s): 9f3c913

agent tools

Browse files
Files changed (1) hide show
  1. app.py +13 -0
app.py CHANGED
@@ -7,6 +7,7 @@ from langchain.tools import Tool
7
  import os
8
  import datasets
9
  from langchain.docstore.document import Document
 
10
  from langchain_community.retrievers import BM25Retriever
11
  from retriever import extract_text
12
 
@@ -72,4 +73,16 @@ tools = [guest_info_tool]
72
  chat_with_tools = model.bind_tools(tools)
73
 
74
 
 
 
 
 
 
 
 
 
 
 
 
 
75
  demo.launch()
 
7
  import os
8
  import datasets
9
  from langchain.docstore.document import Document
10
+ from langgraph.graph import START, StateGraph
11
  from langchain_community.retrievers import BM25Retriever
12
  from retriever import extract_text
13
 
 
73
  chat_with_tools = model.bind_tools(tools)
74
 
75
 
76
+ # Generate the AgentState and Agent graph
77
+ class AgentState(TypedDict):
78
+ messages: Annotated[list[AnyMessage], add_messages]
79
+
80
+ def assistant(state: AgentState):
81
+ return {
82
+ "messages": [chat_with_tools.invoke(state["messages"])],
83
+ }
84
+
85
+ ## The graph
86
+ builder = StateGraph(AgentState)
87
+
88
  demo.launch()