mirror of
https://github.com/supermemoryai/supermemory.git
synced 2026-11-09 08:17:31 +00:00
Merge 3119e9e0d6 into 8b47bd17c2
This commit is contained in:
commit
38e51d7ca1
3 changed files with 25 additions and 0 deletions
|
|
@ -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(
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
})
|
||||
})
|
||||
|
|
|
|||
|
|
@ -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.",
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue