langchain.js
    Preparing search index...

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

    Hierarchy (View Summary)

    Index

    Constructors

    • Parameters

      Returns Milvus

    Properties

    autoId?: boolean
    client: MilvusClient
    collectionName: string
    embeddings: EmbeddingsInterface
    fields: string[]
    FilterType: string
    indexCreateParams: IndexCreateOptions
    indexSearchParams: keyValueObj
    numDimensions?: number
    partitionKey?: string
    partitionKeyMaxLength?: number
    partitionName?: string
    primaryField: string
    textField: string
    textFieldMaxLength: number
    vectorField: string

    Accessors

    • get lc_secrets(): { [key: string]: string }

      Returns { [key: string]: string }

    Methods

    • Returns string

    • Adds documents to the Milvus database.

      Parameters

      • documents: Document[]

        Array of Document instances to be added to the database.

      • Optionaloptions: { ids?: string[] }

        Optional parameter that can include specific IDs for the documents.

      Returns Promise<void>

      Promise resolving to void.

    • Adds vectors to the Milvus database.

      Parameters

      • vectors: number[][]

        Array of vectors to be added to the database.

      • documents: Document[]

        Array of Document instances associated with the vectors.

      • Optionaloptions: { ids?: string[] }

        Optional parameter that can include specific IDs for the documents.

      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[]

        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; ids?: string[] }

        Object containing a filter to apply to the deletion.

      Returns Promise<void>

      Promise resolving to void.

    • Ensures that a collection exists in the Milvus database.

      Parameters

      • Optionalvectors: number[][]

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

      • Optionaldocuments: Document[]

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

      Returns Promise<void>

      Promise resolving to void.

    • Ensures that a partition exists in the Milvus collection.

      Returns Promise<void>

      Promise resolving to void.

    • Retrieves the fields of a collection in the Milvus database.

      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.

      • Optionalfilter: string

        Optional filter to apply to the search.

      Returns Promise<[Document, 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[]

        Array of Document instances to be added to the database.

      • embeddings: EmbeddingsInterface

        Embeddings instance used to generate vector embeddings for the documents.

      • OptionaldbConfig: 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: EmbeddingsInterface

        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: EmbeddingsInterface

        Embeddings instance used to generate vector embeddings for the texts.

      • OptionaldbConfig: MilvusLibArgs

        Optional configuration for the Milvus database.

      Returns Promise<Milvus>

      Promise resolving to a new Milvus instance.