Create conversation

edit

Create a new Elastic AI Assistant conversation.

Request URL

edit

POST <kibana host>:<port>/api/security_ai_assistant/current_user/conversations

Request body

edit
Name Type Description Required

title

String

Conversation title. If you set it to "New chat", the AI will generate a title.

Yes

category

String

Can be "assistant", "insights", or not defined.

No

isDefault

Boolean

Define if conversation is a system conversation which cannot be deleted. Defaults to false.

No

excludeFromLastConversationStorage

Boolean

Defines if conversation can appear as the latest conversation.

No

apiConfig

apiConfig object

Conversation configuration.

No

messages

messages object

Array of conversation messages.

No

replacements

Key, Value(String, String)

List of the fields with anonymization.

No

apiConfig object

edit
Name Type Description Required

connectorId

String

Kibana connector ID.

Yes

actionTypeId

String

Kibana connector action type ID.

Yes

defaultSystemPromptId

String

Default system prompt ID.

Yes

model

String

Specific LLM name.

No

messages object

edit
Name Type Description Required

role

String

Message role. Can be "user", "assistant", or "system".

Yes

content

String

Message content to send to LLM.

Yes

isError

Boolean

Define if the message is an error message instead of an LLM response.

No

timestamp

String

Timestamp when the message was sent.

No

Example requests

edit

Example 1

Creates a new conversation.

POST api/security_ai_assistant/current_user/conversations
{
  "title": "The conversation title.",
  "category": "assistant",
  "messages": [
    {
      "content": "test content",
      "role": "user",
      "isError": false,
      "timestamp": "2019-12-13T16:40:33.400Z",
      "traceData": {
        "traceId": "1234",
        "transactionId": "2"
      }
    }
  ],
  "apiConfig": {
    "actionTypeId": ".gen-ai",
    "connectorId": "86ab-471c-a00b-25b7e20c2d12",
    "defaultSystemPromptId": "Default",
    "model": "gpt-4o"
  },
  "isDefault": false,
  "excludeFromLastConversationStorage": true,
  "replacements": {
    "field1": "914beb92-86ab-471c-a00b"
  }
}

Response code

edit

200 Indicates a successful call.

Response payload

edit

A JSON conversation object with a unique id.

Example 1

Conversation response payload:

{
  "id": "07805df2-6462-451a-b534-78da47873c42",
  "title": "The conversation title.",
  "category": "assistant",
  "timestamp": "2024-07-29T06:58:15.670Z",
  "updatedAt": "2024-07-29T06:58:15.670Z",
  "createdAt": "2024-07-29T06:58:15.670Z",
  "replacements": {
    "field1": "914beb92-86ab-471c-a00b"
  },
  "users": [
    {
      "name": "elastic"
    }
  ],
  "messages": [
    {
      "content": "test content",
      "role": "user",
      "timestamp": "2019-12-13T16:40:33.400Z",
      "traceData": {
        "transactionId": "2",
        "traceId": "1234"
      }
    }
  ],
  "apiConfig": {
    "connectorId": "86ab-471c-a00b-25b7e20c2d12",
    "actionTypeId": ".gen-ai",
    "defaultSystemPromptId": "Default",
    "model": "gpt-4o"
  },
  "isDefault": false,
  "excludeFromLastConversationStorage": true,
  "namespace": "default"
}