Get message
Introduced 2.12
Use this API to retrieve message information for conversational search.
To retrieve message information, you can:
When the Security plugin is enabled, all memories exist in a private
security mode. Only the user who created a memory can interact with that memory and its messages.
Get a message by ID
You can retrieve message information by using the message_id
.
Path and HTTP methods
GET /_plugins/_ml/memory/message/<message_id>
Path parameters
The following table lists the available path parameters.
Parameter | Data type | Description |
---|---|---|
message_id | String | The ID of the message to retrieve. |
Example request
GET /_plugins/_ml/memory/message/0m8ya40BfUsSoeNTj-pU
copy
Example response
{
"memory_id": "gW8Aa40BfUsSoeNTvOKI",
"message_id": "0m8ya40BfUsSoeNTj-pU",
"create_time": "2024-02-02T19:01:32.113621539Z",
"input": null,
"prompt_template": null,
"response": "Hello, this is OpenAI. Here is the answer to your question.",
"origin": null,
"additional_info": {
"suggestion": "api.openai.com"
}
}
For information about response fields, see Create Message request fields.
Get all messages within a memory
Use this command to get a list of messages for a certain memory.
Path and HTTP methods
GET /_plugins/_ml/memory/<memory_id>/messages
Path parameters
The following table lists the available path parameters.
Parameter | Data type | Description |
---|---|---|
memory_id | String | The ID of the memory for which to retrieve messages. |
Example request
GET /_plugins/_ml/memory/gW8Aa40BfUsSoeNTvOKI/messages
copy
POST /_plugins/_ml/message/_search
{
"query": {
"match_all": {}
},
"size": 1000
}
copy
Example response
{
"messages": [
{
"memory_id": "gW8Aa40BfUsSoeNTvOKI",
"message_id": "BW8ha40BfUsSoeNT8-i3",
"create_time": "2024-02-02T18:43:23.566994302Z",
"input": "How do I make an interaction?",
"prompt_template": "Hello OpenAI, can you answer this question?",
"response": "Hello, this is OpenAI. Here is the answer to your question.",
"origin": "MyFirstOpenAIWrapper",
"additional_info": {
"suggestion": "api.openai.com"
}
},
{
"memory_id": "gW8Aa40BfUsSoeNTvOKI",
"message_id": "0m8ya40BfUsSoeNTj-pU",
"create_time": "2024-02-02T19:01:32.113621539Z",
"input": null,
"prompt_template": null,
"response": "Hello, this is OpenAI. Here is the answer to your question.",
"origin": null,
"additional_info": {
"suggestion": "api.openai.com"
}
}
]
}
Response fields
For information about response fields, see Create Message request fields.