-
Notifications
You must be signed in to change notification settings - Fork 617
Add comprehensive agentic memory API documentation for OpenSearch 3.3 #11169
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 5 commits
b08069d
b0144d7
10fb3cc
5ec0870
8a8ef96
eb75f4e
014d9ba
7c976f2
7428307
ab7fd46
c5a4cc8
ee90e24
e82965d
56a10a2
f4d4bbf
1340f34
b18236c
fdbd793
0a258d2
2e2ed16
f7d8364
32d60a6
e09a08e
7775179
a097c34
3f6e899
8ad80e2
5bec8d3
51926fd
f9e8b86
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||
---|---|---|---|---|---|---|---|---|---|---|
|
@@ -10,10 +10,14 @@ | |||||||||
**Introduced 3.2** | ||||||||||
{: .label .label-purple } | ||||||||||
|
||||||||||
This is an experimental feature and is not recommended for use in a production environment. For updates on the progress of the feature or if you want to leave feedback, join the discussion on the [OpenSearch forum](https://forum.opensearch.org/). | ||||||||||
{: .warning} | ||||||||||
|
||||||||||
Use this API to add an agentic memory to a [memory container]({{site.url}}{{site.baseurl}}/ml-commons-plugin/api/agentic-memory-apis/create-memory-container). You can create a memory in one of the following modes (controlled by the `infer` parameter): | ||||||||||
Use this API to add an agentic memory to a [memory container]({{site.url}}{{site.baseurl}}/ml-commons-plugin/api/agentic-memory-apis/create-memory-container). You can create memories in two types: | ||||||||||
|
||||||||||
- **Conversation memory** -- Stores conversational messages between users and assistants. Can be processed (when `infer` is `true`) to extract facts or stored as raw messages. | ||||||||||
|
- **Conversation memory** -- Stores conversational messages between users and assistants. Can be processed (when `infer` is `true`) to extract facts or stored as raw messages. | |
- **conversational** -- Stores conversational messages between users and assistants. |
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- **Data memory** -- Stores structured, non-conversational data such as agent state, checkpoints, or reference information. | |
- **data** -- Stores extra messages, structured, non-conversational data such as agent state, checkpoints, or reference information. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add some description before showing infer=true/false ? For example add this
User can use infer
to choose to extract key information from raw messages or not.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems misunderstood my comments. Check the preview of this doc, it shows
provide memory payload in two types:
- conversational: ...
- data: ...
- infer: ...
Let's keep it simple, just remove this infer line, just merge this infer parameter description to the infer row in the fields table ?
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- Fact memory -- A processed representation of the message. The large language model (LLM) associated with the memory container extracts and stores key factual information or knowledge from the original text. | |
- **infer=true** -- Use large language model (LLM) to extract key information or knowledge from the messages. |
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
`messages` | List | Conditional | A list of messages for conversation memory. Each message requires `content` and may include a `role` (commonly, `user` or `assistant`) when `infer` is set to `true`. Required for `memory_type` of `conversation`. | |
`messages` | List | Conditional | A list of messages for conversational payload. Each message requires `content` and may include a `role` (commonly, `user` or `assistant`) when `infer` is set to `true`. Required for `payload_type` of `conversational`. |
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
`structured_data` | Object | Conditional | Structured data content for data memory. Required for `memory_type` of `data`. | |
`structured_data` | Map<String, Object> | Conditional | Structured data content for data memory. Required for `memory_type` of `data`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add a new row for binary_data
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And metadata
also?
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
`memory_type` | String | Required | The type of memory: `conversation` or `data`. | |
`payload_type` | String | Required | The type of payload: `conversational` or `data`. |
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
`namespace` | Object | Optional | Namespace context for organizing memories (e.g., `user_id`, `session_id`, `agent_id`). | |
`namespace` | List<String> | Optional | Namespace context for organizing memories (e.g., `user_id`, `session_id`, `agent_id`). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Explain more details
If session_id
not exists in namespace
will create a new session and use the new session's id
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
`metadata` | Object | Optional | Additional metadata for the memory (e.g., `status`, `branch`, custom fields). | |
`metadata` | Map<String, String> | Optional | Additional metadata for the memory (e.g., `status`, `branch`, custom fields). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
From the code looks like it's Map<String, Object>
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add a new row for tags
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove these two lines: 45, 46
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
`infer` | Boolean | Optional | Controls whether the LLM infers context from messages. Default is `true` for conversation memory, `false` for data memory. When `true`, the LLM extracts factual information from the original text and stores it as the memory. When `false`, the memory contains the unprocessed message and you must explicitly specify the `role` in each message. | |
`infer` | Boolean | Optional | Controls whether use LLM to extract key information from messages. Default is `false`. When `true`, the LLM extracts key information from the original text and stores it as the memory. |
Check failure on line 52 in _ml-commons-plugin/api/agentic-memory-apis/add-memory.md
GitHub Actions / style-job
[vale] reported by reviewdog 🐶
[OpenSearch.StackedHeadings] Do not stack headings. Insert an introductory sentence between headings.
Raw Output:
{"message": "[OpenSearch.StackedHeadings] Do not stack headings. Insert an introductory sentence between headings.", "location": {"path": "_ml-commons-plugin/api/agentic-memory-apis/add-memory.md", "range": {"start": {"line": 52, "column": 1}}}, "severity": "ERROR"}
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
### Conversation memory | |
### Conversational payload |
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"memory_type": "conversation" | |
"payload_type": "conversational" |
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
### Data memory | |
### Data payload | |
Store agent state in working memory: |
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"memory_type": "data" | |
"payload_type": "data" |
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
### Trace data memory | |
Store agent trace data in working memory: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't clearly follow this suggestion. you want me to remove ### Trace data memory
section?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I mean the Trace data should be one kind of data type payload, we don't need to make it as same level of ### Data payload
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"memory_type": "conversation" | |
"payload_type": "conversation" |
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -10,14 +10,13 @@ nav_order: 10 | |||||
**Introduced 3.2** | ||||||
{: .label .label-purple } | ||||||
|
||||||
This is an experimental feature and is not recommended for use in a production environment. For updates on the progress of the feature or if you want to leave feedback, join the discussion on the [OpenSearch forum](https://forum.opensearch.org/). | ||||||
{: .warning} | ||||||
|
||||||
Use this API to create a memory container to hold agentic memories. The container can have two model types associated with it: | ||||||
|
||||||
- A text embedding model for vectorizing the message so it can be searched. Use a text embedding model for dense vector embeddings or a sparse encoding model for sparse vector formats. If no embedding model is specified, messages are stored but cannot be used for vector-based searches. | ||||||
natebower marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
- A large language model (LLM) for reasoning over the message to produce factual or processed content. If no LLM is specified, messages are stored directly, without applying inference. | ||||||
|
||||||
**Note**: LLM connectors must support `system_prompt` and `user_prompt` parameters for agentic memory processing. The default `llm_result_path` is configured for Bedrock Converse API format (`"$.output.message.content[0].text"`). | ||||||
natebower marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||||||
|
||||||
Once a memory container is created, you'll provide its `memory_container_id` to other APIs. | ||||||
|
||||||
## Prerequisites | ||||||
|
@@ -143,33 +142,110 @@ Field | Data type | Required/Optional | Description | |||||
:--- | :--- | :--- | :--- | ||||||
`name` | String | Required | The name of the memory container. | ||||||
`description` | String | Optional | The description of the memory container. | ||||||
`memory_storage_config` | Object | Optional | The memory storage configuration. See [the `memory_storage_config` object](#the-memory_storage_config-object). | ||||||
`configuration` | Object | Required | The memory container configuration. See [the `configuration` object](#the-configuration-object). | ||||||
|
||||||
|
||||||
### The memory_storage_config object | ||||||
### The configuration object | ||||||
|
||||||
The `memory_storage_config` object supports the following fields. | ||||||
The `configuration` object supports the following fields. | ||||||
|
||||||
Field | Data type | Required/Optional | Description | ||||||
:--- | :--- | :--- | :--- | ||||||
`dimension` | Integer | Optional | The dimension of the embedding model. Required if `embedding_model_type` is `TEXT_EMBEDDING`. | ||||||
`embedding_model_id` | String | Optional | The embedding model ID. | ||||||
`embedding_model_type` | String | Optional | The embedding model type. Supported types are `TEXT_EMBEDDING` and `SPARSE_ENCODING`. | ||||||
`llm_model_id` | String | Optional | The LLM ID. | ||||||
`max_infer_size` | Integer | Optional | The maximum number of messages the LLM processes for inference in a single request. Valid values are 1--9, inclusive. Default is 5. | ||||||
`memory_index_name` | String | Optional | The name of the index in which to save messages, embeddings, and inferred facts. If not specified, a default index is automatically generated. | ||||||
`embedding_model_id` | String | Optional | The embedding model ID. | ||||||
`embedding_dimension` | Integer | Optional | The dimension of the embedding model. Required if `embedding_model_type` is `TEXT_EMBEDDING`. | ||||||
`llm_id` | String | Optional | The LLM model ID for processing and inference. | ||||||
`index_prefix` | String | Optional | Custom prefix for the memory indices. If not specified, a default prefix is used. | ||||||
|
||||||
`use_system_index` | Boolean | Optional | Whether to use system indices. Default is `true`. | ||||||
`strategies` | Array | Optional | Array of memory processing strategies. See [the `strategies` array](#the-strategies-array). | ||||||
`parameters` | Object | Optional | Global parameters for the memory container. See [the `parameters` object](#the-parameters-object). | ||||||
|
||||||
### The strategies array | ||||||
|
||||||
Each strategy in the `strategies` array supports the following fields. | ||||||
|
||||||
Field | Data type | Required/Optional | Description | ||||||
:--- | :--- | :--- | :--- | ||||||
`type` | String | Required | The strategy type: `SEMANTIC`, `USER_PREFERENCE`, or `SUMMARY`. | ||||||
|
||||||
`namespace` | Array | Required | Array of namespace dimensions for organizing memories (e.g., `["user_id"]`, `["agent_id"]`). | ||||||
|
`namespace` | Array | Required | Array of namespace dimensions for organizing memories (e.g., `["user_id"]`, `["agent_id"]`). | |
`namespace` | Array | Required | Array of namespace dimensions for organizing memories (e.g., `["user_id"]`, `["agent_id", "session_id"]`). |
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
`configuration` | Object | Optional | Strategy-specific configuration. See [the strategy `configuration` object](#the-strategy-configuration-object). | |
`configuration` | Map<String, Object> | Optional | Strategy-specific configuration. See [the strategy `configuration` object](#the-strategy-configuration-object). |
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We also support
system_prompt
, so user can override the default strategy prompt.llm_id
, user can set different LLM for each strategy
natebower marked this conversation as resolved.
Show resolved
Hide resolved
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All of these three strategies shows llm_result_path
example.
Let's also show the system_prompt
and llm_id
example?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.