Skip to Content

Interface ImportResult

What MemoryOperations.importMemories returns.

Each memory is judged on its own, so a refused entry does not stop the others and there is no whole-batch verdict to read: walk results and act per entry.

ImportOutcome.index indexes the array the caller passed, whatever the service's per-call batch limit happens to be. A long batch goes out as several calls, each numbering its own results from zero, and the SDK renumbers them back; without that a split batch would report position 0 once per call and identify nothing.

instructions comes from the first of those calls — they are one operation in one domain, so their guidance is the same.

const result = await client.memory.importMemories(batch, {
domain: 'coding'
})
for (const outcome of result.results) {
if (outcome.status === ImportStatus.REJECTED) {
console.log(outcome.index, [...batch[outcome.index].queries][0])
for (const problem of outcome.errors) {
console.log(` ${problem}`)
}
}
}
interface ImportResult {
    results: readonly ImportOutcome[];
    instructions: Instructions;
}
Index
results: readonly ImportOutcome[]

One outcome per memory sent, in the order they were sent.

instructions: Instructions

What the service asks the caller to do next.