Commit 634ec77
[Security Solution][AI Assistant] Update
## Summary
Epic: elastic/security-team#12768
Meta: elastic/security-team#13657
RFC: [internal
link](https://docs.google.com/document/d/13jAJ5Q3_At_zAuwKjvpYehnM5uzKJSwZIZ1aJJNAf5k)
With these changes we update the conversation summary schema to
accommodate new fields to allow conversation summarization and past
conversation search. Also, as part of these changes, the OLD (unused)
summary fields are removed from the APIs.
### Mapping changes
The conversations index mapping already has a `summary` field which is
an object that looks like:
<details>
<summary><b>OLD</b> summary schema</summary>
```json
"summary": {
"properties": {
"@timestamp": {
"type": "date"
},
"confidence": {
"type": "keyword"
},
"content": {
"type": "text"
},
"public": {
"type": "boolean"
}
}
}
```
</details>
To be able to summarize conversations and semantically search through
existing summaries, the new fields (`semantic_content` and
`summarized_message_ids`) are added into the mapping:
<details>
<summary><b>Updated</b> summary schema</summary>
```json
"summary": {
"properties": {
"@timestamp": {
"type": "date"
},
"confidence": {
"type": "keyword"
},
"content": {
"type": "text"
},
"public": {
"type": "boolean"
},
"semantic_content": {
"type": "semantic_text",
"inference_id": ".elser-2-elasticsearch"
},
"summarized_message_ids": {
"type": "keyword",
"array": true
}
}
}
```
</details>
### New fields description
`semantic_content` field will be used to store conversation summary and
allows semantical search through the ELSER v2 or E5 models.
`summarized_message_ids` field will contain a list of all messages that
are summarized and part of the summary stored within the
`semantic_content` field.
### Legacy fields and API interface changes
There are bunch of fields that were never used and won't be supported or
used in future - `summary.confidence`, `summary.content` and
`summary.public`. After discussion with @YulNaumenko and
@elastic/security-generative-ai, this fields will be marked as legacy on
the mappings level for compatibility with the installed indices and will
be removed on the API level. Previously, we allowed to update
`summary.confidence`, `summary.content` and `summary.public` fields via
API calls and never used in kibana UI.
**NOTE**: Thanks @spong to pointing to [this
cluster](https://overview.elastic-cloud.com/app/dashboards#/view/serverless-api-services-http-requests-overview?_g=h@6558260)
to see the API usage in production. It shows that within last 90 days,
the update conversation API (the only way for users to update
conversations and potentially add a summary to it) was used only 41
times which looks low and I believe negligible.
<img width="1144" height="423" alt="Screenshot 2025-08-20 at 10 50 35"
src="https://github.com/user-attachments/assets/6cb8e1a2-4d9d-44d2-8e66-2de6d8ac74e2"
/>
From now on, the conversation will have next summary fields on the **API
level**:
```typescript
interface ConversationSummary {
/**
* The timestamp summary was updated.
*/
timestamp: string;
/**
* Summary text of the conversation over time.
*/
semanticContent?: string;
/**
* The list of summarized messages.
*/
summarizedMessageIds?: string[];
}
```
### Testing
To test, you can use next API calls:
<details>
<summary><b>Fetch</b> all existing conversations</summary>
This call will fetch all existing conversation. Good for overview of
existing conversations and verifying expected summary values.
```curl
curl --location 'http://localhost:5601/sbb/api/security_ai_assistant/current_user/conversations/_find' \
--header 'Authorization: Basic ZWxhc3RpYzpjaGFuZ2VtZQ==' \
--header 'kbn-xsrf: true' \
--header 'elastic-api-version: 2023-10-31'
```
</details>
<details>
<summary><b>Update</b> a conversation</summary>
This call will update a conversation and add/update a summary.
```curl
curl --location --request PUT 'http://localhost:5601/sbb/api/security_ai_assistant/current_user/conversations/{{CONVERSATION_ID}}' \
--header 'kbn-xsrf: true' \
--header 'elastic-api-version: 2023-10-31' \
--header 'Content-Type: application/json' \
--header 'Authorization: Basic ZWxhc3RpYzpjaGFuZ2VtZQ==' \
--data '{
"id": "a565baa8-5566-47b2-ab69-807248b2fc46",
"summary": {
"semanticContent": "Very nice demo semantic content."
}
}'
```
</details>
<details>
<summary><b>Bulk Update</b> existing conversation(s)</summary>
This call will update a conversation and add/update a summary.
```curl
curl --location 'http://localhost:5601/sbb/internal/elastic_assistant/current_user/conversations/_bulk_action' \
--header 'kbn-xsrf: true' \
--header 'elastic-api-version: 1' \
--header 'x-elastic-internal-origin: Kibana' \
--header 'kbn-version: 9.2.0' \
--header 'Content-Type: application/json' \
--header 'Authorization: Basic ZWxhc3RpYzpjaGFuZ2VtZQ==' \
--data '{
"update":
[
{
"id": "{{CONVERSATION_ID}}",
"summary": {
"semanticContent": "Very nice demo semantic content."
}
}
]
}'
```
</details>
Some test cases:
1. Check that if not updated, a new conversation does not have a summary
2. Check that `summary` contains expected value after it has been
updated via one of the above APIs
3. Check that we do not return legacy fields (`summary.confidence`,
`summary.content` and `summary.public`) even if you add a document with
those fields set. You can set legacy fields, either via DevTools or via
update APIs from above in previous kibana version.
---------
Co-authored-by: kibanamachine <[email protected]>ConversationSummary schema and interface (elastic#13657) (elastic#232288)1 parent b0fa542 commit 634ec77
File tree
41 files changed
+2111
-531
lines changed- .buildkite
- oas_docs/output
- x-pack
- solutions/security
- plugins/elastic_assistant/server
- __mocks__
- ai_assistant_data_clients
- conversations
- routes
- chat
- user_conversations
- test/security_solution_api_integration
- test_suites/genai/conversations
- mocks
- trial_license_complete_tier
- bulk_actions
- configs
- update
- utils
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
41 files changed
+2111
-531
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
108 | 108 | | |
109 | 109 | | |
110 | 110 | | |
| 111 | + | |
| 112 | + | |
111 | 113 | | |
112 | 114 | | |
113 | 115 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
61559 | 61559 | | |
61560 | 61560 | | |
61561 | 61561 | | |
61562 | | - | |
61563 | | - | |
61564 | | - | |
61565 | | - | |
61566 | | - | |
61567 | | - | |
61568 | | - | |
61569 | | - | |
61570 | 61562 | | |
61571 | 61563 | | |
61572 | 61564 | | |
| |||
61651 | 61643 | | |
61652 | 61644 | | |
61653 | 61645 | | |
| 61646 | + | |
| 61647 | + | |
| 61648 | + | |
| 61649 | + | |
| 61650 | + | |
| 61651 | + | |
| 61652 | + | |
| 61653 | + | |
| 61654 | + | |
| 61655 | + | |
| 61656 | + | |
61654 | 61657 | | |
61655 | 61658 | | |
61656 | | - | |
61657 | | - | |
61658 | | - | |
61659 | | - | |
61660 | | - | |
| 61659 | + | |
61661 | 61660 | | |
61662 | 61661 | | |
61663 | 61662 | | |
61664 | | - | |
61665 | | - | |
61666 | | - | |
61667 | | - | |
61668 | | - | |
61669 | | - | |
61670 | | - | |
61671 | | - | |
| 61663 | + | |
| 61664 | + | |
| 61665 | + | |
| 61666 | + | |
| 61667 | + | |
61672 | 61668 | | |
61673 | 61669 | | |
61674 | 61670 | | |
| |||
61692 | 61688 | | |
61693 | 61689 | | |
61694 | 61690 | | |
61695 | | - | |
| 61691 | + | |
61696 | 61692 | | |
61697 | 61693 | | |
61698 | 61694 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
74108 | 74108 | | |
74109 | 74109 | | |
74110 | 74110 | | |
74111 | | - | |
74112 | | - | |
74113 | | - | |
74114 | | - | |
74115 | | - | |
74116 | | - | |
74117 | | - | |
74118 | | - | |
74119 | 74111 | | |
74120 | 74112 | | |
74121 | 74113 | | |
| |||
74200 | 74192 | | |
74201 | 74193 | | |
74202 | 74194 | | |
| 74195 | + | |
| 74196 | + | |
| 74197 | + | |
| 74198 | + | |
| 74199 | + | |
| 74200 | + | |
| 74201 | + | |
| 74202 | + | |
| 74203 | + | |
| 74204 | + | |
| 74205 | + | |
74203 | 74206 | | |
74204 | 74207 | | |
74205 | | - | |
74206 | | - | |
74207 | | - | |
74208 | | - | |
74209 | | - | |
| 74208 | + | |
74210 | 74209 | | |
74211 | 74210 | | |
74212 | 74211 | | |
74213 | | - | |
74214 | | - | |
74215 | | - | |
74216 | | - | |
74217 | | - | |
74218 | | - | |
74219 | | - | |
74220 | | - | |
| 74212 | + | |
| 74213 | + | |
| 74214 | + | |
| 74215 | + | |
| 74216 | + | |
74221 | 74217 | | |
74222 | 74218 | | |
74223 | 74219 | | |
| |||
74241 | 74237 | | |
74242 | 74238 | | |
74243 | 74239 | | |
74244 | | - | |
| 74240 | + | |
74245 | 74241 | | |
74246 | 74242 | | |
74247 | 74243 | | |
| |||
Lines changed: 18 additions & 24 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1959 | 1959 | | |
1960 | 1960 | | |
1961 | 1961 | | |
1962 | | - | |
1963 | | - | |
1964 | | - | |
1965 | | - | |
1966 | | - | |
1967 | | - | |
1968 | | - | |
1969 | | - | |
1970 | 1962 | | |
1971 | 1963 | | |
1972 | 1964 | | |
| |||
2051 | 2043 | | |
2052 | 2044 | | |
2053 | 2045 | | |
| 2046 | + | |
| 2047 | + | |
| 2048 | + | |
| 2049 | + | |
| 2050 | + | |
| 2051 | + | |
| 2052 | + | |
| 2053 | + | |
| 2054 | + | |
| 2055 | + | |
| 2056 | + | |
2054 | 2057 | | |
2055 | 2058 | | |
2056 | | - | |
2057 | | - | |
2058 | | - | |
2059 | | - | |
2060 | | - | |
2061 | | - | |
2062 | | - | |
| 2059 | + | |
2063 | 2060 | | |
2064 | 2061 | | |
2065 | 2062 | | |
2066 | 2063 | | |
2067 | 2064 | | |
2068 | | - | |
2069 | | - | |
2070 | | - | |
2071 | | - | |
2072 | | - | |
2073 | | - | |
2074 | | - | |
2075 | | - | |
| 2065 | + | |
| 2066 | + | |
| 2067 | + | |
| 2068 | + | |
| 2069 | + | |
2076 | 2070 | | |
2077 | 2071 | | |
2078 | 2072 | | |
| |||
2096 | 2090 | | |
2097 | 2091 | | |
2098 | 2092 | | |
2099 | | - | |
| 2093 | + | |
2100 | 2094 | | |
2101 | 2095 | | |
2102 | 2096 | | |
| |||
Lines changed: 18 additions & 24 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1959 | 1959 | | |
1960 | 1960 | | |
1961 | 1961 | | |
1962 | | - | |
1963 | | - | |
1964 | | - | |
1965 | | - | |
1966 | | - | |
1967 | | - | |
1968 | | - | |
1969 | | - | |
1970 | 1962 | | |
1971 | 1963 | | |
1972 | 1964 | | |
| |||
2051 | 2043 | | |
2052 | 2044 | | |
2053 | 2045 | | |
| 2046 | + | |
| 2047 | + | |
| 2048 | + | |
| 2049 | + | |
| 2050 | + | |
| 2051 | + | |
| 2052 | + | |
| 2053 | + | |
| 2054 | + | |
| 2055 | + | |
| 2056 | + | |
2054 | 2057 | | |
2055 | 2058 | | |
2056 | | - | |
2057 | | - | |
2058 | | - | |
2059 | | - | |
2060 | | - | |
2061 | | - | |
2062 | | - | |
| 2059 | + | |
2063 | 2060 | | |
2064 | 2061 | | |
2065 | 2062 | | |
2066 | 2063 | | |
2067 | 2064 | | |
2068 | | - | |
2069 | | - | |
2070 | | - | |
2071 | | - | |
2072 | | - | |
2073 | | - | |
2074 | | - | |
2075 | | - | |
| 2065 | + | |
| 2066 | + | |
| 2067 | + | |
| 2068 | + | |
| 2069 | + | |
2076 | 2070 | | |
2077 | 2071 | | |
2078 | 2072 | | |
| |||
2096 | 2090 | | |
2097 | 2091 | | |
2098 | 2092 | | |
2099 | | - | |
| 2093 | + | |
2100 | 2094 | | |
2101 | 2095 | | |
2102 | 2096 | | |
| |||
Lines changed: 16 additions & 14 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
298 | 298 | | |
299 | 299 | | |
300 | 300 | | |
301 | | - | |
302 | | - | |
| 301 | + | |
| 302 | + | |
303 | 303 | | |
304 | 304 | | |
305 | 305 | | |
306 | | - | |
307 | | - | |
308 | | - | |
309 | | - | |
310 | | - | |
| 306 | + | |
311 | 307 | | |
312 | | - | |
| 308 | + | |
313 | 309 | | |
314 | | - | |
315 | | - | |
316 | | - | |
317 | | - | |
318 | | - | |
| 310 | + | |
319 | 311 | | |
320 | 312 | | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
321 | 323 | | |
322 | 324 | | |
323 | 325 | | |
| |||
389 | 391 | | |
390 | 392 | | |
391 | 393 | | |
392 | | - | |
| 394 | + | |
393 | 395 | | |
394 | 396 | | |
395 | 397 | | |
| |||
Lines changed: 20 additions & 15 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
306 | 306 | | |
307 | 307 | | |
308 | 308 | | |
309 | | - | |
| 309 | + | |
310 | 310 | | |
311 | 311 | | |
312 | | - | |
| 312 | + | |
313 | 313 | | |
314 | 314 | | |
315 | 315 | | |
316 | | - | |
317 | | - | |
318 | | - | |
319 | | - | |
320 | | - | |
321 | | - | |
322 | | - | |
323 | | - | |
324 | | - | |
325 | | - | |
326 | | - | |
327 | | - | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
328 | 333 | | |
329 | 334 | | |
330 | 335 | | |
| |||
426 | 431 | | |
427 | 432 | | |
428 | 433 | | |
429 | | - | |
| 434 | + | |
430 | 435 | | |
431 | 436 | | |
432 | 437 | | |
| |||
0 commit comments