@zilliz/milvus2-sdk-node 2.6.1 → 2.6.2
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.
- package/dist/milvus/MilvusClient.js +7 -1
- package/dist/milvus/MilvusClient.js.map +1 -1
- package/dist/milvus/const/milvus.d.ts +28 -3
- package/dist/milvus/const/milvus.js +29 -1
- package/dist/milvus/const/milvus.js.map +1 -1
- package/dist/milvus/grpc/BaseClient.d.ts +1 -0
- package/dist/milvus/grpc/BaseClient.js +1 -0
- package/dist/milvus/grpc/BaseClient.js.map +1 -1
- package/dist/milvus/grpc/Collection.js +21 -2
- package/dist/milvus/grpc/Collection.js.map +1 -1
- package/dist/milvus/grpc/Data.d.ts +57 -20
- package/dist/milvus/grpc/Data.js +138 -51
- package/dist/milvus/grpc/Data.js.map +1 -1
- package/dist/milvus/proto-json/milvus.base.d.ts +164 -2
- package/dist/milvus/proto-json/milvus.base.js +165 -3
- package/dist/milvus/proto-json/milvus.base.js.map +1 -1
- package/dist/milvus/proto-json/milvus.d.ts +164 -2
- package/dist/milvus/proto-json/milvus.js +165 -3
- package/dist/milvus/proto-json/milvus.js.map +1 -1
- package/dist/milvus/proto-json/schema.base.d.ts +52 -0
- package/dist/milvus/proto-json/schema.base.js +53 -1
- package/dist/milvus/proto-json/schema.base.js.map +1 -1
- package/dist/milvus/types/Collection.d.ts +8 -2
- package/dist/milvus/types/Common.d.ts +3 -0
- package/dist/milvus/types/Data.d.ts +1 -304
- package/dist/milvus/types/Data.js +0 -1
- package/dist/milvus/types/Data.js.map +1 -1
- package/dist/milvus/types/DataTypes.d.ts +35 -0
- package/dist/milvus/types/DataTypes.js +3 -0
- package/dist/milvus/types/DataTypes.js.map +1 -0
- package/dist/milvus/types/HighLevel.d.ts +1 -1
- package/dist/milvus/types/Insert.d.ts +66 -0
- package/dist/milvus/types/Insert.js +4 -0
- package/dist/milvus/types/Insert.js.map +1 -0
- package/dist/milvus/types/Search.d.ts +147 -0
- package/dist/milvus/types/Search.js +4 -0
- package/dist/milvus/types/Search.js.map +1 -0
- package/dist/milvus/types/Segments.d.ts +68 -0
- package/dist/milvus/types/Segments.js +3 -0
- package/dist/milvus/types/Segments.js.map +1 -0
- package/dist/milvus/types/index.d.ts +4 -0
- package/dist/milvus/types/index.js +4 -0
- package/dist/milvus/types/index.js.map +1 -1
- package/dist/milvus/types.d.ts +4 -0
- package/dist/milvus/types.js +4 -1
- package/dist/milvus/types.js.map +1 -1
- package/dist/milvus/utils/Bytes.d.ts +3 -3
- package/dist/milvus/utils/Bytes.js +11 -10
- package/dist/milvus/utils/Bytes.js.map +1 -1
- package/dist/milvus/utils/Connection.d.ts +14 -0
- package/dist/milvus/utils/Connection.js +24 -0
- package/dist/milvus/utils/Connection.js.map +1 -0
- package/dist/milvus/utils/Data.d.ts +43 -0
- package/dist/milvus/utils/Data.js +297 -0
- package/dist/milvus/utils/Data.js.map +1 -0
- package/dist/milvus/utils/Format.d.ts +1 -233
- package/dist/milvus/utils/Format.js +108 -728
- package/dist/milvus/utils/Format.js.map +1 -1
- package/dist/milvus/utils/Function.d.ts +1 -21
- package/dist/milvus/utils/Function.js +1 -82
- package/dist/milvus/utils/Function.js.map +1 -1
- package/dist/milvus/utils/Schema.d.ts +59 -0
- package/dist/milvus/utils/Schema.js +256 -0
- package/dist/milvus/utils/Schema.js.map +1 -0
- package/dist/milvus/utils/Search.d.ts +193 -0
- package/dist/milvus/utils/Search.js +419 -0
- package/dist/milvus/utils/Search.js.map +1 -0
- package/dist/milvus/utils/index.d.ts +4 -0
- package/dist/milvus/utils/index.js +4 -0
- package/dist/milvus/utils/index.js.map +1 -1
- package/dist/sdk.json +1 -1
- package/package.json +2 -2
|
@@ -1,79 +1,8 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
|
-
import { GrpcTimeOut,
|
|
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 Int8Vector = number[] | Int8Array;
|
|
16
|
-
export type SparseVectorCOO = {
|
|
17
|
-
index: number;
|
|
18
|
-
value: number;
|
|
19
|
-
}[];
|
|
20
|
-
export type SparseFloatVector = SparseVectorArray | SparseVectorDic | SparseVectorCSR | SparseVectorCOO;
|
|
21
|
-
export type VectorTypes = FloatVector | Float16Vector | BinaryVector | BFloat16Vector | SparseFloatVector | Int8Vector;
|
|
22
|
-
export type Bool = boolean;
|
|
23
|
-
export type Int8 = number;
|
|
24
|
-
export type Int16 = number;
|
|
25
|
-
export type Int32 = number;
|
|
26
|
-
export type Int64 = number;
|
|
27
|
-
export type Float = number;
|
|
28
|
-
export type Double = number;
|
|
29
|
-
export type VarChar = string;
|
|
30
|
-
export type JSON = {
|
|
31
|
-
[key: string]: any;
|
|
32
|
-
};
|
|
33
|
-
export type Geometry = string;
|
|
34
|
-
export type Array = Int8[] | Int16[] | Int32[] | Int64[] | Float[] | Double[] | VarChar[];
|
|
35
|
-
export type FieldData = Bool | Int8 | Int16 | Int32 | Int64 | Float | Double | VarChar | JSON | Geometry | Array | VectorTypes | null | undefined;
|
|
36
|
-
export interface RowData {
|
|
37
|
-
[x: string]: FieldData;
|
|
38
|
-
}
|
|
39
|
-
export interface _Field {
|
|
40
|
-
name: string;
|
|
41
|
-
type: keyof typeof DataType;
|
|
42
|
-
elementType?: keyof typeof DataType;
|
|
43
|
-
data: FieldData[];
|
|
44
|
-
dim?: number;
|
|
45
|
-
nullable?: boolean;
|
|
46
|
-
default_value?: FieldData;
|
|
47
|
-
}
|
|
48
|
-
export interface FlushReq extends GrpcTimeOut {
|
|
49
|
-
collection_names: string[];
|
|
50
|
-
db_name?: string;
|
|
51
|
-
}
|
|
2
|
+
import { GrpcTimeOut, NumberArrayId, StringArrayId, keyValueObj, DataType, ConsistencyLevelEnum, collectionNameReq, resStatusResponse, OutputTransformers } from '../';
|
|
52
3
|
export interface CountReq extends collectionNameReq {
|
|
53
4
|
expr?: string;
|
|
54
5
|
}
|
|
55
|
-
export type InsertTransformers = {
|
|
56
|
-
[DataType.BFloat16Vector]?: (bf16: BFloat16Vector) => Uint8Array;
|
|
57
|
-
[DataType.Float16Vector]?: (f16: Float16Vector) => Uint8Array;
|
|
58
|
-
};
|
|
59
|
-
interface BaseInsertReq extends collectionNameReq {
|
|
60
|
-
partition_name?: string;
|
|
61
|
-
hash_keys?: number[];
|
|
62
|
-
transformers?: InsertTransformers;
|
|
63
|
-
skip_check_schema?: boolean;
|
|
64
|
-
}
|
|
65
|
-
interface DataInsertReq extends BaseInsertReq {
|
|
66
|
-
data: RowData[];
|
|
67
|
-
fields_data?: never;
|
|
68
|
-
}
|
|
69
|
-
interface FieldsDataInsertReq extends BaseInsertReq {
|
|
70
|
-
fields_data: RowData[];
|
|
71
|
-
data?: never;
|
|
72
|
-
}
|
|
73
|
-
export type InsertReq = DataInsertReq | FieldsDataInsertReq;
|
|
74
|
-
export type UpsertReq = (DataInsertReq | FieldsDataInsertReq) & {
|
|
75
|
-
partial_update?: boolean;
|
|
76
|
-
};
|
|
77
6
|
interface BaseDeleteReq extends collectionNameReq {
|
|
78
7
|
partition_name?: string;
|
|
79
8
|
consistency_level?: 'Strong' | 'Session' | 'Bounded' | 'Eventually' | 'Customized';
|
|
@@ -101,67 +30,10 @@ export interface CalcDistanceReq extends GrpcTimeOut {
|
|
|
101
30
|
value: string;
|
|
102
31
|
}[];
|
|
103
32
|
}
|
|
104
|
-
export interface GetFlushStateReq extends GrpcTimeOut {
|
|
105
|
-
segmentIDs: number[];
|
|
106
|
-
}
|
|
107
|
-
export interface LoadBalanceReq extends GrpcTimeOut {
|
|
108
|
-
src_nodeID: number;
|
|
109
|
-
dst_nodeIDs?: number[];
|
|
110
|
-
sealed_segmentIDs?: number[];
|
|
111
|
-
}
|
|
112
|
-
export interface GetQuerySegmentInfoReq extends GrpcTimeOut {
|
|
113
|
-
collectionName: string;
|
|
114
|
-
dbName?: string;
|
|
115
|
-
}
|
|
116
|
-
export interface GePersistentSegmentInfoReq extends GrpcTimeOut {
|
|
117
|
-
collectionName: string;
|
|
118
|
-
dbName?: string;
|
|
119
|
-
}
|
|
120
|
-
export interface ImportReq extends collectionNameReq {
|
|
121
|
-
partition_name?: string;
|
|
122
|
-
channel_names?: string[];
|
|
123
|
-
files: string[];
|
|
124
|
-
options?: KeyValuePair[];
|
|
125
|
-
}
|
|
126
|
-
export interface ListImportTasksReq extends collectionNameReq {
|
|
127
|
-
limit?: number;
|
|
128
|
-
}
|
|
129
|
-
export interface GetImportStateReq extends GrpcTimeOut {
|
|
130
|
-
task: number;
|
|
131
|
-
}
|
|
132
|
-
export interface GetFlushStateResponse extends resStatusResponse {
|
|
133
|
-
flushed: boolean;
|
|
134
|
-
}
|
|
135
33
|
export interface GetMetricsResponse extends resStatusResponse {
|
|
136
34
|
response: any;
|
|
137
35
|
component_name: string;
|
|
138
36
|
}
|
|
139
|
-
export interface QuerySegmentInfo {
|
|
140
|
-
segmentID: number;
|
|
141
|
-
collectionID: number;
|
|
142
|
-
partitionID: number;
|
|
143
|
-
mem_size: number;
|
|
144
|
-
num_rows: number;
|
|
145
|
-
index_name: string;
|
|
146
|
-
indexID: number;
|
|
147
|
-
nodeID: number;
|
|
148
|
-
state: SegmentState;
|
|
149
|
-
nodeIds: number[];
|
|
150
|
-
level: SegmentLevel;
|
|
151
|
-
}
|
|
152
|
-
export interface PersistentSegmentInfo {
|
|
153
|
-
segmentID: number;
|
|
154
|
-
collectionID: number;
|
|
155
|
-
partitionID: number;
|
|
156
|
-
num_rows: number;
|
|
157
|
-
state: SegmentState;
|
|
158
|
-
}
|
|
159
|
-
export interface GetQuerySegmentInfoResponse extends resStatusResponse {
|
|
160
|
-
infos: QuerySegmentInfo[];
|
|
161
|
-
}
|
|
162
|
-
export interface GePersistentSegmentInfoResponse extends resStatusResponse {
|
|
163
|
-
infos: PersistentSegmentInfo[];
|
|
164
|
-
}
|
|
165
37
|
export interface MutationResult extends resStatusResponse {
|
|
166
38
|
succ_index: Number[];
|
|
167
39
|
err_index: Number[];
|
|
@@ -178,169 +50,11 @@ export interface QueryResults extends resStatusResponse {
|
|
|
178
50
|
export interface CountResult extends resStatusResponse {
|
|
179
51
|
data: number;
|
|
180
52
|
}
|
|
181
|
-
export interface SearchResultData {
|
|
182
|
-
[x: string]: any;
|
|
183
|
-
score: number;
|
|
184
|
-
id: string;
|
|
185
|
-
}
|
|
186
|
-
export type DetermineResultsType<T extends Record<string, any>> = T['vectors'] extends [VectorTypes] ? SearchResultData[] : T['vectors'] extends VectorTypes[] ? SearchResultData[][] : T['vector'] extends VectorTypes ? SearchResultData[] : T['data'] extends [any] ? SearchResultData[] : T['data'] extends VectorTypes[] | string[] ? SearchResultData[][] : SearchResultData[];
|
|
187
|
-
export interface SearchResults<T extends SearchReq | SearchSimpleReq | HybridSearchReq> extends resStatusResponse {
|
|
188
|
-
results: DetermineResultsType<T>;
|
|
189
|
-
recalls: number[];
|
|
190
|
-
session_ts: number;
|
|
191
|
-
collection_name: string;
|
|
192
|
-
all_search_count?: number;
|
|
193
|
-
search_iterator_v2_results?: Record<string, any>;
|
|
194
|
-
_search_iterator_v2_results?: string;
|
|
195
|
-
}
|
|
196
|
-
export interface ImportResponse extends resStatusResponse {
|
|
197
|
-
tasks: number[];
|
|
198
|
-
}
|
|
199
|
-
export interface GetImportStateResponse extends resStatusResponse {
|
|
200
|
-
state: ImportState;
|
|
201
|
-
row_count: number;
|
|
202
|
-
id_list: number[];
|
|
203
|
-
infos: KeyValuePair[];
|
|
204
|
-
id: number;
|
|
205
|
-
collection_id: number;
|
|
206
|
-
segment_ids: number[];
|
|
207
|
-
create_ts: number;
|
|
208
|
-
}
|
|
209
|
-
export interface ListImportTasksResponse extends resStatusResponse {
|
|
210
|
-
tasks: GetImportStateResponse[];
|
|
211
|
-
}
|
|
212
53
|
export interface GetMetricsRequest extends GrpcTimeOut {
|
|
213
54
|
request: {
|
|
214
55
|
metric_type: 'system_info' | 'system_statistics' | 'system_log';
|
|
215
56
|
};
|
|
216
57
|
}
|
|
217
|
-
export interface SearchParam {
|
|
218
|
-
anns_field: string;
|
|
219
|
-
topk: string | number;
|
|
220
|
-
metric_type: string;
|
|
221
|
-
params: string;
|
|
222
|
-
offset?: number;
|
|
223
|
-
round_decimal?: number;
|
|
224
|
-
ignore_growing?: boolean;
|
|
225
|
-
group_by_field?: string;
|
|
226
|
-
group_size?: number;
|
|
227
|
-
strict_group_size?: boolean;
|
|
228
|
-
hints?: string;
|
|
229
|
-
[key: string]: any;
|
|
230
|
-
}
|
|
231
|
-
export interface SearchReq extends collectionNameReq {
|
|
232
|
-
anns_field?: string;
|
|
233
|
-
partition_names?: string[];
|
|
234
|
-
expr?: string;
|
|
235
|
-
exprValues?: keyValueObj;
|
|
236
|
-
search_params: SearchParam;
|
|
237
|
-
vectors: VectorTypes[] | [VectorTypes];
|
|
238
|
-
output_fields?: string[];
|
|
239
|
-
travel_timestamp?: string;
|
|
240
|
-
vector_type: DataType.BinaryVector | DataType.FloatVector;
|
|
241
|
-
nq?: number;
|
|
242
|
-
consistency_level?: ConsistencyLevelEnum;
|
|
243
|
-
transformers?: OutputTransformers;
|
|
244
|
-
}
|
|
245
|
-
export type SearchTextType = string | string[] | [string];
|
|
246
|
-
export type SearchVectorType = VectorTypes | VectorTypes[] | [VectorTypes];
|
|
247
|
-
export type SearchDataType = SearchVectorType | SearchTextType;
|
|
248
|
-
export type SearchMultipleDataType = VectorTypes[] | SearchTextType[];
|
|
249
|
-
export interface SearchSimpleReq extends collectionNameReq {
|
|
250
|
-
partition_names?: string[];
|
|
251
|
-
anns_field?: string;
|
|
252
|
-
data?: SearchDataType;
|
|
253
|
-
vector?: VectorTypes;
|
|
254
|
-
vectors?: VectorTypes[] | [VectorTypes];
|
|
255
|
-
output_fields?: string[];
|
|
256
|
-
limit?: number;
|
|
257
|
-
topk?: number;
|
|
258
|
-
offset?: number;
|
|
259
|
-
filter?: string;
|
|
260
|
-
expr?: string;
|
|
261
|
-
exprValues?: keyValueObj;
|
|
262
|
-
params?: keyValueObj;
|
|
263
|
-
metric_type?: string;
|
|
264
|
-
consistency_level?: ConsistencyLevelEnum;
|
|
265
|
-
ignore_growing?: boolean;
|
|
266
|
-
group_by_field?: string;
|
|
267
|
-
group_size?: number;
|
|
268
|
-
strict_group_size?: boolean;
|
|
269
|
-
hints?: string;
|
|
270
|
-
round_decimal?: number;
|
|
271
|
-
transformers?: OutputTransformers;
|
|
272
|
-
rerank?: RerankerObj | FunctionObject;
|
|
273
|
-
}
|
|
274
|
-
export type HybridSearchSingleReq = Pick<SearchParam, 'anns_field' | 'ignore_growing' | 'group_by_field'> & {
|
|
275
|
-
data: SearchDataType;
|
|
276
|
-
expr?: string;
|
|
277
|
-
exprValues?: keyValueObj;
|
|
278
|
-
params?: keyValueObj;
|
|
279
|
-
transformers?: OutputTransformers;
|
|
280
|
-
};
|
|
281
|
-
export interface SearchIteratorReq extends Omit<SearchSimpleReq, 'vectors' | 'offset' | 'limit' | 'topk'> {
|
|
282
|
-
limit?: number;
|
|
283
|
-
batchSize: number;
|
|
284
|
-
external_filter_fn?: (row: SearchResultData) => boolean;
|
|
285
|
-
}
|
|
286
|
-
export type RerankerObj = {
|
|
287
|
-
strategy: RANKER_TYPE | string;
|
|
288
|
-
params: keyValueObj;
|
|
289
|
-
};
|
|
290
|
-
export type HybridSearchReq = Omit<SearchSimpleReq, 'data' | 'vector' | 'vectors' | 'params' | 'anns_field' | 'expr' | 'exprValues'> & {
|
|
291
|
-
data: HybridSearchSingleReq[];
|
|
292
|
-
params?: keyValueObj;
|
|
293
|
-
rerank?: RerankerObj | FunctionObject;
|
|
294
|
-
};
|
|
295
|
-
export interface SearchRes extends resStatusResponse {
|
|
296
|
-
results: {
|
|
297
|
-
top_k: number;
|
|
298
|
-
fields_data: {
|
|
299
|
-
type: string;
|
|
300
|
-
field_name: string;
|
|
301
|
-
field_id: number;
|
|
302
|
-
field: 'vectors' | 'scalars';
|
|
303
|
-
vectors?: {
|
|
304
|
-
dim: string;
|
|
305
|
-
data: 'float_vector' | 'binary_vector';
|
|
306
|
-
float_vector?: {
|
|
307
|
-
data: number[];
|
|
308
|
-
};
|
|
309
|
-
binary_vector?: Buffer;
|
|
310
|
-
};
|
|
311
|
-
scalars: {
|
|
312
|
-
[x: string]: any;
|
|
313
|
-
data: string;
|
|
314
|
-
};
|
|
315
|
-
}[];
|
|
316
|
-
scores: number[];
|
|
317
|
-
ids: {
|
|
318
|
-
int_id?: {
|
|
319
|
-
data: number[];
|
|
320
|
-
};
|
|
321
|
-
str_id?: {
|
|
322
|
-
data: string[];
|
|
323
|
-
};
|
|
324
|
-
id_field: 'int_id' | 'str_id';
|
|
325
|
-
};
|
|
326
|
-
num_queries: number;
|
|
327
|
-
topks: number[];
|
|
328
|
-
output_fields: string[];
|
|
329
|
-
group_by_field_value: string;
|
|
330
|
-
recalls: number[];
|
|
331
|
-
search_iterator_v2_results?: Record<string, any>;
|
|
332
|
-
_search_iterator_v2_results?: string;
|
|
333
|
-
all_search_count?: number;
|
|
334
|
-
};
|
|
335
|
-
collection_name: string;
|
|
336
|
-
session_ts: number;
|
|
337
|
-
}
|
|
338
|
-
export type OutputTransformers = {
|
|
339
|
-
[DataType.BFloat16Vector]?: (bf16bytes: Uint8Array) => BFloat16Vector;
|
|
340
|
-
[DataType.Float16Vector]?: (f16: Uint8Array) => Float16Vector;
|
|
341
|
-
[DataType.SparseFloatVector]?: (sparse: SparseVectorDic) => SparseFloatVector;
|
|
342
|
-
[DataType.Int8Vector]?: (int8Vector: Int8Array) => Int8Vector;
|
|
343
|
-
};
|
|
344
58
|
type BaseQueryReq = collectionNameReq & {
|
|
345
59
|
output_fields?: string[];
|
|
346
60
|
partition_names?: string[];
|
|
@@ -396,21 +110,4 @@ export interface QueryRes extends resStatusResponse {
|
|
|
396
110
|
output_fields: string[];
|
|
397
111
|
collection_name: string;
|
|
398
112
|
}
|
|
399
|
-
export interface FlushResult extends resStatusResponse {
|
|
400
|
-
coll_segIDs: any;
|
|
401
|
-
}
|
|
402
|
-
export interface ListIndexedSegmentReq extends collectionNameReq {
|
|
403
|
-
index_name: string;
|
|
404
|
-
}
|
|
405
|
-
export interface ListIndexedSegmentResponse extends resStatusResponse {
|
|
406
|
-
segmentIDs: number[];
|
|
407
|
-
}
|
|
408
|
-
export interface DescribeSegmentIndexDataReq extends collectionNameReq {
|
|
409
|
-
index_name: string;
|
|
410
|
-
segmentsIDs: number[];
|
|
411
|
-
}
|
|
412
|
-
export interface DescribeSegmentIndexDataResponse extends resStatusResponse {
|
|
413
|
-
index_params: any;
|
|
414
|
-
index_data: any;
|
|
415
|
-
}
|
|
416
113
|
export {};
|
|
@@ -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":""}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
export type FloatVector = number[];
|
|
2
|
+
export type Float16Vector = number[] | Uint8Array;
|
|
3
|
+
export type BFloat16Vector = number[] | Uint8Array;
|
|
4
|
+
export type BinaryVector = number[];
|
|
5
|
+
export type SparseVectorArray = (number | undefined)[];
|
|
6
|
+
export type SparseVectorDic = {
|
|
7
|
+
[key: string]: number;
|
|
8
|
+
};
|
|
9
|
+
export type SparseVectorCSR = {
|
|
10
|
+
indices: number[];
|
|
11
|
+
values: number[];
|
|
12
|
+
};
|
|
13
|
+
export type Int8Vector = number[] | Int8Array;
|
|
14
|
+
export type SparseVectorCOO = {
|
|
15
|
+
index: number;
|
|
16
|
+
value: number;
|
|
17
|
+
}[];
|
|
18
|
+
export type SparseFloatVector = SparseVectorArray | SparseVectorDic | SparseVectorCSR | SparseVectorCOO;
|
|
19
|
+
export type VectorTypes = FloatVector | Float16Vector | BinaryVector | BFloat16Vector | SparseFloatVector | Int8Vector;
|
|
20
|
+
export type Bool = boolean;
|
|
21
|
+
export type Int8 = number;
|
|
22
|
+
export type Int16 = number;
|
|
23
|
+
export type Int32 = number;
|
|
24
|
+
export type Int64 = number;
|
|
25
|
+
export type Float = number;
|
|
26
|
+
export type Double = number;
|
|
27
|
+
export type VarChar = string;
|
|
28
|
+
export type JSON = {
|
|
29
|
+
[key: string]: any;
|
|
30
|
+
};
|
|
31
|
+
export type Geometry = string;
|
|
32
|
+
export type Struct = {
|
|
33
|
+
[key: string]: Bool | Int8 | Int16 | Int32 | Int64 | Float | Double | VarChar | JSON | Geometry | VectorTypes;
|
|
34
|
+
};
|
|
35
|
+
export type Array = Int8[] | Int16[] | Int32[] | Int64[] | Float[] | Double[] | VarChar[] | Struct[];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DataTypes.js","sourceRoot":"","sources":["../../../milvus/types/DataTypes.ts"],"names":[],"mappings":""}
|
|
@@ -9,7 +9,7 @@ export interface CreateColReq extends collectionNameReq {
|
|
|
9
9
|
enableDynamicField?: boolean;
|
|
10
10
|
description?: string;
|
|
11
11
|
auto_id?: boolean;
|
|
12
|
-
consistency_level?:
|
|
12
|
+
consistency_level?: string;
|
|
13
13
|
index_params?: CreateIndexParam;
|
|
14
14
|
timeout?: number;
|
|
15
15
|
}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { GrpcTimeOut, KeyValuePair, DataType, ImportState, collectionNameReq, resStatusResponse, Bool, Int8, Int16, Int32, Int64, Float, Double, VarChar, JSON, Geometry, Array, VectorTypes, BFloat16Vector, Float16Vector } from '../';
|
|
2
|
+
export type FieldData = Bool | Int8 | Int16 | Int32 | Int64 | Float | Double | VarChar | JSON | Geometry | Array | VectorTypes | null | undefined;
|
|
3
|
+
export interface RowData {
|
|
4
|
+
[x: string]: FieldData;
|
|
5
|
+
}
|
|
6
|
+
export interface _Field {
|
|
7
|
+
name: string;
|
|
8
|
+
type: DataType;
|
|
9
|
+
elementType?: DataType;
|
|
10
|
+
data: FieldData[];
|
|
11
|
+
dim?: number;
|
|
12
|
+
nullable?: boolean;
|
|
13
|
+
default_value?: FieldData;
|
|
14
|
+
fieldMap: Map<string, _Field>;
|
|
15
|
+
}
|
|
16
|
+
export type InsertTransformers = {
|
|
17
|
+
[DataType.BFloat16Vector]?: (bf16: BFloat16Vector) => Uint8Array;
|
|
18
|
+
[DataType.Float16Vector]?: (f16: Float16Vector) => Uint8Array;
|
|
19
|
+
};
|
|
20
|
+
interface BaseInsertReq extends collectionNameReq {
|
|
21
|
+
partition_name?: string;
|
|
22
|
+
hash_keys?: number[];
|
|
23
|
+
transformers?: InsertTransformers;
|
|
24
|
+
skip_check_schema?: boolean;
|
|
25
|
+
}
|
|
26
|
+
export type InsertReq = DataInsertReq | FieldsDataInsertReq;
|
|
27
|
+
export type UpsertReq = (DataInsertReq | FieldsDataInsertReq) & {
|
|
28
|
+
partial_update?: boolean;
|
|
29
|
+
};
|
|
30
|
+
interface DataInsertReq extends BaseInsertReq {
|
|
31
|
+
data: RowData[];
|
|
32
|
+
fields_data?: never;
|
|
33
|
+
}
|
|
34
|
+
interface FieldsDataInsertReq extends BaseInsertReq {
|
|
35
|
+
fields_data: RowData[];
|
|
36
|
+
data?: never;
|
|
37
|
+
}
|
|
38
|
+
export interface ImportReq extends collectionNameReq {
|
|
39
|
+
partition_name?: string;
|
|
40
|
+
channel_names?: string[];
|
|
41
|
+
files: string[];
|
|
42
|
+
options?: KeyValuePair[];
|
|
43
|
+
}
|
|
44
|
+
export interface ListImportTasksReq extends collectionNameReq {
|
|
45
|
+
limit?: number;
|
|
46
|
+
}
|
|
47
|
+
export interface GetImportStateReq extends GrpcTimeOut {
|
|
48
|
+
task: number;
|
|
49
|
+
}
|
|
50
|
+
export interface ImportResponse extends resStatusResponse {
|
|
51
|
+
tasks: number[];
|
|
52
|
+
}
|
|
53
|
+
export interface GetImportStateResponse extends resStatusResponse {
|
|
54
|
+
state: ImportState;
|
|
55
|
+
row_count: number;
|
|
56
|
+
id_list: number[];
|
|
57
|
+
infos: KeyValuePair[];
|
|
58
|
+
id: number;
|
|
59
|
+
collection_id: number;
|
|
60
|
+
segment_ids: number[];
|
|
61
|
+
create_ts: number;
|
|
62
|
+
}
|
|
63
|
+
export interface ListImportTasksResponse extends resStatusResponse {
|
|
64
|
+
tasks: GetImportStateResponse[];
|
|
65
|
+
}
|
|
66
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Insert.js","sourceRoot":"","sources":["../../../milvus/types/Insert.ts"],"names":[],"mappings":";;AAAA,2BAqBa"}
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
import { keyValueObj, DataType, ConsistencyLevelEnum, collectionNameReq, resStatusResponse, RANKER_TYPE, FunctionObject, VectorTypes, BFloat16Vector, Float16Vector, SparseVectorDic, SparseFloatVector, Int8Vector } from '../';
|
|
3
|
+
export interface SearchParam {
|
|
4
|
+
anns_field: string;
|
|
5
|
+
topk: string | number;
|
|
6
|
+
metric_type: string;
|
|
7
|
+
params: string;
|
|
8
|
+
offset?: number;
|
|
9
|
+
round_decimal?: number;
|
|
10
|
+
ignore_growing?: boolean;
|
|
11
|
+
group_by_field?: string;
|
|
12
|
+
group_size?: number;
|
|
13
|
+
strict_group_size?: boolean;
|
|
14
|
+
hints?: string;
|
|
15
|
+
[key: string]: any;
|
|
16
|
+
}
|
|
17
|
+
export type SearchText = string;
|
|
18
|
+
export type SearchEmbList = VectorTypes[];
|
|
19
|
+
export type SearchVector = VectorTypes;
|
|
20
|
+
export type SearchData = SearchVector | SearchText | SearchEmbList;
|
|
21
|
+
export interface SearchReq extends collectionNameReq {
|
|
22
|
+
anns_field?: string;
|
|
23
|
+
partition_names?: string[];
|
|
24
|
+
expr?: string;
|
|
25
|
+
exprValues?: keyValueObj;
|
|
26
|
+
search_params: SearchParam;
|
|
27
|
+
vectors: SearchData | SearchData[];
|
|
28
|
+
output_fields?: string[];
|
|
29
|
+
travel_timestamp?: string;
|
|
30
|
+
vector_type: DataType.BinaryVector | DataType.FloatVector;
|
|
31
|
+
nq?: number;
|
|
32
|
+
consistency_level?: ConsistencyLevelEnum;
|
|
33
|
+
transformers?: OutputTransformers;
|
|
34
|
+
}
|
|
35
|
+
export interface FunctionScore {
|
|
36
|
+
functions: FunctionObject[];
|
|
37
|
+
params: keyValueObj;
|
|
38
|
+
}
|
|
39
|
+
export interface SearchSimpleReq extends collectionNameReq {
|
|
40
|
+
partition_names?: string[];
|
|
41
|
+
anns_field?: string;
|
|
42
|
+
data: SearchData | SearchData[];
|
|
43
|
+
vector?: SearchData | SearchData[];
|
|
44
|
+
output_fields?: string[];
|
|
45
|
+
limit?: number;
|
|
46
|
+
topk?: number;
|
|
47
|
+
offset?: number;
|
|
48
|
+
filter?: string;
|
|
49
|
+
expr?: string;
|
|
50
|
+
exprValues?: keyValueObj;
|
|
51
|
+
params?: keyValueObj;
|
|
52
|
+
metric_type?: string;
|
|
53
|
+
consistency_level?: ConsistencyLevelEnum;
|
|
54
|
+
ignore_growing?: boolean;
|
|
55
|
+
group_by_field?: string;
|
|
56
|
+
group_size?: number;
|
|
57
|
+
strict_group_size?: boolean;
|
|
58
|
+
hints?: string;
|
|
59
|
+
round_decimal?: number;
|
|
60
|
+
transformers?: OutputTransformers;
|
|
61
|
+
rerank?: RerankerObj | FunctionObject | FunctionScore;
|
|
62
|
+
nq?: number;
|
|
63
|
+
}
|
|
64
|
+
export type HybridSearchSingleReq = Pick<SearchParam, 'anns_field' | 'ignore_growing' | 'group_by_field'> & {
|
|
65
|
+
data: SearchData;
|
|
66
|
+
expr?: string;
|
|
67
|
+
exprValues?: keyValueObj;
|
|
68
|
+
params?: keyValueObj;
|
|
69
|
+
transformers?: OutputTransformers;
|
|
70
|
+
};
|
|
71
|
+
export interface SearchIteratorReq extends Omit<SearchSimpleReq, 'vectors' | 'offset' | 'limit' | 'topk'> {
|
|
72
|
+
limit?: number;
|
|
73
|
+
batchSize: number;
|
|
74
|
+
external_filter_fn?: (row: SearchResultData) => boolean;
|
|
75
|
+
}
|
|
76
|
+
export type RerankerObj = {
|
|
77
|
+
strategy: RANKER_TYPE | string;
|
|
78
|
+
params: keyValueObj;
|
|
79
|
+
};
|
|
80
|
+
export type HybridSearchReq = Omit<SearchSimpleReq, 'data' | 'vector' | 'vectors' | 'anns_field' | 'expr' | 'exprValues'> & {
|
|
81
|
+
data: HybridSearchSingleReq[];
|
|
82
|
+
rerank?: RerankerObj | FunctionObject | FunctionScore;
|
|
83
|
+
};
|
|
84
|
+
export interface SearchRes extends resStatusResponse {
|
|
85
|
+
results: {
|
|
86
|
+
top_k: number;
|
|
87
|
+
fields_data: {
|
|
88
|
+
type: string;
|
|
89
|
+
field_name: string;
|
|
90
|
+
field_id: number;
|
|
91
|
+
field: 'vectors' | 'scalars';
|
|
92
|
+
vectors?: {
|
|
93
|
+
dim: string;
|
|
94
|
+
data: 'float_vector' | 'binary_vector';
|
|
95
|
+
float_vector?: {
|
|
96
|
+
data: number[];
|
|
97
|
+
};
|
|
98
|
+
binary_vector?: Buffer;
|
|
99
|
+
};
|
|
100
|
+
scalars: {
|
|
101
|
+
[x: string]: any;
|
|
102
|
+
data: string;
|
|
103
|
+
};
|
|
104
|
+
}[];
|
|
105
|
+
scores: number[];
|
|
106
|
+
ids: {
|
|
107
|
+
int_id?: {
|
|
108
|
+
data: number[];
|
|
109
|
+
};
|
|
110
|
+
str_id?: {
|
|
111
|
+
data: string[];
|
|
112
|
+
};
|
|
113
|
+
id_field: 'int_id' | 'str_id';
|
|
114
|
+
};
|
|
115
|
+
num_queries: number;
|
|
116
|
+
topks: number[];
|
|
117
|
+
output_fields: string[];
|
|
118
|
+
group_by_field_value: string;
|
|
119
|
+
recalls: number[];
|
|
120
|
+
search_iterator_v2_results?: Record<string, any>;
|
|
121
|
+
_search_iterator_v2_results?: string;
|
|
122
|
+
all_search_count?: number;
|
|
123
|
+
};
|
|
124
|
+
collection_name: string;
|
|
125
|
+
session_ts: number;
|
|
126
|
+
}
|
|
127
|
+
export type OutputTransformers = {
|
|
128
|
+
[DataType.BFloat16Vector]?: (bf16bytes: Uint8Array) => BFloat16Vector;
|
|
129
|
+
[DataType.Float16Vector]?: (f16: Uint8Array) => Float16Vector;
|
|
130
|
+
[DataType.SparseFloatVector]?: (sparse: SparseVectorDic) => SparseFloatVector;
|
|
131
|
+
[DataType.Int8Vector]?: (int8Vector: Int8Array) => Int8Vector;
|
|
132
|
+
};
|
|
133
|
+
export type DetermineResultsType<T extends Record<string, any>> = T['vectors'] extends [SearchData] ? SearchResultData[] : T['vectors'] extends SearchData[] ? SearchResultData[][] : T['vector'] extends SearchData ? SearchResultData[] : T['data'] extends SearchData ? SearchResultData[] : T['data'] extends SearchData[] ? SearchResultData[][] : SearchResultData[];
|
|
134
|
+
export interface SearchResultData {
|
|
135
|
+
[x: string]: any;
|
|
136
|
+
score: number;
|
|
137
|
+
id: string;
|
|
138
|
+
}
|
|
139
|
+
export interface SearchResults<T extends SearchReq | SearchSimpleReq | HybridSearchReq> extends resStatusResponse {
|
|
140
|
+
results: DetermineResultsType<T>;
|
|
141
|
+
recalls: number[];
|
|
142
|
+
session_ts: number;
|
|
143
|
+
collection_name: string;
|
|
144
|
+
all_search_count?: number;
|
|
145
|
+
search_iterator_v2_results?: Record<string, any>;
|
|
146
|
+
_search_iterator_v2_results?: string;
|
|
147
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Search.js","sourceRoot":"","sources":["../../../milvus/types/Search.ts"],"names":[],"mappings":";;AAAA,2BAca"}
|