forked from elastic/kibana
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Bug][Assistant API] - chat/complete endpoint is not persisting the m…
…odel response to the chosen conversation ID (elastic#11783) (elastic#212122) ## Summary BUG: elastic/security-team#11783 This PR fixes the behaviour of the `/api/security_ai_assistant/chat/complete` route where the `persist` flag: 1. when set to `true` does not append the assistant reply to existing conversation 2. when set to `false` appends user message to existing conversation ### Expected behaviour [Details](elastic/security-team#11783 (comment)). 1. `conversationId == undefined && persist == false`: no new conversations and nothing persisted 2. `conversationId == undefined && persist == true`: new conversations is created and both user message and assistant reply appended to the new conversation 3. `conversationId == 'existing-id' && persist == false`: nothing appended to the existing conversation 4. `conversationId == 'existing-id' && persist == true`: both user message and assistant reply appended to the existing conversation ### Testing * Use this `curl` command (with replace `connectorId` and `conversationId`) to test the endpoint. ``` curl --location 'http://localhost:5601/api/security_ai_assistant/chat/complete' \ --header 'kbn-xsrf: true' \ --header 'Content-Type: application/json' \ --data '{ "connectorId": "{{my-gpt4o-ai}}", "conversationId": "{{existing-conversation-id | undefined}}", "isStream": false, "messages": [ { "content": "Follow up", "role": "user" } ], "persist": true }' ``` * To retrieve the conversation ID: (/api/security_ai_assistant/current_user/conversations/_find) * `conversationId` can be either existing conversation id or `undefined`
- Loading branch information
Showing
2 changed files
with
151 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters