langchain.js
    Preparing search index...

    The main class that extends the 'VectorStore' class. It provides methods for interacting with Upstash index, such as adding documents, deleting documents, performing similarity search and more.

    Hierarchy (View Summary)

    Index

    Constructors

    Properties

    caller: AsyncCaller
    filter?: string
    FilterType: string
    index: Index
    namespace?: string
    useUpstashEmbeddings?: boolean

    Methods

    • This method adds the provided documents to Upstash database. The pageContent of the documents will be embedded by Upstash Embeddings.

      Parameters

      • documents: DocumentInterface[]

        Array of Document objects to be added to the Upstash database.

      • Optionaloptions: { ids?: string[] }

        Optional object containing the array of ids for the documents.

      Returns Promise<string[]>

      Promise that resolves with the ids of the provided documents when the upsert operation is done.

    • Parameters

      • query: string | number[]
      • k: number
      • Optionalfilter: string
      • Optionaloptions: { includeVectors: boolean }

      Returns Promise<QueryResult<UpstashQueryMetadata>[]>

    • Returns string

    • This method adds documents to Upstash database. Documents are first converted to vectors using the provided embeddings instance, and then upserted to the database.

      Parameters

      • documents: DocumentInterface[]

        Array of Document objects to be added to the database.

      • Optionaloptions: { ids?: string[]; useUpstashEmbeddings?: boolean }

        Optional object containing array of ids for the documents.

      Returns Promise<string[]>

      Promise that resolves with the ids of the provided documents when the upsert operation is done.

    • This method adds the provided vectors to Upstash database.

      Parameters

      • vectors: number[][]

        Array of vectors to be added to the Upstash database.

      • documents: DocumentInterface[]

        Array of Document objects, each associated with a vector.

      • Optionaloptions: { ids?: string[] }

        Optional object containing the array of ids foor the vectors.

      Returns Promise<string[]>

      Promise that resolves with the ids of the provided documents when the upsert operation is done.

    • This method deletes documents from the Upstash database. You can either provide the target ids, or delete all vectors in the database.

      Parameters

      • params: UpstashDeleteParams

        Object containing either array of ids of the documents or boolean deleteAll.

      Returns Promise<void>

      Promise that resolves when the specified documents have been deleted from the database.

    • This method performs a similarity search in the Upstash database over the existing vectors.

      Parameters

      • query: string | number[]

        Query vector for the similarity search.

      • k: number

        The number of similar vectors to return as result.

      • Optionalfilter: string

      Returns Promise<[DocumentInterface, number][]>

      Promise that resolves with an array of tuples, each containing Document object and similarity score. The length of the result will be maximum of 'k' and vectors in the index.

    • This method creates a new UpstashVector instance from an array of Document instances.

      Parameters

      • docs: DocumentInterface[]

        The docs to be added to Upstash database.

      • embeddings: EmbeddingsInterface

        Embedding interface of choice, to create the embeddings.

      • dbConfig: UpstashVectorLibArgs

        Object containing the Upstash database configs.

      Returns Promise<UpstashVectorStore>

      Promise that resolves with a new UpstashVector instance

    • This method creates a new UpstashVector instance from an existing index.

      Parameters

      • embeddings: EmbeddingsInterface

        Embedding interface of the choice, to create the embeddings.

      • dbConfig: UpstashVectorLibArgs

        Object containing the Upstash database configs.

      Returns Promise<UpstashVectorStore>

    • This method creates a new UpstashVector instance from an array of texts. The texts are initially converted to Document instances and added to Upstash database.

      Parameters

      • texts: string[]

        The texts to create the documents from.

      • metadatas: UpstashMetadata | UpstashMetadata[]

        The metadata values associated with the texts.

      • embeddings: EmbeddingsInterface

        Embedding interface of choice, to create the text embeddings.

      • dbConfig: UpstashVectorLibArgs

        Object containing the Upstash database configs.

      Returns Promise<UpstashVectorStore>

      Promise that resolves with a new UpstashVector instance.