-
Notifications
You must be signed in to change notification settings - Fork 25
Open
Labels
documentationImprovements or additions to documentationImprovements or additions to documentation
Description
refs #114
This is an overall description of how to interact with the chat feature of the assistant via the OCS API.
The messages are grouped in conversations (sessions).
- Session
- id
- timestamp: the creation date
- title
- agency_conversation_token: only set when using agency
- agency_pending_actions: only set when using agency
- Message
- id
- session_id
- role:
system(system prompt added by the assistant),human(messages written by the user) orassistant(LLM messages) - ocp_task_id: The related task processing task ID, the one that produced the content of the message (only for
assistantrole tasks) - sources: only set when using agency
- attachments: only set when using audio chat
Sequence of actions
This is the classic course of actions (API calls):
- Create a session (if needed)
- Create a human message in the session
- Ask the assistant to generate a response to the last human message of a session. This returns a taskprocessing task ID.
- Poll the message generation status until it finishes and returns the new message
Endpoints
All endpoints are OCS
- List sessions: GET
/ocs/v2.php/apps/assistant/chat/sessions - Delete a session: DELETE
/ocs/v2.php/apps/assistant/chat/delete_session- sessionId
- Create a session: PUT
/ocs/v2.php/apps/assistant/chat/new_sessionwith params- title: session title, is optional
- timestamp
- Create a message: PUT
/ocs/v2.php/apps/assistant/chat/new_message- sessionId
- role
- content
- timestamp
- attachments: optional, only useful when using agency
- firstHumanMessage: boolean, set it to true if it is the first human message of the session
- Delete a message: DELETE
/ocs/v2.php/apps/assistant/chat/delete_message- messageId
- sessionId
- Ask to generate new
assistantmessage/response in the session: GET/ocs/v2.php/apps/assistant/chat/generate, no parameters - Get messages of a session: GET
/ocs/v2.php/apps/assistant/chat/messages- sessionId
Other endpoints are documented in the OpenAPI specs that can be browsed with the ocs_api_viewer app while the assistant app is installed
Metadata
Metadata
Assignees
Labels
documentationImprovements or additions to documentationImprovements or additions to documentation