Simple retriever options.

interface SimpleRetrieverOptions<C extends ZodTypeAny = ZodTypeAny, R = any> {
    configSchema?: C;
    content?:
        | string
        | (
            item: R,
        ) =>
            | string
            | (
                | { media?: undefined; text: string }
                | { media: { contentType?: string; url: string }; text?: undefined }
            )[];
    metadata?: string[] | (item: R) => undefined | Record<string, any>;
    name: string;
}

Type Parameters

Properties

configSchema?: C

A Zod schema containing any configuration info available beyond the query.

content?:
    | string
    | (
        item: R,
    ) =>
        | string
        | (
            | { media?: undefined; text: string }
            | { media: { contentType?: string; url: string }; text?: undefined }
        )[]

Specifies how to extract content from the returned items.

  • If a string, specifies the key of the returned item to extract as content.
  • If a function, allows you to extract content as text or a document part.
metadata?: string[] | (item: R) => undefined | Record<string, any>

Specifies how to extract metadata from the returned items.

  • If an array of strings, specifies list of keys to extract from returned objects.
  • If a function, allows you to use custom behavior to extract metadata from returned items.
name: string

The name of the retriever you're creating.