From 56676d168e325b66807e76484b6cda90b0d34950 Mon Sep 17 00:00:00 2001 From: Ivan Pleshkov Date: Mon, 12 Aug 2024 18:25:06 +0200 Subject: [PATCH] V1.11.0 (#82) * update grpc * update rest * version up * integration test qdrant version up * use dev version in integration test (temp) * update grpc * update openapi * Update latest Qdrant version to v1.11.0 --------- Co-authored-by: timvisee --- 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 | 51 +- packages/js-client-grpc/proto/points.proto | 72 ++- .../js-client-grpc/proto/points_service.proto | 4 + .../src/proto/collections_pb.ts | 425 +++++++++++++- .../js-client-grpc/src/proto/points_pb.ts | 389 ++++++++++++- .../src/proto/points_service_connect.ts | 14 +- packages/js-client-rest/CHANGELOG.md | 6 + packages/js-client-rest/package.json | 2 +- packages/js-client-rest/src/api/points-api.ts | 17 +- .../src/openapi/generated_schema.ts | 546 +++++++++++++++--- packages/js-client-rest/src/qdrant-client.ts | 84 ++- 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, 1481 insertions(+), 163 deletions(-) diff --git a/examples/node-js-basic/package.json b/examples/node-js-basic/package.json index fcabe58..8dcc3ba 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.10.0" + "@qdrant/qdrant-js": "^1.11.0" } } diff --git a/packages/js-client-grpc/CHANGELOG.md b/packages/js-client-grpc/CHANGELOG.md index db0eb9e..bd33c59 100644 --- a/packages/js-client-grpc/CHANGELOG.md +++ b/packages/js-client-grpc/CHANGELOG.md @@ -1,5 +1,11 @@ # @qdrant/js-client-grpc +## 1.11.0 + +### Minor Changes + +- Qdrant v1.11.0 API + ## 1.10.0 ### Minor Changes diff --git a/packages/js-client-grpc/package.json b/packages/js-client-grpc/package.json index 8254e7f..eb48ad1 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.10.0", + "version": "1.11.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 4090c78..302593a 100644 --- a/packages/js-client-grpc/proto/collections.proto +++ b/packages/js-client-grpc/proto/collections.proto @@ -129,6 +129,7 @@ enum PayloadSchemaType { Text = 5; Bool = 6; Datetime = 7; + Uuid = 8; } enum QuantizationType { @@ -385,6 +386,26 @@ enum TokenizerType { Multilingual = 4; } +message KeywordIndexParams { + optional bool is_tenant = 1; // If true - used for tenant optimization. + optional bool on_disk = 2; // If true - store index on disk. +} + +message IntegerIndexParams { + bool lookup = 1; // If true - support direct lookups. + 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. +} + +message FloatIndexParams { + optional bool on_disk = 1; // If true - store index on disk. + optional bool is_principal = 2; // 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. +} + +message GeoIndexParams { +} + message TextIndexParams { TokenizerType tokenizer = 1; // Tokenizer type optional bool lowercase = 2; // If true - all tokens will be lowercase @@ -392,15 +413,29 @@ message TextIndexParams { optional uint64 max_token_len = 4; // Maximal token length } -message IntegerIndexParams { - bool lookup = 1; // If true - support direct lookups. - bool range = 2; // If true - support ranges filters. +message BoolIndexParams { +} + +message DatetimeIndexParams { + optional bool on_disk = 1; // If true - store index on disk. + optional bool is_principal = 2; // 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. +} + +message UuidIndexParams { + optional bool is_tenant = 1; // If true - used for tenant optimization. + optional bool on_disk = 2; // If true - store index on disk. } message PayloadIndexParams { oneof index_params { - TextIndexParams text_index_params = 1; // Parameters for text index + KeywordIndexParams keyword_index_params = 3; // Parameters for keyword index IntegerIndexParams integer_index_params = 2; // Parameters for integer index + FloatIndexParams float_index_params = 4; // Parameters for float index + GeoIndexParams geo_index_params = 5; // Parameters for geo index + TextIndexParams text_index_params = 1; // Parameters for text index + BoolIndexParams bool_index_params = 6; // Parameters for bool index + DatetimeIndexParams datetime_index_params = 7; // Parameters for datetime index + UuidIndexParams uuid_index_params = 8; // Parameters for uuid index } } @@ -511,12 +546,20 @@ message ShardTransferInfo { bool sync = 4; // If `true` transfer is a synchronization of a replicas; If `false` transfer is a moving of a shard from one peer to another } +message ReshardingInfo { + uint32 shard_id = 1; + uint64 peer_id = 2; + optional ShardKey shard_key = 3; +} + message CollectionClusterInfoResponse { uint64 peer_id = 1; // ID of this peer uint64 shard_count = 2; // Total number of shards repeated LocalShardInfo local_shards = 3; // Local shards repeated RemoteShardInfo remote_shards = 4; // Remote shards repeated ShardTransferInfo shard_transfers = 5; // Shard transfers + // TODO(resharding): enable on release: + // repeated ReshardingInfo resharding_operations = 6; // Resharding operations } message MoveShard { diff --git a/packages/js-client-grpc/proto/points.proto b/packages/js-client-grpc/proto/points.proto index ebab92d..858cb99 100644 --- a/packages/js-client-grpc/proto/points.proto +++ b/packages/js-client-grpc/proto/points.proto @@ -79,6 +79,7 @@ message VectorInput { // --------------------------------------------- // ----------------- ShardKeySelector ---------- // --------------------------------------------- + message ShardKeySelector { repeated ShardKey shard_keys = 1; // List of shard keys which should be used in the request } @@ -112,6 +113,7 @@ message GetPoints { optional WithVectorsSelector with_vectors = 5; // Options for specifying which vectors to include into response optional ReadConsistency read_consistency = 6; // Options for specifying read consistency guarantees optional ShardKeySelector shard_key_selector = 7; // Specify in which shards to look for the points, if not specified - look in all shards + optional uint64 timeout = 8; // If set, overrides global timeout setting for this request. Unit is seconds. } message UpdatePointVectors { @@ -173,6 +175,7 @@ enum FieldType { FieldTypeText = 4; FieldTypeBool = 5; FieldTypeDatetime = 6; + FieldTypeUuid = 7; } message CreateFieldIndexCollection { @@ -265,7 +268,7 @@ message SearchParams { optional bool exact = 2; /* - If set to true, search will ignore quantized vector data + If set to true, search will ignore quantized vector data */ optional QuantizationSearchParams quantization = 3; /* @@ -358,16 +361,17 @@ message ScrollPoints { optional ReadConsistency read_consistency = 8; // Options for specifying read consistency guarantees optional ShardKeySelector shard_key_selector = 9; // Specify in which shards to look for the points, if not specified - look in all shards optional OrderBy order_by = 10; // Order the records by a payload field + optional uint64 timeout = 11; // If set, overrides global timeout setting for this request. Unit is seconds. } -// How to use positive and negative vectors to find the results, default is `AverageVector`: +// How to use positive and negative vectors to find the results, default is `AverageVector`. enum RecommendStrategy { - // Average positive and negative vectors and create a single query with the formula + // Average positive and negative vectors and create a single query with the formula // `query = avg_pos + avg_pos - avg_neg`. Then performs normal search. AverageVector = 0; - // Uses custom search objective. Each candidate is compared against all - // examples, its score is then chosen from the `max(max_pos_score, max_neg_score)`. + // Uses custom search objective. Each candidate is compared against all + // examples, its score is then chosen from the `max(max_pos_score, max_neg_score)`. // If the `max_neg_score` is chosen then it is squared and negated. BestScore = 1; } @@ -433,7 +437,7 @@ message RecommendPointGroups { message TargetVector { oneof target { VectorExample single = 1; - + // leaving extensibility for possibly adding multi-target } } @@ -480,6 +484,7 @@ message CountPoints { optional bool exact = 3; // If `true` - return exact count, if `false` - return approximate count optional ReadConsistency read_consistency = 4; // Options for specifying read consistency guarantees optional ShardKeySelector shard_key_selector = 5; // Specify in which shards to look for the points, if not specified - look in all shards + optional uint64 timeout = 6; // If set, overrides global timeout setting for this request. Unit is seconds. } message RecommendInput { @@ -504,6 +509,16 @@ message ContextInput { enum Fusion { RRF = 0; // Reciprocal Rank Fusion + DBSF = 1; // Distribution-Based Score Fusion +} + +// Sample points from the collection +// +// Available sampling methods: +// +// * `random` - Random sampling +enum Sample { + Random = 0; } message Query { @@ -514,6 +529,7 @@ message Query { ContextInput context = 4; // Return points that live in positive areas. OrderBy order_by = 5; // Order the points by a payload field. Fusion fusion = 6; // Fuse the results of multiple prefetches. + Sample sample = 7; // Sample points from the collection. } } @@ -553,6 +569,37 @@ message QueryBatchPoints { optional uint64 timeout = 4; // If set, overrides global timeout setting for this request. Unit is seconds. } +message QueryPointGroups { + string collection_name = 1; // Name of the collection + repeated PrefetchQuery prefetch = 2; // Sub-requests to perform first. If present, the query will be performed on the results of the prefetches. + optional Query query = 3; // Query to perform. If missing, returns points ordered by their IDs. + optional string using = 4; // Define which vector to use for querying. If missing, the default vector is used. + optional Filter filter = 5; // Filter conditions - return only those points that satisfy the specified conditions. + optional SearchParams params = 6; // Search params for when there is no prefetch. + optional float score_threshold = 7; // Return points with scores better than this threshold. + WithPayloadSelector with_payload = 8; // Options for specifying which payload to include or not + optional WithVectorsSelector with_vectors = 9; // Options for specifying which vectors to include into response + optional LookupLocation lookup_from = 10; // The location to use for IDs lookup, if not specified - use the current collection and the 'using' vector + optional uint64 limit = 11; // Max number of points. Default is 3. + optional uint64 group_size = 12; // Maximum amount of points to return per group. Default to 10. + string group_by = 13; // Payload field to group by, must be a string or number field. If there are multiple values for the field, all of them will be used. One point can be in multiple groups. + optional ReadConsistency read_consistency = 14; // Options for specifying read consistency guarantees + optional WithLookup with_lookup = 15; // Options for specifying how to use the group id to lookup points in another collection + optional uint64 timeout = 16; // If set, overrides global timeout setting for this request. Unit is seconds. + optional ShardKeySelector shard_key_selector = 17; // 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 + } +} + +message FacetValueHit { + FacetValue value = 1; // Value from the facet + uint64 count = 2; // Number of points with this value +} + message PointsUpdateOperation { message PointStructList { repeated PointStruct points = 1; @@ -666,7 +713,7 @@ message GroupId { message PointGroup { GroupId id = 1; // Group id - repeated ScoredPoint hits = 2; // Points in the group + repeated ScoredPoint hits = 2; // Points in the group RetrievedPoint lookup = 3; // Point(s) from the lookup collection that matches the group id } @@ -689,6 +736,11 @@ message QueryBatchResponse { double time = 2; // Time spent to process } +message QueryGroupsResponse { + GroupsResult result = 1; + double time = 2; // Time spent to process +} + message BatchResult { repeated ScoredPoint result = 1; } @@ -770,12 +822,12 @@ message Filter { repeated Condition should = 1; // At least one of those conditions should match repeated Condition must = 2; // All conditions must match repeated Condition must_not = 3; // All conditions must NOT match - optional MinShould min_should = 4; // At least minimum amount of given conditions should match + optional MinShould min_should = 4; // At least minimum amount of given conditions should match } message MinShould { - repeated Condition conditions = 1; - uint64 min_count = 2; + repeated Condition conditions = 1; + uint64 min_count = 2; } message Condition { diff --git a/packages/js-client-grpc/proto/points_service.proto b/packages/js-client-grpc/proto/points_service.proto index 092d2ca..def47d1 100644 --- a/packages/js-client-grpc/proto/points_service.proto +++ b/packages/js-client-grpc/proto/points_service.proto @@ -117,4 +117,8 @@ service Points { Universally query points in a batch fashion. This endpoint covers all capabilities of search, recommend, discover, filters. But also enables hybrid and multi-stage queries. */ rpc QueryBatch (QueryBatchPoints) returns (QueryBatchResponse) {} + /* + 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) {} } diff --git a/packages/js-client-grpc/src/proto/collections_pb.ts b/packages/js-client-grpc/src/proto/collections_pb.ts index ac6d8a3..eef9422 100644 --- a/packages/js-client-grpc/src/proto/collections_pb.ts +++ b/packages/js-client-grpc/src/proto/collections_pb.ts @@ -201,6 +201,11 @@ export enum PayloadSchemaType { * @generated from enum value: Datetime = 7; */ Datetime = 7, + + /** + * @generated from enum value: Uuid = 8; + */ + Uuid = 8, } // Retrieve enum metadata with: proto3.getEnumType(PayloadSchemaType) proto3.util.setEnumType(PayloadSchemaType, "qdrant.PayloadSchemaType", [ @@ -212,6 +217,7 @@ proto3.util.setEnumType(PayloadSchemaType, "qdrant.PayloadSchemaType", [ { no: 5, name: "Text" }, { no: 6, name: "Bool" }, { no: 7, name: "Datetime" }, + { no: 8, name: "Uuid" }, ]); /** @@ -2430,6 +2436,194 @@ export class CollectionConfig extends Message { } } +/** + * @generated from message qdrant.KeywordIndexParams + */ +export class KeywordIndexParams extends Message { + /** + * If true - used for tenant optimization. + * + * @generated from field: optional bool is_tenant = 1; + */ + isTenant?: boolean; + + /** + * If true - store index on disk. + * + * @generated from field: optional bool on_disk = 2; + */ + onDisk?: boolean; + + constructor(data?: PartialMessage) { + super(); + proto3.util.initPartial(data, this); + } + + static readonly runtime: typeof proto3 = proto3; + static readonly typeName = "qdrant.KeywordIndexParams"; + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + { no: 1, name: "is_tenant", kind: "scalar", T: 8 /* ScalarType.BOOL */, opt: true }, + { no: 2, name: "on_disk", kind: "scalar", T: 8 /* ScalarType.BOOL */, opt: true }, + ]); + + static fromBinary(bytes: Uint8Array, options?: Partial): KeywordIndexParams { + return new KeywordIndexParams().fromBinary(bytes, options); + } + + static fromJson(jsonValue: JsonValue, options?: Partial): KeywordIndexParams { + return new KeywordIndexParams().fromJson(jsonValue, options); + } + + static fromJsonString(jsonString: string, options?: Partial): KeywordIndexParams { + return new KeywordIndexParams().fromJsonString(jsonString, options); + } + + static equals(a: KeywordIndexParams | PlainMessage | undefined, b: KeywordIndexParams | PlainMessage | undefined): boolean { + return proto3.util.equals(KeywordIndexParams, a, b); + } +} + +/** + * @generated from message qdrant.IntegerIndexParams + */ +export class IntegerIndexParams extends Message { + /** + * If true - support direct lookups. + * + * @generated from field: bool lookup = 1; + */ + lookup = false; + + /** + * If true - support ranges filters. + * + * @generated from field: bool range = 2; + */ + range = false; + + /** + * 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. + * + * @generated from field: optional bool is_principal = 3; + */ + isPrincipal?: boolean; + + /** + * If true - store index on disk. + * + * @generated from field: optional bool on_disk = 4; + */ + onDisk?: boolean; + + constructor(data?: PartialMessage) { + super(); + proto3.util.initPartial(data, this); + } + + 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: 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 }, + ]); + + static fromBinary(bytes: Uint8Array, options?: Partial): IntegerIndexParams { + return new IntegerIndexParams().fromBinary(bytes, options); + } + + static fromJson(jsonValue: JsonValue, options?: Partial): IntegerIndexParams { + return new IntegerIndexParams().fromJson(jsonValue, options); + } + + static fromJsonString(jsonString: string, options?: Partial): IntegerIndexParams { + return new IntegerIndexParams().fromJsonString(jsonString, options); + } + + static equals(a: IntegerIndexParams | PlainMessage | undefined, b: IntegerIndexParams | PlainMessage | undefined): boolean { + return proto3.util.equals(IntegerIndexParams, a, b); + } +} + +/** + * @generated from message qdrant.FloatIndexParams + */ +export class FloatIndexParams extends Message { + /** + * If true - store index on disk. + * + * @generated from field: optional bool on_disk = 1; + */ + onDisk?: 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. + * + * @generated from field: optional bool is_principal = 2; + */ + isPrincipal?: boolean; + + constructor(data?: PartialMessage) { + super(); + proto3.util.initPartial(data, this); + } + + static readonly runtime: typeof proto3 = proto3; + static readonly typeName = "qdrant.FloatIndexParams"; + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + { no: 1, name: "on_disk", kind: "scalar", T: 8 /* ScalarType.BOOL */, opt: true }, + { no: 2, name: "is_principal", kind: "scalar", T: 8 /* ScalarType.BOOL */, opt: true }, + ]); + + static fromBinary(bytes: Uint8Array, options?: Partial): FloatIndexParams { + return new FloatIndexParams().fromBinary(bytes, options); + } + + static fromJson(jsonValue: JsonValue, options?: Partial): FloatIndexParams { + return new FloatIndexParams().fromJson(jsonValue, options); + } + + static fromJsonString(jsonString: string, options?: Partial): FloatIndexParams { + return new FloatIndexParams().fromJsonString(jsonString, options); + } + + static equals(a: FloatIndexParams | PlainMessage | undefined, b: FloatIndexParams | PlainMessage | undefined): boolean { + return proto3.util.equals(FloatIndexParams, a, b); + } +} + +/** + * @generated from message qdrant.GeoIndexParams + */ +export class GeoIndexParams extends Message { + constructor(data?: PartialMessage) { + super(); + proto3.util.initPartial(data, this); + } + + static readonly runtime: typeof proto3 = proto3; + static readonly typeName = "qdrant.GeoIndexParams"; + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + ]); + + static fromBinary(bytes: Uint8Array, options?: Partial): GeoIndexParams { + return new GeoIndexParams().fromBinary(bytes, options); + } + + static fromJson(jsonValue: JsonValue, options?: Partial): GeoIndexParams { + return new GeoIndexParams().fromJson(jsonValue, options); + } + + static fromJsonString(jsonString: string, options?: Partial): GeoIndexParams { + return new GeoIndexParams().fromJsonString(jsonString, options); + } + + static equals(a: GeoIndexParams | PlainMessage | undefined, b: GeoIndexParams | PlainMessage | undefined): boolean { + return proto3.util.equals(GeoIndexParams, a, b); + } +} + /** * @generated from message qdrant.TextIndexParams */ @@ -2494,49 +2688,127 @@ export class TextIndexParams extends Message { } /** - * @generated from message qdrant.IntegerIndexParams + * @generated from message qdrant.BoolIndexParams */ -export class IntegerIndexParams extends Message { +export class BoolIndexParams extends Message { + constructor(data?: PartialMessage) { + super(); + proto3.util.initPartial(data, this); + } + + static readonly runtime: typeof proto3 = proto3; + static readonly typeName = "qdrant.BoolIndexParams"; + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + ]); + + static fromBinary(bytes: Uint8Array, options?: Partial): BoolIndexParams { + return new BoolIndexParams().fromBinary(bytes, options); + } + + static fromJson(jsonValue: JsonValue, options?: Partial): BoolIndexParams { + return new BoolIndexParams().fromJson(jsonValue, options); + } + + static fromJsonString(jsonString: string, options?: Partial): BoolIndexParams { + return new BoolIndexParams().fromJsonString(jsonString, options); + } + + static equals(a: BoolIndexParams | PlainMessage | undefined, b: BoolIndexParams | PlainMessage | undefined): boolean { + return proto3.util.equals(BoolIndexParams, a, b); + } +} + +/** + * @generated from message qdrant.DatetimeIndexParams + */ +export class DatetimeIndexParams extends Message { /** - * If true - support direct lookups. + * If true - store index on disk. * - * @generated from field: bool lookup = 1; + * @generated from field: optional bool on_disk = 1; */ - lookup = false; + onDisk?: boolean; /** - * If true - support ranges filters. + * 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. * - * @generated from field: bool range = 2; + * @generated from field: optional bool is_principal = 2; */ - range = false; + isPrincipal?: boolean; - constructor(data?: PartialMessage) { + constructor(data?: PartialMessage) { super(); proto3.util.initPartial(data, this); } static readonly runtime: typeof proto3 = proto3; - static readonly typeName = "qdrant.IntegerIndexParams"; + static readonly typeName = "qdrant.DatetimeIndexParams"; 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: "on_disk", kind: "scalar", T: 8 /* ScalarType.BOOL */, opt: true }, + { no: 2, name: "is_principal", kind: "scalar", T: 8 /* ScalarType.BOOL */, opt: true }, ]); - static fromBinary(bytes: Uint8Array, options?: Partial): IntegerIndexParams { - return new IntegerIndexParams().fromBinary(bytes, options); + static fromBinary(bytes: Uint8Array, options?: Partial): DatetimeIndexParams { + return new DatetimeIndexParams().fromBinary(bytes, options); } - static fromJson(jsonValue: JsonValue, options?: Partial): IntegerIndexParams { - return new IntegerIndexParams().fromJson(jsonValue, options); + static fromJson(jsonValue: JsonValue, options?: Partial): DatetimeIndexParams { + return new DatetimeIndexParams().fromJson(jsonValue, options); } - static fromJsonString(jsonString: string, options?: Partial): IntegerIndexParams { - return new IntegerIndexParams().fromJsonString(jsonString, options); + static fromJsonString(jsonString: string, options?: Partial): DatetimeIndexParams { + return new DatetimeIndexParams().fromJsonString(jsonString, options); } - static equals(a: IntegerIndexParams | PlainMessage | undefined, b: IntegerIndexParams | PlainMessage | undefined): boolean { - return proto3.util.equals(IntegerIndexParams, a, b); + static equals(a: DatetimeIndexParams | PlainMessage | undefined, b: DatetimeIndexParams | PlainMessage | undefined): boolean { + return proto3.util.equals(DatetimeIndexParams, a, b); + } +} + +/** + * @generated from message qdrant.UuidIndexParams + */ +export class UuidIndexParams extends Message { + /** + * If true - used for tenant optimization. + * + * @generated from field: optional bool is_tenant = 1; + */ + isTenant?: boolean; + + /** + * If true - store index on disk. + * + * @generated from field: optional bool on_disk = 2; + */ + onDisk?: boolean; + + constructor(data?: PartialMessage) { + super(); + proto3.util.initPartial(data, this); + } + + static readonly runtime: typeof proto3 = proto3; + static readonly typeName = "qdrant.UuidIndexParams"; + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + { no: 1, name: "is_tenant", kind: "scalar", T: 8 /* ScalarType.BOOL */, opt: true }, + { no: 2, name: "on_disk", kind: "scalar", T: 8 /* ScalarType.BOOL */, opt: true }, + ]); + + static fromBinary(bytes: Uint8Array, options?: Partial): UuidIndexParams { + return new UuidIndexParams().fromBinary(bytes, options); + } + + static fromJson(jsonValue: JsonValue, options?: Partial): UuidIndexParams { + return new UuidIndexParams().fromJson(jsonValue, options); + } + + static fromJsonString(jsonString: string, options?: Partial): UuidIndexParams { + return new UuidIndexParams().fromJsonString(jsonString, options); + } + + static equals(a: UuidIndexParams | PlainMessage | undefined, b: UuidIndexParams | PlainMessage | undefined): boolean { + return proto3.util.equals(UuidIndexParams, a, b); } } @@ -2549,12 +2821,12 @@ export class PayloadIndexParams extends Message { */ indexParams: { /** - * Parameters for text index + * Parameters for keyword index * - * @generated from field: qdrant.TextIndexParams text_index_params = 1; + * @generated from field: qdrant.KeywordIndexParams keyword_index_params = 3; */ - value: TextIndexParams; - case: "textIndexParams"; + value: KeywordIndexParams; + case: "keywordIndexParams"; } | { /** * Parameters for integer index @@ -2563,6 +2835,54 @@ export class PayloadIndexParams extends Message { */ value: IntegerIndexParams; case: "integerIndexParams"; + } | { + /** + * Parameters for float index + * + * @generated from field: qdrant.FloatIndexParams float_index_params = 4; + */ + value: FloatIndexParams; + case: "floatIndexParams"; + } | { + /** + * Parameters for geo index + * + * @generated from field: qdrant.GeoIndexParams geo_index_params = 5; + */ + value: GeoIndexParams; + case: "geoIndexParams"; + } | { + /** + * Parameters for text index + * + * @generated from field: qdrant.TextIndexParams text_index_params = 1; + */ + value: TextIndexParams; + case: "textIndexParams"; + } | { + /** + * Parameters for bool index + * + * @generated from field: qdrant.BoolIndexParams bool_index_params = 6; + */ + value: BoolIndexParams; + case: "boolIndexParams"; + } | { + /** + * Parameters for datetime index + * + * @generated from field: qdrant.DatetimeIndexParams datetime_index_params = 7; + */ + value: DatetimeIndexParams; + case: "datetimeIndexParams"; + } | { + /** + * Parameters for uuid index + * + * @generated from field: qdrant.UuidIndexParams uuid_index_params = 8; + */ + value: UuidIndexParams; + case: "uuidIndexParams"; } | { case: undefined; value?: undefined } = { case: undefined }; constructor(data?: PartialMessage) { @@ -2573,8 +2893,14 @@ export class PayloadIndexParams extends Message { static readonly runtime: typeof proto3 = proto3; static readonly typeName = "qdrant.PayloadIndexParams"; static readonly fields: FieldList = proto3.util.newFieldList(() => [ - { no: 1, name: "text_index_params", kind: "message", T: TextIndexParams, oneof: "index_params" }, + { no: 3, name: "keyword_index_params", kind: "message", T: KeywordIndexParams, oneof: "index_params" }, { no: 2, name: "integer_index_params", kind: "message", T: IntegerIndexParams, oneof: "index_params" }, + { no: 4, name: "float_index_params", kind: "message", T: FloatIndexParams, oneof: "index_params" }, + { no: 5, name: "geo_index_params", kind: "message", T: GeoIndexParams, oneof: "index_params" }, + { no: 1, name: "text_index_params", kind: "message", T: TextIndexParams, oneof: "index_params" }, + { no: 6, name: "bool_index_params", kind: "message", T: BoolIndexParams, oneof: "index_params" }, + { no: 7, name: "datetime_index_params", kind: "message", T: DatetimeIndexParams, oneof: "index_params" }, + { no: 8, name: "uuid_index_params", kind: "message", T: UuidIndexParams, oneof: "index_params" }, ]); static fromBinary(bytes: Uint8Array, options?: Partial): PayloadIndexParams { @@ -3427,6 +3753,55 @@ export class ShardTransferInfo extends Message { } } +/** + * @generated from message qdrant.ReshardingInfo + */ +export class ReshardingInfo extends Message { + /** + * @generated from field: uint32 shard_id = 1; + */ + shardId = 0; + + /** + * @generated from field: uint64 peer_id = 2; + */ + peerId = protoInt64.zero; + + /** + * @generated from field: optional qdrant.ShardKey shard_key = 3; + */ + shardKey?: ShardKey; + + constructor(data?: PartialMessage) { + super(); + proto3.util.initPartial(data, this); + } + + static readonly runtime: typeof proto3 = proto3; + static readonly typeName = "qdrant.ReshardingInfo"; + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + { no: 1, name: "shard_id", kind: "scalar", T: 13 /* ScalarType.UINT32 */ }, + { no: 2, name: "peer_id", kind: "scalar", T: 4 /* ScalarType.UINT64 */ }, + { no: 3, name: "shard_key", kind: "message", T: ShardKey, opt: true }, + ]); + + static fromBinary(bytes: Uint8Array, options?: Partial): ReshardingInfo { + return new ReshardingInfo().fromBinary(bytes, options); + } + + static fromJson(jsonValue: JsonValue, options?: Partial): ReshardingInfo { + return new ReshardingInfo().fromJson(jsonValue, options); + } + + static fromJsonString(jsonString: string, options?: Partial): ReshardingInfo { + return new ReshardingInfo().fromJsonString(jsonString, options); + } + + static equals(a: ReshardingInfo | PlainMessage | undefined, b: ReshardingInfo | PlainMessage | undefined): boolean { + return proto3.util.equals(ReshardingInfo, a, b); + } +} + /** * @generated from message qdrant.CollectionClusterInfoResponse */ diff --git a/packages/js-client-grpc/src/proto/points_pb.ts b/packages/js-client-grpc/src/proto/points_pb.ts index aae11fa..fa85b6c 100644 --- a/packages/js-client-grpc/src/proto/points_pb.ts +++ b/packages/js-client-grpc/src/proto/points_pb.ts @@ -110,6 +110,11 @@ export enum FieldType { * @generated from enum value: FieldTypeDatetime = 6; */ FieldTypeDatetime = 6, + + /** + * @generated from enum value: FieldTypeUuid = 7; + */ + FieldTypeUuid = 7, } // Retrieve enum metadata with: proto3.getEnumType(FieldType) proto3.util.setEnumType(FieldType, "qdrant.FieldType", [ @@ -120,6 +125,7 @@ proto3.util.setEnumType(FieldType, "qdrant.FieldType", [ { no: 4, name: "FieldTypeText" }, { no: 5, name: "FieldTypeBool" }, { no: 6, name: "FieldTypeDatetime" }, + { no: 7, name: "FieldTypeUuid" }, ]); /** @@ -143,13 +149,13 @@ proto3.util.setEnumType(Direction, "qdrant.Direction", [ ]); /** - * How to use positive and negative vectors to find the results, default is `AverageVector`: + * How to use positive and negative vectors to find the results, default is `AverageVector`. * * @generated from enum qdrant.RecommendStrategy */ export enum RecommendStrategy { /** - * Average positive and negative vectors and create a single query with the formula + * Average positive and negative vectors and create a single query with the formula * `query = avg_pos + avg_pos - avg_neg`. Then performs normal search. * * @generated from enum value: AverageVector = 0; @@ -157,8 +163,8 @@ export enum RecommendStrategy { AverageVector = 0, /** - * Uses custom search objective. Each candidate is compared against all - * examples, its score is then chosen from the `max(max_pos_score, max_neg_score)`. + * Uses custom search objective. Each candidate is compared against all + * examples, its score is then chosen from the `max(max_pos_score, max_neg_score)`. * If the `max_neg_score` is chosen then it is squared and negated. * * @generated from enum value: BestScore = 1; @@ -181,10 +187,38 @@ export enum Fusion { * @generated from enum value: RRF = 0; */ RRF = 0, + + /** + * Distribution-Based Score Fusion + * + * @generated from enum value: DBSF = 1; + */ + DBSF = 1, } // Retrieve enum metadata with: proto3.getEnumType(Fusion) proto3.util.setEnumType(Fusion, "qdrant.Fusion", [ { no: 0, name: "RRF" }, + { no: 1, name: "DBSF" }, +]); + +/** + * Sample points from the collection + * + * Available sampling methods: + * + * * `random` - Random sampling + * + * @generated from enum qdrant.Sample + */ +export enum Sample { + /** + * @generated from enum value: Random = 0; + */ + Random = 0, +} +// Retrieve enum metadata with: proto3.getEnumType(Sample) +proto3.util.setEnumType(Sample, "qdrant.Sample", [ + { no: 0, name: "Random" }, ]); /** @@ -650,10 +684,6 @@ export class VectorInput extends Message { } /** - * --------------------------------------------- - * ----------------- ShardKeySelector ---------- - * --------------------------------------------- - * * @generated from message qdrant.ShardKeySelector */ export class ShardKeySelector extends Message { @@ -878,6 +908,13 @@ export class GetPoints extends Message { */ shardKeySelector?: ShardKeySelector; + /** + * If set, overrides global timeout setting for this request. Unit is seconds. + * + * @generated from field: optional uint64 timeout = 8; + */ + timeout?: bigint; + constructor(data?: PartialMessage) { super(); proto3.util.initPartial(data, this); @@ -892,6 +929,7 @@ export class GetPoints extends Message { { no: 5, name: "with_vectors", kind: "message", T: WithVectorsSelector, opt: true }, { no: 6, name: "read_consistency", kind: "message", T: ReadConsistency, opt: true }, { no: 7, name: "shard_key_selector", kind: "message", T: ShardKeySelector, opt: true }, + { no: 8, name: "timeout", kind: "scalar", T: 4 /* ScalarType.UINT64 */, opt: true }, ]); static fromBinary(bytes: Uint8Array, options?: Partial): GetPoints { @@ -1891,7 +1929,7 @@ export class SearchParams extends Message { /** * - * If set to true, search will ignore quantized vector data + * If set to true, search will ignore quantized vector data * * @generated from field: optional qdrant.QuantizationSearchParams quantization = 3; */ @@ -2536,6 +2574,13 @@ export class ScrollPoints extends Message { */ orderBy?: OrderBy; + /** + * If set, overrides global timeout setting for this request. Unit is seconds. + * + * @generated from field: optional uint64 timeout = 11; + */ + timeout?: bigint; + constructor(data?: PartialMessage) { super(); proto3.util.initPartial(data, this); @@ -2553,6 +2598,7 @@ export class ScrollPoints extends Message { { no: 8, name: "read_consistency", kind: "message", T: ReadConsistency, opt: true }, { no: 9, name: "shard_key_selector", kind: "message", T: ShardKeySelector, opt: true }, { no: 10, name: "order_by", kind: "message", T: OrderBy, opt: true }, + { no: 11, name: "timeout", kind: "scalar", T: 4 /* ScalarType.UINT64 */, opt: true }, ]); static fromBinary(bytes: Uint8Array, options?: Partial): ScrollPoints { @@ -3431,6 +3477,13 @@ export class CountPoints extends Message { */ shardKeySelector?: ShardKeySelector; + /** + * If set, overrides global timeout setting for this request. Unit is seconds. + * + * @generated from field: optional uint64 timeout = 6; + */ + timeout?: bigint; + constructor(data?: PartialMessage) { super(); proto3.util.initPartial(data, this); @@ -3444,6 +3497,7 @@ export class CountPoints extends Message { { no: 3, name: "exact", kind: "scalar", T: 8 /* ScalarType.BOOL */, opt: true }, { no: 4, name: "read_consistency", kind: "message", T: ReadConsistency, opt: true }, { no: 5, name: "shard_key_selector", kind: "message", T: ShardKeySelector, opt: true }, + { no: 6, name: "timeout", kind: "scalar", T: 4 /* ScalarType.UINT64 */, opt: true }, ]); static fromBinary(bytes: Uint8Array, options?: Partial): CountPoints { @@ -3706,6 +3760,14 @@ export class Query extends Message { */ value: Fusion; case: "fusion"; + } | { + /** + * Sample points from the collection. + * + * @generated from field: qdrant.Sample sample = 7; + */ + value: Sample; + case: "sample"; } | { case: undefined; value?: undefined } = { case: undefined }; constructor(data?: PartialMessage) { @@ -3722,6 +3784,7 @@ export class Query extends Message { { no: 4, name: "context", kind: "message", T: ContextInput, oneof: "variant" }, { no: 5, name: "order_by", kind: "message", T: OrderBy, oneof: "variant" }, { no: 6, name: "fusion", kind: "enum", T: proto3.getEnumType(Fusion), oneof: "variant" }, + { no: 7, name: "sample", kind: "enum", T: proto3.getEnumType(Sample), oneof: "variant" }, ]); static fromBinary(bytes: Uint8Array, options?: Partial): Query { @@ -4046,6 +4109,265 @@ export class QueryBatchPoints extends Message { } } +/** + * @generated from message qdrant.QueryPointGroups + */ +export class QueryPointGroups extends Message { + /** + * Name of the collection + * + * @generated from field: string collection_name = 1; + */ + collectionName = ""; + + /** + * Sub-requests to perform first. If present, the query will be performed on the results of the prefetches. + * + * @generated from field: repeated qdrant.PrefetchQuery prefetch = 2; + */ + prefetch: PrefetchQuery[] = []; + + /** + * Query to perform. If missing, returns points ordered by their IDs. + * + * @generated from field: optional qdrant.Query query = 3; + */ + query?: Query; + + /** + * Define which vector to use for querying. If missing, the default vector is used. + * + * @generated from field: optional string using = 4; + */ + using?: string; + + /** + * Filter conditions - return only those points that satisfy the specified conditions. + * + * @generated from field: optional qdrant.Filter filter = 5; + */ + filter?: Filter; + + /** + * Search params for when there is no prefetch. + * + * @generated from field: optional qdrant.SearchParams params = 6; + */ + params?: SearchParams; + + /** + * Return points with scores better than this threshold. + * + * @generated from field: optional float score_threshold = 7; + */ + scoreThreshold?: number; + + /** + * Options for specifying which payload to include or not + * + * @generated from field: qdrant.WithPayloadSelector with_payload = 8; + */ + withPayload?: WithPayloadSelector; + + /** + * Options for specifying which vectors to include into response + * + * @generated from field: optional qdrant.WithVectorsSelector with_vectors = 9; + */ + withVectors?: WithVectorsSelector; + + /** + * The location to use for IDs lookup, if not specified - use the current collection and the 'using' vector + * + * @generated from field: optional qdrant.LookupLocation lookup_from = 10; + */ + lookupFrom?: LookupLocation; + + /** + * Max number of points. Default is 3. + * + * @generated from field: optional uint64 limit = 11; + */ + limit?: bigint; + + /** + * Maximum amount of points to return per group. Default to 10. + * + * @generated from field: optional uint64 group_size = 12; + */ + groupSize?: bigint; + + /** + * Payload field to group by, must be a string or number field. If there are multiple values for the field, all of them will be used. One point can be in multiple groups. + * + * @generated from field: string group_by = 13; + */ + groupBy = ""; + + /** + * Options for specifying read consistency guarantees + * + * @generated from field: optional qdrant.ReadConsistency read_consistency = 14; + */ + readConsistency?: ReadConsistency; + + /** + * Options for specifying how to use the group id to lookup points in another collection + * + * @generated from field: optional qdrant.WithLookup with_lookup = 15; + */ + withLookup?: WithLookup; + + /** + * If set, overrides global timeout setting for this request. Unit is seconds. + * + * @generated from field: optional uint64 timeout = 16; + */ + timeout?: bigint; + + /** + * 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 = 17; + */ + shardKeySelector?: ShardKeySelector; + + constructor(data?: PartialMessage) { + super(); + proto3.util.initPartial(data, this); + } + + static readonly runtime: typeof proto3 = proto3; + static readonly typeName = "qdrant.QueryPointGroups"; + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + { no: 1, name: "collection_name", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 2, name: "prefetch", kind: "message", T: PrefetchQuery, repeated: true }, + { no: 3, name: "query", kind: "message", T: Query, opt: true }, + { no: 4, name: "using", kind: "scalar", T: 9 /* ScalarType.STRING */, opt: true }, + { no: 5, name: "filter", kind: "message", T: Filter, opt: true }, + { no: 6, name: "params", kind: "message", T: SearchParams, opt: true }, + { no: 7, name: "score_threshold", kind: "scalar", T: 2 /* ScalarType.FLOAT */, opt: true }, + { no: 8, name: "with_payload", kind: "message", T: WithPayloadSelector }, + { no: 9, name: "with_vectors", kind: "message", T: WithVectorsSelector, opt: true }, + { no: 10, name: "lookup_from", kind: "message", T: LookupLocation, opt: true }, + { no: 11, name: "limit", kind: "scalar", T: 4 /* ScalarType.UINT64 */, opt: true }, + { no: 12, name: "group_size", kind: "scalar", T: 4 /* ScalarType.UINT64 */, opt: true }, + { no: 13, name: "group_by", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 14, name: "read_consistency", kind: "message", T: ReadConsistency, opt: true }, + { no: 15, name: "with_lookup", kind: "message", T: WithLookup, opt: true }, + { no: 16, name: "timeout", kind: "scalar", T: 4 /* ScalarType.UINT64 */, opt: true }, + { no: 17, name: "shard_key_selector", kind: "message", T: ShardKeySelector, opt: true }, + ]); + + static fromBinary(bytes: Uint8Array, options?: Partial): QueryPointGroups { + return new QueryPointGroups().fromBinary(bytes, options); + } + + static fromJson(jsonValue: JsonValue, options?: Partial): QueryPointGroups { + return new QueryPointGroups().fromJson(jsonValue, options); + } + + static fromJsonString(jsonString: string, options?: Partial): QueryPointGroups { + return new QueryPointGroups().fromJsonString(jsonString, options); + } + + static equals(a: QueryPointGroups | PlainMessage | undefined, b: QueryPointGroups | PlainMessage | undefined): boolean { + return proto3.util.equals(QueryPointGroups, a, b); + } +} + +/** + * @generated from message qdrant.FacetValue + */ +export class FacetValue extends Message { + /** + * @generated from oneof qdrant.FacetValue.variant + */ + variant: { + /** + * String value from the facet + * + * @generated from field: string string_value = 1; + */ + value: string; + case: "stringValue"; + } | { case: undefined; value?: undefined } = { case: undefined }; + + constructor(data?: PartialMessage) { + super(); + proto3.util.initPartial(data, this); + } + + static readonly runtime: typeof proto3 = proto3; + 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" }, + ]); + + static fromBinary(bytes: Uint8Array, options?: Partial): FacetValue { + return new FacetValue().fromBinary(bytes, options); + } + + static fromJson(jsonValue: JsonValue, options?: Partial): FacetValue { + return new FacetValue().fromJson(jsonValue, options); + } + + static fromJsonString(jsonString: string, options?: Partial): FacetValue { + return new FacetValue().fromJsonString(jsonString, options); + } + + static equals(a: FacetValue | PlainMessage | undefined, b: FacetValue | PlainMessage | undefined): boolean { + return proto3.util.equals(FacetValue, a, b); + } +} + +/** + * @generated from message qdrant.FacetValueHit + */ +export class FacetValueHit extends Message { + /** + * Value from the facet + * + * @generated from field: qdrant.FacetValue value = 1; + */ + value?: FacetValue; + + /** + * Number of points with this value + * + * @generated from field: uint64 count = 2; + */ + count = protoInt64.zero; + + constructor(data?: PartialMessage) { + super(); + proto3.util.initPartial(data, this); + } + + static readonly runtime: typeof proto3 = proto3; + static readonly typeName = "qdrant.FacetValueHit"; + 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 fromJson(jsonValue: JsonValue, options?: Partial): FacetValueHit { + return new FacetValueHit().fromJson(jsonValue, options); + } + + static fromJsonString(jsonString: string, options?: Partial): FacetValueHit { + return new FacetValueHit().fromJsonString(jsonString, options); + } + + static equals(a: FacetValueHit | PlainMessage | undefined, b: FacetValueHit | PlainMessage | undefined): boolean { + return proto3.util.equals(FacetValueHit, a, b); + } +} + /** * @generated from message qdrant.PointsUpdateOperation */ @@ -4935,7 +5257,7 @@ export class PointGroup extends Message { id?: GroupId; /** - * Points in the group + * Points in the group * * @generated from field: repeated qdrant.ScoredPoint hits = 2; */ @@ -5152,6 +5474,51 @@ export class QueryBatchResponse extends Message { } } +/** + * @generated from message qdrant.QueryGroupsResponse + */ +export class QueryGroupsResponse extends Message { + /** + * @generated from field: qdrant.GroupsResult result = 1; + */ + result?: GroupsResult; + + /** + * 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.QueryGroupsResponse"; + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + { no: 1, name: "result", kind: "message", T: GroupsResult }, + { no: 2, name: "time", kind: "scalar", T: 1 /* ScalarType.DOUBLE */ }, + ]); + + static fromBinary(bytes: Uint8Array, options?: Partial): QueryGroupsResponse { + return new QueryGroupsResponse().fromBinary(bytes, options); + } + + static fromJson(jsonValue: JsonValue, options?: Partial): QueryGroupsResponse { + return new QueryGroupsResponse().fromJson(jsonValue, options); + } + + static fromJsonString(jsonString: string, options?: Partial): QueryGroupsResponse { + return new QueryGroupsResponse().fromJsonString(jsonString, options); + } + + static equals(a: QueryGroupsResponse | PlainMessage | undefined, b: QueryGroupsResponse | PlainMessage | undefined): boolean { + return proto3.util.equals(QueryGroupsResponse, a, b); + } +} + /** * @generated from message qdrant.BatchResult */ @@ -5820,7 +6187,7 @@ export class Filter extends Message { mustNot: Condition[] = []; /** - * At least minimum amount of given conditions should match + * At least minimum amount of given conditions should match * * @generated from field: optional qdrant.MinShould min_should = 4; */ 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 c8ac70b..efba4d1 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, 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, 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 { MethodKind } from "@bufbuild/protobuf"; /** @@ -314,6 +314,18 @@ export const Points = { O: QueryBatchResponse, kind: MethodKind.Unary, }, + /** + * + * 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. + * + * @generated from rpc qdrant.Points.QueryGroups + */ + queryGroups: { + name: "QueryGroups", + I: QueryPointGroups, + O: QueryGroupsResponse, + kind: MethodKind.Unary, + }, } } as const; diff --git a/packages/js-client-rest/CHANGELOG.md b/packages/js-client-rest/CHANGELOG.md index 594f7b8..7df4291 100644 --- a/packages/js-client-rest/CHANGELOG.md +++ b/packages/js-client-rest/CHANGELOG.md @@ -1,5 +1,11 @@ # @qdrant/js-client-rest +## 1.11.0 + +### Minor Changes + +- Qdrant v1.11.0 API + ## 1.10.0 ### Minor Changes diff --git a/packages/js-client-rest/package.json b/packages/js-client-rest/package.json index 11453a3..ab7c10c 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.10.0", + "version": "1.11.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 08a7fa6..14a271a 100644 --- a/packages/js-client-rest/src/api/points-api.ts +++ b/packages/js-client-rest/src/api/points-api.ts @@ -13,7 +13,7 @@ export function createPointsApi(client: Client) { /** * Count points which matches given filtering condition */ - countPoints: client.path('/collections/{collection_name}/points/count').method('post').create(), + countPoints: client.path('/collections/{collection_name}/points/count').method('post').create({timeout: true}), /** * Delete specified key payload for points @@ -55,7 +55,10 @@ export function createPointsApi(client: Client) { /** * Retrieve multiple points by specified IDs */ - getPoints: client.path('/collections/{collection_name}/points').method('post').create({consistency: true}), + getPoints: client + .path('/collections/{collection_name}/points') + .method('post') + .create({consistency: true, timeout: true}), /** * Replace full payload of points with new one @@ -95,7 +98,7 @@ export function createPointsApi(client: Client) { scrollPoints: client .path('/collections/{collection_name}/points/scroll') .method('post') - .create({consistency: true}), + .create({consistency: true, timeout: true}), /** * Retrieve by batch the closest points based on vector similarity and given filtering conditions @@ -176,5 +179,13 @@ export function createPointsApi(client: Client) { .path('/collections/{collection_name}/points/query/batch') .method('post') .create({consistency: true, timeout: true}), + + /** + * Query points, grouped by a given payload field + */ + queryPointsGroups: client + .path('/collections/{collection_name}/points/query/groups') + .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 282e903..5c7dad8 100644 --- a/packages/js-client-rest/src/openapi/generated_schema.ts +++ b/packages/js-client-rest/src/openapi/generated_schema.ts @@ -439,6 +439,13 @@ export interface paths { */ post: operations["query_batch_points"]; }; + "/collections/{collection_name}/points/query/groups": { + /** + * Query points, grouped by a given payload field + * @description Universally query points, grouped by a given payload field + */ + post: operations["query_points_groups"]; + }; } export type webhooks = Record; @@ -457,6 +464,24 @@ export interface components { }; result?: Record | null; }; + /** + * @example { + * "collections": [ + * { + * "name": "arivx-title" + * }, + * { + * "name": "arivx-abstract" + * }, + * { + * "name": "medium-title" + * }, + * { + * "name": "medium-text" + * } + * ] + * } + */ CollectionsResponse: { collections: (components["schemas"]["CollectionDescription"])[]; }; @@ -804,9 +829,45 @@ export interface components { * @description All possible names of payload types * @enum {string} */ - PayloadSchemaType: "keyword" | "integer" | "float" | "geo" | "text" | "bool" | "datetime"; + PayloadSchemaType: "keyword" | "integer" | "float" | "geo" | "text" | "bool" | "datetime" | "uuid"; /** @description Payload type with parameters */ - PayloadSchemaParams: components["schemas"]["TextIndexParams"] | components["schemas"]["IntegerIndexParams"]; + PayloadSchemaParams: components["schemas"]["KeywordIndexParams"] | components["schemas"]["IntegerIndexParams"] | components["schemas"]["FloatIndexParams"] | components["schemas"]["GeoIndexParams"] | components["schemas"]["TextIndexParams"] | components["schemas"]["BoolIndexParams"] | components["schemas"]["DatetimeIndexParams"] | components["schemas"]["UuidIndexParams"]; + KeywordIndexParams: { + type: components["schemas"]["KeywordIndexType"]; + /** @description If true - used for tenant optimization. Default: false. */ + is_tenant?: boolean | null; + /** @description If true, store the index on disk. Default: false. */ + on_disk?: boolean | null; + }; + /** @enum {string} */ + KeywordIndexType: "keyword"; + IntegerIndexParams: { + type: components["schemas"]["IntegerIndexType"]; + /** @description If true - support direct lookups. */ + lookup: boolean; + /** @description If true - support ranges filters. */ + range: boolean; + /** @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. */ + on_disk?: boolean | null; + }; + /** @enum {string} */ + IntegerIndexType: "integer"; + FloatIndexParams: { + type: components["schemas"]["FloatIndexType"]; + /** @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. */ + on_disk?: boolean | null; + }; + /** @enum {string} */ + FloatIndexType: "float"; + GeoIndexParams: { + type: components["schemas"]["GeoIndexType"]; + }; + /** @enum {string} */ + GeoIndexType: "geo"; TextIndexParams: { type: components["schemas"]["TextIndexType"]; tokenizer?: components["schemas"]["TokenizerType"]; @@ -814,22 +875,36 @@ export interface components { min_token_len?: number | null; /** Format: uint */ max_token_len?: number | null; - /** @description If true, lowercase all tokens. Default: true */ + /** @description If true, lowercase all tokens. Default: true. */ lowercase?: boolean | null; }; /** @enum {string} */ TextIndexType: "text"; /** @enum {string} */ TokenizerType: "prefix" | "whitespace" | "word" | "multilingual"; - IntegerIndexParams: { - type: components["schemas"]["IntegerIndexType"]; - /** @description If true - support direct lookups. */ - lookup: boolean; - /** @description If true - support ranges filters. */ - range: boolean; + BoolIndexParams: { + type: components["schemas"]["BoolIndexType"]; }; /** @enum {string} */ - IntegerIndexType: "integer"; + BoolIndexType: "bool"; + DatetimeIndexParams: { + type: components["schemas"]["DatetimeIndexType"]; + /** @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. */ + on_disk?: boolean | null; + }; + /** @enum {string} */ + DatetimeIndexType: "datetime"; + UuidIndexParams: { + type: components["schemas"]["UuidIndexType"]; + /** @description If true - used for tenant optimization. */ + is_tenant?: boolean | null; + /** @description If true, store the index on disk. Default: false. */ + on_disk?: boolean | null; + }; + /** @enum {string} */ + UuidIndexType: "uuid"; PointRequest: { /** @description Specify in which shards to look for the points, if not specified - look in all shards */ shard_key?: components["schemas"]["ShardKeySelector"] | (Record | null); @@ -868,6 +943,12 @@ export interface components { shard_key?: components["schemas"]["ShardKey"] | (Record | null); order_value?: components["schemas"]["OrderValue"] | (Record | null); }; + /** + * @example { + * "city": "London", + * "color": "green" + * } + */ Payload: { [key: string]: unknown; }; @@ -1190,12 +1271,14 @@ export interface components { id: components["schemas"]["ExtendedPointId"]; /** * Format: uint64 - * @description Point version + * @description Point version + * @example 3 */ version: number; /** * Format: float - * @description Points vector distance to the query vector + * @description Points vector distance to the query vector + * @example 0.75 */ score: number; /** @description Payload - values assigned to the point */ @@ -1333,7 +1416,37 @@ export interface components { StartFrom: number | string; /** @description Result of the points read request */ ScrollResult: { - /** @description List of retrieved points */ + /** + * @description List of retrieved points + * @example [ + * { + * "id": 40, + * "payload": { + * "city": "London", + * "color": "green" + * }, + * "vector": [ + * 0.875, + * 0.140625, + * 0.897599995136261 + * ], + * "shard_key": "region_1" + * }, + * { + * "id": 41, + * "payload": { + * "city": "Paris", + * "color": "red" + * }, + * "vector": [ + * 0.75, + * 0.640625, + * 0.8945000171661377 + * ], + * "shard_key": "region_1" + * } + * ] + */ points: (components["schemas"]["Record"])[]; /** @description Offset which should be used to retrieve a next page result */ next_page_offset?: components["schemas"]["ExtendedPointId"] | (Record | null); @@ -1343,7 +1456,9 @@ export interface components { vectors?: components["schemas"]["VectorsConfig"]; /** * Format: uint32 - * @description 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 + * @description 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 * @default null */ shard_number?: number | null; @@ -1699,6 +1814,14 @@ export interface components { */ latest_error_timestamp?: string | null; }; + /** + * @example { + * "name": "my-collection-3766212330831337-2024-07-22-08-31-55.snapshot", + * "creation_time": "2022-08-04T10:49:10", + * "size": 1000000, + * "checksum": "a1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6e7f8a9b0c1d2e3f4a5b6c7d8e9f0" + * } + */ SnapshotDescription: { name: string; /** Format: partial-date-time */ @@ -1744,6 +1867,8 @@ export interface components { remote_shards: (components["schemas"]["RemoteShardInfo"])[]; /** @description Shard transfers */ shard_transfers: (components["schemas"]["ShardTransferInfo"])[]; + /** @description Resharding operations */ + resharding_operations: (components["schemas"]["ReshardingInfo"])[]; }; LocalShardInfo: { /** @@ -1801,6 +1926,18 @@ export interface components { }; /** @description Methods for transferring a shard from one node to another. */ ShardTransferMethod: "stream_records" | "snapshot" | "wal_delta"; + ReshardingInfo: { + direction: components["schemas"]["ReshardingDirection"]; + /** Format: uint32 */ + shard_id: number; + /** Format: uint64 */ + peer_id: number; + shard_key?: components["schemas"]["ShardKey"] | (Record | null); + /** @description A human-readable report of the operation progress. Available only on the source peer. */ + comment?: string | null; + }; + /** @description Resharding direction, scale up or down in number of shards */ + ReshardingDirection: "up" | "down"; TelemetryData: { id: string; app: components["schemas"]["AppBuildTelemetry"]; @@ -1933,7 +2070,7 @@ export interface components { datatype?: components["schemas"]["VectorStorageDatatype"] | (Record | null); }; /** @description Storage types for vectors */ - VectorStorageType: "Memory" | "Mmap" | "ChunkedMmap"; + VectorStorageType: "Memory" | "Mmap" | "ChunkedMmap" | "InRamChunkedMmap"; /** @description Vector index configuration */ Indexes: OneOf<[{ /** @enum {string} */ @@ -2245,6 +2382,12 @@ export interface components { CollectionsAliasesResponse: { aliases: (components["schemas"]["AliasDescription"])[]; }; + /** + * @example { + * "alias_name": "blogs-title", + * "collection_name": "arivx-title" + * } + */ AliasDescription: { alias_name: string; collection_name: string; @@ -2605,7 +2748,7 @@ export interface components { }; QueryInterface: components["schemas"]["VectorInput"] | components["schemas"]["Query"]; VectorInput: (number)[] | components["schemas"]["SparseVector"] | ((number)[])[] | components["schemas"]["ExtendedPointId"]; - Query: components["schemas"]["NearestQuery"] | components["schemas"]["RecommendQuery"] | components["schemas"]["DiscoverQuery"] | components["schemas"]["ContextQuery"] | components["schemas"]["OrderByQuery"] | components["schemas"]["FusionQuery"]; + 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"]; }; @@ -2643,16 +2786,69 @@ export interface components { fusion: components["schemas"]["Fusion"]; }; /** - * @description Fusion algorithm allows to combine results of multiple prefetches. Available fusion algorithms: * `rrf` - Rank Reciprocal Fusion + * @description Fusion algorithm allows to combine results of multiple prefetches. + * + * Available fusion algorithms: + * + * * `rrf` - Reciprocal Rank Fusion * `dbsf` - Distribution-Based Score Fusion * @enum {string} */ - Fusion: "rrf"; + Fusion: "rrf" | "dbsf"; + SampleQuery: { + sample: components["schemas"]["Sample"]; + }; + /** @enum {string} */ + Sample: "random"; QueryRequestBatch: { searches: (components["schemas"]["QueryRequest"])[]; }; QueryResponse: { points: (components["schemas"]["ScoredPoint"])[]; }; + QueryGroupsRequest: { + shard_key?: components["schemas"]["ShardKeySelector"] | (Record | null); + /** + * @description Sub-requests to perform first. If present, the query will be performed on the results of the prefetch(es). + * @default null + */ + prefetch?: components["schemas"]["Prefetch"] | (components["schemas"]["Prefetch"])[] | (Record | null); + /** @description Query to perform. If missing without prefetches, returns points ordered by their IDs. */ + query?: components["schemas"]["QueryInterface"] | (Record | null); + /** @description Define which vector name to use for querying. If missing, the default vector is used. */ + using?: string | null; + /** @description Filter conditions - return only those points that satisfy the specified conditions. */ + filter?: components["schemas"]["Filter"] | (Record | null); + /** @description Search params for when there is no prefetch */ + params?: components["schemas"]["SearchParams"] | (Record | null); + /** + * Format: float + * @description Return points with scores better than this threshold. + */ + score_threshold?: number | null; + /** @description Options for specifying which vectors to include into the response. Default is false. */ + with_vector?: components["schemas"]["WithVector"] | (Record | null); + /** @description Options for specifying which payload to include or not. Default is false. */ + with_payload?: components["schemas"]["WithPayloadInterface"] | (Record | null); + /** + * @description The location to use for IDs lookup, if not specified - use the current collection and the 'using' vector Note: the other collection vectors should have the same vector size as the 'using' vector in the current collection + * @default null + */ + lookup_from?: components["schemas"]["LookupLocation"] | (Record | null); + /** @description Payload field to group by, must be a string or number field. If the field contains more than 1 value, all values will be used for grouping. One point can be in multiple groups. */ + group_by: string; + /** + * Format: uint + * @description Maximum amount of points to return per group. Default is 3. + */ + group_size?: number | null; + /** + * Format: uint + * @description Maximum amount of groups to return. Default is 10. + */ + limit?: number | null; + /** @description Look for points in another collection using the group ids */ + with_lookup?: components["schemas"]["WithLookupInterface"] | (Record | null); + }; }; responses: never; parameters: never; @@ -2693,9 +2889,11 @@ export interface operations { "application/json": { /** * Format: float - * @description Time spent to process this request + * @description Time spent to process this request + * @example 0.002 */ time?: number; + /** @example ok */ status?: string; result?: boolean; }; @@ -2743,9 +2941,11 @@ export interface operations { "application/json": { /** * Format: float - * @description Time spent to process this request + * @description Time spent to process this request + * @example 0.002 */ time?: number; + /** @example ok */ status?: string; result?: boolean; }; @@ -2771,32 +2971,14 @@ export interface operations { */ root: { responses: { - /** @description successful operation */ + /** @description Qdrant server version information */ 200: { content: { - "application/json": { - /** - * Format: float - * @description Time spent to process this request - */ - time?: number; - status?: string; - result?: components["schemas"]["VersionInfo"]; - }; - }; - }; - /** @description error */ - default: { - content: { - "application/json": components["schemas"]["ErrorResponse"]; + "application/json": components["schemas"]["VersionInfo"]; }; }; /** @description error */ - "4XX": { - content: { - "application/json": components["schemas"]["ErrorResponse"]; - }; - }; + "4XX": never; }; }; /** @@ -2817,9 +2999,11 @@ export interface operations { "application/json": { /** * Format: float - * @description Time spent to process this request + * @description Time spent to process this request + * @example 0.002 */ time?: number; + /** @example ok */ status?: string; result?: components["schemas"]["TelemetryData"]; }; @@ -2873,9 +3057,11 @@ export interface operations { "application/json": { /** * Format: float - * @description Time spent to process this request + * @description Time spent to process this request + * @example 0.002 */ time?: number; + /** @example ok */ status?: string; result?: components["schemas"]["LocksOption"]; }; @@ -2913,9 +3099,11 @@ export interface operations { "application/json": { /** * Format: float - * @description Time spent to process this request + * @description Time spent to process this request + * @example 0.002 */ time?: number; + /** @example ok */ status?: string; result?: components["schemas"]["LocksOption"]; }; @@ -3027,9 +3215,11 @@ export interface operations { "application/json": { /** * Format: float - * @description Time spent to process this request + * @description Time spent to process this request + * @example 0.002 */ time?: number; + /** @example ok */ status?: string; result?: components["schemas"]["ClusterStatus"]; }; @@ -3058,9 +3248,11 @@ export interface operations { "application/json": { /** * Format: float - * @description Time spent to process this request + * @description Time spent to process this request + * @example 0.002 */ time?: number; + /** @example ok */ status?: string; result?: boolean; }; @@ -3102,9 +3294,11 @@ export interface operations { "application/json": { /** * Format: float - * @description Time spent to process this request + * @description Time spent to process this request + * @example 0.002 */ time?: number; + /** @example ok */ status?: string; result?: boolean; }; @@ -3136,9 +3330,11 @@ export interface operations { "application/json": { /** * Format: float - * @description Time spent to process this request + * @description Time spent to process this request + * @example 0.002 */ time?: number; + /** @example ok */ status?: string; result?: components["schemas"]["CollectionsResponse"]; }; @@ -3176,9 +3372,11 @@ export interface operations { "application/json": { /** * Format: float - * @description Time spent to process this request + * @description Time spent to process this request + * @example 0.002 */ time?: number; + /** @example ok */ status?: string; result?: components["schemas"]["CollectionInfo"]; }; @@ -3229,9 +3427,11 @@ export interface operations { "application/json": { /** * Format: float - * @description Time spent to process this request + * @description Time spent to process this request + * @example 0.002 */ time?: number; + /** @example ok */ status?: string; result?: boolean; }; @@ -3276,9 +3476,11 @@ export interface operations { "application/json": { /** * Format: float - * @description Time spent to process this request + * @description Time spent to process this request + * @example 0.002 */ time?: number; + /** @example ok */ status?: string; result?: boolean; }; @@ -3329,9 +3531,11 @@ export interface operations { "application/json": { /** * Format: float - * @description Time spent to process this request + * @description Time spent to process this request + * @example 0.002 */ time?: number; + /** @example ok */ status?: string; result?: boolean; }; @@ -3375,9 +3579,11 @@ export interface operations { "application/json": { /** * Format: float - * @description Time spent to process this request + * @description Time spent to process this request + * @example 0.002 */ time?: number; + /** @example ok */ status?: string; result?: boolean; }; @@ -3427,9 +3633,11 @@ export interface operations { "application/json": { /** * Format: float - * @description Time spent to process this request + * @description Time spent to process this request + * @example 0.002 */ time?: number; + /** @example ok */ status?: string; result?: components["schemas"]["UpdateResult"]; }; @@ -3467,9 +3675,11 @@ export interface operations { "application/json": { /** * Format: float - * @description Time spent to process this request + * @description Time spent to process this request + * @example 0.002 */ time?: number; + /** @example ok */ status?: string; result?: components["schemas"]["CollectionExistence"]; }; @@ -3515,9 +3725,11 @@ export interface operations { "application/json": { /** * Format: float - * @description Time spent to process this request + * @description Time spent to process this request + * @example 0.002 */ time?: number; + /** @example ok */ status?: string; result?: components["schemas"]["UpdateResult"]; }; @@ -3555,9 +3767,11 @@ export interface operations { "application/json": { /** * Format: float - * @description Time spent to process this request + * @description Time spent to process this request + * @example 0.002 */ time?: number; + /** @example ok */ status?: string; result?: components["schemas"]["CollectionClusterInfo"]; }; @@ -3605,9 +3819,11 @@ export interface operations { "application/json": { /** * Format: float - * @description Time spent to process this request + * @description Time spent to process this request + * @example 0.002 */ time?: number; + /** @example ok */ status?: string; result?: boolean; }; @@ -3645,9 +3861,11 @@ export interface operations { "application/json": { /** * Format: float - * @description Time spent to process this request + * @description Time spent to process this request + * @example 0.002 */ time?: number; + /** @example ok */ status?: string; result?: components["schemas"]["CollectionsAliasesResponse"]; }; @@ -3679,9 +3897,11 @@ export interface operations { "application/json": { /** * Format: float - * @description Time spent to process this request + * @description Time spent to process this request + * @example 0.002 */ time?: number; + /** @example ok */ status?: string; result?: components["schemas"]["CollectionsAliasesResponse"]; }; @@ -3736,9 +3956,11 @@ export interface operations { "application/json": { /** * Format: float - * @description Time spent to process this request + * @description Time spent to process this request + * @example 0.002 */ time?: number; + /** @example ok */ status?: string; result?: boolean; }; @@ -3799,9 +4021,11 @@ export interface operations { "application/json": { /** * Format: float - * @description Time spent to process this request + * @description Time spent to process this request + * @example 0.002 */ time?: number; + /** @example ok */ status?: string; result?: boolean; }; @@ -3852,9 +4076,11 @@ export interface operations { "application/json": { /** * Format: float - * @description Time spent to process this request + * @description Time spent to process this request + * @example 0.002 */ time?: number; + /** @example ok */ status?: string; result?: (components["schemas"]["SnapshotDescription"])[]; }; @@ -3896,9 +4122,11 @@ export interface operations { "application/json": { /** * Format: float - * @description Time spent to process this request + * @description Time spent to process this request + * @example 0.002 */ time?: number; + /** @example ok */ status?: string; result?: components["schemas"]["SnapshotDescription"]; }; @@ -3989,9 +4217,11 @@ export interface operations { "application/json": { /** * Format: float - * @description Time spent to process this request + * @description Time spent to process this request + * @example 0.002 */ time?: number; + /** @example ok */ status?: string; result?: boolean; }; @@ -4036,9 +4266,11 @@ export interface operations { "application/json": { /** * Format: float - * @description Time spent to process this request + * @description Time spent to process this request + * @example 0.002 */ time?: number; + /** @example ok */ status?: string; result?: (components["schemas"]["SnapshotDescription"])[]; }; @@ -4076,9 +4308,11 @@ export interface operations { "application/json": { /** * Format: float - * @description Time spent to process this request + * @description Time spent to process this request + * @example 0.002 */ time?: number; + /** @example ok */ status?: string; result?: components["schemas"]["SnapshotDescription"]; }; @@ -4165,9 +4399,11 @@ export interface operations { "application/json": { /** * Format: float - * @description Time spent to process this request + * @description Time spent to process this request + * @example 0.002 */ time?: number; + /** @example ok */ status?: string; result?: boolean; }; @@ -4237,9 +4473,11 @@ export interface operations { "application/json": { /** * Format: float - * @description Time spent to process this request + * @description Time spent to process this request + * @example 0.002 */ time?: number; + /** @example ok */ status?: string; result?: boolean; }; @@ -4302,9 +4540,11 @@ export interface operations { "application/json": { /** * Format: float - * @description Time spent to process this request + * @description Time spent to process this request + * @example 0.002 */ time?: number; + /** @example ok */ status?: string; result?: boolean; }; @@ -4357,9 +4597,11 @@ export interface operations { "application/json": { /** * Format: float - * @description Time spent to process this request + * @description Time spent to process this request + * @example 0.002 */ time?: number; + /** @example ok */ status?: string; result?: (components["schemas"]["SnapshotDescription"])[]; }; @@ -4403,9 +4645,11 @@ export interface operations { "application/json": { /** * Format: float - * @description Time spent to process this request + * @description Time spent to process this request + * @example 0.002 */ time?: number; + /** @example ok */ status?: string; result?: components["schemas"]["SnapshotDescription"]; }; @@ -4500,9 +4744,11 @@ export interface operations { "application/json": { /** * Format: float - * @description Time spent to process this request + * @description Time spent to process this request + * @example 0.002 */ time?: number; + /** @example ok */ status?: string; result?: boolean; }; @@ -4559,9 +4805,11 @@ export interface operations { "application/json": { /** * Format: float - * @description Time spent to process this request + * @description Time spent to process this request + * @example 0.002 */ time?: number; + /** @example ok */ status?: string; result?: components["schemas"]["Record"]; }; @@ -4611,9 +4859,11 @@ export interface operations { "application/json": { /** * Format: float - * @description Time spent to process this request + * @description Time spent to process this request + * @example 0.002 */ time?: number; + /** @example ok */ status?: string; result?: components["schemas"]["UpdateResult"]; }; @@ -4642,6 +4892,8 @@ export interface operations { 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 retrieve from */ @@ -4661,9 +4913,11 @@ export interface operations { "application/json": { /** * Format: float - * @description Time spent to process this request + * @description Time spent to process this request + * @example 0.002 */ time?: number; + /** @example ok */ status?: string; result?: (components["schemas"]["Record"])[]; }; @@ -4713,9 +4967,11 @@ export interface operations { "application/json": { /** * Format: float - * @description Time spent to process this request + * @description Time spent to process this request + * @example 0.002 */ time?: number; + /** @example ok */ status?: string; result?: components["schemas"]["UpdateResult"]; }; @@ -4765,9 +5021,11 @@ export interface operations { "application/json": { /** * Format: float - * @description Time spent to process this request + * @description Time spent to process this request + * @example 0.002 */ time?: number; + /** @example ok */ status?: string; result?: components["schemas"]["UpdateResult"]; }; @@ -4817,9 +5075,11 @@ export interface operations { "application/json": { /** * Format: float - * @description Time spent to process this request + * @description Time spent to process this request + * @example 0.002 */ time?: number; + /** @example ok */ status?: string; result?: components["schemas"]["UpdateResult"]; }; @@ -4869,9 +5129,11 @@ export interface operations { "application/json": { /** * Format: float - * @description Time spent to process this request + * @description Time spent to process this request + * @example 0.002 */ time?: number; + /** @example ok */ status?: string; result?: components["schemas"]["UpdateResult"]; }; @@ -4921,9 +5183,11 @@ export interface operations { "application/json": { /** * Format: float - * @description Time spent to process this request + * @description Time spent to process this request + * @example 0.002 */ time?: number; + /** @example ok */ status?: string; result?: components["schemas"]["UpdateResult"]; }; @@ -4973,9 +5237,11 @@ export interface operations { "application/json": { /** * Format: float - * @description Time spent to process this request + * @description Time spent to process this request + * @example 0.002 */ time?: number; + /** @example ok */ status?: string; result?: components["schemas"]["UpdateResult"]; }; @@ -5025,9 +5291,11 @@ export interface operations { "application/json": { /** * Format: float - * @description Time spent to process this request + * @description Time spent to process this request + * @example 0.002 */ time?: number; + /** @example ok */ status?: string; result?: components["schemas"]["UpdateResult"]; }; @@ -5077,9 +5345,11 @@ export interface operations { "application/json": { /** * Format: float - * @description Time spent to process this request + * @description Time spent to process this request + * @example 0.002 */ time?: number; + /** @example ok */ status?: string; result?: (components["schemas"]["UpdateResult"])[]; }; @@ -5108,6 +5378,8 @@ export interface operations { 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 retrieve from */ @@ -5127,9 +5399,11 @@ export interface operations { "application/json": { /** * Format: float - * @description Time spent to process this request + * @description Time spent to process this request + * @example 0.002 */ time?: number; + /** @example ok */ status?: string; result?: components["schemas"]["ScrollResult"]; }; @@ -5179,9 +5453,11 @@ export interface operations { "application/json": { /** * Format: float - * @description Time spent to process this request + * @description Time spent to process this request + * @example 0.002 */ time?: number; + /** @example ok */ status?: string; result?: (components["schemas"]["ScoredPoint"])[]; }; @@ -5231,9 +5507,11 @@ export interface operations { "application/json": { /** * Format: float - * @description Time spent to process this request + * @description Time spent to process this request + * @example 0.002 */ time?: number; + /** @example ok */ status?: string; result?: ((components["schemas"]["ScoredPoint"])[])[]; }; @@ -5283,9 +5561,11 @@ export interface operations { "application/json": { /** * Format: float - * @description Time spent to process this request + * @description Time spent to process this request + * @example 0.002 */ time?: number; + /** @example ok */ status?: string; result?: components["schemas"]["GroupsResult"]; }; @@ -5335,9 +5615,11 @@ export interface operations { "application/json": { /** * Format: float - * @description Time spent to process this request + * @description Time spent to process this request + * @example 0.002 */ time?: number; + /** @example ok */ status?: string; result?: (components["schemas"]["ScoredPoint"])[]; }; @@ -5387,9 +5669,11 @@ export interface operations { "application/json": { /** * Format: float - * @description Time spent to process this request + * @description Time spent to process this request + * @example 0.002 */ time?: number; + /** @example ok */ status?: string; result?: ((components["schemas"]["ScoredPoint"])[])[]; }; @@ -5439,9 +5723,11 @@ export interface operations { "application/json": { /** * Format: float - * @description Time spent to process this request + * @description Time spent to process this request + * @example 0.002 */ time?: number; + /** @example ok */ status?: string; result?: components["schemas"]["GroupsResult"]; }; @@ -5494,9 +5780,11 @@ export interface operations { "application/json": { /** * Format: float - * @description Time spent to process this request + * @description Time spent to process this request + * @example 0.002 */ time?: number; + /** @example ok */ status?: string; result?: (components["schemas"]["ScoredPoint"])[]; }; @@ -5546,9 +5834,11 @@ export interface operations { "application/json": { /** * Format: float - * @description Time spent to process this request + * @description Time spent to process this request + * @example 0.002 */ time?: number; + /** @example ok */ status?: string; result?: ((components["schemas"]["ScoredPoint"])[])[]; }; @@ -5574,6 +5864,10 @@ export interface operations { */ count_points: { parameters: { + query?: { + /** @description If set, overrides global timeout for this request. Unit is seconds. */ + timeout?: number; + }; path: { /** @description Name of the collection to count in */ collection_name: string; @@ -5592,9 +5886,11 @@ export interface operations { "application/json": { /** * Format: float - * @description Time spent to process this request + * @description Time spent to process this request + * @example 0.002 */ time?: number; + /** @example ok */ status?: string; result?: components["schemas"]["CountResult"]; }; @@ -5644,9 +5940,11 @@ export interface operations { "application/json": { /** * Format: float - * @description Time spent to process this request + * @description Time spent to process this request + * @example 0.002 */ time?: number; + /** @example ok */ status?: string; result?: components["schemas"]["QueryResponse"]; }; @@ -5696,9 +5994,11 @@ export interface operations { "application/json": { /** * Format: float - * @description Time spent to process this request + * @description Time spent to process this request + * @example 0.002 */ time?: number; + /** @example ok */ status?: string; result?: (components["schemas"]["QueryResponse"])[]; }; @@ -5718,4 +6018,58 @@ export interface operations { }; }; }; + /** + * Query points, grouped by a given payload field + * @description Universally query points, grouped by a given payload field + */ + query_points_groups: { + 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 query */ + collection_name: string; + }; + }; + /** @description Describes the query to make to the collection */ + requestBody?: { + content: { + "application/json": components["schemas"]["QueryGroupsRequest"]; + }; + }; + 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"]["GroupsResult"]; + }; + }; + }; + /** @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 7921c39..c3fcfc5 100644 --- a/packages/js-client-rest/src/qdrant-client.ts +++ b/packages/js-client-rest/src/qdrant-client.ts @@ -441,12 +441,13 @@ export class QdrantClient { shard_key, filter, consistency, + timeout, limit = 10, offset, with_payload = true, with_vector = false, order_by, - }: SchemaFor<'ScrollRequest'> & {consistency?: SchemaFor<'ReadConsistency'>} = {}, + }: SchemaFor<'ScrollRequest'> & {timeout?: number} & {consistency?: SchemaFor<'ReadConsistency'>} = {}, ) { const response = await this._openApiClient.points.scrollPoints({ collection_name, @@ -458,6 +459,7 @@ export class QdrantClient { with_vector, order_by, consistency, + timeout, }); return maybe(response.data.result).orThrow('Scroll points API returned empty'); } @@ -475,12 +477,16 @@ export class QdrantClient { * Default: `true` * @returns Amount of points in the collection matching the filter. */ - async count(collection_name: string, {shard_key, filter, exact = true}: SchemaFor<'CountRequest'> = {}) { + async count( + collection_name: string, + {shard_key, filter, exact = true, timeout}: SchemaFor<'CountRequest'> & {timeout?: number} = {}, + ) { const response = await this._openApiClient.points.countPoints({ collection_name, shard_key, filter, exact, + timeout, }); return maybe(response.data.result).orThrow('Count points returned empty'); } @@ -772,7 +778,8 @@ export class QdrantClient { with_payload = true, with_vector, consistency, - }: SchemaFor<'PointRequest'> & {consistency?: SchemaFor<'ReadConsistency'>}, + timeout, + }: SchemaFor<'PointRequest'> & {consistency?: SchemaFor<'ReadConsistency'>} & {timeout?: number}, ) { const response = await this._openApiClient.points.getPoints({ collection_name, @@ -781,6 +788,7 @@ export class QdrantClient { with_payload, with_vector, consistency, + timeout, }); return maybe(response.data.result).orThrow('Retrieve API returned empty'); } @@ -1739,7 +1747,7 @@ export class QdrantClient { */ async versionInfo() { const response = await this._openApiClient.service.root({}); - return maybe(response.data.result).orThrow('Version Info returned empty'); + return maybe(response.data).orThrow('Version Info returned empty'); } /** @@ -1849,4 +1857,72 @@ export class QdrantClient { }); return maybe(response.data.result).orThrow('Query points returned empty'); } + + /** + * Query points, grouped by a given payload field + * @description Universally query points, grouped by a given payload field + * @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. + * - prefetch: Sub-requests to perform first. If present, the query will be performed on the results of the prefetch(es). + * - query: Query to perform. If missing without prefetches, returns points ordered by their IDs. + * - using: Define which vector name to use for querying. If missing, the default vector is used. + * - filter: Filter conditions - return only those points that satisfy the specified conditions. + * - params: Search params for when there is no prefetch + * - score_threshold: Return points with scores better than this threshold. + * - with_vector: Options for specifying which vectors to include into the response. Default is false. + * - with_payload: Options for specifying which payload to include or not. Default is false. + * - group_by: Payload field to group by, must be a string or number field. If the field contains more than 1 value, all values will be used for grouping. One point can be in multiple groups. + * - group_size: Maximum amount of points to return per group. Default is 3. + * - limit: Maximum amount of groups to return. Default is 10. + * - with_lookup: Look for points in another collection using the group ids. + * @returns Operation result + */ + async queryGroups( + collection_name: string, + { + consistency, + timeout, + shard_key, + prefetch, + query, + using, + filter, + params, + score_threshold, + with_vector, + with_payload, + group_by, + group_size, + limit, + with_lookup, + }: {consistency?: SchemaFor<'ReadConsistency'>} & {timeout?: number} & SchemaFor<'QueryGroupsRequest'>, + ) { + const response = await this._openApiClient.points.queryPointsGroups({ + collection_name, + consistency, + timeout, + shard_key, + prefetch, + query, + using, + filter, + params, + score_threshold, + with_vector, + with_payload, + group_by, + group_size, + limit, + with_lookup, + }); + return maybe(response.data.result).orThrow('Query groups returned empty'); + } } diff --git a/packages/qdrant-js/CHANGELOG.md b/packages/qdrant-js/CHANGELOG.md index 3b43b46..3ef5931 100644 --- a/packages/qdrant-js/CHANGELOG.md +++ b/packages/qdrant-js/CHANGELOG.md @@ -1,5 +1,17 @@ # @qdrant/qdrant-js +## 1.11.0 + +### Minor Changes + +- Qdrant v1.11.0 API + +### Patch Changes + +- Updated dependencies []: + - @qdrant/js-client-grpc@1.11.0 + - @qdrant/js-client-rest@1.11.0 + ## 1.10.0 ### Minor Changes diff --git a/packages/qdrant-js/package.json b/packages/qdrant-js/package.json index bce1f5b..f17649c 100644 --- a/packages/qdrant-js/package.json +++ b/packages/qdrant-js/package.json @@ -1,6 +1,6 @@ { "name": "@qdrant/qdrant-js", - "version": "1.10.0", + "version": "1.11.0", "engines": { "node": ">=18.0.0", "pnpm": ">=8" @@ -57,8 +57,8 @@ "clean": "rimraf ./dist" }, "dependencies": { - "@qdrant/js-client-rest": "workspace:1.10.0", - "@qdrant/js-client-grpc": "workspace:1.10.0" + "@qdrant/js-client-rest": "workspace:1.11.0", + "@qdrant/js-client-grpc": "workspace:1.11.0" }, "peerDependencies": { "typescript": ">=4.1" diff --git a/packages/qdrant-js/scripts/integration-tests.sh b/packages/qdrant-js/scripts/integration-tests.sh index a3f816c..6907708 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.10.0" +QDRANT_LATEST="v1.11.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 ce8acec..d933d49 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.10.0 + specifier: workspace:1.11.0 version: link:../js-client-grpc '@qdrant/js-client-rest': - specifier: workspace:1.10.0 + specifier: workspace:1.11.0 version: link:../js-client-rest typescript: specifier: '>=4.1'