Update backend API interfaces to be agnostic to messages list (i.e. MessageGraph
)
#294
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
Currently, the OpenGPTs backend only implements
MessageGraph
. ImplementingStateGraph
in the backend demonstrates the ability to support arbitrary graphs within OpenGPTs. Migrating the current usage ofMessageGraph
toStateGraph
is the first step.Changes in this PR are adopted from this PR.
Implementation
messages
-->values
.Dict[str, Any]
agent state type:Sequence[AnyMessage]
-->Union[Sequence[AnyMessage], Dict[str, Any]]
.Breaking API Changes
GET /threads/<tid>/messages
-->GET /threads/<tid>/state
Response:
{"messages": [...], ...}
-->{"values": [...], "next": []}
POST /threads/<tid>/messages
-->POST /threads/<tid>/state
Body:
{"messages": [...]}
-->{"values": [...]}
To Do
Migrateget_chatbot_executor()
to useStateGraph
Migrateget_retrieval_executor()
to useStateGraph
Migrateget_google_agent_executor()
to useStateGraph
Migrateget_openai_agent_executor()
to useStateGraph
Migrateget_xml_agent_executor()
to useStateGraph
Note: This PR can be merged without completing these to-do's.