This commit is contained in:
Dhravya Shah 2026-11-02 02:20:14 +00:00 • committed by GitHub
commit 38e51d7ca1
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 25 additions and 0 deletions

View file

@ -8,6 +8,7 @@ import {
BulkDeleteMemoriesSchema,
ConnectionResponseSchema,
ContainerTagSettingsUpdateSchema,
DreamingSchema,
CreateProjectSchema,
DeleteProjectResponseSchema,
DeleteProjectSchema,
@ -231,6 +232,7 @@ export const apiSchema = createSchema({
containerTag: z.string().optional(),
entityContext: z.string().max(1500).optional(),
metadata: z.record(z.unknown()).optional(),
dreaming: DreamingSchema.optional(),
}),
output: z.object({
results: z.array(

View file

@ -4,6 +4,7 @@ import {
BulkDeleteMemoriesSchema,
DocumentsWithMemoriesQuerySchema,
ListMemoriesQuerySchema,
MemoryAddSchema,
SearchRequestSchema,
Searchv4RequestSchema,
} from "./api"
@ -175,3 +176,18 @@ describe("pagination query schemas", () => {
expect(BulkDeleteMemoriesSchema.safeParse(ok).success).toBe(true)
})
})
describe("document add schemas", () => {
it("keeps dreaming on add requests", () => {
expect(
MemoryAddSchema.parse({ content: "probe", dreaming: "instant" }),
).toEqual({ content: "probe", dreaming: "instant" })
})
it("rejects unknown dreaming modes", () => {
expect(
MemoryAddSchema.safeParse({ content: "probe", dreaming: "eager" })
.success,
).toBe(false)
})
})

View file

@ -138,6 +138,12 @@ export const MemorySchema = z
example: exampleMemory,
})
export const DreamingSchema = z.enum(["dynamic", "instant"]).openapi({
description:
'Processing mode. "dynamic" (default) groups related documents together before extracting memories; "instant" processes each document on its own right away.',
example: "instant",
})
export const MemoryUpdateSchema = z.object({
containerTags: z
.array(z.string())
@ -157,6 +163,7 @@ export const MemoryUpdateSchema = z.object({
"Optional custom ID of the memory. This could be an ID from your database that will uniquely identify this memory.",
example: "mem_abc123",
}),
dreaming: DreamingSchema.optional(),
entityContext: z.string().max(1500).optional().openapi({
description:
"Context for memory extraction on this container tag. Helps guide how memories are extracted and understood.",