As a demonstration, get_chatbot_executor() and get_retrieval_executor() are updated to use StateGraph. Moving forward, when using the RAG assistant (assistantType === "chat_retrieval"), the POST /runs and /runs/stream API must be called with the follow request body:
{
// input is an object instead of a list
"input": {
// messages key must be present
"messages": [
{
"content": "hello!", // content key must be present
"role": "human", // role key must be present
...
}
],
...
},
...
}
All other assistant types require the existing request body format (e.g. "input": [{...}]).
Implementation
The MessageGraph in get_chatbot_executor() is migrated to StateGraph.
The MessageGraph in get_retrieval_executor() is migrated to StateGraph. The graph now accepts a TypedDict for the state. The interfaces for the corresponding nodes are updated accordingly.
API GET /threads/<tid>/state (storage layer) is updated to retrieve the graph state based on the assistant type.
Frontend is updated to call the API POST /runs/stream with the correct request body format based on the assistant type.
To Do
[x] Update API documentation (if necessary, details TBD).
Summary
As a demonstration,
get_chatbot_executor()
andget_retrieval_executor()
are updated to useStateGraph
. Moving forward, when using the RAG assistant (assistantType === "chat_retrieval"
), thePOST /runs and /runs/stream
API must be called with the follow request body:All other assistant types require the existing request body format (e.g.
"input": [{...}]
).Implementation
MessageGraph
inget_chatbot_executor()
is migrated toStateGraph
.MessageGraph
inget_retrieval_executor()
is migrated toStateGraph
. The graph now accepts aTypedDict
for the state. The interfaces for the corresponding nodes are updated accordingly.GET /threads/<tid>/state
(storage layer) is updated to retrieve the graph state based on the assistant type.POST /runs/stream
with the correct request body format based on the assistant type.To Do
TODO
s in code. Updatelangchain_core
dependency and implement new API. See https://github.com/langchain-ai/langchain/pull/20402 for details.get_retrieval_executor()
StateGraph
state.TODO
s are resolved.