Hierarchy

  • VectorStore
    • AstraDBVectorStore

Constructors

Properties

FilterType: CollectionFilter
caller: AsyncCaller

Methods

  • Method that adds documents to AstraDB.

    Parameters

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

      Array of documents to add to AstraDB.

    • Optional options: string[]

      Optional ids for the documents.

    Returns Promise<void>

    Promise that resolves the documents have been added.

  • Method to save vectors to AstraDB.

    Parameters

    • vectors: number[][]

      Vectors to save.

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

      The documents associated with the vectors.

    • Optional options: string[]

    Returns Promise<void>

    Promise that resolves when the vectors have been added.

  • Create a new collection in your Astra DB vector database and then connects to it. If the collection already exists, it will connect to it as well.

    Returns Promise<void>

    Promise that resolves if connected to the collection.

  • Return documents selected using the maximal marginal relevance. Maximal marginal relevance optimizes for similarity to the query AND diversity among selected documents.

    Parameters

    • query: string

      Text to look up documents similar to.

    • options: MaxMarginalRelevanceSearchOptions<CollectionFilter>

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

    • List of documents selected by maximal marginal relevance.
  • Method that performs a similarity search in AstraDB and returns and similarity scores.

    Parameters

    • query: number[]

      Query vector for the similarity search.

    • k: number

      Number of top results to return.

    • Optional filter: CollectionFilter

      Optional filter to apply to the search.

    Returns Promise<[Document<Record<string, any>>, number][]>

    Promise that resolves with an array of documents and their scores.

  • Static method to create an instance of AstraDBVectorStore from documents.

    Parameters

    • docs: Document<Record<string, any>>[]

      The Documents to use.

    • embeddings: EmbeddingsInterface

      The embeddings to use.

    • dbConfig: AstraLibArgs

      The arguments for the AstraDBVectorStore.

    Returns Promise<AstraDBVectorStore>

    Promise that resolves with a new instance of AstraDBVectorStore.

  • Static method to create an instance of AstraDBVectorStore from texts.

    Parameters

    • texts: string[]

      The texts to use.

    • metadatas: object | object[]

      The metadata associated with the texts.

    • embeddings: EmbeddingsInterface

      The embeddings to use.

    • dbConfig: AstraLibArgs

      The arguments for the AstraDBVectorStore.

    Returns Promise<AstraDBVectorStore>

    Promise that resolves with a new instance of AstraDBVectorStore.

Generated using TypeDoc