langchain.js
    Preparing search index...

    Interface VectorStoreRetrieverInterface<V>

    Interface for a retriever that uses a vector store to store and retrieve document embeddings. This retriever interface allows for adding documents to the underlying vector store and conducting retrieval operations.

    VectorStoreRetrieverInterface extends BaseRetrieverInterface to provide document retrieval capabilities based on vector similarity.

    VectorStoreRetrieverInterface

    interface VectorStoreRetrieverInterface<
        V extends VectorStoreInterface = VectorStoreInterface,
    > {
        lc_serializable: boolean;
        vectorStore: V;
        get lc_id(): string[];
        addDocuments(
            documents: DocumentInterface<Record<string, any>>[],
            options?: AddDocumentOptions,
        ): Promise<void | string[]>;
        batch(
            inputs: string[],
            options?:
                | Partial<RunnableConfig<Record<string, any>>>
                | Partial<RunnableConfig<Record<string, any>>>[],
            batchOptions?: RunnableBatchOptions & { returnExceptions?: false },
        ): Promise<DocumentInterface<Record<string, any>>[][]>;
        batch(
            inputs: string[],
            options?:
                | Partial<RunnableConfig<Record<string, any>>>
                | Partial<RunnableConfig<Record<string, any>>>[],
            batchOptions?: RunnableBatchOptions & { returnExceptions: true },
        ): Promise<(DocumentInterface<Record<string, any>>[] | Error)[]>;
        batch(
            inputs: string[],
            options?:
                | Partial<RunnableConfig<Record<string, any>>>
                | Partial<RunnableConfig<Record<string, any>>>[],
            batchOptions?: RunnableBatchOptions,
        ): Promise<(DocumentInterface<Record<string, any>>[] | Error)[]>;
        getName(suffix?: string): string;
        getRelevantDocuments(
            query: string,
            config?: Callbacks | BaseCallbackConfig,
        ): Promise<DocumentInterface<Record<string, any>>[]>;
        invoke(
            input: string,
            options?: Partial<RunnableConfig<Record<string, any>>>,
        ): Promise<DocumentInterface<Record<string, any>>[]>;
        stream(
            input: string,
            options?: Partial<RunnableConfig<Record<string, any>>>,
        ): Promise<
            IterableReadableStreamInterface<
                DocumentInterface<Record<string, any>>[],
            >,
        >;
        transform(
            generator: AsyncGenerator<string>,
            options: Partial<CallOptions>,
        ): AsyncGenerator<DocumentInterface<Record<string, any>>[]>;
    }

    Type Parameters

    Hierarchy (View Summary)

    Implemented by

    Index

    Properties

    lc_serializable: boolean
    vectorStore: V

    Accessors

    • get lc_id(): string[]

      Returns string[]

    Methods

    • Adds an array of documents to the vector store.

      This method embeds the provided documents and stores them within the vector store. Additional options can be specified for custom behavior during the addition process.

      Parameters

      • documents: DocumentInterface<Record<string, any>>[]

        An array of documents to embed and add to the vector store.

      • Optionaloptions: AddDocumentOptions

        Optional settings to customize document addition.

      Returns Promise<void | string[]>

      A promise that resolves to an array of document IDs or void, depending on the implementation.

    • Parameters

      • Optionalsuffix: string

      Returns string

    • Retrieves documents relevant to a given query, allowing optional configurations for customization.

      Parameters

      • query: string

        A string representing the query to search for relevant documents.

      • Optionalconfig: Callbacks | BaseCallbackConfig

        (optional) Configuration options for the retrieval process, which may include callbacks and additional context settings.

      Returns Promise<DocumentInterface<Record<string, any>>[]>

      A promise that resolves to an array of DocumentInterface instances, each containing metadata specified by the Metadata type parameter.