Context
Assemble context
Get an engine's answer and the memories that relate to it in one call, and save the turn to memory.
/v1/context/assembleAnswers a question from an engine, recalls the related memories from a memory space, and saves the question and answer back to that space, all in one call. Use it to build an assistant turn without separate query, recall, and write requests.
Body
engine_idstring<uuid>requiredThe engine to answer from.
querystringrequiredThe question, up to 4,000 characters.
memory_space_idstring<uuid> | nullThe memory space to recall from and save the turn to. Leave it out to get only the engine's answer.
user_refstring | nullYour own reference for the person asking, stored with the saved turn.
top_kintegerdefault: 8How many chunks the engine searches for, from 1 to 50.
query_modestringdefault: preciseThe answer mode. See Answer modes.
write_to_memorybooleandefault: trueSave the question and answer as a memory in memory_space_id.
Memory context comes from the space's space-level memory. To recall one person's memories in a multi-user space, call Search memories with an end_user.
Response
answerstringrequiredThe engine's answer.
citationsobject[]requiredThe chunks the answer is based on.
confidencenumberrequiredHow well the sources support the answer, from 0 to 1.
memory_contextobject[]requiredUp to 5 related memories, each with id, content, memory_type, and confidence_score. Empty without a memory_space_id.
memory_writtenbooleanrequiredWhether the turn was saved to memory.
query_modestringrequiredThe answer mode that was used.
Status codes
| Status | Meaning |
|---|---|
200 | The engine answered, and memory was read and written as requested. |
400 | The question couldn't be answered as sent. |
401 | The key is missing, malformed, or revoked. |
403 | The key's capability or scope doesn't allow reading this engine or using this memory space. |
404 | The engine or memory space doesn't exist in the key's workspace. |
422 | A field is missing or invalid. |