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

Hierarchy

Constructors

Properties

FilterType: string
client: MilvusClient
collectionName: string
embeddings: Embeddings
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 = ...
lc_kwargs: SerializedFields
lc_namespace: string[] = ...

A path to the module that contains the class, eg. ["langchain", "llms"] Usually should be the same as the entrypoint the class is exported from.

lc_serializable: boolean = false
primaryField: string
textField: string
textFieldMaxLength: number
vectorField: string
autoId?: boolean
numDimensions?: number

Accessors

  • get lc_aliases(): undefined | {
        [key: string]: string;
    }
  • A map of aliases for constructor args. Keys are the attribute names, e.g. "foo". Values are the alias that will replace the key in serialization. This is used to eg. make argument names match Python.

    Returns undefined | {
        [key: string]: string;
    }

  • get lc_attributes(): undefined | SerializedFields
  • A map of additional attributes to merge with constructor args. Keys are the attribute names, e.g. "foo". Values are the attribute values, which will be serialized. These attributes need to be accepted by the constructor as arguments.

    Returns undefined | SerializedFields

  • get lc_secrets(): {
        [key: string]: string;
    }
  • A map of secrets, which will be omitted from serialization. Keys are paths to the secret in constructor args, e.g. "foo.bar.baz". Values are the secret ids, which will be used when deserializing.

    Returns {
        [key: string]: string;
    }

    • [key: string]: string

Methods

  • Adds vectors to the Milvus database.

    Parameters

    • vectors: number[][]

      Array of vectors to be added to the database.

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

      Array of Document instances associated with the vectors.

    Returns Promise<void>

    Promise resolving to void.

  • 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.

  • Deletes data from the Milvus database.

    Parameters

    • params: {
          filter: string;
      }

      Object containing a filter to apply to the deletion.

      • filter: string

    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.

  • 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.

  • Creates a Milvus instance from a set of Document instances.

    Parameters

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

      Array of Document instances to be added to the database.

    • embeddings: Embeddings

      Embeddings instance used to generate vector embeddings for the documents.

    • Optional dbConfig: MilvusLibArgs

      Optional configuration for the Milvus database.

    Returns Promise<Milvus>

    Promise resolving to a new Milvus instance.

  • Creates a Milvus instance from an existing collection in the Milvus database.

    Parameters

    • embeddings: Embeddings

      Embeddings instance used to generate vector embeddings for the documents in the collection.

    • dbConfig: MilvusLibArgs

      Configuration for the Milvus database.

    Returns Promise<Milvus>

    Promise resolving to a new Milvus instance.

  • 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: Embeddings

      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.

  • The name of the serializable. Override to provide an alias or to preserve the serialized module name in minified environments.

    Implemented as a static method to support loading logic.

    Returns string

Generated using TypeDoc