langchain.js
    Preparing search index...

    A vector store using LibSQL/Turso for storage and retrieval.

    Type Parameters

    • Metadata extends MetadataDefault = MetadataDefault

    Hierarchy (View Summary)

    Index

    Constructors

    • Initializes a new instance of the LibSQLVectorStore.

      Type Parameters

      • Metadata extends MetadataDefault = MetadataDefault

      Parameters

      • embeddings: EmbeddingsInterface

        The embeddings interface to use.

      • options: LibSQLVectorStoreArgs

        Configuration options for the vector store.

      Returns LibSQLVectorStore<Metadata>

    Properties

    FilterType: InStatement | WhereCondition<Metadata>

    Methods

    • Returns the type of vector store.

      Returns string

      The string "libsql".

    • Adds documents to the vector store.

      Parameters

      • documents: Document<Metadata>[]

        The documents to add.

      Returns Promise<string[]>

      The IDs of the added documents.

    • Adds vectors to the vector store.

      Parameters

      • vectors: number[][]

        The vectors to add.

      • documents: Document<Metadata>[]

        The documents associated with the vectors.

      Returns Promise<string[]>

      The IDs of the added vectors.

    • Deletes vectors from the store.

      Parameters

      • params: { deleteAll?: boolean; ids?: string[] | number[] }

        Delete parameters.

        • OptionaldeleteAll?: boolean
        • Optionalids?: string[] | number[]

          The ids of the vectors to delete.

      Returns Promise<void>

    • Performs a similarity search using a vector query and returns documents with their scores.

      Parameters

      • query: number[]

        The query vector.

      • k: number

        The number of results to return.

      • Optionalfilter: InStatement | WhereCondition<Metadata>

      Returns Promise<[Document<Metadata>, number][]>

      An array of tuples containing the similar documents and their scores.

    • Creates a new LibSQLVectorStore instance from documents.

      Type Parameters

      • Metadata extends MetadataDefault = MetadataDefault

      Parameters

      • docs: Document<Metadata>[]

        The documents to add to the store.

      • embeddings: EmbeddingsInterface

        The embeddings interface to use.

      • Optionaloptions: LibSQLVectorStoreArgs

        Configuration options for the vector store.

      Returns Promise<LibSQLVectorStore<Metadata>>

      A new LibSQLVectorStore instance.

    • Creates a new LibSQLVectorStore instance from texts.

      Type Parameters

      • Metadata extends MetadataDefault = MetadataDefault

      Parameters

      • texts: string[]

        The texts to add to the store.

      • metadatas: Metadata | Metadata[]

        The metadata for the texts.

      • embeddings: EmbeddingsInterface

        The embeddings interface to use.

      • Optionaloptions: LibSQLVectorStoreArgs

        Configuration options for the vector store.

      Returns Promise<LibSQLVectorStore<Metadata>>

      A new LibSQLVectorStore instance.