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

  1. GET /_plugins/_ml/memory/message/<message_id>

Path parameters

The following table lists the available path parameters.

ParameterData typeDescription
message_idStringThe ID of the message to retrieve.

Example request

  1. GET /_plugins/_ml/memory/message/0m8ya40BfUsSoeNTj-pU

copy

Example response

  1. {
  2. "memory_id": "gW8Aa40BfUsSoeNTvOKI",
  3. "message_id": "0m8ya40BfUsSoeNTj-pU",
  4. "create_time": "2024-02-02T19:01:32.113621539Z",
  5. "input": null,
  6. "prompt_template": null,
  7. "response": "Hello, this is OpenAI. Here is the answer to your question.",
  8. "origin": null,
  9. "additional_info": {
  10. "suggestion": "api.openai.com"
  11. }
  12. }

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

  1. GET /_plugins/_ml/memory/<memory_id>/messages

Path parameters

The following table lists the available path parameters.

ParameterData typeDescription
memory_idStringThe ID of the memory for which to retrieve messages.

Example request

  1. GET /_plugins/_ml/memory/gW8Aa40BfUsSoeNTvOKI/messages

copy

  1. POST /_plugins/_ml/message/_search
  2. {
  3. "query": {
  4. "match_all": {}
  5. },
  6. "size": 1000
  7. }

copy

Example response

  1. {
  2. "messages": [
  3. {
  4. "memory_id": "gW8Aa40BfUsSoeNTvOKI",
  5. "message_id": "BW8ha40BfUsSoeNT8-i3",
  6. "create_time": "2024-02-02T18:43:23.566994302Z",
  7. "input": "How do I make an interaction?",
  8. "prompt_template": "Hello OpenAI, can you answer this question?",
  9. "response": "Hello, this is OpenAI. Here is the answer to your question.",
  10. "origin": "MyFirstOpenAIWrapper",
  11. "additional_info": {
  12. "suggestion": "api.openai.com"
  13. }
  14. },
  15. {
  16. "memory_id": "gW8Aa40BfUsSoeNTvOKI",
  17. "message_id": "0m8ya40BfUsSoeNTj-pU",
  18. "create_time": "2024-02-02T19:01:32.113621539Z",
  19. "input": null,
  20. "prompt_template": null,
  21. "response": "Hello, this is OpenAI. Here is the answer to your question.",
  22. "origin": null,
  23. "additional_info": {
  24. "suggestion": "api.openai.com"
  25. }
  26. }
  27. ]
  28. }

Response body fields

For information about response fields, see Create Message request fields.