mirror of
https://github.com/supermemoryai/supermemory.git
synced 2026-11-04 07:30:17 +00:00
refactor(validation): add dreaming directly to MemoryUpdateSchema
Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
This commit is contained in:
parent
0025cfe519
commit
3119e9e0d6
2 changed files with 8 additions and 16 deletions
|
|
@ -5,7 +5,6 @@ import {
|
|||
DocumentsWithMemoriesQuerySchema,
|
||||
ListMemoriesQuerySchema,
|
||||
MemoryAddSchema,
|
||||
MemoryUpdateSchema,
|
||||
SearchRequestSchema,
|
||||
Searchv4RequestSchema,
|
||||
} from "./api"
|
||||
|
|
@ -191,10 +190,4 @@ describe("document add schemas", () => {
|
|||
.success,
|
||||
).toBe(false)
|
||||
})
|
||||
|
||||
it("does not add dreaming to update requests", () => {
|
||||
expect(
|
||||
MemoryUpdateSchema.parse({ content: "probe", dreaming: "instant" }),
|
||||
).toEqual({ content: "probe" })
|
||||
})
|
||||
})
|
||||
|
|
|
|||
|
|
@ -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.",
|
||||
|
|
@ -170,15 +177,7 @@ export const MemoryUpdateSchema = z.object({
|
|||
}),
|
||||
})
|
||||
|
||||
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 MemoryAddSchema = MemoryUpdateSchema.extend({
|
||||
dreaming: DreamingSchema.optional(),
|
||||
})
|
||||
export const MemoryAddSchema = MemoryUpdateSchema
|
||||
|
||||
export const PaginationSchema = z
|
||||
.object({
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue