Class for interacting with a Milvus database. Extends the VectorStore class.

Hierarchy

Constructors

Properties

FilterType: string
client: MilvusClient
collectionName: string
fields: string[]
indexCreateParams: {
    index_type: string;
    metric_type: string;
    params: string;
} = ...

Type declaration

  • index_type: string
  • metric_type: string
  • params: string
indexParams: Record<IndexType, IndexParam> = ...
indexSearchParams: string = ...
primaryField: string
textField: string
textFieldMaxLength: number
vectorField: string
autoId?: boolean
numDimensions?: number

Methods

  • Creates a collection in the Milvus database.

    Parameters

    • vectors: number[][]

      Array of vectors to be added to the new collection.

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

      Array of Document instances to be added to the new collection.

    Returns Promise<void>

    Promise resolving to void.

  • Ensures that a collection exists in the Milvus database.

    Parameters

    • Optional vectors: number[][]

      Optional array of vectors to be used if a new collection needs to be created.

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

      Optional array of Document instances to be used if a new collection needs to be created.

    Returns Promise<void>

    Promise resolving to void.

  • Parameters

    • query: string
    • Optional k: number
    • Optional filter: string
    • Optional _callbacks: Callbacks

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

  • Searches for vectors in the Milvus database that are similar to a given vector.

    Parameters

    • query: number[]

      Vector to compare with the vectors in the database.

    • k: number

      Number of similar vectors to return.

    • Optional filter: string

      Optional filter to apply to the search.

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

    Promise resolving to an array of tuples, each containing a Document instance and a similarity score.

  • Parameters

    • query: string
    • Optional k: number
    • Optional filter: string
    • Optional _callbacks: Callbacks

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

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

    Parameters

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

    • List of documents selected by maximal marginal relevance.
  • Creates a Milvus instance from a set of texts and their associated metadata.

    Parameters

    • texts: string[]

      Array of texts to be added to the database.

    • metadatas: object | object[]

      Array of metadata objects associated with the texts.

    • embeddings: EmbeddingsInterface

      Embeddings instance used to generate vector embeddings for the texts.

    • Optional dbConfig: MilvusLibArgs

      Optional configuration for the Milvus database.

    Returns Promise<Milvus>

    Promise resolving to a new Milvus instance.

Generated using TypeDoc