Skip to main content
POST
/
product
/
chat
/
stream
Chat with MemOS
curl --request POST \
  --url https://api.example.com/product/chat/stream \
  --header 'Content-Type: application/json' \
  --data '
{
  "user_id": "<string>",
  "query": "<string>",
  "readable_cube_ids": [
    "<string>"
  ],
  "writable_cube_ids": [
    "<string>"
  ],
  "history": [
    {
      "content": "<string>",
      "role": "<string>",
      "name": "<string>",
      "chat_time": "<string>",
      "message_id": "<string>"
    }
  ],
  "mode": "fast",
  "system_prompt": "<string>",
  "top_k": 10,
  "session_id": "<string>",
  "include_preference": true,
  "pref_top_k": 6,
  "model_name_or_path": "<string>",
  "max_tokens": 123,
  "temperature": 123,
  "top_p": 123,
  "add_message_on_answer": true,
  "filter": {},
  "internet_search": false,
  "threshold": 0.5,
  "moscube": false,
  "mem_cube_id": "<string>"
}
'
{
  "detail": [
    {
      "loc": [
        "<string>"
      ],
      "msg": "<string>",
      "type": "<string>"
    }
  ]
}

Body

application/json

Request model for chat operations.

This model is used as the algorithm-facing chat interface, while also remaining backward compatible with older developer-facing APIs.

user_id
string
required

User ID

query
string
required

Chat query message

readable_cube_ids
string[] | null

List of cube IDs user can read for multi-cube chat

writable_cube_ids
string[] | null

List of cube IDs user can write for multi-cube chat

history
(ChatCompletionSystemMessageParam · object | ChatCompletionUserMessageParam · object | ChatCompletionAssistantMessageParam · object | ChatCompletionToolMessageParam · object)[] | null

Chat history

mode
enum<string>
default:fast

search mode: fast, fine, or mixture

Available options:
fast,
fine,
mixture
system_prompt
string | null

Base system prompt to use for chat

top_k
integer
default:10

Number of results to return

session_id
string | null

Session ID for soft-filtering memories

include_preference
boolean
default:true

Whether to handle preference memory

pref_top_k
integer
default:6

Number of preference results to return

model_name_or_path
string | null

Model name to use for chat

max_tokens
integer | null

Max tokens to generate

temperature
number | null

Temperature for sampling

top_p
number | null

Top-p (nucleus) sampling parameter

add_message_on_answer
boolean
default:true

Add dialogs to memory after chat

filter
Filter · object
Filter for the memory, example:
{
"`and` or `or`": [
{"id": "uuid-xxx"},
{"created_at": {"gt": "2024-01-01"}},
]
}

Whether to use internet search

threshold
number
default:0.5

Threshold for filtering references

moscube
boolean
default:false

(Deprecated) Whether to use legacy MemOSCube pipeline.

mem_cube_id
string | null

(Deprecated) Single cube ID to use for chat. Prefer readable_cube_ids / writable_cube_ids for multi-cube chat.

Response

Successful Response