Install and import from @langchain/qdrant instead.

Class that extends the VectorStore base class to interact with a Qdrant database. It includes methods for adding documents and vectors to the Qdrant database, searching for similar vectors, and ensuring the existence of a collection in the database.

Hierarchy (view full)

Constructors

Properties

FilterType: {
    min_should?: null | Record<string, unknown> | {
        conditions: (
            | ({ should?: (... | { key: string; match?: Record<string, unknown> | { value: string | number | boolean; } | { text: string; } | { any: string[] | number[]; } | { except: string[] | number[]; } | null | undefined; ... 4 more ...; values_count?: Record<...> | ... 2 more ... | undefined; } | { ...; } | { ...; } | { ...;...)
            | {
                key: string;
                geo_bounding_box?: null | Record<string, unknown> | {
                    bottom_right: {
                        lat: number;
                        lon: number;
                    };
                    top_left: {
                        lat: number;
                        lon: number;
                    };
                };
                geo_polygon?: null | Record<string, unknown> | {
                    exterior: {
                        points: {
                            lat: ...;
                            lon: ...;
                        }[];
                    };
                    interiors?: null | {
                        points: ...;
                    }[];
                };
                geo_radius?: null | Record<string, unknown> | {
                    center: {
                        lat: number;
                        lon: number;
                    };
                    radius: number;
                };
                match?:
                    | null
                    | Record<string, unknown>
                    | {
                        value: string | number | boolean;
                    }
                    | {
                        text: string;
                    }
                    | {
                        any: string[] | number[];
                    }
                    | {
                        except: string[] | number[];
                    };
                range?:
                    | null
                    | Record<string, unknown>
                    | {
                        gt?: null | number;
                        gte?: null | number;
                        lt?: null | number;
                        lte?: null | number;
                    }
                    | {
                        gt?: null | string;
                        gte?: null | string;
                        lt?: null | string;
                        lte?: null | string;
                    };
                values_count?: null | Record<string, unknown> | {
                    gt?: null | number;
                    gte?: null | number;
                    lt?: null | number;
                    lte?: null | number;
                };
            }
            | {
                is_empty: {
                    key: string;
                };
            }
            | {
                is_null: {
                    key: string;
                };
            }
            | {
                has_id: (string | number)[];
            }
            | {
                nested: {
                    filter: { should?: (... | { key: string; match?: Record<string, unknown> | { value: string | number | boolean; } | { text: string; } | { any: string[] | number[]; } | { except: string[] | number[]; } | null | undefined; ... 4 more ...; values_count?: Record<...> | ... 2 more ... | undefined; } | { ...; } | { ...; } | { ...;...;
                    key: string;
                };
            })[];
        min_count: number;
    };
    must?: null | (
        | ({ should?: (... | { key: string; match?: Record<string, unknown> | { value: string | number | boolean; } | { text: string; } | { any: string[] | number[]; } | { except: string[] | number[]; } | null | undefined; ... 4 more ...; values_count?: Record<...> | ... 2 more ... | undefined; } | { ...; } | { ...; } | { ...;...)
        | {
            key: string;
            geo_bounding_box?: null | Record<string, unknown> | {
                bottom_right: {
                    lat: number;
                    lon: number;
                };
                top_left: {
                    lat: number;
                    lon: number;
                };
            };
            geo_polygon?: null | Record<string, unknown> | {
                exterior: {
                    points: {
                        lat: number;
                        lon: number;
                    }[];
                };
                interiors?: null | {
                    points: (...)[];
                }[];
            };
            geo_radius?: null | Record<string, unknown> | {
                center: {
                    lat: number;
                    lon: number;
                };
                radius: number;
            };
            match?:
                | null
                | Record<string, unknown>
                | {
                    value: string | number | boolean;
                }
                | {
                    text: string;
                }
                | {
                    any: string[] | number[];
                }
                | {
                    except: string[] | number[];
                };
            range?:
                | null
                | Record<string, unknown>
                | {
                    gt?: null | number;
                    gte?: null | number;
                    lt?: null | number;
                    lte?: null | number;
                }
                | {
                    gt?: null | string;
                    gte?: null | string;
                    lt?: null | string;
                    lte?: null | string;
                };
            values_count?: null | Record<string, unknown> | {
                gt?: null | number;
                gte?: null | number;
                lt?: null | number;
                lte?: null | number;
            };
        }
        | {
            is_empty: {
                key: string;
            };
        }
        | {
            is_null: {
                key: string;
            };
        }
        | {
            has_id: (string | number)[];
        }
        | {
            nested: {
                filter: { should?: (... | { key: string; match?: Record<string, unknown> | { value: string | number | boolean; } | { text: string; } | { any: string[] | number[]; } | { except: string[] | number[]; } | null | undefined; ... 4 more ...; values_count?: Record<...> | ... 2 more ... | undefined; } | { ...; } | { ...; } | { ...;...;
                key: string;
            };
        })[];
    must_not?: null | (
        | ({ should?: (... | { key: string; match?: Record<string, unknown> | { value: string | number | boolean; } | { text: string; } | { any: string[] | number[]; } | { except: string[] | number[]; } | null | undefined; ... 4 more ...; values_count?: Record<...> | ... 2 more ... | undefined; } | { ...; } | { ...; } | { ...;...)
        | {
            key: string;
            geo_bounding_box?: null | Record<string, unknown> | {
                bottom_right: {
                    lat: number;
                    lon: number;
                };
                top_left: {
                    lat: number;
                    lon: number;
                };
            };
            geo_polygon?: null | Record<string, unknown> | {
                exterior: {
                    points: {
                        lat: number;
                        lon: number;
                    }[];
                };
                interiors?: null | {
                    points: (...)[];
                }[];
            };
            geo_radius?: null | Record<string, unknown> | {
                center: {
                    lat: number;
                    lon: number;
                };
                radius: number;
            };
            match?:
                | null
                | Record<string, unknown>
                | {
                    value: string | number | boolean;
                }
                | {
                    text: string;
                }
                | {
                    any: string[] | number[];
                }
                | {
                    except: string[] | number[];
                };
            range?:
                | null
                | Record<string, unknown>
                | {
                    gt?: null | number;
                    gte?: null | number;
                    lt?: null | number;
                    lte?: null | number;
                }
                | {
                    gt?: null | string;
                    gte?: null | string;
                    lt?: null | string;
                    lte?: null | string;
                };
            values_count?: null | Record<string, unknown> | {
                gt?: null | number;
                gte?: null | number;
                lt?: null | number;
                lte?: null | number;
            };
        }
        | {
            is_empty: {
                key: string;
            };
        }
        | {
            is_null: {
                key: string;
            };
        }
        | {
            has_id: (string | number)[];
        }
        | {
            nested: {
                filter: { should?: (... | { key: string; match?: Record<string, unknown> | { value: string | number | boolean; } | { text: string; } | { any: string[] | number[]; } | { except: string[] | number[]; } | null | undefined; ... 4 more ...; values_count?: Record<...> | ... 2 more ... | undefined; } | { ...; } | { ...; } | { ...;...;
                key: string;
            };
        })[];
    should?: null | (
        | ({ should?: (... | { key: string; match?: Record<string, unknown> | { value: string | number | boolean; } | { text: string; } | { any: string[] | number[]; } | { except: string[] | number[]; } | null | undefined; ... 4 more ...; values_count?: Record<...> | ... 2 more ... | undefined; } | { ...; } | { ...; } | { ...;...)
        | {
            key: string;
            geo_bounding_box?: null | Record<string, unknown> | {
                bottom_right: {
                    lat: number;
                    lon: number;
                };
                top_left: {
                    lat: number;
                    lon: number;
                };
            };
            geo_polygon?: null | Record<string, unknown> | {
                exterior: {
                    points: {
                        lat: number;
                        lon: number;
                    }[];
                };
                interiors?: null | {
                    points: (...)[];
                }[];
            };
            geo_radius?: null | Record<string, unknown> | {
                center: {
                    lat: number;
                    lon: number;
                };
                radius: number;
            };
            match?:
                | null
                | Record<string, unknown>
                | {
                    value: string | number | boolean;
                }
                | {
                    text: string;
                }
                | {
                    any: string[] | number[];
                }
                | {
                    except: string[] | number[];
                };
            range?:
                | null
                | Record<string, unknown>
                | {
                    gt?: null | number;
                    gte?: null | number;
                    lt?: null | number;
                    lte?: null | number;
                }
                | {
                    gt?: null | string;
                    gte?: null | string;
                    lt?: null | string;
                    lte?: null | string;
                };
            values_count?: null | Record<string, unknown> | {
                gt?: null | number;
                gte?: null | number;
                lt?: null | number;
                lte?: null | number;
            };
        }
        | {
            is_empty: {
                key: string;
            };
        }
        | {
            is_null: {
                key: string;
            };
        }
        | {
            has_id: (string | number)[];
        }
        | {
            nested: {
                filter: { should?: (... | { key: string; match?: Record<string, unknown> | { value: string | number | boolean; } | { text: string; } | { any: string[] | number[]; } | { except: string[] | number[]; } | null | undefined; ... 4 more ...; values_count?: Record<...> | ... 2 more ... | undefined; } | { ...; } | { ...; } | { ...;...;
                key: string;
            };
        })[];
}

Type declaration

  • Optionalmin_should?: null | Record<string, unknown> | {
        conditions: (
            | ({ should?: (... | { key: string; match?: Record<string, unknown> | { value: string | number | boolean; } | { text: string; } | { any: string[] | number[]; } | { except: string[] | number[]; } | null | undefined; ... 4 more ...; values_count?: Record<...> | ... 2 more ... | undefined; } | { ...; } | { ...; } | { ...;...)
            | {
                key: string;
                geo_bounding_box?: null | Record<string, unknown> | {
                    bottom_right: {
                        lat: number;
                        lon: number;
                    };
                    top_left: {
                        lat: number;
                        lon: number;
                    };
                };
                geo_polygon?: null | Record<string, unknown> | {
                    exterior: {
                        points: {
                            lat: ...;
                            lon: ...;
                        }[];
                    };
                    interiors?: null | {
                        points: ...;
                    }[];
                };
                geo_radius?: null | Record<string, unknown> | {
                    center: {
                        lat: number;
                        lon: number;
                    };
                    radius: number;
                };
                match?:
                    | null
                    | Record<string, unknown>
                    | {
                        value: string | number | boolean;
                    }
                    | {
                        text: string;
                    }
                    | {
                        any: string[] | number[];
                    }
                    | {
                        except: string[] | number[];
                    };
                range?:
                    | null
                    | Record<string, unknown>
                    | {
                        gt?: null | number;
                        gte?: null | number;
                        lt?: null | number;
                        lte?: null | number;
                    }
                    | {
                        gt?: null | string;
                        gte?: null | string;
                        lt?: null | string;
                        lte?: null | string;
                    };
                values_count?: null | Record<string, unknown> | {
                    gt?: null | number;
                    gte?: null | number;
                    lt?: null | number;
                    lte?: null | number;
                };
            }
            | {
                is_empty: {
                    key: string;
                };
            }
            | {
                is_null: {
                    key: string;
                };
            }
            | {
                has_id: (string | number)[];
            }
            | {
                nested: {
                    filter: { should?: (... | { key: string; match?: Record<string, unknown> | { value: string | number | boolean; } | { text: string; } | { any: string[] | number[]; } | { except: string[] | number[]; } | null | undefined; ... 4 more ...; values_count?: Record<...> | ... 2 more ... | undefined; } | { ...; } | { ...; } | { ...;...;
                    key: string;
                };
            })[];
        min_count: number;
    }

    At least minimum amount of given conditions should match

  • Optionalmust?: null | (
        | ({ should?: (... | { key: string; match?: Record<string, unknown> | { value: string | number | boolean; } | { text: string; } | { any: string[] | number[]; } | { except: string[] | number[]; } | null | undefined; ... 4 more ...; values_count?: Record<...> | ... 2 more ... | undefined; } | { ...; } | { ...; } | { ...;...)
        | {
            key: string;
            geo_bounding_box?: null | Record<string, unknown> | {
                bottom_right: {
                    lat: number;
                    lon: number;
                };
                top_left: {
                    lat: number;
                    lon: number;
                };
            };
            geo_polygon?: null | Record<string, unknown> | {
                exterior: {
                    points: {
                        lat: number;
                        lon: number;
                    }[];
                };
                interiors?: null | {
                    points: (...)[];
                }[];
            };
            geo_radius?: null | Record<string, unknown> | {
                center: {
                    lat: number;
                    lon: number;
                };
                radius: number;
            };
            match?:
                | null
                | Record<string, unknown>
                | {
                    value: string | number | boolean;
                }
                | {
                    text: string;
                }
                | {
                    any: string[] | number[];
                }
                | {
                    except: string[] | number[];
                };
            range?:
                | null
                | Record<string, unknown>
                | {
                    gt?: null | number;
                    gte?: null | number;
                    lt?: null | number;
                    lte?: null | number;
                }
                | {
                    gt?: null | string;
                    gte?: null | string;
                    lt?: null | string;
                    lte?: null | string;
                };
            values_count?: null | Record<string, unknown> | {
                gt?: null | number;
                gte?: null | number;
                lt?: null | number;
                lte?: null | number;
            };
        }
        | {
            is_empty: {
                key: string;
            };
        }
        | {
            is_null: {
                key: string;
            };
        }
        | {
            has_id: (string | number)[];
        }
        | {
            nested: {
                filter: { should?: (... | { key: string; match?: Record<string, unknown> | { value: string | number | boolean; } | { text: string; } | { any: string[] | number[]; } | { except: string[] | number[]; } | null | undefined; ... 4 more ...; values_count?: Record<...> | ... 2 more ... | undefined; } | { ...; } | { ...; } | { ...;...;
                key: string;
            };
        })[]

    All conditions must match

  • Optionalmust_not?: null | (
        | ({ should?: (... | { key: string; match?: Record<string, unknown> | { value: string | number | boolean; } | { text: string; } | { any: string[] | number[]; } | { except: string[] | number[]; } | null | undefined; ... 4 more ...; values_count?: Record<...> | ... 2 more ... | undefined; } | { ...; } | { ...; } | { ...;...)
        | {
            key: string;
            geo_bounding_box?: null | Record<string, unknown> | {
                bottom_right: {
                    lat: number;
                    lon: number;
                };
                top_left: {
                    lat: number;
                    lon: number;
                };
            };
            geo_polygon?: null | Record<string, unknown> | {
                exterior: {
                    points: {
                        lat: number;
                        lon: number;
                    }[];
                };
                interiors?: null | {
                    points: (...)[];
                }[];
            };
            geo_radius?: null | Record<string, unknown> | {
                center: {
                    lat: number;
                    lon: number;
                };
                radius: number;
            };
            match?:
                | null
                | Record<string, unknown>
                | {
                    value: string | number | boolean;
                }
                | {
                    text: string;
                }
                | {
                    any: string[] | number[];
                }
                | {
                    except: string[] | number[];
                };
            range?:
                | null
                | Record<string, unknown>
                | {
                    gt?: null | number;
                    gte?: null | number;
                    lt?: null | number;
                    lte?: null | number;
                }
                | {
                    gt?: null | string;
                    gte?: null | string;
                    lt?: null | string;
                    lte?: null | string;
                };
            values_count?: null | Record<string, unknown> | {
                gt?: null | number;
                gte?: null | number;
                lt?: null | number;
                lte?: null | number;
            };
        }
        | {
            is_empty: {
                key: string;
            };
        }
        | {
            is_null: {
                key: string;
            };
        }
        | {
            has_id: (string | number)[];
        }
        | {
            nested: {
                filter: { should?: (... | { key: string; match?: Record<string, unknown> | { value: string | number | boolean; } | { text: string; } | { any: string[] | number[]; } | { except: string[] | number[]; } | null | undefined; ... 4 more ...; values_count?: Record<...> | ... 2 more ... | undefined; } | { ...; } | { ...; } | { ...;...;
                key: string;
            };
        })[]

    All conditions must NOT match

  • Optionalshould?: null | (
        | ({ should?: (... | { key: string; match?: Record<string, unknown> | { value: string | number | boolean; } | { text: string; } | { any: string[] | number[]; } | { except: string[] | number[]; } | null | undefined; ... 4 more ...; values_count?: Record<...> | ... 2 more ... | undefined; } | { ...; } | { ...; } | { ...;...)
        | {
            key: string;
            geo_bounding_box?: null | Record<string, unknown> | {
                bottom_right: {
                    lat: number;
                    lon: number;
                };
                top_left: {
                    lat: number;
                    lon: number;
                };
            };
            geo_polygon?: null | Record<string, unknown> | {
                exterior: {
                    points: {
                        lat: number;
                        lon: number;
                    }[];
                };
                interiors?: null | {
                    points: (...)[];
                }[];
            };
            geo_radius?: null | Record<string, unknown> | {
                center: {
                    lat: number;
                    lon: number;
                };
                radius: number;
            };
            match?:
                | null
                | Record<string, unknown>
                | {
                    value: string | number | boolean;
                }
                | {
                    text: string;
                }
                | {
                    any: string[] | number[];
                }
                | {
                    except: string[] | number[];
                };
            range?:
                | null
                | Record<string, unknown>
                | {
                    gt?: null | number;
                    gte?: null | number;
                    lt?: null | number;
                    lte?: null | number;
                }
                | {
                    gt?: null | string;
                    gte?: null | string;
                    lt?: null | string;
                    lte?: null | string;
                };
            values_count?: null | Record<string, unknown> | {
                gt?: null | number;
                gte?: null | number;
                lt?: null | number;
                lte?: null | number;
            };
        }
        | {
            is_empty: {
                key: string;
            };
        }
        | {
            is_null: {
                key: string;
            };
        }
        | {
            has_id: (string | number)[];
        }
        | {
            nested: {
                filter: { should?: (... | { key: string; match?: Record<string, unknown> | { value: string | number | boolean; } | { text: string; } | { any: string[] | number[]; } | { except: string[] | number[]; } | null | undefined; ... 4 more ...; values_count?: Record<...> | ... 2 more ... | undefined; } | { ...; } | { ...; } | { ...;...;
                key: string;
            };
        })[]

    At least one of those conditions should match

client: QdrantClient
collectionName: string
contentPayloadKey: string
metadataPayloadKey: string
collectionConfig?: {
    hnsw_config?: null | Record<string, unknown> | {
        ef_construct?: null | number;
        full_scan_threshold?: null | number;
        m?: null | number;
        max_indexing_threads?: null | number;
        on_disk?: null | boolean;
        payload_m?: null | number;
    };
    init_from?: null | Record<string, unknown> | {
        collection: string;
    };
    on_disk_payload?: null | boolean;
    optimizers_config?: null | Record<string, unknown> | {
        default_segment_number?: null | number;
        deleted_threshold?: null | number;
        flush_interval_sec?: null | number;
        indexing_threshold?: null | number;
        max_optimization_threads?: null | number;
        max_segment_size?: null | number;
        memmap_threshold?: null | number;
        vacuum_min_vector_number?: null | number;
    };
    quantization_config?:
        | null
        | Record<string, unknown>
        | {
            scalar: {
                type: "int8";
                always_ram?: null | boolean;
                quantile?: null | number;
            };
        }
        | {
            product: {
                compression:
                    | "x4"
                    | "x8"
                    | "x16"
                    | "x32"
                    | "x64";
                always_ram?: null | boolean;
            };
        }
        | {
            binary: {
                always_ram?: null | boolean;
            };
        };
    replication_factor?: null | number;
    shard_number?: null | number;
    sharding_method?:
        | null
        | Record<string, unknown>
        | "auto"
        | "custom";
    sparse_vectors?: null | {
        [key: string]: components["schemas"]["SparseVectorParams"] | undefined;
    };
    vectors?: {
        distance:
            | "Cosine"
            | "Euclid"
            | "Dot"
            | "Manhattan";
        size: number;
        datatype?:
            | null
            | Record<string, unknown>
            | "float32"
            | "uint8";
        hnsw_config?: null | Record<string, unknown> | {
            ef_construct?: null | number;
            full_scan_threshold?: null | number;
            m?: null | number;
            max_indexing_threads?: null | number;
            on_disk?: null | boolean;
            payload_m?: null | number;
        };
        on_disk?: null | boolean;
        quantization_config?:
            | null
            | Record<string, unknown>
            | {
                scalar: {
                    type: "int8";
                    always_ram?: null | boolean;
                    quantile?: null | number;
                };
            }
            | {
                product: {
                    compression:
                        | "x4"
                        | "x8"
                        | "x16"
                        | "x32"
                        | "x64";
                    always_ram?: null | boolean;
                };
            }
            | {
                binary: {
                    always_ram?: null | boolean;
                };
            };
    } | {
        [key: string]: components["schemas"]["VectorParams"] | undefined;
    };
    wal_config?: null | Record<string, unknown> | {
        wal_capacity_mb?: null | number;
        wal_segments_ahead?: null | number;
    };
    write_consistency_factor?: null | number;
}

Type declaration

  • Optionalhnsw_config?: null | Record<string, unknown> | {
        ef_construct?: null | number;
        full_scan_threshold?: null | number;
        m?: null | number;
        max_indexing_threads?: null | number;
        on_disk?: null | boolean;
        payload_m?: null | number;
    }

    Custom params for HNSW index. If none - values from service configuration file are used.

  • Optionalinit_from?: null | Record<string, unknown> | {
        collection: string;
    }

    Specify other collection to copy data from.

    null
    
  • Optionalon_disk_payload?: null | boolean

    If true - point's payload will not be stored in memory. It will be read from the disk every time it is requested. This setting saves RAM by (slightly) increasing the response time. Note: those payload values that are involved in filtering and are indexed - remain in RAM.

    null
    
  • Optionaloptimizers_config?: null | Record<string, unknown> | {
        default_segment_number?: null | number;
        deleted_threshold?: null | number;
        flush_interval_sec?: null | number;
        indexing_threshold?: null | number;
        max_optimization_threads?: null | number;
        max_segment_size?: null | number;
        memmap_threshold?: null | number;
        vacuum_min_vector_number?: null | number;
    }

    Custom params for Optimizers. If none - values from service configuration file are used.

  • Optionalquantization_config?:
        | null
        | Record<string, unknown>
        | {
            scalar: {
                type: "int8";
                always_ram?: null | boolean;
                quantile?: null | number;
            };
        }
        | {
            product: {
                compression:
                    | "x4"
                    | "x8"
                    | "x16"
                    | "x32"
                    | "x64";
                always_ram?: null | boolean;
            };
        }
        | {
            binary: {
                always_ram?: null | boolean;
            };
        }

    Quantization parameters. If none - quantization is disabled.

    null
    
  • Optionalreplication_factor?: null | number

    Format: uint32

    Number of shards replicas. Default is 1 Minimum is 1

    null
    
  • Optionalshard_number?: null | number

    Format: uint32

    For auto sharding: Number of shards in collection. - Default is 1 for standalone, otherwise equal to the number of nodes - Minimum is 1 For custom sharding: Number of shards in collection per shard group. - Default is 1, meaning that each shard key will be mapped to a single shard - Minimum is 1

    null
    
  • Optionalsharding_method?:
        | null
        | Record<string, unknown>
        | "auto"
        | "custom"

    Sharding method Default is Auto - points are distributed across all available shards Custom - points are distributed across shards according to shard key

    null
    
  • Optionalsparse_vectors?: null | {
        [key: string]: components["schemas"]["SparseVectorParams"] | undefined;
    }

    Sparse vector data config.

  • Optionalvectors?: {
        distance:
            | "Cosine"
            | "Euclid"
            | "Dot"
            | "Manhattan";
        size: number;
        datatype?:
            | null
            | Record<string, unknown>
            | "float32"
            | "uint8";
        hnsw_config?: null | Record<string, unknown> | {
            ef_construct?: null | number;
            full_scan_threshold?: null | number;
            m?: null | number;
            max_indexing_threads?: null | number;
            on_disk?: null | boolean;
            payload_m?: null | number;
        };
        on_disk?: null | boolean;
        quantization_config?:
            | null
            | Record<string, unknown>
            | {
                scalar: {
                    type: "int8";
                    always_ram?: null | boolean;
                    quantile?: null | number;
                };
            }
            | {
                product: {
                    compression:
                        | "x4"
                        | "x8"
                        | "x16"
                        | "x32"
                        | "x64";
                    always_ram?: null | boolean;
                };
            }
            | {
                binary: {
                    always_ram?: null | boolean;
                };
            };
    } | {
        [key: string]: components["schemas"]["VectorParams"] | undefined;
    }
  • Optionalwal_config?: null | Record<string, unknown> | {
        wal_capacity_mb?: null | number;
        wal_segments_ahead?: null | number;
    }

    Custom params for WAL. If none - values from service configuration file are used.

  • Optionalwrite_consistency_factor?: null | number

    Format: uint32

    Defines how many replicas should apply the operation for us to consider it successful. Increasing this number will make the collection more resilient to inconsistencies, but will also make it fail if not enough replicas are available. Does not have any performance impact.

    null
    

Methods

  • Method to add documents to the Qdrant database. It generates vectors from the documents using the Embeddings instance and then adds the vectors to the database.

    Parameters

    • documents: Document[]

      Array of Document instances to be added to the Qdrant database.

    • OptionaldocumentOptions: QdrantAddDocumentOptions

      Optional QdrantAddDocumentOptions which has a list of JSON objects for extra querying

    Returns Promise<void>

    Promise that resolves when the documents have been added to the database.

  • Method to add vectors to the Qdrant database. Each vector is associated with a document, which is stored as the payload for a point in the database.

    Parameters

    • vectors: number[][]

      Array of vectors to be added to the Qdrant database.

    • documents: Document[]

      Array of Document instances associated with the vectors.

    • OptionaldocumentOptions: QdrantAddDocumentOptions

      Optional QdrantAddDocumentOptions which has a list of JSON objects for extra querying

    Returns Promise<void>

    Promise that resolves when the vectors have been added to the database.

  • Method to ensure the existence of a collection in the Qdrant database. If the collection does not exist, it is created.

    Returns Promise<void>

    Promise that resolves when the existence of the collection has been ensured.

  • Method to search for vectors in the Qdrant database that are similar to a given query vector. The search results include the score and payload (metadata and content) for each similar vector.

    Parameters

    • query: number[]

      Query vector to search for similar vectors in the Qdrant database.

    • Optionalk: number

      Optional number of similar vectors to return. If not specified, all similar vectors are returned.

    • Optionalfilter: {
          min_should?: null | Record<string, unknown> | {
              conditions: (
                  | ({ should?: (... | { key: string; match?: Record<string, unknown> | { value: string | number | boolean; } | { text: string; } | { any: string[] | number[]; } | { except: string[] | number[]; } | null | undefined; ... 4 more ...; values_count?: Record<...> | ... 2 more ... | undefined; } | { ...; } | { ...; } | { ...;...)
                  | {
                      key: string;
                      geo_bounding_box?: null | Record<string, unknown> | {
                          bottom_right: {
                              lat: number;
                              lon: number;
                          };
                          top_left: {
                              lat: number;
                              lon: number;
                          };
                      };
                      geo_polygon?: null | Record<string, unknown> | {
                          exterior: {
                              points: (...)[];
                          };
                          interiors?: null | (...)[];
                      };
                      geo_radius?: null | Record<string, unknown> | {
                          center: {
                              lat: number;
                              lon: number;
                          };
                          radius: number;
                      };
                      match?:
                          | null
                          | Record<string, unknown>
                          | {
                              value: string | number | boolean;
                          }
                          | {
                              text: string;
                          }
                          | {
                              any: (...)[] | (...)[];
                          }
                          | {
                              except: (...)[] | (...)[];
                          };
                      range?:
                          | null
                          | Record<string, unknown>
                          | {
                              gt?: null | number;
                              gte?: null | number;
                              lt?: null | number;
                              lte?: null | number;
                          }
                          | {
                              gt?: null | string;
                              gte?: null | string;
                              lt?: null | string;
                              lte?: null | string;
                          };
                      values_count?: null | Record<string, unknown> | {
                          gt?: null | number;
                          gte?: null | number;
                          lt?: null | number;
                          lte?: null | number;
                      };
                  }
                  | {
                      is_empty: {
                          key: string;
                      };
                  }
                  | {
                      is_null: {
                          key: string;
                      };
                  }
                  | {
                      has_id: (string | number)[];
                  }
                  | {
                      nested: {
                          filter: { should?: (... | { key: string; match?: Record<string, unknown> | { value: string | number | boolean; } | { text: string; } | { any: string[] | number[]; } | { except: string[] | number[]; } | null | undefined; ... 4 more ...; values_count?: Record<...> | ... 2 more ... | undefined; } | { ...; } | { ...; } | { ...;...;
                          key: string;
                      };
                  })[];
              min_count: number;
          };
          must?: null | (
              | ({ should?: (... | { key: string; match?: Record<string, unknown> | { value: string | number | boolean; } | { text: string; } | { any: string[] | number[]; } | { except: string[] | number[]; } | null | undefined; ... 4 more ...; values_count?: Record<...> | ... 2 more ... | undefined; } | { ...; } | { ...; } | { ...;...)
              | {
                  key: string;
                  geo_bounding_box?: null | Record<string, unknown> | {
                      bottom_right: {
                          lat: number;
                          lon: number;
                      };
                      top_left: {
                          lat: number;
                          lon: number;
                      };
                  };
                  geo_polygon?: null | Record<string, unknown> | {
                      exterior: {
                          points: {
                              lat: ...;
                              lon: ...;
                          }[];
                      };
                      interiors?: null | {
                          points: ...;
                      }[];
                  };
                  geo_radius?: null | Record<string, unknown> | {
                      center: {
                          lat: number;
                          lon: number;
                      };
                      radius: number;
                  };
                  match?:
                      | null
                      | Record<string, unknown>
                      | {
                          value: string | number | boolean;
                      }
                      | {
                          text: string;
                      }
                      | {
                          any: string[] | number[];
                      }
                      | {
                          except: string[] | number[];
                      };
                  range?:
                      | null
                      | Record<string, unknown>
                      | {
                          gt?: null | number;
                          gte?: null | number;
                          lt?: null | number;
                          lte?: null | number;
                      }
                      | {
                          gt?: null | string;
                          gte?: null | string;
                          lt?: null | string;
                          lte?: null | string;
                      };
                  values_count?: null | Record<string, unknown> | {
                      gt?: null | number;
                      gte?: null | number;
                      lt?: null | number;
                      lte?: null | number;
                  };
              }
              | {
                  is_empty: {
                      key: string;
                  };
              }
              | {
                  is_null: {
                      key: string;
                  };
              }
              | {
                  has_id: (string | number)[];
              }
              | {
                  nested: {
                      filter: { should?: (... | { key: string; match?: Record<string, unknown> | { value: string | number | boolean; } | { text: string; } | { any: string[] | number[]; } | { except: string[] | number[]; } | null | undefined; ... 4 more ...; values_count?: Record<...> | ... 2 more ... | undefined; } | { ...; } | { ...; } | { ...;...;
                      key: string;
                  };
              })[];
          must_not?: null | (
              | ({ should?: (... | { key: string; match?: Record<string, unknown> | { value: string | number | boolean; } | { text: string; } | { any: string[] | number[]; } | { except: string[] | number[]; } | null | undefined; ... 4 more ...; values_count?: Record<...> | ... 2 more ... | undefined; } | { ...; } | { ...; } | { ...;...)
              | {
                  key: string;
                  geo_bounding_box?: null | Record<string, unknown> | {
                      bottom_right: {
                          lat: number;
                          lon: number;
                      };
                      top_left: {
                          lat: number;
                          lon: number;
                      };
                  };
                  geo_polygon?: null | Record<string, unknown> | {
                      exterior: {
                          points: {
                              lat: ...;
                              lon: ...;
                          }[];
                      };
                      interiors?: null | {
                          points: ...;
                      }[];
                  };
                  geo_radius?: null | Record<string, unknown> | {
                      center: {
                          lat: number;
                          lon: number;
                      };
                      radius: number;
                  };
                  match?:
                      | null
                      | Record<string, unknown>
                      | {
                          value: string | number | boolean;
                      }
                      | {
                          text: string;
                      }
                      | {
                          any: string[] | number[];
                      }
                      | {
                          except: string[] | number[];
                      };
                  range?:
                      | null
                      | Record<string, unknown>
                      | {
                          gt?: null | number;
                          gte?: null | number;
                          lt?: null | number;
                          lte?: null | number;
                      }
                      | {
                          gt?: null | string;
                          gte?: null | string;
                          lt?: null | string;
                          lte?: null | string;
                      };
                  values_count?: null | Record<string, unknown> | {
                      gt?: null | number;
                      gte?: null | number;
                      lt?: null | number;
                      lte?: null | number;
                  };
              }
              | {
                  is_empty: {
                      key: string;
                  };
              }
              | {
                  is_null: {
                      key: string;
                  };
              }
              | {
                  has_id: (string | number)[];
              }
              | {
                  nested: {
                      filter: { should?: (... | { key: string; match?: Record<string, unknown> | { value: string | number | boolean; } | { text: string; } | { any: string[] | number[]; } | { except: string[] | number[]; } | null | undefined; ... 4 more ...; values_count?: Record<...> | ... 2 more ... | undefined; } | { ...; } | { ...; } | { ...;...;
                      key: string;
                  };
              })[];
          should?: null | (
              | ({ should?: (... | { key: string; match?: Record<string, unknown> | { value: string | number | boolean; } | { text: string; } | { any: string[] | number[]; } | { except: string[] | number[]; } | null | undefined; ... 4 more ...; values_count?: Record<...> | ... 2 more ... | undefined; } | { ...; } | { ...; } | { ...;...)
              | {
                  key: string;
                  geo_bounding_box?: null | Record<string, unknown> | {
                      bottom_right: {
                          lat: number;
                          lon: number;
                      };
                      top_left: {
                          lat: number;
                          lon: number;
                      };
                  };
                  geo_polygon?: null | Record<string, unknown> | {
                      exterior: {
                          points: {
                              lat: ...;
                              lon: ...;
                          }[];
                      };
                      interiors?: null | {
                          points: ...;
                      }[];
                  };
                  geo_radius?: null | Record<string, unknown> | {
                      center: {
                          lat: number;
                          lon: number;
                      };
                      radius: number;
                  };
                  match?:
                      | null
                      | Record<string, unknown>
                      | {
                          value: string | number | boolean;
                      }
                      | {
                          text: string;
                      }
                      | {
                          any: string[] | number[];
                      }
                      | {
                          except: string[] | number[];
                      };
                  range?:
                      | null
                      | Record<string, unknown>
                      | {
                          gt?: null | number;
                          gte?: null | number;
                          lt?: null | number;
                          lte?: null | number;
                      }
                      | {
                          gt?: null | string;
                          gte?: null | string;
                          lt?: null | string;
                          lte?: null | string;
                      };
                  values_count?: null | Record<string, unknown> | {
                      gt?: null | number;
                      gte?: null | number;
                      lt?: null | number;
                      lte?: null | number;
                  };
              }
              | {
                  is_empty: {
                      key: string;
                  };
              }
              | {
                  is_null: {
                      key: string;
                  };
              }
              | {
                  has_id: (string | number)[];
              }
              | {
                  nested: {
                      filter: { should?: (... | { key: string; match?: Record<string, unknown> | { value: string | number | boolean; } | { text: string; } | { any: string[] | number[]; } | { except: string[] | number[]; } | null | undefined; ... 4 more ...; values_count?: Record<...> | ... 2 more ... | undefined; } | { ...; } | { ...; } | { ...;...;
                      key: string;
                  };
              })[];
      }

      Optional filter to apply to the search results.

      • Optionalmin_should?: null | Record<string, unknown> | {
            conditions: (
                | ({ should?: (... | { key: string; match?: Record<string, unknown> | { value: string | number | boolean; } | { text: string; } | { any: string[] | number[]; } | { except: string[] | number[]; } | null | undefined; ... 4 more ...; values_count?: Record<...> | ... 2 more ... | undefined; } | { ...; } | { ...; } | { ...;...)
                | {
                    key: string;
                    geo_bounding_box?: null | Record<string, unknown> | {
                        bottom_right: {
                            lat: number;
                            lon: number;
                        };
                        top_left: {
                            lat: number;
                            lon: number;
                        };
                    };
                    geo_polygon?: null | Record<string, unknown> | {
                        exterior: {
                            points: (...)[];
                        };
                        interiors?: null | (...)[];
                    };
                    geo_radius?: null | Record<string, unknown> | {
                        center: {
                            lat: number;
                            lon: number;
                        };
                        radius: number;
                    };
                    match?:
                        | null
                        | Record<string, unknown>
                        | {
                            value: string | number | boolean;
                        }
                        | {
                            text: string;
                        }
                        | {
                            any: (...)[] | (...)[];
                        }
                        | {
                            except: (...)[] | (...)[];
                        };
                    range?:
                        | null
                        | Record<string, unknown>
                        | {
                            gt?: null | number;
                            gte?: null | number;
                            lt?: null | number;
                            lte?: null | number;
                        }
                        | {
                            gt?: null | string;
                            gte?: null | string;
                            lt?: null | string;
                            lte?: null | string;
                        };
                    values_count?: null | Record<string, unknown> | {
                        gt?: null | number;
                        gte?: null | number;
                        lt?: null | number;
                        lte?: null | number;
                    };
                }
                | {
                    is_empty: {
                        key: string;
                    };
                }
                | {
                    is_null: {
                        key: string;
                    };
                }
                | {
                    has_id: (string | number)[];
                }
                | {
                    nested: {
                        filter: { should?: (... | { key: string; match?: Record<string, unknown> | { value: string | number | boolean; } | { text: string; } | { any: string[] | number[]; } | { except: string[] | number[]; } | null | undefined; ... 4 more ...; values_count?: Record<...> | ... 2 more ... | undefined; } | { ...; } | { ...; } | { ...;...;
                        key: string;
                    };
                })[];
            min_count: number;
        }

        At least minimum amount of given conditions should match

      • Optionalmust?: null | (
            | ({ should?: (... | { key: string; match?: Record<string, unknown> | { value: string | number | boolean; } | { text: string; } | { any: string[] | number[]; } | { except: string[] | number[]; } | null | undefined; ... 4 more ...; values_count?: Record<...> | ... 2 more ... | undefined; } | { ...; } | { ...; } | { ...;...)
            | {
                key: string;
                geo_bounding_box?: null | Record<string, unknown> | {
                    bottom_right: {
                        lat: number;
                        lon: number;
                    };
                    top_left: {
                        lat: number;
                        lon: number;
                    };
                };
                geo_polygon?: null | Record<string, unknown> | {
                    exterior: {
                        points: {
                            lat: ...;
                            lon: ...;
                        }[];
                    };
                    interiors?: null | {
                        points: ...;
                    }[];
                };
                geo_radius?: null | Record<string, unknown> | {
                    center: {
                        lat: number;
                        lon: number;
                    };
                    radius: number;
                };
                match?:
                    | null
                    | Record<string, unknown>
                    | {
                        value: string | number | boolean;
                    }
                    | {
                        text: string;
                    }
                    | {
                        any: string[] | number[];
                    }
                    | {
                        except: string[] | number[];
                    };
                range?:
                    | null
                    | Record<string, unknown>
                    | {
                        gt?: null | number;
                        gte?: null | number;
                        lt?: null | number;
                        lte?: null | number;
                    }
                    | {
                        gt?: null | string;
                        gte?: null | string;
                        lt?: null | string;
                        lte?: null | string;
                    };
                values_count?: null | Record<string, unknown> | {
                    gt?: null | number;
                    gte?: null | number;
                    lt?: null | number;
                    lte?: null | number;
                };
            }
            | {
                is_empty: {
                    key: string;
                };
            }
            | {
                is_null: {
                    key: string;
                };
            }
            | {
                has_id: (string | number)[];
            }
            | {
                nested: {
                    filter: { should?: (... | { key: string; match?: Record<string, unknown> | { value: string | number | boolean; } | { text: string; } | { any: string[] | number[]; } | { except: string[] | number[]; } | null | undefined; ... 4 more ...; values_count?: Record<...> | ... 2 more ... | undefined; } | { ...; } | { ...; } | { ...;...;
                    key: string;
                };
            })[]

        All conditions must match

      • Optionalmust_not?: null | (
            | ({ should?: (... | { key: string; match?: Record<string, unknown> | { value: string | number | boolean; } | { text: string; } | { any: string[] | number[]; } | { except: string[] | number[]; } | null | undefined; ... 4 more ...; values_count?: Record<...> | ... 2 more ... | undefined; } | { ...; } | { ...; } | { ...;...)
            | {
                key: string;
                geo_bounding_box?: null | Record<string, unknown> | {
                    bottom_right: {
                        lat: number;
                        lon: number;
                    };
                    top_left: {
                        lat: number;
                        lon: number;
                    };
                };
                geo_polygon?: null | Record<string, unknown> | {
                    exterior: {
                        points: {
                            lat: ...;
                            lon: ...;
                        }[];
                    };
                    interiors?: null | {
                        points: ...;
                    }[];
                };
                geo_radius?: null | Record<string, unknown> | {
                    center: {
                        lat: number;
                        lon: number;
                    };
                    radius: number;
                };
                match?:
                    | null
                    | Record<string, unknown>
                    | {
                        value: string | number | boolean;
                    }
                    | {
                        text: string;
                    }
                    | {
                        any: string[] | number[];
                    }
                    | {
                        except: string[] | number[];
                    };
                range?:
                    | null
                    | Record<string, unknown>
                    | {
                        gt?: null | number;
                        gte?: null | number;
                        lt?: null | number;
                        lte?: null | number;
                    }
                    | {
                        gt?: null | string;
                        gte?: null | string;
                        lt?: null | string;
                        lte?: null | string;
                    };
                values_count?: null | Record<string, unknown> | {
                    gt?: null | number;
                    gte?: null | number;
                    lt?: null | number;
                    lte?: null | number;
                };
            }
            | {
                is_empty: {
                    key: string;
                };
            }
            | {
                is_null: {
                    key: string;
                };
            }
            | {
                has_id: (string | number)[];
            }
            | {
                nested: {
                    filter: { should?: (... | { key: string; match?: Record<string, unknown> | { value: string | number | boolean; } | { text: string; } | { any: string[] | number[]; } | { except: string[] | number[]; } | null | undefined; ... 4 more ...; values_count?: Record<...> | ... 2 more ... | undefined; } | { ...; } | { ...; } | { ...;...;
                    key: string;
                };
            })[]

        All conditions must NOT match

      • Optionalshould?: null | (
            | ({ should?: (... | { key: string; match?: Record<string, unknown> | { value: string | number | boolean; } | { text: string; } | { any: string[] | number[]; } | { except: string[] | number[]; } | null | undefined; ... 4 more ...; values_count?: Record<...> | ... 2 more ... | undefined; } | { ...; } | { ...; } | { ...;...)
            | {
                key: string;
                geo_bounding_box?: null | Record<string, unknown> | {
                    bottom_right: {
                        lat: number;
                        lon: number;
                    };
                    top_left: {
                        lat: number;
                        lon: number;
                    };
                };
                geo_polygon?: null | Record<string, unknown> | {
                    exterior: {
                        points: {
                            lat: ...;
                            lon: ...;
                        }[];
                    };
                    interiors?: null | {
                        points: ...;
                    }[];
                };
                geo_radius?: null | Record<string, unknown> | {
                    center: {
                        lat: number;
                        lon: number;
                    };
                    radius: number;
                };
                match?:
                    | null
                    | Record<string, unknown>
                    | {
                        value: string | number | boolean;
                    }
                    | {
                        text: string;
                    }
                    | {
                        any: string[] | number[];
                    }
                    | {
                        except: string[] | number[];
                    };
                range?:
                    | null
                    | Record<string, unknown>
                    | {
                        gt?: null | number;
                        gte?: null | number;
                        lt?: null | number;
                        lte?: null | number;
                    }
                    | {
                        gt?: null | string;
                        gte?: null | string;
                        lt?: null | string;
                        lte?: null | string;
                    };
                values_count?: null | Record<string, unknown> | {
                    gt?: null | number;
                    gte?: null | number;
                    lt?: null | number;
                    lte?: null | number;
                };
            }
            | {
                is_empty: {
                    key: string;
                };
            }
            | {
                is_null: {
                    key: string;
                };
            }
            | {
                has_id: (string | number)[];
            }
            | {
                nested: {
                    filter: { should?: (... | { key: string; match?: Record<string, unknown> | { value: string | number | boolean; } | { text: string; } | { any: string[] | number[]; } | { except: string[] | number[]; } | null | undefined; ... 4 more ...; values_count?: Record<...> | ... 2 more ... | undefined; } | { ...; } | { ...; } | { ...;...;
                    key: string;
                };
            })[]

        At least one of those conditions should match

    Returns Promise<[Document, number][]>

    Promise that resolves with an array of tuples, where each tuple includes a Document instance and a score for a similar vector.

  • Static method to create a QdrantVectorStore instance from Document instances. The documents are added to the Qdrant database.

    Parameters

    • docs: Document[]

      Array of Document instances to be added to the Qdrant database.

    • embeddings: EmbeddingsInterface

      Embeddings instance used to generate vectors from the documents.

    • dbConfig: QdrantLibArgs

      QdrantLibArgs instance specifying the configuration for the Qdrant database.

    Returns Promise<QdrantVectorStore>

    Promise that resolves with a new QdrantVectorStore instance.

  • Static method to create a QdrantVectorStore instance from an existing collection in the Qdrant database.

    Parameters

    • embeddings: EmbeddingsInterface

      Embeddings instance used to generate vectors from the documents in the collection.

    • dbConfig: QdrantLibArgs

      QdrantLibArgs instance specifying the configuration for the Qdrant database.

    Returns Promise<QdrantVectorStore>

    Promise that resolves with a new QdrantVectorStore instance.

  • Static method to create a QdrantVectorStore instance from texts. Each text is associated with metadata and converted to a Document instance, which is then added to the Qdrant database.

    Parameters

    • texts: string[]

      Array of texts to be converted to Document instances and added to the Qdrant database.

    • metadatas: object | object[]

      Array or single object of metadata to be associated with the texts.

    • embeddings: EmbeddingsInterface

      Embeddings instance used to generate vectors from the texts.

    • dbConfig: QdrantLibArgs

      QdrantLibArgs instance specifying the configuration for the Qdrant database.

    Returns Promise<QdrantVectorStore>

    Promise that resolves with a new QdrantVectorStore instance.