@zilliz/milvus2-sdk-node 2.3.5 → 2.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (121) hide show
  1. package/README.md +154 -35
  2. package/dist/milvus/HttpClient.d.ts +165 -2
  3. package/dist/milvus/HttpClient.js +17 -3
  4. package/dist/milvus/HttpClient.js.map +1 -1
  5. package/dist/milvus/MilvusClient.d.ts +3 -3
  6. package/dist/milvus/MilvusClient.js +42 -8
  7. package/dist/milvus/MilvusClient.js.map +1 -1
  8. package/dist/milvus/const/client.d.ts +4 -3
  9. package/dist/milvus/const/client.js +4 -3
  10. package/dist/milvus/const/client.js.map +1 -1
  11. package/dist/milvus/const/defaults.d.ts +5 -4
  12. package/dist/milvus/const/defaults.js +14 -13
  13. package/dist/milvus/const/defaults.js.map +1 -1
  14. package/dist/milvus/const/error.js +1 -1
  15. package/dist/milvus/const/error.js.map +1 -1
  16. package/dist/milvus/const/milvus.d.ts +47 -8
  17. package/dist/milvus/const/milvus.js +42 -3
  18. package/dist/milvus/const/milvus.js.map +1 -1
  19. package/dist/milvus/grpc/BaseClient.d.ts +11 -9
  20. package/dist/milvus/grpc/BaseClient.js +59 -21
  21. package/dist/milvus/grpc/BaseClient.js.map +1 -1
  22. package/dist/milvus/grpc/Collection.d.ts +311 -366
  23. package/dist/milvus/grpc/Collection.js +355 -387
  24. package/dist/milvus/grpc/Collection.js.map +1 -1
  25. package/dist/milvus/grpc/Data.d.ts +244 -291
  26. package/dist/milvus/grpc/Data.js +402 -539
  27. package/dist/milvus/grpc/Data.js.map +1 -1
  28. package/dist/milvus/grpc/Database.d.ts +29 -41
  29. package/dist/milvus/grpc/Database.js +32 -44
  30. package/dist/milvus/grpc/Database.js.map +1 -1
  31. package/dist/milvus/grpc/GrpcClient.d.ts +34 -13
  32. package/dist/milvus/grpc/GrpcClient.js +80 -70
  33. package/dist/milvus/grpc/GrpcClient.js.map +1 -1
  34. package/dist/milvus/grpc/MilvusIndex.d.ts +127 -67
  35. package/dist/milvus/grpc/MilvusIndex.js +166 -70
  36. package/dist/milvus/grpc/MilvusIndex.js.map +1 -1
  37. package/dist/milvus/grpc/Partition.d.ts +78 -113
  38. package/dist/milvus/grpc/Partition.js +109 -119
  39. package/dist/milvus/grpc/Partition.js.map +1 -1
  40. package/dist/milvus/grpc/Resource.d.ts +63 -92
  41. package/dist/milvus/grpc/Resource.js +69 -98
  42. package/dist/milvus/grpc/Resource.js.map +1 -1
  43. package/dist/milvus/grpc/User.d.ts +263 -295
  44. package/dist/milvus/grpc/User.js +287 -310
  45. package/dist/milvus/grpc/User.js.map +1 -1
  46. package/dist/milvus/http/Alias.d.ts +37 -0
  47. package/dist/milvus/http/Alias.js +62 -0
  48. package/dist/milvus/http/Alias.js.map +1 -0
  49. package/dist/milvus/http/Collection.d.ts +15 -1
  50. package/dist/milvus/http/Collection.js +55 -9
  51. package/dist/milvus/http/Collection.js.map +1 -1
  52. package/dist/milvus/http/Import.d.ts +33 -0
  53. package/dist/milvus/http/Import.js +48 -0
  54. package/dist/milvus/http/Import.js.map +1 -0
  55. package/dist/milvus/http/MilvusIndex.d.ts +35 -0
  56. package/dist/milvus/http/MilvusIndex.js +55 -0
  57. package/dist/milvus/http/MilvusIndex.js.map +1 -0
  58. package/dist/milvus/http/Partition.d.ts +41 -0
  59. package/dist/milvus/http/Partition.js +76 -0
  60. package/dist/milvus/http/Partition.js.map +1 -0
  61. package/dist/milvus/http/Role.d.ts +39 -0
  62. package/dist/milvus/http/Role.js +69 -0
  63. package/dist/milvus/http/Role.js.map +1 -0
  64. package/dist/milvus/http/User.d.ts +41 -0
  65. package/dist/milvus/http/User.js +76 -0
  66. package/dist/milvus/http/User.js.map +1 -0
  67. package/dist/milvus/http/Vector.d.ts +5 -3
  68. package/dist/milvus/http/Vector.js +10 -7
  69. package/dist/milvus/http/Vector.js.map +1 -1
  70. package/dist/milvus/http/index.d.ts +6 -0
  71. package/dist/milvus/http/index.js +6 -0
  72. package/dist/milvus/http/index.js.map +1 -1
  73. package/dist/milvus/index.d.ts +0 -1
  74. package/dist/milvus/index.js +0 -1
  75. package/dist/milvus/index.js.map +1 -1
  76. package/dist/milvus/types/Client.d.ts +5 -0
  77. package/dist/milvus/types/Collection.d.ts +34 -9
  78. package/dist/milvus/types/Common.d.ts +1 -3
  79. package/dist/milvus/types/Data.d.ts +79 -23
  80. package/dist/milvus/types/Data.js +1 -0
  81. package/dist/milvus/types/Data.js.map +1 -1
  82. package/dist/milvus/types/HighLevel.d.ts +6 -3
  83. package/dist/milvus/types/Http.d.ts +191 -9
  84. package/dist/milvus/types/MilvusIndex.d.ts +17 -3
  85. package/dist/milvus/utils/Bytes.d.ts +84 -0
  86. package/dist/milvus/utils/Bytes.js +261 -0
  87. package/dist/milvus/utils/Bytes.js.map +1 -0
  88. package/dist/milvus/utils/Format.d.ts +126 -68
  89. package/dist/milvus/utils/Format.js +375 -94
  90. package/dist/milvus/utils/Format.js.map +1 -1
  91. package/dist/milvus/utils/Function.d.ts +4 -2
  92. package/dist/milvus/utils/Function.js +58 -25
  93. package/dist/milvus/utils/Function.js.map +1 -1
  94. package/dist/milvus/utils/Grpc.d.ts +3 -2
  95. package/dist/milvus/utils/Grpc.js +65 -98
  96. package/dist/milvus/utils/Grpc.js.map +1 -1
  97. package/dist/milvus/utils/Validate.d.ts +18 -3
  98. package/dist/milvus/utils/Validate.js +38 -12
  99. package/dist/milvus/utils/Validate.js.map +1 -1
  100. package/dist/milvus/utils/index.d.ts +1 -1
  101. package/dist/milvus/utils/index.js +1 -1
  102. package/dist/milvus/utils/index.js.map +1 -1
  103. package/dist/proto/proto/common.proto +26 -1
  104. package/dist/proto/proto/google/protobuf/descriptor.proto +90 -28
  105. package/dist/proto/proto/milvus.proto +168 -2
  106. package/dist/proto/proto/rg.proto +28 -0
  107. package/dist/proto/proto/schema.proto +34 -0
  108. package/dist/sdk.json +1 -1
  109. package/package.json +8 -5
  110. package/dist/milvus/OrmClient.d.ts +0 -19
  111. package/dist/milvus/OrmClient.js +0 -51
  112. package/dist/milvus/OrmClient.js.map +0 -1
  113. package/dist/milvus/orm/Collection.d.ts +0 -43
  114. package/dist/milvus/orm/Collection.js +0 -165
  115. package/dist/milvus/orm/Collection.js.map +0 -1
  116. package/dist/milvus/orm/index.d.ts +0 -1
  117. package/dist/milvus/orm/index.js +0 -18
  118. package/dist/milvus/orm/index.js.map +0 -1
  119. package/dist/milvus/utils/Blob.d.ts +0 -4
  120. package/dist/milvus/utils/Blob.js +0 -18
  121. package/dist/milvus/utils/Blob.js.map +0 -1
@@ -1,8 +1,23 @@
1
1
  /// <reference types="node" />
2
- import { GrpcTimeOut, KeyValuePair, NumberArrayId, StringArrayId, keyValueObj, DataType, SegmentState, ImportState, ConsistencyLevelEnum, collectionNameReq, resStatusResponse } from '../';
3
- export type FloatVectors = number[];
4
- export type BinaryVectors = number[];
5
- export type Vectors = FloatVectors | BinaryVectors;
2
+ import { GrpcTimeOut, KeyValuePair, NumberArrayId, StringArrayId, keyValueObj, DataType, SegmentState, ImportState, ConsistencyLevelEnum, collectionNameReq, resStatusResponse, RANKER_TYPE } from '../';
3
+ export type FloatVector = number[];
4
+ export type Float16Vector = number[] | Uint8Array;
5
+ export type BFloat16Vector = number[] | Uint8Array;
6
+ export type BinaryVector = number[];
7
+ export type SparseVectorArray = (number | undefined)[];
8
+ export type SparseVectorDic = {
9
+ [key: string]: number;
10
+ };
11
+ export type SparseVectorCSR = {
12
+ indices: number[];
13
+ values: number[];
14
+ };
15
+ export type SparseVectorCOO = {
16
+ index: number;
17
+ value: number;
18
+ }[];
19
+ export type SparseFloatVector = SparseVectorArray | SparseVectorDic | SparseVectorCSR | SparseVectorCOO;
20
+ export type VectorTypes = FloatVector | Float16Vector | BinaryVector | BFloat16Vector | SparseFloatVector;
6
21
  export type Bool = boolean;
7
22
  export type Int8 = number;
8
23
  export type Int16 = number;
@@ -15,7 +30,7 @@ export type JSON = {
15
30
  [key: string]: any;
16
31
  };
17
32
  export type Array = Int8[] | Int16[] | Int32[] | Int64[] | Float[] | Double[] | VarChar[];
18
- export type FieldData = Bool | Int8 | Int16 | Int32 | Int64 | Float | Double | VarChar | JSON | Array | Vectors | FloatVectors | BinaryVectors;
33
+ export type FieldData = Bool | Int8 | Int16 | Int32 | Int64 | Float | Double | VarChar | JSON | Array | VectorTypes;
19
34
  export interface RowData {
20
35
  [x: string]: FieldData;
21
36
  }
@@ -30,22 +45,33 @@ export interface FlushReq extends GrpcTimeOut {
30
45
  collection_names: string[];
31
46
  }
32
47
  export interface CountReq extends collectionNameReq {
48
+ expr?: string;
33
49
  }
50
+ export type InsertTransformers = {
51
+ [DataType.BFloat16Vector]?: (bf16: BFloat16Vector) => Buffer;
52
+ [DataType.Float16Vector]?: (f16: Float16Vector) => Buffer;
53
+ };
34
54
  export interface InsertReq extends collectionNameReq {
35
55
  partition_name?: string;
36
- fields_data?: RowData[];
37
56
  data?: RowData[];
57
+ fields_data?: RowData[];
38
58
  hash_keys?: Number[];
59
+ transformers?: InsertTransformers;
39
60
  }
40
61
  export interface DeleteEntitiesReq extends collectionNameReq {
41
- expr?: string;
42
62
  filter?: string;
63
+ expr?: string;
43
64
  partition_name?: string;
44
65
  }
45
- export interface DeleteReq extends collectionNameReq {
66
+ export interface DeleteByIdsReq extends collectionNameReq {
46
67
  ids: string[] | number[];
47
68
  partition_name?: string;
48
69
  }
70
+ export interface DeleteByFilterReq extends collectionNameReq {
71
+ filter: string;
72
+ partition_name?: string;
73
+ }
74
+ export type DeleteReq = DeleteByIdsReq | DeleteByFilterReq;
49
75
  export interface CalcDistanceReq extends GrpcTimeOut {
50
76
  op_left: any;
51
77
  op_right: any;
@@ -160,39 +186,61 @@ export interface GetMetricsRequest extends GrpcTimeOut {
160
186
  }
161
187
  export interface SearchParam {
162
188
  anns_field: string;
163
- topk: string;
189
+ topk: string | number;
164
190
  metric_type: string;
165
191
  params: string;
192
+ offset?: number;
166
193
  round_decimal?: number;
167
194
  ignore_growing?: boolean;
195
+ group_by_field?: string;
196
+ }
197
+ export interface SearchReq extends collectionNameReq {
198
+ anns_field?: string;
199
+ partition_names?: string[];
200
+ expr?: string;
201
+ search_params: SearchParam;
202
+ vectors: VectorTypes[];
203
+ output_fields?: string[];
204
+ travel_timestamp?: string;
205
+ vector_type: DataType.BinaryVector | DataType.FloatVector;
206
+ nq?: number;
207
+ consistency_level?: ConsistencyLevelEnum;
208
+ transformers?: OutputTransformers;
168
209
  }
169
210
  export interface SearchSimpleReq extends collectionNameReq {
170
- vector?: number[];
171
- vectors?: number[][];
172
- data?: number[][] | number[];
211
+ partition_names?: string[];
212
+ anns_field?: string;
213
+ data?: VectorTypes[] | VectorTypes;
214
+ vector?: VectorTypes;
215
+ vectors?: VectorTypes[];
173
216
  output_fields?: string[];
174
217
  limit?: number;
175
218
  topk?: number;
176
219
  offset?: number;
177
220
  filter?: string;
178
221
  expr?: string;
179
- partition_names?: string[];
180
222
  params?: keyValueObj;
181
223
  metric_type?: string;
182
224
  consistency_level?: ConsistencyLevelEnum;
183
225
  ignore_growing?: boolean;
226
+ group_by_field?: string;
227
+ round_decimal?: number;
228
+ transformers?: OutputTransformers;
184
229
  }
185
- export interface SearchReq extends collectionNameReq {
186
- partition_names?: string[];
230
+ export type HybridSearchSingleReq = Pick<SearchParam, 'anns_field' | 'ignore_growing' | 'group_by_field'> & {
231
+ data: VectorTypes[] | VectorTypes;
187
232
  expr?: string;
188
- search_params: SearchParam;
189
- vectors: number[][];
190
- output_fields?: string[];
191
- travel_timestamp?: string;
192
- vector_type: DataType.BinaryVector | DataType.FloatVector;
193
- nq?: number;
194
- consistency_level?: ConsistencyLevelEnum;
195
- }
233
+ params?: keyValueObj;
234
+ transformers?: OutputTransformers;
235
+ };
236
+ export type RerankerObj = {
237
+ strategy: RANKER_TYPE | string;
238
+ params: keyValueObj;
239
+ };
240
+ export type HybridSearchReq = Omit<SearchSimpleReq, 'data' | 'vector' | 'vectors' | 'params' | 'anns_field'> & {
241
+ data: HybridSearchSingleReq[];
242
+ rerank?: RerankerObj;
243
+ };
196
244
  export interface SearchRes extends resStatusResponse {
197
245
  results: {
198
246
  top_k: number;
@@ -227,16 +275,24 @@ export interface SearchRes extends resStatusResponse {
227
275
  num_queries: number;
228
276
  topks: number[];
229
277
  output_fields: string[];
278
+ group_by_field_value: string;
230
279
  };
231
280
  }
281
+ export type OutputTransformers = {
282
+ [DataType.BFloat16Vector]?: (bf16bytes: Uint8Array) => BFloat16Vector;
283
+ [DataType.Float16Vector]?: (f16: Uint8Array) => Float16Vector;
284
+ [DataType.SparseFloatVector]?: (sparse: SparseVectorDic) => SparseFloatVector;
285
+ };
232
286
  export interface QueryReq extends collectionNameReq {
233
287
  output_fields?: string[];
234
288
  partition_names?: string[];
289
+ ids?: string[] | number[];
235
290
  expr?: string;
236
291
  filter?: string;
237
292
  offset?: number;
238
293
  limit?: number;
239
294
  consistency_level?: ConsistencyLevelEnum;
295
+ transformers?: OutputTransformers;
240
296
  }
241
297
  export interface GetReq extends collectionNameReq {
242
298
  ids: string[] | number[];
@@ -1,3 +1,4 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ const __1 = require("../");
3
4
  //# sourceMappingURL=Data.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Data.js","sourceRoot":"","sources":["../../../milvus/types/Data.ts"],"names":[],"mappings":""}
1
+ {"version":3,"file":"Data.js","sourceRoot":"","sources":["../../../milvus/types/Data.ts"],"names":[],"mappings":";;AAAA,2BAaa"}
@@ -1,15 +1,18 @@
1
- import { DataType, MetricType, CreateIndexParam, collectionNameReq } from '../';
1
+ import { DataType, MetricType, CreateIndexParam, collectionNameReq, CreateCollectionReq, CreateIndexSimpleReq } from '../';
2
2
  export interface CreateColReq extends collectionNameReq {
3
3
  dimension: number;
4
4
  primary_field_name?: string;
5
5
  id_type?: DataType.Int64 | DataType.VarChar;
6
6
  vector_field_name?: string;
7
7
  metric_type?: string | MetricType;
8
- timeout?: number;
9
8
  enable_dynamic_field?: boolean;
10
9
  enableDynamicField?: boolean;
11
10
  description?: string;
12
11
  auto_id?: boolean;
13
- timeouts?: number;
12
+ consistency_level?: 'Strong' | 'Session' | 'Bounded' | 'Eventually' | 'Customized';
14
13
  index_params?: CreateIndexParam;
14
+ timeout?: number;
15
15
  }
16
+ export type CreateColWithSchemaAndIndexParamsReq = CreateCollectionReq & {
17
+ index_params: Omit<CreateIndexSimpleReq, 'collection_name'>[] | Omit<CreateIndexSimpleReq, 'collection_name'>;
18
+ };
@@ -1,4 +1,4 @@
1
- import { FloatVectors } from '..';
1
+ import { FloatVector } from '..';
2
2
  type Fetch = (input: any, init?: any) => Promise<any>;
3
3
  export type Constructor<T = {}> = new (...args: any[]) => T;
4
4
  export type FetchOptions = {
@@ -7,12 +7,12 @@ export type FetchOptions = {
7
7
  };
8
8
  type HttpClientConfigBase = {
9
9
  database?: string;
10
- version?: string;
11
10
  token?: string;
12
11
  username?: string;
13
12
  password?: string;
14
13
  timeout?: number;
15
14
  fetch?: Fetch;
15
+ acceptInt64?: boolean;
16
16
  };
17
17
  type HttpClientConfigAddress = HttpClientConfigBase & {
18
18
  endpoint: string;
@@ -32,12 +32,52 @@ export interface HttpBaseResponse<T = {}> {
32
32
  data: T;
33
33
  message?: string;
34
34
  }
35
+ type CollectionIndexParam = {
36
+ metricType: string;
37
+ fieldName: string;
38
+ indexName: string;
39
+ params?: {
40
+ index_type: string;
41
+ nlist?: number;
42
+ M?: string;
43
+ efConstruction?: string;
44
+ };
45
+ };
46
+ type CollectionCreateParams = {
47
+ max_length?: number;
48
+ enableDynamicField?: boolean;
49
+ shardsNum?: number;
50
+ consistencyLevel?: string;
51
+ partitionsNum?: number;
52
+ ttlSeconds?: number;
53
+ };
54
+ type CollectionCreateField = {
55
+ fieldName: string;
56
+ dataType: string;
57
+ elementDataType?: string;
58
+ isPrimary?: boolean;
59
+ isPartitionKey?: boolean;
60
+ elementTypeParams?: {
61
+ max_length?: number;
62
+ dim?: number;
63
+ max_capacity?: number;
64
+ };
65
+ };
66
+ type CollectionCreateSchema = {
67
+ autoID?: boolean;
68
+ enabledDynamicField?: boolean;
69
+ fields: CollectionCreateField[];
70
+ };
35
71
  export interface HttpCollectionCreateReq extends HttpBaseReq {
36
- dimension: number;
72
+ dimension?: number;
37
73
  metricType?: string;
38
- primaryField?: string;
39
- vectorField?: string;
40
- description?: string;
74
+ idType?: string;
75
+ autoID?: boolean;
76
+ primaryFieldName?: string;
77
+ vectorFieldName?: string;
78
+ schema?: CollectionCreateSchema;
79
+ indexParams?: CollectionIndexParam[];
80
+ params?: CollectionCreateParams;
41
81
  }
42
82
  export interface HttpCollectionListReq extends Omit<HttpBaseReq, 'collectionName'> {
43
83
  }
@@ -59,11 +99,31 @@ export interface HttpCollectionDescribeResponse extends HttpBaseResponse<{
59
99
  indexes: Index[];
60
100
  load: string;
61
101
  shardsNum: number;
62
- enableDynamic: boolean;
102
+ enableDynamicField: boolean;
63
103
  }> {
64
104
  }
65
105
  export interface HttpCollectionListResponse extends HttpBaseResponse<string[]> {
66
106
  }
107
+ export interface HttpCollectionHasResponse extends HttpBaseResponse<{
108
+ has: boolean;
109
+ }> {
110
+ }
111
+ export interface HttpCollectionRenameReq extends HttpBaseReq {
112
+ newCollectionName: string;
113
+ newDbName?: string;
114
+ }
115
+ export interface HttpCollectionStatisticsResponse extends HttpBaseResponse<{
116
+ rowCount: number;
117
+ }> {
118
+ }
119
+ export interface HttpCollectionLoadStateReq extends HttpBaseReq {
120
+ partitionNames?: string;
121
+ }
122
+ export interface HttpCollectionLoadStateResponse extends HttpBaseResponse<{
123
+ loadProgress: number;
124
+ loadState: string;
125
+ }> {
126
+ }
67
127
  export interface HttpVectorInsertReq extends HttpBaseReq {
68
128
  data: Record<string, any>[];
69
129
  }
@@ -72,11 +132,18 @@ export interface HttpVectorInsertResponse extends HttpBaseResponse<{
72
132
  insertIds: number | string[];
73
133
  }> {
74
134
  }
135
+ export interface HttpVectorUpsertResponse extends HttpBaseResponse<{
136
+ upsertCount: number;
137
+ upsertIds: number | string[];
138
+ }> {
139
+ }
75
140
  export interface HttpVectorGetReq extends HttpBaseReq {
76
141
  id: number | number[] | string | string[];
77
142
  outputFields: string[];
78
143
  }
79
- export interface HttpVectorDeleteReq extends Omit<HttpVectorGetReq, 'outputFields'> {
144
+ export interface HttpVectorDeleteReq extends HttpBaseReq {
145
+ filter: string;
146
+ partitionName?: string;
80
147
  }
81
148
  export interface HttpVectorQueryReq extends HttpBaseReq {
82
149
  outputFields: string[];
@@ -89,7 +156,7 @@ type QueryResult = Record<string, any>[];
89
156
  export interface HttpVectorQueryResponse extends HttpBaseResponse<QueryResult> {
90
157
  }
91
158
  export interface HttpVectorSearchReq extends Omit<HttpVectorQueryReq, 'filter'> {
92
- vector: FloatVectors;
159
+ data: FloatVector[];
93
160
  filter?: string;
94
161
  }
95
162
  export interface HttpVectorSearchResponse extends HttpVectorQueryResponse {
@@ -97,4 +164,119 @@ export interface HttpVectorSearchResponse extends HttpVectorQueryResponse {
97
164
  distance: number | string;
98
165
  };
99
166
  }
167
+ export interface HttpPartitionBaseReq extends HttpBaseReq {
168
+ partitionName: string;
169
+ }
170
+ export interface HttpPartitionListReq extends HttpBaseReq {
171
+ partitionNames: string[];
172
+ }
173
+ export interface HttpPartitionHasResponse extends HttpBaseResponse<{
174
+ has: boolean;
175
+ }> {
176
+ }
177
+ export interface HttpPartitionStatisticsResponse extends HttpBaseResponse<{
178
+ rowCount: number;
179
+ }> {
180
+ }
181
+ export interface HttpUserBaseReq {
182
+ userName: string;
183
+ }
184
+ export interface HttpUserCreateReq extends HttpUserBaseReq {
185
+ password: string;
186
+ }
187
+ export interface HttpUserUpdatePasswordReq extends HttpUserCreateReq {
188
+ newPassword: string;
189
+ }
190
+ export interface HttpUserRoleReq extends HttpUserBaseReq {
191
+ roleName: string;
192
+ }
193
+ export interface HttpRoleBaseReq {
194
+ roleName: string;
195
+ }
196
+ export interface HttpRolePrivilegeReq extends HttpRoleBaseReq {
197
+ objectType: string;
198
+ objectName: string;
199
+ privilege: string;
200
+ }
201
+ export interface HttpRoleDescribeResponse extends HttpBaseResponse<HttpRolePrivilegeReq[]> {
202
+ }
203
+ export interface HttpIndexCreateReq extends HttpBaseReq {
204
+ indexParams: CollectionIndexParam[];
205
+ }
206
+ export interface HttpIndexBaseReq extends HttpBaseReq {
207
+ indexName: string;
208
+ }
209
+ type IndexDescribeType = {
210
+ failReason: string;
211
+ fieldName: string;
212
+ indexName: string;
213
+ indexState: string;
214
+ indexType: string;
215
+ indexedRows: number;
216
+ metricType: string;
217
+ pendingRows: number;
218
+ totalRows: number;
219
+ };
220
+ export interface HttpIndexDescribeResponse extends HttpBaseResponse<IndexDescribeType[]> {
221
+ }
222
+ export type HttpAliasBaseReq = Pick<HttpBaseReq, 'dbName'>;
223
+ export interface HttpAliasCreateReq extends HttpBaseReq {
224
+ aliasName: string;
225
+ }
226
+ export type HttpAliasAlterReq = HttpAliasCreateReq;
227
+ export interface HttpAliasDescribeReq extends HttpAliasBaseReq {
228
+ aliasName: string;
229
+ }
230
+ export interface HttpAliasDescribeResponse extends HttpBaseResponse<{
231
+ aliasName: string;
232
+ } & Required<HttpBaseReq>> {
233
+ }
234
+ export interface HttpAliasDropReq extends Partial<HttpBaseReq> {
235
+ aliasName: string;
236
+ }
237
+ type ImportJobType = {
238
+ collectionName: string;
239
+ jobId: string;
240
+ progress: number;
241
+ state: string;
242
+ };
243
+ type ImportJobDetailType = {
244
+ completeTime: string;
245
+ fileName: string;
246
+ fileSize: number;
247
+ importedRows: number;
248
+ progress: number;
249
+ state: string;
250
+ totalRows: number;
251
+ };
252
+ export interface HttpImportListResponse extends HttpBaseResponse<{
253
+ records: ImportJobType[];
254
+ }> {
255
+ }
256
+ export interface HttpImportCreateReq extends HttpBaseReq {
257
+ files: string[][];
258
+ options?: {
259
+ timeout: string;
260
+ };
261
+ }
262
+ export interface HttpImportCreateResponse extends HttpBaseResponse<{
263
+ jobId: string;
264
+ }> {
265
+ }
266
+ export interface HttpImportProgressReq extends Pick<HttpBaseReq, 'dbName'> {
267
+ jobId: string;
268
+ }
269
+ export interface HttpImportProgressResponse extends HttpBaseResponse<{
270
+ jobId: string;
271
+ progress: number;
272
+ state: string;
273
+ totalRows?: number;
274
+ importedRows?: number;
275
+ fileSize?: number;
276
+ completeTime?: string;
277
+ collectionName?: string;
278
+ details?: ImportJobDetailType[];
279
+ reason?: string;
280
+ }> {
281
+ }
100
282
  export {};
@@ -10,9 +10,11 @@ export interface CreateIndexReq extends collectionNameReq {
10
10
  index_name?: string;
11
11
  extra_params?: CreateIndexParam;
12
12
  }
13
+ export type CreateIndexRequest = CreateIndexReq | CreateIndexSimpleReq;
14
+ export type CreateIndexesReq = CreateIndexRequest[] | CreateIndexRequest;
13
15
  export interface CreateIndexSimpleReq extends collectionNameReq {
14
16
  field_name: string;
15
- index_type?: string;
17
+ index_type: string;
16
18
  metric_type?: string;
17
19
  index_name?: string;
18
20
  params?: keyValueObj;
@@ -21,10 +23,15 @@ export interface DescribeIndexReq extends collectionNameReq {
21
23
  field_name?: string;
22
24
  index_name?: string;
23
25
  }
24
- export interface GetIndexStateReq extends DescribeIndexReq {
26
+ export interface FieldNameReq extends collectionNameReq {
27
+ field_name: string;
25
28
  }
26
- export interface GetIndexBuildProgressReq extends DescribeIndexReq {
29
+ export interface IndexNameReq extends collectionNameReq {
30
+ index_name: string;
27
31
  }
32
+ export interface GetIndexStateReq extends DescribeIndexReq {
33
+ }
34
+ export type GetIndexBuildProgressReq = FieldNameReq | IndexNameReq;
28
35
  export interface DropIndexReq extends DescribeIndexReq {
29
36
  }
30
37
  export interface IndexDescription {
@@ -41,6 +48,9 @@ export interface IndexDescription {
41
48
  export interface DescribeIndexResponse extends resStatusResponse {
42
49
  index_descriptions: IndexDescription[];
43
50
  }
51
+ export interface ListIndexResponse extends resStatusResponse {
52
+ indexes: string[];
53
+ }
44
54
  export interface GetIndexStateResponse extends resStatusResponse {
45
55
  state: IndexState;
46
56
  }
@@ -48,3 +58,7 @@ export interface GetIndexBuildProgressResponse extends resStatusResponse {
48
58
  indexed_rows: number;
49
59
  total_rows: number;
50
60
  }
61
+ export interface AlterIndexReq extends collectionNameReq {
62
+ index_name: string;
63
+ params: Record<string, number | string | boolean>;
64
+ }
@@ -0,0 +1,84 @@
1
+ /// <reference types="node" />
2
+ import { Root } from 'protobufjs';
3
+ import { FloatVector, BinaryVector, SparseFloatVector, DataType, VectorTypes, Float16Vector, BFloat16Vector } from '..';
4
+ /**
5
+ * Converts a float vector into bytes format.
6
+ *
7
+ * @param {FloatVector} array - The float vector to convert.
8
+ * @returns {Buffer} Bytes representing the float vector.
9
+ */
10
+ export declare const f32ArrayToF32Bytes: (array: FloatVector) => Buffer;
11
+ /**
12
+ * Converts a binary vector into bytes format.
13
+ *
14
+ * @param {BinaryVector} array - The binary vector to convert.
15
+ * @returns {Buffer} Bytes representing the binary vector.
16
+ */
17
+ export declare const f32ArrayToBinaryBytes: (array: BinaryVector) => Buffer;
18
+ /**
19
+ * Converts a float16 vector into bytes format.
20
+ *
21
+ * @param {Float16Vector} array - The float16 vector(f32 format) to convert.
22
+ * @returns {Buffer} Bytes representing the float16 vector.
23
+ */
24
+ export declare const f32ArrayToF16Bytes: (array: Float16Vector) => Buffer;
25
+ /**
26
+ * Convert float16 bytes to float32 array.
27
+ * @param {Uint8Array} f16Bytes - The float16 bytes to convert.
28
+ * @returns {Array} The float32 array.
29
+ */
30
+ export declare const f16BytesToF32Array: (f16Bytes: Uint8Array) => number[];
31
+ /**
32
+ * Convert float32 array to BFloat16 bytes, not a real conversion, just take the last 2 bytes of float32.
33
+ * @param {BFloat16Vector} array - The float32 array to convert.
34
+ * @returns {Buffer} The BFloat16 bytes.
35
+ */
36
+ export declare const f32ArrayToBf16Bytes: (array: BFloat16Vector) => Buffer;
37
+ /**
38
+ * Convert BFloat16 bytes to Float32 array.
39
+ * @param {Uint8Array} bf16Bytes - The BFloat16 bytes to convert.
40
+ * @returns {Array} The Float32 array.
41
+ */
42
+ export declare const bf16BytesToF32Array: (bf16Bytes: Uint8Array) => number[];
43
+ /**
44
+ * Get SparseVector type.
45
+ * @param {SparseFloatVector} vector - The sparse float vector to convert.
46
+ *
47
+ * @returns string, 'array' | 'coo' | 'csr' | 'dict'
48
+ */
49
+ export declare const getSparseFloatVectorType: (vector: SparseFloatVector) => 'array' | 'coo' | 'csr' | 'dict' | 'unknown';
50
+ /**
51
+ * Converts a sparse float vector into bytes format.
52
+ *
53
+ * @param {SparseFloatVector} data - The sparse float vector to convert, support 'array' | 'coo' | 'csr' | 'dict'.
54
+ *
55
+ * @returns {Uint8Array} Bytes representing the sparse float vector.
56
+ * @throws {Error} If the length of indices and values is not the same, or if the index is not within the valid range, or if the value is NaN.
57
+ */
58
+ export declare const sparseToBytes: (data: SparseFloatVector) => Uint8Array;
59
+ /**
60
+ * Converts an array of sparse float vectors into an array of bytes format.
61
+ *
62
+ * @param {SparseFloatVector[]} data - The array of sparse float vectors to convert.
63
+ *
64
+ * @returns {Uint8Array[]} An array of bytes representing the sparse float vectors.
65
+ */
66
+ export declare const sparseRowsToBytes: (data: SparseFloatVector[]) => Uint8Array[];
67
+ /**
68
+ * Parses the provided buffer data into a sparse row representation.
69
+ *
70
+ * @param {Buffer} bufferData - The buffer data to parse.
71
+ *
72
+ * @returns {SparseFloatVector} The parsed sparse float vectors.
73
+ */
74
+ export declare const bytesToSparseRow: (bufferData: Buffer) => SparseFloatVector;
75
+ /**
76
+ * This function builds a placeholder group in bytes format for Milvus.
77
+ *
78
+ * @param {Root} milvusProto - The root object of the Milvus protocol.
79
+ * @param {VectorTypes[]} vectors - An array of search vectors.
80
+ * @param {DataType} vectorDataType - The data type of the vectors.
81
+ *
82
+ * @returns {Uint8Array} The placeholder group in bytes format.
83
+ */
84
+ export declare const buildPlaceholderGroupBytes: (milvusProto: Root, vectors: VectorTypes[], vectorDataType: DataType) => Uint8Array;