From c45d94b40a62f3e0fc127d86a0932c891e4cef08 Mon Sep 17 00:00:00 2001 From: Ivan Pleshkov Date: Tue, 8 Oct 2024 17:08:51 +0200 Subject: [PATCH] V1.12.0 (#85) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * update grpc protos * rest api * version up * apply api updates * make api names consistent with other clients * Update container version to 1.12.0 --------- Co-authored-by: generall Co-authored-by: Tim Visée --- examples/node-js-basic/package.json | 2 +- packages/js-client-grpc/CHANGELOG.md | 6 + packages/js-client-grpc/package.json | 2 +- .../js-client-grpc/proto/collections.proto | 20 +- packages/js-client-grpc/proto/points.proto | 59 +- .../js-client-grpc/proto/points_service.proto | 12 + .../src/proto/collections_pb.ts | 123 +++- .../js-client-grpc/src/proto/points_pb.ts | 524 +++++++++++++++++- .../src/proto/points_service_connect.ts | 38 +- packages/js-client-rest/CHANGELOG.md | 6 + packages/js-client-rest/package.json | 2 +- packages/js-client-rest/src/api/points-api.ts | 24 + .../src/openapi/generated_schema.ts | 305 +++++++++- packages/js-client-rest/src/qdrant-client.ts | 132 +++++ packages/qdrant-js/CHANGELOG.md | 12 + packages/qdrant-js/package.json | 6 +- .../qdrant-js/scripts/integration-tests.sh | 2 +- pnpm-lock.yaml | 4 +- 18 files changed, 1238 insertions(+), 41 deletions(-) diff --git a/examples/node-js-basic/package.json b/examples/node-js-basic/package.json index 8dcc3ba..71ee6d8 100644 --- a/examples/node-js-basic/package.json +++ b/examples/node-js-basic/package.json @@ -15,6 +15,6 @@ "author": "Qdrant Team", "license": "Apache-2.0", "dependencies": { - "@qdrant/qdrant-js": "^1.11.0" + "@qdrant/qdrant-js": "^1.12.0" } } diff --git a/packages/js-client-grpc/CHANGELOG.md b/packages/js-client-grpc/CHANGELOG.md index bd33c59..5a5cc58 100644 --- a/packages/js-client-grpc/CHANGELOG.md +++ b/packages/js-client-grpc/CHANGELOG.md @@ -1,5 +1,11 @@ # @qdrant/js-client-grpc +## 1.12.0 + +### Minor Changes + +- Qdrant v1.12.0 API + ## 1.11.0 ### Minor Changes diff --git a/packages/js-client-grpc/package.json b/packages/js-client-grpc/package.json index eb48ad1..e8100cd 100644 --- a/packages/js-client-grpc/package.json +++ b/packages/js-client-grpc/package.json @@ -1,6 +1,6 @@ { "name": "@qdrant/js-client-grpc", - "version": "1.11.0", + "version": "1.12.0", "engines": { "node": ">=18.0.0", "pnpm": ">=8" diff --git a/packages/js-client-grpc/proto/collections.proto b/packages/js-client-grpc/proto/collections.proto index 302593a..474735f 100644 --- a/packages/js-client-grpc/proto/collections.proto +++ b/packages/js-client-grpc/proto/collections.proto @@ -310,6 +310,18 @@ enum ShardingMethod { Custom = 1; // Shard by user-defined key } +message StrictModeConfig { + optional bool enabled = 1; + optional uint32 max_query_limit = 2; + optional uint32 max_timeout = 3; + optional bool unindexed_filtering_retrieve = 4; + optional bool unindexed_filtering_update = 5; + + optional uint32 search_max_hnsw_ef = 6; + optional bool search_allow_exact = 7; + optional float search_max_oversampling = 8; +} + message CreateCollection { string collection_name = 1; // Name of the collection reserved 2; // Deprecated @@ -327,6 +339,7 @@ message CreateCollection { optional QuantizationConfig quantization_config = 14; // Quantization configuration of vector optional ShardingMethod sharding_method = 15; // Sharding method optional SparseVectorConfig sparse_vectors_config = 16; // Configuration for sparse vectors + optional StrictModeConfig strict_mode_config = 17; // Configuration for strict mode } message UpdateCollection { @@ -376,6 +389,7 @@ message CollectionConfig { OptimizersConfigDiff optimizer_config = 3; // Configuration of the optimizers WalConfigDiff wal_config = 4; // Configuration of the Write-Ahead-Log optional QuantizationConfig quantization_config = 5; // Configuration of the vector quantization + optional StrictModeConfig strict_mode_config = 6; // Configuration of strict mode. } enum TokenizerType { @@ -392,8 +406,8 @@ message KeywordIndexParams { } message IntegerIndexParams { - bool lookup = 1; // If true - support direct lookups. - bool range = 2; // If true - support ranges filters. + optional bool lookup = 1; // If true - support direct lookups. + optional bool range = 2; // If true - support ranges filters. optional bool is_principal = 3; // If true - use this key to organize storage of the collection data. This option assumes that this key will be used in majority of filtered requests. optional bool on_disk = 4; // If true - store index on disk. } @@ -404,6 +418,7 @@ message FloatIndexParams { } message GeoIndexParams { + optional bool on_disk = 1; // If true - store index on disk. } message TextIndexParams { @@ -411,6 +426,7 @@ message TextIndexParams { optional bool lowercase = 2; // If true - all tokens will be lowercase optional uint64 min_token_len = 3; // Minimal token length optional uint64 max_token_len = 4; // Maximal token length + optional bool on_disk = 5; // If true - store index on disk. } message BoolIndexParams { diff --git a/packages/js-client-grpc/proto/points.proto b/packages/js-client-grpc/proto/points.proto index 858cb99..03fa593 100644 --- a/packages/js-client-grpc/proto/points.proto +++ b/packages/js-client-grpc/proto/points.proto @@ -589,17 +589,59 @@ message QueryPointGroups { optional ShardKeySelector shard_key_selector = 17; // Specify in which shards to look for the points, if not specified - look in all shards } +message FacetCounts { + string collection_name = 1; // Name of the collection + string key = 2; // Payload key of the facet + optional Filter filter = 3; // Filter conditions - return only those points that satisfy the specified conditions. + optional uint64 limit = 4; // Max number of facets. Default is 10. + optional bool exact = 5; // If true, return exact counts, slower but useful for debugging purposes. Default is false. + optional uint64 timeout = 6; // If set, overrides global timeout setting for this request. Unit is seconds. + optional ReadConsistency read_consistency = 7; // Options for specifying read consistency guarantees + optional ShardKeySelector shard_key_selector = 8; // Specify in which shards to look for the points, if not specified - look in all shards +} + message FacetValue { oneof variant { string string_value = 1; // String value from the facet + int64 integer_value = 2; // Integer value from the facet + bool bool_value = 3; // Boolean value from the facet } } -message FacetValueHit { +message FacetHit { FacetValue value = 1; // Value from the facet uint64 count = 2; // Number of points with this value } +message SearchMatrixPoints { + string collection_name = 1; // Name of the collection + optional Filter filter = 2; // Filter conditions - return only those points that satisfy the specified conditions. + optional uint64 sample = 3; // How many points to select and search within. Default is 10. + optional uint64 limit = 4; // How many neighbours per sample to find. Default is 3. + optional string using = 5; // Define which vector to use for querying. If missing, the default vector is is used. + optional uint64 timeout = 6; // If set, overrides global timeout setting for this request. Unit is seconds. + optional ReadConsistency read_consistency = 7; // Options for specifying read consistency guarantees + optional ShardKeySelector shard_key_selector = 8; // Specify in which shards to look for the points, if not specified - look in all shards +} + +message SearchMatrixPairs { + repeated SearchMatrixPair pairs = 1; // List of pairs of points with scores +} + +message SearchMatrixPair { + PointId a = 1; // first id of the pair + PointId b = 2; // second id of the pair + float score = 3; // score of the pair +} + +message SearchMatrixOffsets { + repeated uint64 offsets_row = 1; // Row indices of the matrix + repeated uint64 offsets_col = 2; // Column indices of the matrix + repeated float scores = 3; // Scores associated with matrix coordinates + repeated PointId ids = 4; // Ids of the points in order +} + + message PointsUpdateOperation { message PointStructList { repeated PointStruct points = 1; @@ -814,6 +856,21 @@ message UpdateBatchResponse { double time = 2; // Time spent to process } +message FacetResponse { + repeated FacetHit hits = 1; + double time = 2; // Time spent to process +} + +message SearchMatrixPairsResponse { + SearchMatrixPairs result = 1; + double time = 2; // Time spent to process +} + +message SearchMatrixOffsetsResponse { + SearchMatrixOffsets result = 1; + double time = 2; // Time spent to process +} + // --------------------------------------------- // ------------- Filter Conditions ------------- // --------------------------------------------- diff --git a/packages/js-client-grpc/proto/points_service.proto b/packages/js-client-grpc/proto/points_service.proto index def47d1..ef83007 100644 --- a/packages/js-client-grpc/proto/points_service.proto +++ b/packages/js-client-grpc/proto/points_service.proto @@ -121,4 +121,16 @@ service Points { Universally query points in a group fashion. This endpoint covers all capabilities of search, recommend, discover, filters. But also enables hybrid and multi-stage queries. */ rpc QueryGroups (QueryPointGroups) returns (QueryGroupsResponse) {} + /* + Perform facet counts. For each value in the field, count the number of points that have this value and match the conditions. + */ + rpc Facet (FacetCounts) returns (FacetResponse) {} + /* + Compute distance matrix for sampled points with a pair based output format + */ + rpc SearchMatrixPairs (SearchMatrixPoints) returns (SearchMatrixPairsResponse) {} + /* + Compute distance matrix for sampled points with an offset based output format + */ + rpc SearchMatrixOffsets (SearchMatrixPoints) returns (SearchMatrixOffsetsResponse) {} } diff --git a/packages/js-client-grpc/src/proto/collections_pb.ts b/packages/js-client-grpc/src/proto/collections_pb.ts index eef9422..37036ac 100644 --- a/packages/js-client-grpc/src/proto/collections_pb.ts +++ b/packages/js-client-grpc/src/proto/collections_pb.ts @@ -1875,6 +1875,85 @@ export class QuantizationConfigDiff extends Message { } } +/** + * @generated from message qdrant.StrictModeConfig + */ +export class StrictModeConfig extends Message { + /** + * @generated from field: optional bool enabled = 1; + */ + enabled?: boolean; + + /** + * @generated from field: optional uint32 max_query_limit = 2; + */ + maxQueryLimit?: number; + + /** + * @generated from field: optional uint32 max_timeout = 3; + */ + maxTimeout?: number; + + /** + * @generated from field: optional bool unindexed_filtering_retrieve = 4; + */ + unindexedFilteringRetrieve?: boolean; + + /** + * @generated from field: optional bool unindexed_filtering_update = 5; + */ + unindexedFilteringUpdate?: boolean; + + /** + * @generated from field: optional uint32 search_max_hnsw_ef = 6; + */ + searchMaxHnswEf?: number; + + /** + * @generated from field: optional bool search_allow_exact = 7; + */ + searchAllowExact?: boolean; + + /** + * @generated from field: optional float search_max_oversampling = 8; + */ + searchMaxOversampling?: number; + + constructor(data?: PartialMessage) { + super(); + proto3.util.initPartial(data, this); + } + + static readonly runtime: typeof proto3 = proto3; + static readonly typeName = "qdrant.StrictModeConfig"; + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + { no: 1, name: "enabled", kind: "scalar", T: 8 /* ScalarType.BOOL */, opt: true }, + { no: 2, name: "max_query_limit", kind: "scalar", T: 13 /* ScalarType.UINT32 */, opt: true }, + { no: 3, name: "max_timeout", kind: "scalar", T: 13 /* ScalarType.UINT32 */, opt: true }, + { no: 4, name: "unindexed_filtering_retrieve", kind: "scalar", T: 8 /* ScalarType.BOOL */, opt: true }, + { no: 5, name: "unindexed_filtering_update", kind: "scalar", T: 8 /* ScalarType.BOOL */, opt: true }, + { no: 6, name: "search_max_hnsw_ef", kind: "scalar", T: 13 /* ScalarType.UINT32 */, opt: true }, + { no: 7, name: "search_allow_exact", kind: "scalar", T: 8 /* ScalarType.BOOL */, opt: true }, + { no: 8, name: "search_max_oversampling", kind: "scalar", T: 2 /* ScalarType.FLOAT */, opt: true }, + ]); + + static fromBinary(bytes: Uint8Array, options?: Partial): StrictModeConfig { + return new StrictModeConfig().fromBinary(bytes, options); + } + + static fromJson(jsonValue: JsonValue, options?: Partial): StrictModeConfig { + return new StrictModeConfig().fromJson(jsonValue, options); + } + + static fromJsonString(jsonString: string, options?: Partial): StrictModeConfig { + return new StrictModeConfig().fromJsonString(jsonString, options); + } + + static equals(a: StrictModeConfig | PlainMessage | undefined, b: StrictModeConfig | PlainMessage | undefined): boolean { + return proto3.util.equals(StrictModeConfig, a, b); + } +} + /** * @generated from message qdrant.CreateCollection */ @@ -1977,6 +2056,13 @@ export class CreateCollection extends Message { */ sparseVectorsConfig?: SparseVectorConfig; + /** + * Configuration for strict mode + * + * @generated from field: optional qdrant.StrictModeConfig strict_mode_config = 17; + */ + strictModeConfig?: StrictModeConfig; + constructor(data?: PartialMessage) { super(); proto3.util.initPartial(data, this); @@ -1999,6 +2085,7 @@ export class CreateCollection extends Message { { no: 14, name: "quantization_config", kind: "message", T: QuantizationConfig, opt: true }, { no: 15, name: "sharding_method", kind: "enum", T: proto3.getEnumType(ShardingMethod), opt: true }, { no: 16, name: "sparse_vectors_config", kind: "message", T: SparseVectorConfig, opt: true }, + { no: 17, name: "strict_mode_config", kind: "message", T: StrictModeConfig, opt: true }, ]); static fromBinary(bytes: Uint8Array, options?: Partial): CreateCollection { @@ -2404,6 +2491,13 @@ export class CollectionConfig extends Message { */ quantizationConfig?: QuantizationConfig; + /** + * Configuration of strict mode. + * + * @generated from field: optional qdrant.StrictModeConfig strict_mode_config = 6; + */ + strictModeConfig?: StrictModeConfig; + constructor(data?: PartialMessage) { super(); proto3.util.initPartial(data, this); @@ -2417,6 +2511,7 @@ export class CollectionConfig extends Message { { no: 3, name: "optimizer_config", kind: "message", T: OptimizersConfigDiff }, { no: 4, name: "wal_config", kind: "message", T: WalConfigDiff }, { no: 5, name: "quantization_config", kind: "message", T: QuantizationConfig, opt: true }, + { no: 6, name: "strict_mode_config", kind: "message", T: StrictModeConfig, opt: true }, ]); static fromBinary(bytes: Uint8Array, options?: Partial): CollectionConfig { @@ -2490,16 +2585,16 @@ export class IntegerIndexParams extends Message { /** * If true - support direct lookups. * - * @generated from field: bool lookup = 1; + * @generated from field: optional bool lookup = 1; */ - lookup = false; + lookup?: boolean; /** * If true - support ranges filters. * - * @generated from field: bool range = 2; + * @generated from field: optional bool range = 2; */ - range = false; + range?: boolean; /** * If true - use this key to organize storage of the collection data. This option assumes that this key will be used in majority of filtered requests. @@ -2523,8 +2618,8 @@ export class IntegerIndexParams extends Message { static readonly runtime: typeof proto3 = proto3; static readonly typeName = "qdrant.IntegerIndexParams"; static readonly fields: FieldList = proto3.util.newFieldList(() => [ - { no: 1, name: "lookup", kind: "scalar", T: 8 /* ScalarType.BOOL */ }, - { no: 2, name: "range", kind: "scalar", T: 8 /* ScalarType.BOOL */ }, + { no: 1, name: "lookup", kind: "scalar", T: 8 /* ScalarType.BOOL */, opt: true }, + { no: 2, name: "range", kind: "scalar", T: 8 /* ScalarType.BOOL */, opt: true }, { no: 3, name: "is_principal", kind: "scalar", T: 8 /* ScalarType.BOOL */, opt: true }, { no: 4, name: "on_disk", kind: "scalar", T: 8 /* ScalarType.BOOL */, opt: true }, ]); @@ -2597,6 +2692,13 @@ export class FloatIndexParams extends Message { * @generated from message qdrant.GeoIndexParams */ export class GeoIndexParams extends Message { + /** + * If true - store index on disk. + * + * @generated from field: optional bool on_disk = 1; + */ + onDisk?: boolean; + constructor(data?: PartialMessage) { super(); proto3.util.initPartial(data, this); @@ -2605,6 +2707,7 @@ export class GeoIndexParams extends Message { static readonly runtime: typeof proto3 = proto3; static readonly typeName = "qdrant.GeoIndexParams"; static readonly fields: FieldList = proto3.util.newFieldList(() => [ + { no: 1, name: "on_disk", kind: "scalar", T: 8 /* ScalarType.BOOL */, opt: true }, ]); static fromBinary(bytes: Uint8Array, options?: Partial): GeoIndexParams { @@ -2656,6 +2759,13 @@ export class TextIndexParams extends Message { */ maxTokenLen?: bigint; + /** + * If true - store index on disk. + * + * @generated from field: optional bool on_disk = 5; + */ + onDisk?: boolean; + constructor(data?: PartialMessage) { super(); proto3.util.initPartial(data, this); @@ -2668,6 +2778,7 @@ export class TextIndexParams extends Message { { no: 2, name: "lowercase", kind: "scalar", T: 8 /* ScalarType.BOOL */, opt: true }, { no: 3, name: "min_token_len", kind: "scalar", T: 4 /* ScalarType.UINT64 */, opt: true }, { no: 4, name: "max_token_len", kind: "scalar", T: 4 /* ScalarType.UINT64 */, opt: true }, + { no: 5, name: "on_disk", kind: "scalar", T: 8 /* ScalarType.BOOL */, opt: true }, ]); static fromBinary(bytes: Uint8Array, options?: Partial): TextIndexParams { diff --git a/packages/js-client-grpc/src/proto/points_pb.ts b/packages/js-client-grpc/src/proto/points_pb.ts index fa85b6c..3af7a70 100644 --- a/packages/js-client-grpc/src/proto/points_pb.ts +++ b/packages/js-client-grpc/src/proto/points_pb.ts @@ -4276,6 +4276,101 @@ export class QueryPointGroups extends Message { } } +/** + * @generated from message qdrant.FacetCounts + */ +export class FacetCounts extends Message { + /** + * Name of the collection + * + * @generated from field: string collection_name = 1; + */ + collectionName = ""; + + /** + * Payload key of the facet + * + * @generated from field: string key = 2; + */ + key = ""; + + /** + * Filter conditions - return only those points that satisfy the specified conditions. + * + * @generated from field: optional qdrant.Filter filter = 3; + */ + filter?: Filter; + + /** + * Max number of facets. Default is 10. + * + * @generated from field: optional uint64 limit = 4; + */ + limit?: bigint; + + /** + * If true, return exact counts, slower but useful for debugging purposes. Default is false. + * + * @generated from field: optional bool exact = 5; + */ + exact?: boolean; + + /** + * If set, overrides global timeout setting for this request. Unit is seconds. + * + * @generated from field: optional uint64 timeout = 6; + */ + timeout?: bigint; + + /** + * Options for specifying read consistency guarantees + * + * @generated from field: optional qdrant.ReadConsistency read_consistency = 7; + */ + readConsistency?: ReadConsistency; + + /** + * Specify in which shards to look for the points, if not specified - look in all shards + * + * @generated from field: optional qdrant.ShardKeySelector shard_key_selector = 8; + */ + shardKeySelector?: ShardKeySelector; + + constructor(data?: PartialMessage) { + super(); + proto3.util.initPartial(data, this); + } + + static readonly runtime: typeof proto3 = proto3; + static readonly typeName = "qdrant.FacetCounts"; + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + { no: 1, name: "collection_name", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 2, name: "key", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 3, name: "filter", kind: "message", T: Filter, opt: true }, + { no: 4, name: "limit", kind: "scalar", T: 4 /* ScalarType.UINT64 */, opt: true }, + { no: 5, name: "exact", kind: "scalar", T: 8 /* ScalarType.BOOL */, opt: true }, + { no: 6, name: "timeout", kind: "scalar", T: 4 /* ScalarType.UINT64 */, opt: true }, + { no: 7, name: "read_consistency", kind: "message", T: ReadConsistency, opt: true }, + { no: 8, name: "shard_key_selector", kind: "message", T: ShardKeySelector, opt: true }, + ]); + + static fromBinary(bytes: Uint8Array, options?: Partial): FacetCounts { + return new FacetCounts().fromBinary(bytes, options); + } + + static fromJson(jsonValue: JsonValue, options?: Partial): FacetCounts { + return new FacetCounts().fromJson(jsonValue, options); + } + + static fromJsonString(jsonString: string, options?: Partial): FacetCounts { + return new FacetCounts().fromJsonString(jsonString, options); + } + + static equals(a: FacetCounts | PlainMessage | undefined, b: FacetCounts | PlainMessage | undefined): boolean { + return proto3.util.equals(FacetCounts, a, b); + } +} + /** * @generated from message qdrant.FacetValue */ @@ -4291,6 +4386,22 @@ export class FacetValue extends Message { */ value: string; case: "stringValue"; + } | { + /** + * Integer value from the facet + * + * @generated from field: int64 integer_value = 2; + */ + value: bigint; + case: "integerValue"; + } | { + /** + * Boolean value from the facet + * + * @generated from field: bool bool_value = 3; + */ + value: boolean; + case: "boolValue"; } | { case: undefined; value?: undefined } = { case: undefined }; constructor(data?: PartialMessage) { @@ -4302,6 +4413,8 @@ export class FacetValue extends Message { static readonly typeName = "qdrant.FacetValue"; static readonly fields: FieldList = proto3.util.newFieldList(() => [ { no: 1, name: "string_value", kind: "scalar", T: 9 /* ScalarType.STRING */, oneof: "variant" }, + { no: 2, name: "integer_value", kind: "scalar", T: 3 /* ScalarType.INT64 */, oneof: "variant" }, + { no: 3, name: "bool_value", kind: "scalar", T: 8 /* ScalarType.BOOL */, oneof: "variant" }, ]); static fromBinary(bytes: Uint8Array, options?: Partial): FacetValue { @@ -4322,9 +4435,9 @@ export class FacetValue extends Message { } /** - * @generated from message qdrant.FacetValueHit + * @generated from message qdrant.FacetHit */ -export class FacetValueHit extends Message { +export class FacetHit extends Message { /** * Value from the facet * @@ -4339,32 +4452,284 @@ export class FacetValueHit extends Message { */ count = protoInt64.zero; - constructor(data?: PartialMessage) { + constructor(data?: PartialMessage) { super(); proto3.util.initPartial(data, this); } static readonly runtime: typeof proto3 = proto3; - static readonly typeName = "qdrant.FacetValueHit"; + static readonly typeName = "qdrant.FacetHit"; static readonly fields: FieldList = proto3.util.newFieldList(() => [ { no: 1, name: "value", kind: "message", T: FacetValue }, { no: 2, name: "count", kind: "scalar", T: 4 /* ScalarType.UINT64 */ }, ]); - static fromBinary(bytes: Uint8Array, options?: Partial): FacetValueHit { - return new FacetValueHit().fromBinary(bytes, options); + static fromBinary(bytes: Uint8Array, options?: Partial): FacetHit { + return new FacetHit().fromBinary(bytes, options); + } + + static fromJson(jsonValue: JsonValue, options?: Partial): FacetHit { + return new FacetHit().fromJson(jsonValue, options); + } + + static fromJsonString(jsonString: string, options?: Partial): FacetHit { + return new FacetHit().fromJsonString(jsonString, options); + } + + static equals(a: FacetHit | PlainMessage | undefined, b: FacetHit | PlainMessage | undefined): boolean { + return proto3.util.equals(FacetHit, a, b); + } +} + +/** + * @generated from message qdrant.SearchMatrixPoints + */ +export class SearchMatrixPoints extends Message { + /** + * Name of the collection + * + * @generated from field: string collection_name = 1; + */ + collectionName = ""; + + /** + * Filter conditions - return only those points that satisfy the specified conditions. + * + * @generated from field: optional qdrant.Filter filter = 2; + */ + filter?: Filter; + + /** + * How many points to select and search within. Default is 10. + * + * @generated from field: optional uint64 sample = 3; + */ + sample?: bigint; + + /** + * How many neighbours per sample to find. Default is 3. + * + * @generated from field: optional uint64 limit = 4; + */ + limit?: bigint; + + /** + * Define which vector to use for querying. If missing, the default vector is is used. + * + * @generated from field: optional string using = 5; + */ + using?: string; + + /** + * If set, overrides global timeout setting for this request. Unit is seconds. + * + * @generated from field: optional uint64 timeout = 6; + */ + timeout?: bigint; + + /** + * Options for specifying read consistency guarantees + * + * @generated from field: optional qdrant.ReadConsistency read_consistency = 7; + */ + readConsistency?: ReadConsistency; + + /** + * Specify in which shards to look for the points, if not specified - look in all shards + * + * @generated from field: optional qdrant.ShardKeySelector shard_key_selector = 8; + */ + shardKeySelector?: ShardKeySelector; + + constructor(data?: PartialMessage) { + super(); + proto3.util.initPartial(data, this); + } + + static readonly runtime: typeof proto3 = proto3; + static readonly typeName = "qdrant.SearchMatrixPoints"; + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + { no: 1, name: "collection_name", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 2, name: "filter", kind: "message", T: Filter, opt: true }, + { no: 3, name: "sample", kind: "scalar", T: 4 /* ScalarType.UINT64 */, opt: true }, + { no: 4, name: "limit", kind: "scalar", T: 4 /* ScalarType.UINT64 */, opt: true }, + { no: 5, name: "using", kind: "scalar", T: 9 /* ScalarType.STRING */, opt: true }, + { no: 6, name: "timeout", kind: "scalar", T: 4 /* ScalarType.UINT64 */, opt: true }, + { no: 7, name: "read_consistency", kind: "message", T: ReadConsistency, opt: true }, + { no: 8, name: "shard_key_selector", kind: "message", T: ShardKeySelector, opt: true }, + ]); + + static fromBinary(bytes: Uint8Array, options?: Partial): SearchMatrixPoints { + return new SearchMatrixPoints().fromBinary(bytes, options); } - static fromJson(jsonValue: JsonValue, options?: Partial): FacetValueHit { - return new FacetValueHit().fromJson(jsonValue, options); + static fromJson(jsonValue: JsonValue, options?: Partial): SearchMatrixPoints { + return new SearchMatrixPoints().fromJson(jsonValue, options); } - static fromJsonString(jsonString: string, options?: Partial): FacetValueHit { - return new FacetValueHit().fromJsonString(jsonString, options); + static fromJsonString(jsonString: string, options?: Partial): SearchMatrixPoints { + return new SearchMatrixPoints().fromJsonString(jsonString, options); } - static equals(a: FacetValueHit | PlainMessage | undefined, b: FacetValueHit | PlainMessage | undefined): boolean { - return proto3.util.equals(FacetValueHit, a, b); + static equals(a: SearchMatrixPoints | PlainMessage | undefined, b: SearchMatrixPoints | PlainMessage | undefined): boolean { + return proto3.util.equals(SearchMatrixPoints, a, b); + } +} + +/** + * @generated from message qdrant.SearchMatrixPairs + */ +export class SearchMatrixPairs extends Message { + /** + * List of pairs of points with scores + * + * @generated from field: repeated qdrant.SearchMatrixPair pairs = 1; + */ + pairs: SearchMatrixPair[] = []; + + constructor(data?: PartialMessage) { + super(); + proto3.util.initPartial(data, this); + } + + static readonly runtime: typeof proto3 = proto3; + static readonly typeName = "qdrant.SearchMatrixPairs"; + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + { no: 1, name: "pairs", kind: "message", T: SearchMatrixPair, repeated: true }, + ]); + + static fromBinary(bytes: Uint8Array, options?: Partial): SearchMatrixPairs { + return new SearchMatrixPairs().fromBinary(bytes, options); + } + + static fromJson(jsonValue: JsonValue, options?: Partial): SearchMatrixPairs { + return new SearchMatrixPairs().fromJson(jsonValue, options); + } + + static fromJsonString(jsonString: string, options?: Partial): SearchMatrixPairs { + return new SearchMatrixPairs().fromJsonString(jsonString, options); + } + + static equals(a: SearchMatrixPairs | PlainMessage | undefined, b: SearchMatrixPairs | PlainMessage | undefined): boolean { + return proto3.util.equals(SearchMatrixPairs, a, b); + } +} + +/** + * @generated from message qdrant.SearchMatrixPair + */ +export class SearchMatrixPair extends Message { + /** + * first id of the pair + * + * @generated from field: qdrant.PointId a = 1; + */ + a?: PointId; + + /** + * second id of the pair + * + * @generated from field: qdrant.PointId b = 2; + */ + b?: PointId; + + /** + * score of the pair + * + * @generated from field: float score = 3; + */ + score = 0; + + constructor(data?: PartialMessage) { + super(); + proto3.util.initPartial(data, this); + } + + static readonly runtime: typeof proto3 = proto3; + static readonly typeName = "qdrant.SearchMatrixPair"; + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + { no: 1, name: "a", kind: "message", T: PointId }, + { no: 2, name: "b", kind: "message", T: PointId }, + { no: 3, name: "score", kind: "scalar", T: 2 /* ScalarType.FLOAT */ }, + ]); + + static fromBinary(bytes: Uint8Array, options?: Partial): SearchMatrixPair { + return new SearchMatrixPair().fromBinary(bytes, options); + } + + static fromJson(jsonValue: JsonValue, options?: Partial): SearchMatrixPair { + return new SearchMatrixPair().fromJson(jsonValue, options); + } + + static fromJsonString(jsonString: string, options?: Partial): SearchMatrixPair { + return new SearchMatrixPair().fromJsonString(jsonString, options); + } + + static equals(a: SearchMatrixPair | PlainMessage | undefined, b: SearchMatrixPair | PlainMessage | undefined): boolean { + return proto3.util.equals(SearchMatrixPair, a, b); + } +} + +/** + * @generated from message qdrant.SearchMatrixOffsets + */ +export class SearchMatrixOffsets extends Message { + /** + * Row indices of the matrix + * + * @generated from field: repeated uint64 offsets_row = 1; + */ + offsetsRow: bigint[] = []; + + /** + * Column indices of the matrix + * + * @generated from field: repeated uint64 offsets_col = 2; + */ + offsetsCol: bigint[] = []; + + /** + * Scores associated with matrix coordinates + * + * @generated from field: repeated float scores = 3; + */ + scores: number[] = []; + + /** + * Ids of the points in order + * + * @generated from field: repeated qdrant.PointId ids = 4; + */ + ids: PointId[] = []; + + constructor(data?: PartialMessage) { + super(); + proto3.util.initPartial(data, this); + } + + static readonly runtime: typeof proto3 = proto3; + static readonly typeName = "qdrant.SearchMatrixOffsets"; + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + { no: 1, name: "offsets_row", kind: "scalar", T: 4 /* ScalarType.UINT64 */, repeated: true }, + { no: 2, name: "offsets_col", kind: "scalar", T: 4 /* ScalarType.UINT64 */, repeated: true }, + { no: 3, name: "scores", kind: "scalar", T: 2 /* ScalarType.FLOAT */, repeated: true }, + { no: 4, name: "ids", kind: "message", T: PointId, repeated: true }, + ]); + + static fromBinary(bytes: Uint8Array, options?: Partial): SearchMatrixOffsets { + return new SearchMatrixOffsets().fromBinary(bytes, options); + } + + static fromJson(jsonValue: JsonValue, options?: Partial): SearchMatrixOffsets { + return new SearchMatrixOffsets().fromJson(jsonValue, options); + } + + static fromJsonString(jsonString: string, options?: Partial): SearchMatrixOffsets { + return new SearchMatrixOffsets().fromJsonString(jsonString, options); + } + + static equals(a: SearchMatrixOffsets | PlainMessage | undefined, b: SearchMatrixOffsets | PlainMessage | undefined): boolean { + return proto3.util.equals(SearchMatrixOffsets, a, b); } } @@ -6161,6 +6526,141 @@ export class UpdateBatchResponse extends Message { } } +/** + * @generated from message qdrant.FacetResponse + */ +export class FacetResponse extends Message { + /** + * @generated from field: repeated qdrant.FacetHit hits = 1; + */ + hits: FacetHit[] = []; + + /** + * Time spent to process + * + * @generated from field: double time = 2; + */ + time = 0; + + constructor(data?: PartialMessage) { + super(); + proto3.util.initPartial(data, this); + } + + static readonly runtime: typeof proto3 = proto3; + static readonly typeName = "qdrant.FacetResponse"; + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + { no: 1, name: "hits", kind: "message", T: FacetHit, repeated: true }, + { no: 2, name: "time", kind: "scalar", T: 1 /* ScalarType.DOUBLE */ }, + ]); + + static fromBinary(bytes: Uint8Array, options?: Partial): FacetResponse { + return new FacetResponse().fromBinary(bytes, options); + } + + static fromJson(jsonValue: JsonValue, options?: Partial): FacetResponse { + return new FacetResponse().fromJson(jsonValue, options); + } + + static fromJsonString(jsonString: string, options?: Partial): FacetResponse { + return new FacetResponse().fromJsonString(jsonString, options); + } + + static equals(a: FacetResponse | PlainMessage | undefined, b: FacetResponse | PlainMessage | undefined): boolean { + return proto3.util.equals(FacetResponse, a, b); + } +} + +/** + * @generated from message qdrant.SearchMatrixPairsResponse + */ +export class SearchMatrixPairsResponse extends Message { + /** + * @generated from field: qdrant.SearchMatrixPairs result = 1; + */ + result?: SearchMatrixPairs; + + /** + * Time spent to process + * + * @generated from field: double time = 2; + */ + time = 0; + + constructor(data?: PartialMessage) { + super(); + proto3.util.initPartial(data, this); + } + + static readonly runtime: typeof proto3 = proto3; + static readonly typeName = "qdrant.SearchMatrixPairsResponse"; + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + { no: 1, name: "result", kind: "message", T: SearchMatrixPairs }, + { no: 2, name: "time", kind: "scalar", T: 1 /* ScalarType.DOUBLE */ }, + ]); + + static fromBinary(bytes: Uint8Array, options?: Partial): SearchMatrixPairsResponse { + return new SearchMatrixPairsResponse().fromBinary(bytes, options); + } + + static fromJson(jsonValue: JsonValue, options?: Partial): SearchMatrixPairsResponse { + return new SearchMatrixPairsResponse().fromJson(jsonValue, options); + } + + static fromJsonString(jsonString: string, options?: Partial): SearchMatrixPairsResponse { + return new SearchMatrixPairsResponse().fromJsonString(jsonString, options); + } + + static equals(a: SearchMatrixPairsResponse | PlainMessage | undefined, b: SearchMatrixPairsResponse | PlainMessage | undefined): boolean { + return proto3.util.equals(SearchMatrixPairsResponse, a, b); + } +} + +/** + * @generated from message qdrant.SearchMatrixOffsetsResponse + */ +export class SearchMatrixOffsetsResponse extends Message { + /** + * @generated from field: qdrant.SearchMatrixOffsets result = 1; + */ + result?: SearchMatrixOffsets; + + /** + * Time spent to process + * + * @generated from field: double time = 2; + */ + time = 0; + + constructor(data?: PartialMessage) { + super(); + proto3.util.initPartial(data, this); + } + + static readonly runtime: typeof proto3 = proto3; + static readonly typeName = "qdrant.SearchMatrixOffsetsResponse"; + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + { no: 1, name: "result", kind: "message", T: SearchMatrixOffsets }, + { no: 2, name: "time", kind: "scalar", T: 1 /* ScalarType.DOUBLE */ }, + ]); + + static fromBinary(bytes: Uint8Array, options?: Partial): SearchMatrixOffsetsResponse { + return new SearchMatrixOffsetsResponse().fromBinary(bytes, options); + } + + static fromJson(jsonValue: JsonValue, options?: Partial): SearchMatrixOffsetsResponse { + return new SearchMatrixOffsetsResponse().fromJson(jsonValue, options); + } + + static fromJsonString(jsonString: string, options?: Partial): SearchMatrixOffsetsResponse { + return new SearchMatrixOffsetsResponse().fromJsonString(jsonString, options); + } + + static equals(a: SearchMatrixOffsetsResponse | PlainMessage | undefined, b: SearchMatrixOffsetsResponse | PlainMessage | undefined): boolean { + return proto3.util.equals(SearchMatrixOffsetsResponse, a, b); + } +} + /** * @generated from message qdrant.Filter */ diff --git a/packages/js-client-grpc/src/proto/points_service_connect.ts b/packages/js-client-grpc/src/proto/points_service_connect.ts index efba4d1..6880d3f 100644 --- a/packages/js-client-grpc/src/proto/points_service_connect.ts +++ b/packages/js-client-grpc/src/proto/points_service_connect.ts @@ -3,7 +3,7 @@ /* eslint-disable */ // @ts-nocheck -import { ClearPayloadPoints, CountPoints, CountResponse, CreateFieldIndexCollection, DeleteFieldIndexCollection, DeletePayloadPoints, DeletePoints, DeletePointVectors, DiscoverBatchPoints, DiscoverBatchResponse, DiscoverPoints, DiscoverResponse, GetPoints, GetResponse, PointsOperationResponse, QueryBatchPoints, QueryBatchResponse, QueryGroupsResponse, QueryPointGroups, QueryPoints, QueryResponse, RecommendBatchPoints, RecommendBatchResponse, RecommendGroupsResponse, RecommendPointGroups, RecommendPoints, RecommendResponse, ScrollPoints, ScrollResponse, SearchBatchPoints, SearchBatchResponse, SearchGroupsResponse, SearchPointGroups, SearchPoints, SearchResponse, SetPayloadPoints, UpdateBatchPoints, UpdateBatchResponse, UpdatePointVectors, UpsertPoints } from "./points_pb.js"; +import { ClearPayloadPoints, CountPoints, CountResponse, CreateFieldIndexCollection, DeleteFieldIndexCollection, DeletePayloadPoints, DeletePoints, DeletePointVectors, DiscoverBatchPoints, DiscoverBatchResponse, DiscoverPoints, DiscoverResponse, FacetCounts, FacetResponse, GetPoints, GetResponse, PointsOperationResponse, QueryBatchPoints, QueryBatchResponse, QueryGroupsResponse, QueryPointGroups, QueryPoints, QueryResponse, RecommendBatchPoints, RecommendBatchResponse, RecommendGroupsResponse, RecommendPointGroups, RecommendPoints, RecommendResponse, ScrollPoints, ScrollResponse, SearchBatchPoints, SearchBatchResponse, SearchGroupsResponse, SearchMatrixOffsetsResponse, SearchMatrixPairsResponse, SearchMatrixPoints, SearchPointGroups, SearchPoints, SearchResponse, SetPayloadPoints, UpdateBatchPoints, UpdateBatchResponse, UpdatePointVectors, UpsertPoints } from "./points_pb.js"; import { MethodKind } from "@bufbuild/protobuf"; /** @@ -326,6 +326,42 @@ export const Points = { O: QueryGroupsResponse, kind: MethodKind.Unary, }, + /** + * + * Perform facet counts. For each value in the field, count the number of points that have this value and match the conditions. + * + * @generated from rpc qdrant.Points.Facet + */ + facet: { + name: "Facet", + I: FacetCounts, + O: FacetResponse, + kind: MethodKind.Unary, + }, + /** + * + * Compute distance matrix for sampled points with a pair based output format + * + * @generated from rpc qdrant.Points.SearchMatrixPairs + */ + searchMatrixPairs: { + name: "SearchMatrixPairs", + I: SearchMatrixPoints, + O: SearchMatrixPairsResponse, + kind: MethodKind.Unary, + }, + /** + * + * Compute distance matrix for sampled points with an offset based output format + * + * @generated from rpc qdrant.Points.SearchMatrixOffsets + */ + searchMatrixOffsets: { + name: "SearchMatrixOffsets", + I: SearchMatrixPoints, + O: SearchMatrixOffsetsResponse, + kind: MethodKind.Unary, + }, } } as const; diff --git a/packages/js-client-rest/CHANGELOG.md b/packages/js-client-rest/CHANGELOG.md index 7df4291..bf92cf5 100644 --- a/packages/js-client-rest/CHANGELOG.md +++ b/packages/js-client-rest/CHANGELOG.md @@ -1,5 +1,11 @@ # @qdrant/js-client-rest +## 1.12.0 + +### Minor Changes + +- Qdrant v1.12.0 API + ## 1.11.0 ### Minor Changes diff --git a/packages/js-client-rest/package.json b/packages/js-client-rest/package.json index ab7c10c..45793f2 100644 --- a/packages/js-client-rest/package.json +++ b/packages/js-client-rest/package.json @@ -1,6 +1,6 @@ { "name": "@qdrant/js-client-rest", - "version": "1.11.0", + "version": "1.12.0", "engines": { "node": ">=18.0.0", "pnpm": ">=8" diff --git a/packages/js-client-rest/src/api/points-api.ts b/packages/js-client-rest/src/api/points-api.ts index 14a271a..eb3262a 100644 --- a/packages/js-client-rest/src/api/points-api.ts +++ b/packages/js-client-rest/src/api/points-api.ts @@ -187,5 +187,29 @@ export function createPointsApi(client: Client) { .path('/collections/{collection_name}/points/query/groups') .method('post') .create({consistency: true, timeout: true}), + + /** + * Facet a payload key with a given filter. + */ + facet: client + .path('/collections/{collection_name}/facet') + .method('post') + .create({consistency: true, timeout: true}), + + /** + * Search points matrix distance pairs + */ + searchMatrixPairs: client + .path('/collections/{collection_name}/points/search/matrix/pairs') + .method('post') + .create({consistency: true, timeout: true}), + + /** + * Search points matrix distance offsets + */ + searchMatrixOffsets: client + .path('/collections/{collection_name}/points/search/matrix/offsets') + .method('post') + .create({consistency: true, timeout: true}), } as const; } diff --git a/packages/js-client-rest/src/openapi/generated_schema.ts b/packages/js-client-rest/src/openapi/generated_schema.ts index 5c7dad8..28a17ba 100644 --- a/packages/js-client-rest/src/openapi/generated_schema.ts +++ b/packages/js-client-rest/src/openapi/generated_schema.ts @@ -425,6 +425,13 @@ export interface paths { */ post: operations["count_points"]; }; + "/collections/{collection_name}/facet": { + /** + * Facet a payload key with a given filter. + * @description Count points that satisfy the given filter for each unique value of a payload key. + */ + post: operations["facet"]; + }; "/collections/{collection_name}/points/query": { /** * Query points @@ -446,6 +453,20 @@ export interface paths { */ post: operations["query_points_groups"]; }; + "/collections/{collection_name}/points/search/matrix/pairs": { + /** + * Search points matrix distance pairs + * @description Compute distance matrix for sampled points with a pair based output format + */ + post: operations["search_matrix_pairs"]; + }; + "/collections/{collection_name}/points/search/matrix/offsets": { + /** + * Search points matrix distance offsets + * @description Compute distance matrix for sampled points with an offset based output format + */ + post: operations["search_matrix_offsets"]; + }; } export type webhooks = Record; @@ -519,7 +540,7 @@ export interface components { }; }; /** - * @description Current state of the collection. `Green` - all good. `Yellow` - optimization is running, `Red` - some operations failed and was not recovered + * @description Current state of the collection. `Green` - all good. `Yellow` - optimization is running, 'Grey' - optimizations are possible but not triggered, `Red` - some operations failed and was not recovered * @enum {string} */ CollectionStatus: "green" | "yellow" | "grey" | "red"; @@ -844,9 +865,9 @@ export interface components { IntegerIndexParams: { type: components["schemas"]["IntegerIndexType"]; /** @description If true - support direct lookups. */ - lookup: boolean; + lookup?: boolean | null; /** @description If true - support ranges filters. */ - range: boolean; + range?: boolean | null; /** @description If true - use this key to organize storage of the collection data. This option assumes that this key will be used in majority of filtered requests. */ is_principal?: boolean | null; /** @description If true, store the index on disk. Default: false. */ @@ -865,18 +886,28 @@ export interface components { FloatIndexType: "float"; GeoIndexParams: { type: components["schemas"]["GeoIndexType"]; + /** @description If true, store the index on disk. Default: false. */ + on_disk?: boolean | null; }; /** @enum {string} */ GeoIndexType: "geo"; TextIndexParams: { type: components["schemas"]["TextIndexType"]; tokenizer?: components["schemas"]["TokenizerType"]; - /** Format: uint */ + /** + * Format: uint + * @description Minimum characters to be tokenized. + */ min_token_len?: number | null; - /** Format: uint */ + /** + * Format: uint + * @description Maximum characters to be tokenized. + */ max_token_len?: number | null; /** @description If true, lowercase all tokens. Default: true. */ lowercase?: boolean | null; + /** @description If true, store the index on disk. Default: false. */ + on_disk?: boolean | null; }; /** @enum {string} */ TextIndexType: "text"; @@ -955,8 +986,8 @@ export interface components { /** @description Full vector data per point separator with single and multiple vector modes */ VectorStruct: (number)[] | ((number)[])[] | ({ [key: string]: components["schemas"]["Vector"] | undefined; - }); - Vector: (number)[] | components["schemas"]["SparseVector"] | ((number)[])[]; + }) | components["schemas"]["Document"]; + Vector: (number)[] | components["schemas"]["SparseVector"] | ((number)[])[] | components["schemas"]["Document"]; /** @description Sparse vector structure */ SparseVector: { /** @description Indices must be unique */ @@ -964,6 +995,17 @@ export interface components { /** @description Values and indices must be the same length */ values: (number)[]; }; + /** + * @description WARN: Work-in-progress, unimplemented + * + * Text document for embedding. Requires inference infrastructure, unimplemented. + */ + Document: { + /** @description Text of the document This field will be used as input for the embedding model */ + text: string; + /** @description Name of the model used to generate the vector List of available models depends on a provider */ + model?: string | null; + }; OrderValue: number; /** @description Search request. Holds all conditions and parameters for the search of most similar points by vector similarity given the filtering restrictions. */ SearchRequest: { @@ -1698,7 +1740,7 @@ export interface components { }; BatchVectorStruct: ((number)[])[] | (((number)[])[])[] | ({ [key: string]: (components["schemas"]["Vector"])[] | undefined; - }); + }) | (components["schemas"]["Document"])[]; PointsList: { points: (components["schemas"]["PointStruct"])[]; shard_key?: components["schemas"]["ShardKeySelector"] | (Record | null); @@ -1868,7 +1910,7 @@ export interface components { /** @description Shard transfers */ shard_transfers: (components["schemas"]["ShardTransferInfo"])[]; /** @description Resharding operations */ - resharding_operations: (components["schemas"]["ReshardingInfo"])[]; + resharding_operations?: (components["schemas"]["ReshardingInfo"])[] | null; }; LocalShardInfo: { /** @@ -1951,6 +1993,7 @@ export interface components { features?: components["schemas"]["AppFeaturesTelemetry"] | (Record | null); system?: components["schemas"]["RunningEnvironmentTelemetry"] | (Record | null); jwt_rbac?: boolean | null; + hide_jwt_dashboard?: boolean | null; /** Format: date-time */ startup: string; }; @@ -1985,6 +2028,7 @@ export interface components { config: components["schemas"]["CollectionConfig"]; shards: (components["schemas"]["ReplicaSetTelemetry"])[]; transfers: (components["schemas"]["ShardTransferInfo"])[]; + resharding: (components["schemas"]["ReshardingInfo"])[]; }; ReplicaSetTelemetry: { /** Format: uint32 */ @@ -1997,9 +2041,20 @@ export interface components { }; LocalShardTelemetry: { variant_name?: string | null; + status?: components["schemas"]["ShardStatus"] | (Record | null); + /** + * Format: uint + * @description Total number of optimized points since the last start. + */ + total_optimized_points: number; segments: (components["schemas"]["SegmentTelemetry"])[]; optimizations: components["schemas"]["OptimizerTelemetry"]; }; + /** + * @description Current state of the shard (supports same states as the collection) `Green` - all good. `Yellow` - optimization is running, 'Grey' - optimizations are possible but not triggered, `Red` - some operations failed and was not recovered + * @enum {string} + */ + ShardStatus: "green" | "yellow" | "grey" | "red"; SegmentTelemetry: { info: components["schemas"]["SegmentInfo"]; config: components["schemas"]["SegmentConfig"]; @@ -2209,6 +2264,12 @@ export interface components { enabled: boolean; status?: components["schemas"]["ClusterStatusTelemetry"] | (Record | null); config?: components["schemas"]["ClusterConfigTelemetry"] | (Record | null); + peers?: ({ + [key: string]: components["schemas"]["PeerInfo"] | undefined; + }) | null; + metadata?: { + [key: string]: unknown; + } | null; }; ClusterStatusTelemetry: { /** Format: uint */ @@ -2747,7 +2808,7 @@ export interface components { lookup_from?: components["schemas"]["LookupLocation"] | (Record | null); }; QueryInterface: components["schemas"]["VectorInput"] | components["schemas"]["Query"]; - VectorInput: (number)[] | components["schemas"]["SparseVector"] | ((number)[])[] | components["schemas"]["ExtendedPointId"]; + VectorInput: (number)[] | components["schemas"]["SparseVector"] | ((number)[])[] | components["schemas"]["ExtendedPointId"] | components["schemas"]["Document"]; Query: components["schemas"]["NearestQuery"] | components["schemas"]["RecommendQuery"] | components["schemas"]["DiscoverQuery"] | components["schemas"]["ContextQuery"] | components["schemas"]["OrderByQuery"] | components["schemas"]["FusionQuery"] | components["schemas"]["SampleQuery"]; NearestQuery: { nearest: components["schemas"]["VectorInput"]; @@ -2849,6 +2910,68 @@ export interface components { /** @description Look for points in another collection using the group ids */ with_lookup?: components["schemas"]["WithLookupInterface"] | (Record | null); }; + SearchMatrixRequest: { + /** @description Specify in which shards to look for the points, if not specified - look in all shards */ + shard_key?: components["schemas"]["ShardKeySelector"] | (Record | null); + /** @description Look only for points which satisfies this conditions */ + filter?: components["schemas"]["Filter"] | (Record | null); + /** + * Format: uint + * @description How many points to select and search within. Default is 10. + */ + sample?: number | null; + /** + * Format: uint + * @description How many neighbours per sample to find. Default is 3. + */ + limit?: number | null; + /** @description Define which vector name to use for querying. If missing, the default vector is used. */ + using?: string | null; + }; + SearchMatrixOffsetsResponse: { + /** @description Row indices of the matrix */ + offsets_row: (number)[]; + /** @description Column indices of the matrix */ + offsets_col: (number)[]; + /** @description Scores associated with matrix coordinates */ + scores: (number)[]; + /** @description Ids of the points in order */ + ids: (components["schemas"]["ExtendedPointId"])[]; + }; + SearchMatrixPairsResponse: { + /** @description List of pairs of points with scores */ + pairs: (components["schemas"]["SearchMatrixPair"])[]; + }; + /** @description Pair of points (a, b) with score */ + SearchMatrixPair: { + a: components["schemas"]["ExtendedPointId"]; + b: components["schemas"]["ExtendedPointId"]; + /** Format: float */ + score: number; + }; + FacetRequest: { + shard_key?: components["schemas"]["ShardKeySelector"] | (Record | null); + /** @description Payload key to use for faceting. */ + key: string; + /** + * Format: uint + * @description Max number of hits to return. Default is 10. + */ + limit?: number | null; + /** @description Filter conditions - only consider points that satisfy these conditions. */ + filter?: components["schemas"]["Filter"] | (Record | null); + /** @description Whether to do a more expensive exact count for each of the values in the facet. Default is false. */ + exact?: boolean | null; + }; + FacetResponse: { + hits: (components["schemas"]["FacetValueHit"])[]; + }; + FacetValueHit: { + value: components["schemas"]["FacetValue"]; + /** Format: uint */ + count: number; + }; + FacetValue: string | number | boolean; }; responses: never; parameters: never; @@ -5910,6 +6033,60 @@ export interface operations { }; }; }; + /** + * Facet a payload key with a given filter. + * @description Count points that satisfy the given filter for each unique value of a payload key. + */ + facet: { + parameters: { + query?: { + /** @description If set, overrides global timeout for this request. Unit is seconds. */ + timeout?: number; + /** @description Define read consistency guarantees for the operation */ + consistency?: components["schemas"]["ReadConsistency"]; + }; + path: { + /** @description Name of the collection to facet in */ + collection_name: string; + }; + }; + /** @description Request counts of points for each unique value of a payload key */ + requestBody?: { + content: { + "application/json": components["schemas"]["FacetRequest"]; + }; + }; + responses: { + /** @description successful operation */ + 200: { + content: { + "application/json": { + /** + * Format: float + * @description Time spent to process this request + * @example 0.002 + */ + time?: number; + /** @example ok */ + status?: string; + result?: components["schemas"]["FacetResponse"]; + }; + }; + }; + /** @description error */ + default: { + content: { + "application/json": components["schemas"]["ErrorResponse"]; + }; + }; + /** @description error */ + "4XX": { + content: { + "application/json": components["schemas"]["ErrorResponse"]; + }; + }; + }; + }; /** * Query points * @description Universally query points. This endpoint covers all capabilities of search, recommend, discover, filters. But also enables hybrid and multi-stage queries. @@ -6072,4 +6249,112 @@ export interface operations { }; }; }; + /** + * Search points matrix distance pairs + * @description Compute distance matrix for sampled points with a pair based output format + */ + search_matrix_pairs: { + parameters: { + query?: { + /** @description Define read consistency guarantees for the operation */ + consistency?: components["schemas"]["ReadConsistency"]; + /** @description If set, overrides global timeout for this request. Unit is seconds. */ + timeout?: number; + }; + path: { + /** @description Name of the collection to search in */ + collection_name: string; + }; + }; + /** @description Search matrix request with optional filtering */ + requestBody?: { + content: { + "application/json": components["schemas"]["SearchMatrixRequest"]; + }; + }; + responses: { + /** @description successful operation */ + 200: { + content: { + "application/json": { + /** + * Format: float + * @description Time spent to process this request + * @example 0.002 + */ + time?: number; + /** @example ok */ + status?: string; + result?: components["schemas"]["SearchMatrixPairsResponse"]; + }; + }; + }; + /** @description error */ + default: { + content: { + "application/json": components["schemas"]["ErrorResponse"]; + }; + }; + /** @description error */ + "4XX": { + content: { + "application/json": components["schemas"]["ErrorResponse"]; + }; + }; + }; + }; + /** + * Search points matrix distance offsets + * @description Compute distance matrix for sampled points with an offset based output format + */ + search_matrix_offsets: { + parameters: { + query?: { + /** @description Define read consistency guarantees for the operation */ + consistency?: components["schemas"]["ReadConsistency"]; + /** @description If set, overrides global timeout for this request. Unit is seconds. */ + timeout?: number; + }; + path: { + /** @description Name of the collection to search in */ + collection_name: string; + }; + }; + /** @description Search matrix request with optional filtering */ + requestBody?: { + content: { + "application/json": components["schemas"]["SearchMatrixRequest"]; + }; + }; + responses: { + /** @description successful operation */ + 200: { + content: { + "application/json": { + /** + * Format: float + * @description Time spent to process this request + * @example 0.002 + */ + time?: number; + /** @example ok */ + status?: string; + result?: components["schemas"]["SearchMatrixOffsetsResponse"]; + }; + }; + }; + /** @description error */ + default: { + content: { + "application/json": components["schemas"]["ErrorResponse"]; + }; + }; + /** @description error */ + "4XX": { + content: { + "application/json": components["schemas"]["ErrorResponse"]; + }; + }; + }; + }; } diff --git a/packages/js-client-rest/src/qdrant-client.ts b/packages/js-client-rest/src/qdrant-client.ts index c3fcfc5..ad243f9 100644 --- a/packages/js-client-rest/src/qdrant-client.ts +++ b/packages/js-client-rest/src/qdrant-client.ts @@ -1925,4 +1925,136 @@ export class QdrantClient { }); return maybe(response.data.result).orThrow('Query groups returned empty'); } + + /** + * Facet a payload key with a given filter. + * @description Count points that satisfy the given filter for each unique value of a payload key. + * @param collection_name Name of the collection + * @param {object} args - + * - consistency: Read consistency of the search. Defines how many replicas should be queried before returning the result. + * Values: + * number - number of replicas to query, values should present in all queried replicas + * 'majority' - query all replicas, but return values present in the majority of replicas + * 'quorum' - query the majority of replicas, return values present in all of them + * 'all' - query all replicas, and return values present in all replicas + * - timeout: If set, overrides global timeout setting for this request. Unit is seconds. + * - shard_key: Specify in which shards to look for the points, if not specified - look in all shards. + * - key: Payload key to use for faceting. + * - limit: Max number of hits to return. Default is 10. + * - filter: Filter conditions - only consider points that satisfy these conditions. + * - exact: Whether to do a more expensive exact count for each of the values in the facet. Default is false. + * @returns Operation result + */ + async facet( + collection_name: string, + { + consistency, + timeout, + shard_key, + key, + limit, + filter, + exact, + }: {consistency?: SchemaFor<'ReadConsistency'>} & {timeout?: number} & SchemaFor<'FacetRequest'>, + ) { + const response = await this._openApiClient.points.facet({ + collection_name, + consistency, + timeout, + shard_key, + key, + limit, + filter, + exact, + }); + return maybe(response.data.result).orThrow('Facet returned empty'); + } + + /** + * Search points matrix distance pairs. + * @description Compute distance matrix for sampled points with a pair based output format. + * @param collection_name Name of the collection + * @param {object} args - + * - consistency: Read consistency of the search. Defines how many replicas should be queried before returning the result. + * Values: + * number - number of replicas to query, values should present in all queried replicas + * 'majority' - query all replicas, but return values present in the majority of replicas + * 'quorum' - query the majority of replicas, return values present in all of them + * 'all' - query all replicas, and return values present in all replicas + * - timeout: If set, overrides global timeout setting for this request. Unit is seconds. + * - shard_key: Specify in which shards to look for the points, if not specified - look in all shards. + * - filter: Look only for points which satisfies this conditions. + * - sample: How many points to select and search within. Default is 10. + * - limit: How many neighbours per sample to find. Default is 3. + * - using: Define which vector name to use for querying. If missing, the default vector is used. + * @returns Operation result + */ + async searchMatrixPairs( + collection_name: string, + { + consistency, + timeout, + shard_key, + filter, + sample, + limit, + using, + }: {consistency?: SchemaFor<'ReadConsistency'>} & {timeout?: number} & SchemaFor<'SearchMatrixRequest'>, + ) { + const response = await this._openApiClient.points.searchMatrixPairs({ + collection_name, + consistency, + timeout, + shard_key, + filter, + sample, + limit, + using, + }); + return maybe(response.data.result).orThrow('Search points matrix pairs returned empty'); + } + + /** + * Search points matrix distance offsets. + * @description Compute distance matrix for sampled points with an offset based output format. + * @param collection_name Name of the collection + * @param {object} args - + * - consistency: Read consistency of the search. Defines how many replicas should be queried before returning the result. + * Values: + * number - number of replicas to query, values should present in all queried replicas + * 'majority' - query all replicas, but return values present in the majority of replicas + * 'quorum' - query the majority of replicas, return values present in all of them + * 'all' - query all replicas, and return values present in all replicas + * - timeout: If set, overrides global timeout setting for this request. Unit is seconds. + * - shard_key: Specify in which shards to look for the points, if not specified - look in all shards. + * - filter: Look only for points which satisfies this conditions. + * - sample: How many points to select and search within. Default is 10. + * - limit: How many neighbours per sample to find. Default is 3. + * - using: Define which vector name to use for querying. If missing, the default vector is used. + * @returns Operation result + */ + async searchMatrixOffsets( + collection_name: string, + { + consistency, + timeout, + shard_key, + filter, + sample, + limit, + using, + }: {consistency?: SchemaFor<'ReadConsistency'>} & {timeout?: number} & SchemaFor<'SearchMatrixRequest'>, + ) { + const response = await this._openApiClient.points.searchMatrixOffsets({ + collection_name, + consistency, + timeout, + shard_key, + filter, + sample, + limit, + using, + }); + return maybe(response.data.result).orThrow('Search points matrix offsets returned empty'); + } } diff --git a/packages/qdrant-js/CHANGELOG.md b/packages/qdrant-js/CHANGELOG.md index 3ef5931..57f76bf 100644 --- a/packages/qdrant-js/CHANGELOG.md +++ b/packages/qdrant-js/CHANGELOG.md @@ -1,5 +1,17 @@ # @qdrant/qdrant-js +## 1.12.0 + +### Minor Changes + +- Qdrant v1.12.0 API + +### Patch Changes + +- Updated dependencies []: + - @qdrant/js-client-grpc@1.12.0 + - @qdrant/js-client-rest@1.12.0 + ## 1.11.0 ### Minor Changes diff --git a/packages/qdrant-js/package.json b/packages/qdrant-js/package.json index f17649c..55de7b8 100644 --- a/packages/qdrant-js/package.json +++ b/packages/qdrant-js/package.json @@ -1,6 +1,6 @@ { "name": "@qdrant/qdrant-js", - "version": "1.11.0", + "version": "1.12.0", "engines": { "node": ">=18.0.0", "pnpm": ">=8" @@ -57,8 +57,8 @@ "clean": "rimraf ./dist" }, "dependencies": { - "@qdrant/js-client-rest": "workspace:1.11.0", - "@qdrant/js-client-grpc": "workspace:1.11.0" + "@qdrant/js-client-rest": "workspace:1.12.0", + "@qdrant/js-client-grpc": "workspace:1.12.0" }, "peerDependencies": { "typescript": ">=4.1" diff --git a/packages/qdrant-js/scripts/integration-tests.sh b/packages/qdrant-js/scripts/integration-tests.sh index 6907708..55d2323 100755 --- a/packages/qdrant-js/scripts/integration-tests.sh +++ b/packages/qdrant-js/scripts/integration-tests.sh @@ -9,7 +9,7 @@ function stop_docker() docker stop qdrant_test } -QDRANT_LATEST="v1.11.0" +QDRANT_LATEST="v1.12.0" QDRANT_VERSION=${QDRANT_VERSION:-"$QDRANT_LATEST"} QDRANT_HOST='127.0.0.1:6333' diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index d933d49..3e8b342 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -128,10 +128,10 @@ importers: packages/qdrant-js: dependencies: '@qdrant/js-client-grpc': - specifier: workspace:1.11.0 + specifier: workspace:1.12.0 version: link:../js-client-grpc '@qdrant/js-client-rest': - specifier: workspace:1.11.0 + specifier: workspace:1.12.0 version: link:../js-client-rest typescript: specifier: '>=4.1'