@petercatai/whisker-client 0.1.202504091941-dev
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/api.d.ts +1577 -0
- package/dist/api.js +283 -0
- package/package.json +23 -0
package/dist/api.d.ts
ADDED
|
@@ -0,0 +1,1577 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* BaseCharSplitConfig
|
|
3
|
+
* Base split configuration class
|
|
4
|
+
*/
|
|
5
|
+
export interface IBaseCharSplitConfig {
|
|
6
|
+
/**
|
|
7
|
+
* Chunk Size
|
|
8
|
+
* @min 1
|
|
9
|
+
* @exclusiveMax 5000
|
|
10
|
+
* @default 1500
|
|
11
|
+
*/
|
|
12
|
+
chunk_size?: number;
|
|
13
|
+
/**
|
|
14
|
+
* Chunk Overlap
|
|
15
|
+
* @min 0
|
|
16
|
+
* @default 150
|
|
17
|
+
*/
|
|
18
|
+
chunk_overlap?: number;
|
|
19
|
+
}
|
|
20
|
+
/** Chunk */
|
|
21
|
+
export interface IChunk {
|
|
22
|
+
/**
|
|
23
|
+
* Chunk Id
|
|
24
|
+
* chunk id
|
|
25
|
+
*/
|
|
26
|
+
chunk_id?: string;
|
|
27
|
+
/**
|
|
28
|
+
* Space Id
|
|
29
|
+
* space id
|
|
30
|
+
*/
|
|
31
|
+
space_id: string;
|
|
32
|
+
/**
|
|
33
|
+
* Tenant Id
|
|
34
|
+
* tenant id
|
|
35
|
+
*/
|
|
36
|
+
tenant_id: string;
|
|
37
|
+
/**
|
|
38
|
+
* Embedding
|
|
39
|
+
* chunk embedding
|
|
40
|
+
*/
|
|
41
|
+
embedding?: number[] | null;
|
|
42
|
+
/**
|
|
43
|
+
* Context
|
|
44
|
+
* chunk content
|
|
45
|
+
*/
|
|
46
|
+
context: string;
|
|
47
|
+
/**
|
|
48
|
+
* Knowledge Id
|
|
49
|
+
* file source info
|
|
50
|
+
*/
|
|
51
|
+
knowledge_id: string;
|
|
52
|
+
/**
|
|
53
|
+
* Embedding Model Name
|
|
54
|
+
* name of the embedding model
|
|
55
|
+
*/
|
|
56
|
+
embedding_model_name?: string;
|
|
57
|
+
/**
|
|
58
|
+
* Metadata
|
|
59
|
+
* Arbitrary metadata associated with the content.
|
|
60
|
+
*/
|
|
61
|
+
metadata?: object | null;
|
|
62
|
+
/**
|
|
63
|
+
* Gmt Create
|
|
64
|
+
* creation time
|
|
65
|
+
*/
|
|
66
|
+
gmt_create?: string;
|
|
67
|
+
/**
|
|
68
|
+
* Gmt Modified
|
|
69
|
+
* update time
|
|
70
|
+
*/
|
|
71
|
+
gmt_modified?: string;
|
|
72
|
+
}
|
|
73
|
+
/** EmbeddingModelEnum */
|
|
74
|
+
export declare enum IEmbeddingModelEnum {
|
|
75
|
+
Openai = "openai",
|
|
76
|
+
SentenceTransformersAllMiniLML6V2 = "sentence-transformers/all-MiniLM-L6-v2",
|
|
77
|
+
SentenceTransformersAllMpnetBaseV2 = "sentence-transformers/all-mpnet-base-v2",
|
|
78
|
+
SentenceTransformersParaphraseMultilingualMiniLML12V2 = "sentence-transformers/paraphrase-multilingual-MiniLM-L12-v2",
|
|
79
|
+
Shibing624Text2VecBaseChinese = "shibing624/text2vec-base-chinese"
|
|
80
|
+
}
|
|
81
|
+
/** GithubFileSourceConfig */
|
|
82
|
+
export interface IGithubFileSourceConfig {
|
|
83
|
+
/**
|
|
84
|
+
* Repo Name
|
|
85
|
+
* github repo url
|
|
86
|
+
*/
|
|
87
|
+
repo_name: string;
|
|
88
|
+
/**
|
|
89
|
+
* Branch
|
|
90
|
+
* branch name of the repo
|
|
91
|
+
*/
|
|
92
|
+
branch?: string | null;
|
|
93
|
+
/**
|
|
94
|
+
* Commit Id
|
|
95
|
+
* commit id of the repo
|
|
96
|
+
*/
|
|
97
|
+
commit_id?: string | null;
|
|
98
|
+
/**
|
|
99
|
+
* Auth Info
|
|
100
|
+
* authentication information
|
|
101
|
+
*/
|
|
102
|
+
auth_info?: string | null;
|
|
103
|
+
/**
|
|
104
|
+
* Path
|
|
105
|
+
* path of the file in the repo
|
|
106
|
+
*/
|
|
107
|
+
path: string;
|
|
108
|
+
}
|
|
109
|
+
/** GithubRepoCreate */
|
|
110
|
+
export interface IGithubRepoCreate {
|
|
111
|
+
/**
|
|
112
|
+
* Space Id
|
|
113
|
+
* the space of knowledge, example: petercat bot id, github repo name
|
|
114
|
+
*/
|
|
115
|
+
space_id: string;
|
|
116
|
+
/**
|
|
117
|
+
* Knowledge Type
|
|
118
|
+
* type of knowledge resource
|
|
119
|
+
* @default "folder"
|
|
120
|
+
*/
|
|
121
|
+
knowledge_type?: "folder";
|
|
122
|
+
/**
|
|
123
|
+
* Knowledge Name
|
|
124
|
+
* name of the knowledge resource
|
|
125
|
+
* @maxLength 255
|
|
126
|
+
*/
|
|
127
|
+
knowledge_name: string;
|
|
128
|
+
/**
|
|
129
|
+
* Metadata
|
|
130
|
+
* additional metadata, user can update it
|
|
131
|
+
* @default {}
|
|
132
|
+
*/
|
|
133
|
+
metadata?: object;
|
|
134
|
+
/** source type */
|
|
135
|
+
source_type: IKnowledgeSourceEnum;
|
|
136
|
+
/**
|
|
137
|
+
* Embedding Model Name
|
|
138
|
+
* name of the embedding model. you can set any other model if target embedding service registered
|
|
139
|
+
* @default "openai"
|
|
140
|
+
*/
|
|
141
|
+
embedding_model_name?: IEmbeddingModelEnum | string;
|
|
142
|
+
/**
|
|
143
|
+
* File Sha
|
|
144
|
+
* SHA of the file
|
|
145
|
+
*/
|
|
146
|
+
file_sha?: string | null;
|
|
147
|
+
/**
|
|
148
|
+
* File Size
|
|
149
|
+
* size of the file
|
|
150
|
+
*/
|
|
151
|
+
file_size?: number | null;
|
|
152
|
+
/** source config of the knowledge */
|
|
153
|
+
source_config: IGithubRepoSourceConfig;
|
|
154
|
+
/** split config of the knowledge */
|
|
155
|
+
split_config: IBaseCharSplitConfig;
|
|
156
|
+
}
|
|
157
|
+
/** GithubRepoSourceConfig */
|
|
158
|
+
export interface IGithubRepoSourceConfig {
|
|
159
|
+
/**
|
|
160
|
+
* Repo Name
|
|
161
|
+
* github repo url
|
|
162
|
+
*/
|
|
163
|
+
repo_name: string;
|
|
164
|
+
/**
|
|
165
|
+
* Branch
|
|
166
|
+
* branch name of the repo
|
|
167
|
+
*/
|
|
168
|
+
branch?: string | null;
|
|
169
|
+
/**
|
|
170
|
+
* Commit Id
|
|
171
|
+
* commit id of the repo
|
|
172
|
+
*/
|
|
173
|
+
commit_id?: string | null;
|
|
174
|
+
/**
|
|
175
|
+
* Auth Info
|
|
176
|
+
* authentication information
|
|
177
|
+
*/
|
|
178
|
+
auth_info?: string | null;
|
|
179
|
+
}
|
|
180
|
+
/** HTTPValidationError */
|
|
181
|
+
export interface IHTTPValidationError {
|
|
182
|
+
/** Detail */
|
|
183
|
+
detail?: IValidationError[];
|
|
184
|
+
}
|
|
185
|
+
/** ImageCreate */
|
|
186
|
+
export interface IImageCreate {
|
|
187
|
+
/**
|
|
188
|
+
* Space Id
|
|
189
|
+
* the space of knowledge, example: petercat bot id, github repo name
|
|
190
|
+
*/
|
|
191
|
+
space_id: string;
|
|
192
|
+
/**
|
|
193
|
+
* Knowledge Type
|
|
194
|
+
* type of knowledge resource
|
|
195
|
+
* @default "image"
|
|
196
|
+
*/
|
|
197
|
+
knowledge_type?: "image";
|
|
198
|
+
/**
|
|
199
|
+
* Knowledge Name
|
|
200
|
+
* name of the knowledge resource
|
|
201
|
+
* @maxLength 255
|
|
202
|
+
*/
|
|
203
|
+
knowledge_name: string;
|
|
204
|
+
/**
|
|
205
|
+
* Metadata
|
|
206
|
+
* additional metadata, user can update it
|
|
207
|
+
* @default {}
|
|
208
|
+
*/
|
|
209
|
+
metadata?: object;
|
|
210
|
+
/** source type */
|
|
211
|
+
source_type: IKnowledgeSourceEnum;
|
|
212
|
+
/**
|
|
213
|
+
* Embedding Model Name
|
|
214
|
+
* name of the embedding model. you can set any other model if target embedding service registered
|
|
215
|
+
* @default "openai"
|
|
216
|
+
*/
|
|
217
|
+
embedding_model_name?: IEmbeddingModelEnum | string;
|
|
218
|
+
/**
|
|
219
|
+
* File Sha
|
|
220
|
+
* SHA of the file
|
|
221
|
+
*/
|
|
222
|
+
file_sha: string;
|
|
223
|
+
/**
|
|
224
|
+
* File Size
|
|
225
|
+
* Byte size of the file
|
|
226
|
+
*/
|
|
227
|
+
file_size: number;
|
|
228
|
+
/**
|
|
229
|
+
* Source Config
|
|
230
|
+
* source config of the knowledge
|
|
231
|
+
*/
|
|
232
|
+
source_config: IOpenUrlSourceConfig | IOpenIdSourceConfig | IS3SourceConfig;
|
|
233
|
+
}
|
|
234
|
+
/** JSONCreate */
|
|
235
|
+
export interface IJSONCreate {
|
|
236
|
+
/**
|
|
237
|
+
* Space Id
|
|
238
|
+
* the space of knowledge, example: petercat bot id, github repo name
|
|
239
|
+
*/
|
|
240
|
+
space_id: string;
|
|
241
|
+
/**
|
|
242
|
+
* Knowledge Type
|
|
243
|
+
* type of knowledge resource
|
|
244
|
+
* @default "json"
|
|
245
|
+
*/
|
|
246
|
+
knowledge_type?: "json";
|
|
247
|
+
/**
|
|
248
|
+
* Knowledge Name
|
|
249
|
+
* name of the knowledge resource
|
|
250
|
+
* @maxLength 255
|
|
251
|
+
*/
|
|
252
|
+
knowledge_name: string;
|
|
253
|
+
/**
|
|
254
|
+
* Metadata
|
|
255
|
+
* additional metadata, user can update it
|
|
256
|
+
* @default {}
|
|
257
|
+
*/
|
|
258
|
+
metadata?: object;
|
|
259
|
+
/** source type */
|
|
260
|
+
source_type: IKnowledgeSourceEnum;
|
|
261
|
+
/**
|
|
262
|
+
* Embedding Model Name
|
|
263
|
+
* name of the embedding model. you can set any other model if target embedding service registered
|
|
264
|
+
* @default "openai"
|
|
265
|
+
*/
|
|
266
|
+
embedding_model_name?: IEmbeddingModelEnum | string;
|
|
267
|
+
/**
|
|
268
|
+
* File Sha
|
|
269
|
+
* SHA of the file
|
|
270
|
+
*/
|
|
271
|
+
file_sha?: string | null;
|
|
272
|
+
/**
|
|
273
|
+
* File Size
|
|
274
|
+
* size of the file
|
|
275
|
+
*/
|
|
276
|
+
file_size?: number | null;
|
|
277
|
+
/**
|
|
278
|
+
* Source Config
|
|
279
|
+
* source config of the knowledge
|
|
280
|
+
*/
|
|
281
|
+
source_config: ITextSourceConfig | IOpenUrlSourceConfig | IOpenIdSourceConfig | IS3SourceConfig;
|
|
282
|
+
/** split config of the knowledge */
|
|
283
|
+
split_config: IJSONSplitConfig;
|
|
284
|
+
}
|
|
285
|
+
/**
|
|
286
|
+
* JSONSplitConfig
|
|
287
|
+
* JSON document split configuration
|
|
288
|
+
*/
|
|
289
|
+
export interface IJSONSplitConfig {
|
|
290
|
+
/**
|
|
291
|
+
* Chunk Size
|
|
292
|
+
* @min 1
|
|
293
|
+
* @exclusiveMax 5000
|
|
294
|
+
* @default 1500
|
|
295
|
+
*/
|
|
296
|
+
chunk_size?: number;
|
|
297
|
+
/**
|
|
298
|
+
* Chunk Overlap
|
|
299
|
+
* @min 0
|
|
300
|
+
* @default 150
|
|
301
|
+
*/
|
|
302
|
+
chunk_overlap?: number;
|
|
303
|
+
/**
|
|
304
|
+
* Split Level
|
|
305
|
+
* Depth level for JSON splitting
|
|
306
|
+
* @min 1
|
|
307
|
+
* @default 1
|
|
308
|
+
*/
|
|
309
|
+
split_level?: number;
|
|
310
|
+
/**
|
|
311
|
+
* Preserve Structure
|
|
312
|
+
* Whether to preserve JSON structure
|
|
313
|
+
* @default true
|
|
314
|
+
*/
|
|
315
|
+
preserve_structure?: boolean;
|
|
316
|
+
/**
|
|
317
|
+
* Array Handling
|
|
318
|
+
* Array handling mode: 'split' or 'merge'
|
|
319
|
+
* @default "split"
|
|
320
|
+
*/
|
|
321
|
+
array_handling?: string;
|
|
322
|
+
/**
|
|
323
|
+
* Key Filters
|
|
324
|
+
* List of keys to process; processes all keys if None
|
|
325
|
+
*/
|
|
326
|
+
key_filters?: string[] | null;
|
|
327
|
+
}
|
|
328
|
+
/** Knowledge */
|
|
329
|
+
export interface IKnowledge {
|
|
330
|
+
/**
|
|
331
|
+
* Knowledge Id
|
|
332
|
+
* knowledge id
|
|
333
|
+
*/
|
|
334
|
+
knowledge_id?: string;
|
|
335
|
+
/**
|
|
336
|
+
* Space Id
|
|
337
|
+
* the space of knowledge, example: petercat bot id, github repo name
|
|
338
|
+
*/
|
|
339
|
+
space_id: string;
|
|
340
|
+
/**
|
|
341
|
+
* Tenant Id
|
|
342
|
+
* tenant id
|
|
343
|
+
*/
|
|
344
|
+
tenant_id: string;
|
|
345
|
+
/** type of knowledge resource */
|
|
346
|
+
knowledge_type?: string;
|
|
347
|
+
/**
|
|
348
|
+
* Knowledge Name
|
|
349
|
+
* name of the knowledge resource
|
|
350
|
+
* @maxLength 255
|
|
351
|
+
*/
|
|
352
|
+
knowledge_name: string;
|
|
353
|
+
/** source type */
|
|
354
|
+
source_type?: string;
|
|
355
|
+
/**
|
|
356
|
+
* Source Config
|
|
357
|
+
* source config of the knowledge
|
|
358
|
+
*/
|
|
359
|
+
source_config: IGithubRepoSourceConfig | IGithubFileSourceConfig | IS3SourceConfig | IOpenUrlSourceConfig | ITextSourceConfig;
|
|
360
|
+
/**
|
|
361
|
+
* Embedding Model Name
|
|
362
|
+
* name of the embedding model. you can set any other model if target embedding service registered
|
|
363
|
+
*/
|
|
364
|
+
embedding_model_name?: string;
|
|
365
|
+
/**
|
|
366
|
+
* Split Config
|
|
367
|
+
* configuration for splitting the knowledge
|
|
368
|
+
*/
|
|
369
|
+
split_config: IBaseCharSplitConfig | IMarkdownSplitConfig | IPDFSplitConfig | ITextSplitConfig | IJSONSplitConfig;
|
|
370
|
+
/**
|
|
371
|
+
* File Sha
|
|
372
|
+
* SHA of the file
|
|
373
|
+
*/
|
|
374
|
+
file_sha?: string | null;
|
|
375
|
+
/**
|
|
376
|
+
* File Size
|
|
377
|
+
* size of the file
|
|
378
|
+
*/
|
|
379
|
+
file_size?: number | null;
|
|
380
|
+
/**
|
|
381
|
+
* Metadata
|
|
382
|
+
* additional metadata, user can update it
|
|
383
|
+
*/
|
|
384
|
+
metadata?: object | null;
|
|
385
|
+
/**
|
|
386
|
+
* Parent Id
|
|
387
|
+
* parent knowledge id
|
|
388
|
+
*/
|
|
389
|
+
parent_id?: string | null;
|
|
390
|
+
/**
|
|
391
|
+
* Enabled
|
|
392
|
+
* is knowledge enabled
|
|
393
|
+
* @default true
|
|
394
|
+
*/
|
|
395
|
+
enabled?: boolean;
|
|
396
|
+
/**
|
|
397
|
+
* Gmt Create
|
|
398
|
+
* creation time
|
|
399
|
+
*/
|
|
400
|
+
gmt_create?: string;
|
|
401
|
+
/**
|
|
402
|
+
* Gmt Modified
|
|
403
|
+
* update time
|
|
404
|
+
*/
|
|
405
|
+
gmt_modified?: string;
|
|
406
|
+
}
|
|
407
|
+
/**
|
|
408
|
+
* KnowledgeCreate
|
|
409
|
+
* KnowledgeCreate model for creating knowledge resources.
|
|
410
|
+
* Attributes:
|
|
411
|
+
* knowledge_type (ResourceType): Type of knowledge resource.
|
|
412
|
+
* space_id (str): Space ID, example: petercat bot ID.
|
|
413
|
+
* knowledge_name (str): Name of the knowledge resource.
|
|
414
|
+
* file_sha (Optional[str]): SHA of the file.
|
|
415
|
+
* file_size (Optional[int]): Size of the file.
|
|
416
|
+
* split_config (Optional[dict]): Configuration for splitting the knowledge.
|
|
417
|
+
* source_data (Optional[str]): Source data of the knowledge.
|
|
418
|
+
* auth_info (Optional[str]): Authentication information.
|
|
419
|
+
* embedding_model_name (Optional[str]): Name of the embedding model.
|
|
420
|
+
* metadata (Optional[dict]): Additional metadata.
|
|
421
|
+
*/
|
|
422
|
+
export interface IKnowledgeCreate {
|
|
423
|
+
/**
|
|
424
|
+
* Space Id
|
|
425
|
+
* the space of knowledge, example: petercat bot id, github repo name
|
|
426
|
+
*/
|
|
427
|
+
space_id: string;
|
|
428
|
+
/**
|
|
429
|
+
* type of knowledge resource
|
|
430
|
+
* @default "text"
|
|
431
|
+
*/
|
|
432
|
+
knowledge_type?: IKnowledgeTypeEnum;
|
|
433
|
+
/**
|
|
434
|
+
* Knowledge Name
|
|
435
|
+
* name of the knowledge resource
|
|
436
|
+
* @maxLength 255
|
|
437
|
+
*/
|
|
438
|
+
knowledge_name: string;
|
|
439
|
+
/**
|
|
440
|
+
* source type
|
|
441
|
+
* @default "user_input_text"
|
|
442
|
+
*/
|
|
443
|
+
source_type?: IKnowledgeSourceEnum;
|
|
444
|
+
/**
|
|
445
|
+
* Source Config
|
|
446
|
+
* source config of the knowledge
|
|
447
|
+
*/
|
|
448
|
+
source_config: IGithubRepoSourceConfig | IGithubFileSourceConfig | IS3SourceConfig | ITextSourceConfig;
|
|
449
|
+
/**
|
|
450
|
+
* Embedding Model Name
|
|
451
|
+
* name of the embedding model. you can set any other model if target embedding service registered
|
|
452
|
+
* @default "openai"
|
|
453
|
+
*/
|
|
454
|
+
embedding_model_name?: IEmbeddingModelEnum | string;
|
|
455
|
+
/**
|
|
456
|
+
* Split Config
|
|
457
|
+
* configuration for splitting the knowledge
|
|
458
|
+
*/
|
|
459
|
+
split_config: IBaseCharSplitConfig | IMarkdownSplitConfig | IPDFSplitConfig | ITextSplitConfig | IJSONSplitConfig;
|
|
460
|
+
/**
|
|
461
|
+
* File Sha
|
|
462
|
+
* SHA of the file
|
|
463
|
+
*/
|
|
464
|
+
file_sha?: string | null;
|
|
465
|
+
/**
|
|
466
|
+
* File Size
|
|
467
|
+
* size of the file
|
|
468
|
+
*/
|
|
469
|
+
file_size?: number | null;
|
|
470
|
+
/**
|
|
471
|
+
* Metadata
|
|
472
|
+
* additional metadata, user can update it
|
|
473
|
+
* @default {}
|
|
474
|
+
*/
|
|
475
|
+
metadata?: object;
|
|
476
|
+
/**
|
|
477
|
+
* Parent Id
|
|
478
|
+
* parent knowledge id
|
|
479
|
+
*/
|
|
480
|
+
parent_id?: string | null;
|
|
481
|
+
/**
|
|
482
|
+
* Enabled
|
|
483
|
+
* is knowledge enabled
|
|
484
|
+
* @default true
|
|
485
|
+
*/
|
|
486
|
+
enabled?: boolean;
|
|
487
|
+
}
|
|
488
|
+
/** KnowledgeSourceEnum */
|
|
489
|
+
export declare enum IKnowledgeSourceEnum {
|
|
490
|
+
GithubRepo = "github_repo",
|
|
491
|
+
GithubFile = "github_file",
|
|
492
|
+
UserInputText = "user_input_text",
|
|
493
|
+
UserUploadFile = "user_upload_file"
|
|
494
|
+
}
|
|
495
|
+
/**
|
|
496
|
+
* KnowledgeTypeEnum
|
|
497
|
+
* mime type of the knowledge
|
|
498
|
+
*/
|
|
499
|
+
export declare enum IKnowledgeTypeEnum {
|
|
500
|
+
Text = "text",
|
|
501
|
+
Image = "image",
|
|
502
|
+
Markdown = "markdown",
|
|
503
|
+
Json = "json",
|
|
504
|
+
Docx = "docx",
|
|
505
|
+
Pdf = "pdf",
|
|
506
|
+
Qa = "qa",
|
|
507
|
+
Folder = "folder"
|
|
508
|
+
}
|
|
509
|
+
/** MarkdownCreate */
|
|
510
|
+
export interface IMarkdownCreate {
|
|
511
|
+
/**
|
|
512
|
+
* Space Id
|
|
513
|
+
* the space of knowledge, example: petercat bot id, github repo name
|
|
514
|
+
*/
|
|
515
|
+
space_id: string;
|
|
516
|
+
/**
|
|
517
|
+
* Knowledge Type
|
|
518
|
+
* type of knowledge resource
|
|
519
|
+
* @default "markdown"
|
|
520
|
+
*/
|
|
521
|
+
knowledge_type?: "markdown";
|
|
522
|
+
/**
|
|
523
|
+
* Knowledge Name
|
|
524
|
+
* name of the knowledge resource
|
|
525
|
+
* @maxLength 255
|
|
526
|
+
*/
|
|
527
|
+
knowledge_name: string;
|
|
528
|
+
/**
|
|
529
|
+
* Metadata
|
|
530
|
+
* additional metadata, user can update it
|
|
531
|
+
* @default {}
|
|
532
|
+
*/
|
|
533
|
+
metadata?: object;
|
|
534
|
+
/** source type */
|
|
535
|
+
source_type: IKnowledgeSourceEnum;
|
|
536
|
+
/**
|
|
537
|
+
* Embedding Model Name
|
|
538
|
+
* name of the embedding model. you can set any other model if target embedding service registered
|
|
539
|
+
* @default "openai"
|
|
540
|
+
*/
|
|
541
|
+
embedding_model_name?: IEmbeddingModelEnum | string;
|
|
542
|
+
/**
|
|
543
|
+
* File Sha
|
|
544
|
+
* SHA of the file
|
|
545
|
+
*/
|
|
546
|
+
file_sha?: string | null;
|
|
547
|
+
/**
|
|
548
|
+
* File Size
|
|
549
|
+
* size of the file
|
|
550
|
+
*/
|
|
551
|
+
file_size?: number | null;
|
|
552
|
+
/**
|
|
553
|
+
* Source Config
|
|
554
|
+
* source config of the knowledge
|
|
555
|
+
*/
|
|
556
|
+
source_config: ITextSourceConfig | IOpenUrlSourceConfig | IOpenIdSourceConfig | IS3SourceConfig;
|
|
557
|
+
/** split config of the knowledge */
|
|
558
|
+
split_config: IMarkdownSplitConfig;
|
|
559
|
+
}
|
|
560
|
+
/**
|
|
561
|
+
* MarkdownSplitConfig
|
|
562
|
+
* Markdown document split configuration
|
|
563
|
+
*/
|
|
564
|
+
export interface IMarkdownSplitConfig {
|
|
565
|
+
/**
|
|
566
|
+
* Chunk Size
|
|
567
|
+
* @min 1
|
|
568
|
+
* @exclusiveMax 5000
|
|
569
|
+
* @default 1500
|
|
570
|
+
*/
|
|
571
|
+
chunk_size?: number;
|
|
572
|
+
/**
|
|
573
|
+
* Chunk Overlap
|
|
574
|
+
* @min 0
|
|
575
|
+
* @default 150
|
|
576
|
+
*/
|
|
577
|
+
chunk_overlap?: number;
|
|
578
|
+
/**
|
|
579
|
+
* Separators
|
|
580
|
+
* separator list
|
|
581
|
+
*/
|
|
582
|
+
separators: string[] | null;
|
|
583
|
+
/**
|
|
584
|
+
* Split Regex
|
|
585
|
+
* split_regex
|
|
586
|
+
*/
|
|
587
|
+
split_regex: string | null;
|
|
588
|
+
}
|
|
589
|
+
/** OpenIdSourceConfig */
|
|
590
|
+
export interface IOpenIdSourceConfig {
|
|
591
|
+
/**
|
|
592
|
+
* Id
|
|
593
|
+
* cloud storage file id, used for afts
|
|
594
|
+
*/
|
|
595
|
+
id: string;
|
|
596
|
+
}
|
|
597
|
+
/** OpenUrlSourceConfig */
|
|
598
|
+
export interface IOpenUrlSourceConfig {
|
|
599
|
+
/**
|
|
600
|
+
* Url
|
|
601
|
+
* cloud storage url, such as oss, cos, etc.
|
|
602
|
+
*/
|
|
603
|
+
url: string;
|
|
604
|
+
}
|
|
605
|
+
/** PDFCreate */
|
|
606
|
+
export interface IPDFCreate {
|
|
607
|
+
/**
|
|
608
|
+
* Space Id
|
|
609
|
+
* the space of knowledge, example: petercat bot id, github repo name
|
|
610
|
+
*/
|
|
611
|
+
space_id: string;
|
|
612
|
+
/**
|
|
613
|
+
* Knowledge Type
|
|
614
|
+
* type of knowledge resource
|
|
615
|
+
* @default "pdf"
|
|
616
|
+
*/
|
|
617
|
+
knowledge_type?: "pdf";
|
|
618
|
+
/**
|
|
619
|
+
* Knowledge Name
|
|
620
|
+
* name of the knowledge resource
|
|
621
|
+
* @maxLength 255
|
|
622
|
+
*/
|
|
623
|
+
knowledge_name: string;
|
|
624
|
+
/**
|
|
625
|
+
* Metadata
|
|
626
|
+
* additional metadata, user can update it
|
|
627
|
+
* @default {}
|
|
628
|
+
*/
|
|
629
|
+
metadata?: object;
|
|
630
|
+
/** source type */
|
|
631
|
+
source_type: IKnowledgeSourceEnum;
|
|
632
|
+
/**
|
|
633
|
+
* Embedding Model Name
|
|
634
|
+
* name of the embedding model. you can set any other model if target embedding service registered
|
|
635
|
+
* @default "openai"
|
|
636
|
+
*/
|
|
637
|
+
embedding_model_name?: IEmbeddingModelEnum | string;
|
|
638
|
+
/**
|
|
639
|
+
* File Sha
|
|
640
|
+
* SHA of the file
|
|
641
|
+
*/
|
|
642
|
+
file_sha: string;
|
|
643
|
+
/**
|
|
644
|
+
* File Size
|
|
645
|
+
* Byte size of the file
|
|
646
|
+
*/
|
|
647
|
+
file_size: number;
|
|
648
|
+
/**
|
|
649
|
+
* Source Config
|
|
650
|
+
* source config of the knowledge
|
|
651
|
+
*/
|
|
652
|
+
source_config: IOpenUrlSourceConfig | IOpenIdSourceConfig | IS3SourceConfig;
|
|
653
|
+
/** split config of the knowledge */
|
|
654
|
+
split_config: IPDFSplitConfig;
|
|
655
|
+
}
|
|
656
|
+
/**
|
|
657
|
+
* PDFSplitConfig
|
|
658
|
+
* PDF document split configuration
|
|
659
|
+
*/
|
|
660
|
+
export interface IPDFSplitConfig {
|
|
661
|
+
/**
|
|
662
|
+
* Chunk Size
|
|
663
|
+
* @min 1
|
|
664
|
+
* @exclusiveMax 5000
|
|
665
|
+
* @default 1500
|
|
666
|
+
*/
|
|
667
|
+
chunk_size?: number;
|
|
668
|
+
/**
|
|
669
|
+
* Chunk Overlap
|
|
670
|
+
* @min 0
|
|
671
|
+
* @default 150
|
|
672
|
+
*/
|
|
673
|
+
chunk_overlap?: number;
|
|
674
|
+
/**
|
|
675
|
+
* Split By Page
|
|
676
|
+
* Whether to split by pages
|
|
677
|
+
* @default false
|
|
678
|
+
*/
|
|
679
|
+
split_by_page?: boolean;
|
|
680
|
+
/**
|
|
681
|
+
* Keep Layout
|
|
682
|
+
* Whether to preserve the original layout
|
|
683
|
+
* @default true
|
|
684
|
+
*/
|
|
685
|
+
keep_layout?: boolean;
|
|
686
|
+
/**
|
|
687
|
+
* Extract Images
|
|
688
|
+
* Whether to extract images
|
|
689
|
+
* @default false
|
|
690
|
+
*/
|
|
691
|
+
extract_images?: boolean;
|
|
692
|
+
/**
|
|
693
|
+
* Table Extract Mode
|
|
694
|
+
* Table extraction mode: 'text' or 'structure'
|
|
695
|
+
* @default "text"
|
|
696
|
+
*/
|
|
697
|
+
table_extract_mode?: string;
|
|
698
|
+
}
|
|
699
|
+
/** PageParams[Chunk] */
|
|
700
|
+
export interface IPageParamsChunk {
|
|
701
|
+
/**
|
|
702
|
+
* Page
|
|
703
|
+
* page number
|
|
704
|
+
* @min 1
|
|
705
|
+
* @default 1
|
|
706
|
+
*/
|
|
707
|
+
page?: number;
|
|
708
|
+
/**
|
|
709
|
+
* Page Size
|
|
710
|
+
* page size
|
|
711
|
+
* @min 1
|
|
712
|
+
* @max 1000
|
|
713
|
+
* @default 10
|
|
714
|
+
*/
|
|
715
|
+
page_size?: number;
|
|
716
|
+
/**
|
|
717
|
+
* Order By
|
|
718
|
+
* order by field
|
|
719
|
+
*/
|
|
720
|
+
order_by?: string | null;
|
|
721
|
+
/**
|
|
722
|
+
* Order Direction
|
|
723
|
+
* asc or desc
|
|
724
|
+
* @default "asc"
|
|
725
|
+
*/
|
|
726
|
+
order_direction?: string | null;
|
|
727
|
+
/**
|
|
728
|
+
* Eq Conditions
|
|
729
|
+
* list of equality conditions, each as a dict with key and value
|
|
730
|
+
*/
|
|
731
|
+
eq_conditions?: object | null;
|
|
732
|
+
}
|
|
733
|
+
/** PageParams[Knowledge] */
|
|
734
|
+
export interface IPageParamsKnowledge {
|
|
735
|
+
/**
|
|
736
|
+
* Page
|
|
737
|
+
* page number
|
|
738
|
+
* @min 1
|
|
739
|
+
* @default 1
|
|
740
|
+
*/
|
|
741
|
+
page?: number;
|
|
742
|
+
/**
|
|
743
|
+
* Page Size
|
|
744
|
+
* page size
|
|
745
|
+
* @min 1
|
|
746
|
+
* @max 1000
|
|
747
|
+
* @default 10
|
|
748
|
+
*/
|
|
749
|
+
page_size?: number;
|
|
750
|
+
/**
|
|
751
|
+
* Order By
|
|
752
|
+
* order by field
|
|
753
|
+
*/
|
|
754
|
+
order_by?: string | null;
|
|
755
|
+
/**
|
|
756
|
+
* Order Direction
|
|
757
|
+
* asc or desc
|
|
758
|
+
* @default "asc"
|
|
759
|
+
*/
|
|
760
|
+
order_direction?: string | null;
|
|
761
|
+
/**
|
|
762
|
+
* Eq Conditions
|
|
763
|
+
* list of equality conditions, each as a dict with key and value
|
|
764
|
+
*/
|
|
765
|
+
eq_conditions?: object | null;
|
|
766
|
+
}
|
|
767
|
+
/** PageParams[Task] */
|
|
768
|
+
export interface IPageParamsTask {
|
|
769
|
+
/**
|
|
770
|
+
* Page
|
|
771
|
+
* page number
|
|
772
|
+
* @min 1
|
|
773
|
+
* @default 1
|
|
774
|
+
*/
|
|
775
|
+
page?: number;
|
|
776
|
+
/**
|
|
777
|
+
* Page Size
|
|
778
|
+
* page size
|
|
779
|
+
* @min 1
|
|
780
|
+
* @max 1000
|
|
781
|
+
* @default 10
|
|
782
|
+
*/
|
|
783
|
+
page_size?: number;
|
|
784
|
+
/**
|
|
785
|
+
* Order By
|
|
786
|
+
* order by field
|
|
787
|
+
*/
|
|
788
|
+
order_by?: string | null;
|
|
789
|
+
/**
|
|
790
|
+
* Order Direction
|
|
791
|
+
* asc or desc
|
|
792
|
+
* @default "asc"
|
|
793
|
+
*/
|
|
794
|
+
order_direction?: string | null;
|
|
795
|
+
/**
|
|
796
|
+
* Eq Conditions
|
|
797
|
+
* list of equality conditions, each as a dict with key and value
|
|
798
|
+
*/
|
|
799
|
+
eq_conditions?: object | null;
|
|
800
|
+
}
|
|
801
|
+
/** PageResponse[Chunk] */
|
|
802
|
+
export interface IPageResponseChunk {
|
|
803
|
+
/** Items */
|
|
804
|
+
items: IChunk[];
|
|
805
|
+
/** Total */
|
|
806
|
+
total: number;
|
|
807
|
+
/** Page */
|
|
808
|
+
page: number;
|
|
809
|
+
/** Page Size */
|
|
810
|
+
page_size: number;
|
|
811
|
+
/** Total Pages */
|
|
812
|
+
total_pages: number;
|
|
813
|
+
}
|
|
814
|
+
/** PageResponse[Knowledge] */
|
|
815
|
+
export interface IPageResponseKnowledge {
|
|
816
|
+
/** Items */
|
|
817
|
+
items: IKnowledge[];
|
|
818
|
+
/** Total */
|
|
819
|
+
total: number;
|
|
820
|
+
/** Page */
|
|
821
|
+
page: number;
|
|
822
|
+
/** Page Size */
|
|
823
|
+
page_size: number;
|
|
824
|
+
/** Total Pages */
|
|
825
|
+
total_pages: number;
|
|
826
|
+
}
|
|
827
|
+
/** PageResponse[Task] */
|
|
828
|
+
export interface IPageResponseTask {
|
|
829
|
+
/** Items */
|
|
830
|
+
items: ITask[];
|
|
831
|
+
/** Total */
|
|
832
|
+
total: number;
|
|
833
|
+
/** Page */
|
|
834
|
+
page: number;
|
|
835
|
+
/** Page Size */
|
|
836
|
+
page_size: number;
|
|
837
|
+
/** Total Pages */
|
|
838
|
+
total_pages: number;
|
|
839
|
+
}
|
|
840
|
+
/** QACreate */
|
|
841
|
+
export interface IQACreate {
|
|
842
|
+
/**
|
|
843
|
+
* Space Id
|
|
844
|
+
* the space of knowledge, example: petercat bot id, github repo name
|
|
845
|
+
*/
|
|
846
|
+
space_id: string;
|
|
847
|
+
/**
|
|
848
|
+
* Knowledge Type
|
|
849
|
+
* type of knowledge resource
|
|
850
|
+
* @default "qa"
|
|
851
|
+
*/
|
|
852
|
+
knowledge_type?: "qa";
|
|
853
|
+
/**
|
|
854
|
+
* Knowledge Name
|
|
855
|
+
* name of the knowledge resource
|
|
856
|
+
* @maxLength 255
|
|
857
|
+
*/
|
|
858
|
+
knowledge_name: string;
|
|
859
|
+
/**
|
|
860
|
+
* Metadata
|
|
861
|
+
* additional metadata, user can update it
|
|
862
|
+
* @default {}
|
|
863
|
+
*/
|
|
864
|
+
metadata?: object;
|
|
865
|
+
/** source type */
|
|
866
|
+
source_type: IKnowledgeSourceEnum;
|
|
867
|
+
/**
|
|
868
|
+
* Embedding Model Name
|
|
869
|
+
* name of the embedding model. you can set any other model if target embedding service registered
|
|
870
|
+
* @default "openai"
|
|
871
|
+
*/
|
|
872
|
+
embedding_model_name?: IEmbeddingModelEnum | string;
|
|
873
|
+
/**
|
|
874
|
+
* File Sha
|
|
875
|
+
* SHA of the file
|
|
876
|
+
*/
|
|
877
|
+
file_sha?: string | null;
|
|
878
|
+
/**
|
|
879
|
+
* File Size
|
|
880
|
+
* size of the file
|
|
881
|
+
*/
|
|
882
|
+
file_size?: number | null;
|
|
883
|
+
/**
|
|
884
|
+
* Question
|
|
885
|
+
* question of the knowledge resource
|
|
886
|
+
*/
|
|
887
|
+
question: string;
|
|
888
|
+
/**
|
|
889
|
+
* Answer
|
|
890
|
+
* answer of the knowledge resource
|
|
891
|
+
*/
|
|
892
|
+
answer: string;
|
|
893
|
+
/** split config of the knowledge */
|
|
894
|
+
split_config: ITextSplitConfig;
|
|
895
|
+
/** source config of the knowledge */
|
|
896
|
+
source_config?: ITextSourceConfig | null;
|
|
897
|
+
}
|
|
898
|
+
/** ResponseModel */
|
|
899
|
+
export interface IResponseModel {
|
|
900
|
+
/** Success */
|
|
901
|
+
success: boolean;
|
|
902
|
+
/** Data */
|
|
903
|
+
data?: null;
|
|
904
|
+
/** Message */
|
|
905
|
+
message?: string | null;
|
|
906
|
+
}
|
|
907
|
+
/** ResponseModel[Knowledge] */
|
|
908
|
+
export interface IResponseModelKnowledge {
|
|
909
|
+
/** Success */
|
|
910
|
+
success: boolean;
|
|
911
|
+
data?: IKnowledge | null;
|
|
912
|
+
/** Message */
|
|
913
|
+
message?: string | null;
|
|
914
|
+
}
|
|
915
|
+
/** ResponseModel[List[Knowledge]] */
|
|
916
|
+
export interface IResponseModelListKnowledge {
|
|
917
|
+
/** Success */
|
|
918
|
+
success: boolean;
|
|
919
|
+
/** Data */
|
|
920
|
+
data?: IKnowledge[] | null;
|
|
921
|
+
/** Message */
|
|
922
|
+
message?: string | null;
|
|
923
|
+
}
|
|
924
|
+
/** ResponseModel[List[RetrievalChunk]] */
|
|
925
|
+
export interface IResponseModelListRetrievalChunk {
|
|
926
|
+
/** Success */
|
|
927
|
+
success: boolean;
|
|
928
|
+
/** Data */
|
|
929
|
+
data?: IRetrievalChunk[] | null;
|
|
930
|
+
/** Message */
|
|
931
|
+
message?: string | null;
|
|
932
|
+
}
|
|
933
|
+
/** ResponseModel[List[Task]] */
|
|
934
|
+
export interface IResponseModelListTask {
|
|
935
|
+
/** Success */
|
|
936
|
+
success: boolean;
|
|
937
|
+
/** Data */
|
|
938
|
+
data?: ITask[] | null;
|
|
939
|
+
/** Message */
|
|
940
|
+
message?: string | null;
|
|
941
|
+
}
|
|
942
|
+
/** ResponseModel[NoneType] */
|
|
943
|
+
export interface IResponseModelNoneType {
|
|
944
|
+
/** Success */
|
|
945
|
+
success: boolean;
|
|
946
|
+
/** Data */
|
|
947
|
+
data?: null;
|
|
948
|
+
/** Message */
|
|
949
|
+
message?: string | null;
|
|
950
|
+
}
|
|
951
|
+
/** ResponseModel[PageResponse[Chunk]] */
|
|
952
|
+
export interface IResponseModelPageResponseChunk {
|
|
953
|
+
/** Success */
|
|
954
|
+
success: boolean;
|
|
955
|
+
data?: IPageResponseChunk | null;
|
|
956
|
+
/** Message */
|
|
957
|
+
message?: string | null;
|
|
958
|
+
}
|
|
959
|
+
/** ResponseModel[PageResponse[Knowledge]] */
|
|
960
|
+
export interface IResponseModelPageResponseKnowledge {
|
|
961
|
+
/** Success */
|
|
962
|
+
success: boolean;
|
|
963
|
+
data?: IPageResponseKnowledge | null;
|
|
964
|
+
/** Message */
|
|
965
|
+
message?: string | null;
|
|
966
|
+
}
|
|
967
|
+
/** ResponseModel[PageResponse[Task]] */
|
|
968
|
+
export interface IResponseModelPageResponseTask {
|
|
969
|
+
/** Success */
|
|
970
|
+
success: boolean;
|
|
971
|
+
data?: IPageResponseTask | null;
|
|
972
|
+
/** Message */
|
|
973
|
+
message?: string | null;
|
|
974
|
+
}
|
|
975
|
+
/** ResponseModel[Task] */
|
|
976
|
+
export interface IResponseModelTask {
|
|
977
|
+
/** Success */
|
|
978
|
+
success: boolean;
|
|
979
|
+
data?: ITask | null;
|
|
980
|
+
/** Message */
|
|
981
|
+
message?: string | null;
|
|
982
|
+
}
|
|
983
|
+
/** ResponseModel[Tenant] */
|
|
984
|
+
export interface IResponseModelTenant {
|
|
985
|
+
/** Success */
|
|
986
|
+
success: boolean;
|
|
987
|
+
data?: ITenant | null;
|
|
988
|
+
/** Message */
|
|
989
|
+
message?: string | null;
|
|
990
|
+
}
|
|
991
|
+
/** RetrievalByKnowledgeRequest */
|
|
992
|
+
export interface IRetrievalByKnowledgeRequest {
|
|
993
|
+
/**
|
|
994
|
+
* Question
|
|
995
|
+
* The query question
|
|
996
|
+
*/
|
|
997
|
+
question: string;
|
|
998
|
+
/** The name of the embedding model */
|
|
999
|
+
embedding_model_name: IEmbeddingModelEnum;
|
|
1000
|
+
/**
|
|
1001
|
+
* Similarity Threshold
|
|
1002
|
+
* The similarity threshold, ranging from 0.0 to 1.0.
|
|
1003
|
+
* @min 0
|
|
1004
|
+
* @max 1
|
|
1005
|
+
* @default 0.5
|
|
1006
|
+
*/
|
|
1007
|
+
similarity_threshold?: number;
|
|
1008
|
+
/**
|
|
1009
|
+
* Top
|
|
1010
|
+
* The maximum number of results to return.
|
|
1011
|
+
* @min 1
|
|
1012
|
+
* @default 1024
|
|
1013
|
+
*/
|
|
1014
|
+
top?: number;
|
|
1015
|
+
/**
|
|
1016
|
+
* Metadata Filter
|
|
1017
|
+
* metadata filter
|
|
1018
|
+
* @default {}
|
|
1019
|
+
*/
|
|
1020
|
+
metadata_filter?: object;
|
|
1021
|
+
/**
|
|
1022
|
+
* Knowledge Id List
|
|
1023
|
+
* knowledge id list
|
|
1024
|
+
*/
|
|
1025
|
+
knowledge_id_list: string[];
|
|
1026
|
+
}
|
|
1027
|
+
/** RetrievalBySpaceRequest */
|
|
1028
|
+
export interface IRetrievalBySpaceRequest {
|
|
1029
|
+
/**
|
|
1030
|
+
* Question
|
|
1031
|
+
* The query question
|
|
1032
|
+
*/
|
|
1033
|
+
question: string;
|
|
1034
|
+
/** The name of the embedding model */
|
|
1035
|
+
embedding_model_name: IEmbeddingModelEnum;
|
|
1036
|
+
/**
|
|
1037
|
+
* Similarity Threshold
|
|
1038
|
+
* The similarity threshold, ranging from 0.0 to 1.0.
|
|
1039
|
+
* @min 0
|
|
1040
|
+
* @max 1
|
|
1041
|
+
* @default 0.5
|
|
1042
|
+
*/
|
|
1043
|
+
similarity_threshold?: number;
|
|
1044
|
+
/**
|
|
1045
|
+
* Top
|
|
1046
|
+
* The maximum number of results to return.
|
|
1047
|
+
* @min 1
|
|
1048
|
+
* @default 1024
|
|
1049
|
+
*/
|
|
1050
|
+
top?: number;
|
|
1051
|
+
/**
|
|
1052
|
+
* Metadata Filter
|
|
1053
|
+
* metadata filter
|
|
1054
|
+
* @default {}
|
|
1055
|
+
*/
|
|
1056
|
+
metadata_filter?: object;
|
|
1057
|
+
/**
|
|
1058
|
+
* Space Id List
|
|
1059
|
+
* space id list
|
|
1060
|
+
*/
|
|
1061
|
+
space_id_list: string[];
|
|
1062
|
+
}
|
|
1063
|
+
/** RetrievalChunk */
|
|
1064
|
+
export interface IRetrievalChunk {
|
|
1065
|
+
/**
|
|
1066
|
+
* Chunk Id
|
|
1067
|
+
* chunk id
|
|
1068
|
+
*/
|
|
1069
|
+
chunk_id?: string;
|
|
1070
|
+
/**
|
|
1071
|
+
* Space Id
|
|
1072
|
+
* space id
|
|
1073
|
+
*/
|
|
1074
|
+
space_id: string;
|
|
1075
|
+
/**
|
|
1076
|
+
* Tenant Id
|
|
1077
|
+
* tenant id
|
|
1078
|
+
*/
|
|
1079
|
+
tenant_id: string;
|
|
1080
|
+
/**
|
|
1081
|
+
* Embedding
|
|
1082
|
+
* chunk embedding
|
|
1083
|
+
*/
|
|
1084
|
+
embedding?: number[] | null;
|
|
1085
|
+
/**
|
|
1086
|
+
* Context
|
|
1087
|
+
* chunk content
|
|
1088
|
+
*/
|
|
1089
|
+
context: string;
|
|
1090
|
+
/**
|
|
1091
|
+
* Knowledge Id
|
|
1092
|
+
* file source info
|
|
1093
|
+
*/
|
|
1094
|
+
knowledge_id: string;
|
|
1095
|
+
/**
|
|
1096
|
+
* Embedding Model Name
|
|
1097
|
+
* name of the embedding model
|
|
1098
|
+
*/
|
|
1099
|
+
embedding_model_name?: string;
|
|
1100
|
+
/**
|
|
1101
|
+
* Metadata
|
|
1102
|
+
* Arbitrary metadata associated with the content.
|
|
1103
|
+
*/
|
|
1104
|
+
metadata?: object | null;
|
|
1105
|
+
/**
|
|
1106
|
+
* Gmt Create
|
|
1107
|
+
* creation time
|
|
1108
|
+
*/
|
|
1109
|
+
gmt_create?: string;
|
|
1110
|
+
/**
|
|
1111
|
+
* Gmt Modified
|
|
1112
|
+
* update time
|
|
1113
|
+
*/
|
|
1114
|
+
gmt_modified?: string;
|
|
1115
|
+
/**
|
|
1116
|
+
* Similarity
|
|
1117
|
+
* The similarity of the chunk
|
|
1118
|
+
*/
|
|
1119
|
+
similarity: number;
|
|
1120
|
+
}
|
|
1121
|
+
/** S3SourceConfig */
|
|
1122
|
+
export interface IS3SourceConfig {
|
|
1123
|
+
/**
|
|
1124
|
+
* Bucket
|
|
1125
|
+
* s3 bucket name
|
|
1126
|
+
*/
|
|
1127
|
+
bucket: string;
|
|
1128
|
+
/**
|
|
1129
|
+
* Key
|
|
1130
|
+
* s3 key
|
|
1131
|
+
*/
|
|
1132
|
+
key: string;
|
|
1133
|
+
/**
|
|
1134
|
+
* Version Id
|
|
1135
|
+
* s3 version id
|
|
1136
|
+
*/
|
|
1137
|
+
version_id?: string | null;
|
|
1138
|
+
/**
|
|
1139
|
+
* Region
|
|
1140
|
+
* s3 region
|
|
1141
|
+
*/
|
|
1142
|
+
region?: string | null;
|
|
1143
|
+
/**
|
|
1144
|
+
* Access Key
|
|
1145
|
+
* s3 access key
|
|
1146
|
+
*/
|
|
1147
|
+
access_key?: string | null;
|
|
1148
|
+
/**
|
|
1149
|
+
* Secret Key
|
|
1150
|
+
* s3 secret key
|
|
1151
|
+
*/
|
|
1152
|
+
secret_key?: string | null;
|
|
1153
|
+
/**
|
|
1154
|
+
* Session Token
|
|
1155
|
+
* s3 session token
|
|
1156
|
+
*/
|
|
1157
|
+
session_token?: string | null;
|
|
1158
|
+
}
|
|
1159
|
+
/** Task */
|
|
1160
|
+
export interface ITask {
|
|
1161
|
+
/**
|
|
1162
|
+
* Task Id
|
|
1163
|
+
* Unique identifier for the task
|
|
1164
|
+
*/
|
|
1165
|
+
task_id?: string;
|
|
1166
|
+
/**
|
|
1167
|
+
* Current status of the task
|
|
1168
|
+
* @default "pending"
|
|
1169
|
+
*/
|
|
1170
|
+
status?: ITaskStatus;
|
|
1171
|
+
/**
|
|
1172
|
+
* Knowledge Id
|
|
1173
|
+
* Identifier for the source file
|
|
1174
|
+
*/
|
|
1175
|
+
knowledge_id: string;
|
|
1176
|
+
/**
|
|
1177
|
+
* Metadata
|
|
1178
|
+
* Metadata for the task
|
|
1179
|
+
*/
|
|
1180
|
+
metadata?: object | null;
|
|
1181
|
+
/**
|
|
1182
|
+
* Error Message
|
|
1183
|
+
* Error message (only present if the task failed)
|
|
1184
|
+
*/
|
|
1185
|
+
error_message?: string | null;
|
|
1186
|
+
/**
|
|
1187
|
+
* Space Id
|
|
1188
|
+
* Identifier for the space
|
|
1189
|
+
*/
|
|
1190
|
+
space_id: string;
|
|
1191
|
+
/**
|
|
1192
|
+
* User Id
|
|
1193
|
+
* Identifier for the user
|
|
1194
|
+
*/
|
|
1195
|
+
user_id?: string | null;
|
|
1196
|
+
/**
|
|
1197
|
+
* Tenant Id
|
|
1198
|
+
* Identifier for the tenant
|
|
1199
|
+
*/
|
|
1200
|
+
tenant_id: string;
|
|
1201
|
+
/**
|
|
1202
|
+
* Gmt Create
|
|
1203
|
+
* Task creation time
|
|
1204
|
+
*/
|
|
1205
|
+
gmt_create?: string;
|
|
1206
|
+
/**
|
|
1207
|
+
* Gmt Modified
|
|
1208
|
+
* Last update time
|
|
1209
|
+
*/
|
|
1210
|
+
gmt_modified?: string;
|
|
1211
|
+
}
|
|
1212
|
+
/** TaskRestartRequest */
|
|
1213
|
+
export interface ITaskRestartRequest {
|
|
1214
|
+
/**
|
|
1215
|
+
* Task Id List
|
|
1216
|
+
* List of task IDs to restart
|
|
1217
|
+
*/
|
|
1218
|
+
task_id_list: string[];
|
|
1219
|
+
}
|
|
1220
|
+
/** TaskStatus */
|
|
1221
|
+
export declare enum ITaskStatus {
|
|
1222
|
+
Pending = "pending",
|
|
1223
|
+
Running = "running",
|
|
1224
|
+
Success = "success",
|
|
1225
|
+
Failed = "failed",
|
|
1226
|
+
Skipped = "skipped",
|
|
1227
|
+
Canceled = "canceled",
|
|
1228
|
+
PendingRetry = "pending_retry"
|
|
1229
|
+
}
|
|
1230
|
+
/** Tenant */
|
|
1231
|
+
export interface ITenant {
|
|
1232
|
+
/**
|
|
1233
|
+
* Tenant Id
|
|
1234
|
+
* tenant id
|
|
1235
|
+
*/
|
|
1236
|
+
tenant_id?: string;
|
|
1237
|
+
/**
|
|
1238
|
+
* Tenant Name
|
|
1239
|
+
* tenant name
|
|
1240
|
+
* @default ""
|
|
1241
|
+
*/
|
|
1242
|
+
tenant_name?: string;
|
|
1243
|
+
/**
|
|
1244
|
+
* Email
|
|
1245
|
+
* email
|
|
1246
|
+
*/
|
|
1247
|
+
email: string;
|
|
1248
|
+
/**
|
|
1249
|
+
* Secret Key
|
|
1250
|
+
* secret_key
|
|
1251
|
+
* @default ""
|
|
1252
|
+
*/
|
|
1253
|
+
secret_key?: string;
|
|
1254
|
+
/**
|
|
1255
|
+
* Is Active
|
|
1256
|
+
* is active
|
|
1257
|
+
* @default true
|
|
1258
|
+
*/
|
|
1259
|
+
is_active?: boolean;
|
|
1260
|
+
/**
|
|
1261
|
+
* Gmt Create
|
|
1262
|
+
* tenant created time
|
|
1263
|
+
*/
|
|
1264
|
+
gmt_create?: string;
|
|
1265
|
+
/**
|
|
1266
|
+
* Gmt Modified
|
|
1267
|
+
* tenant updated time
|
|
1268
|
+
*/
|
|
1269
|
+
gmt_modified?: string;
|
|
1270
|
+
}
|
|
1271
|
+
/** TenantCreate */
|
|
1272
|
+
export interface ITenantCreate {
|
|
1273
|
+
/** Tenant Name */
|
|
1274
|
+
tenant_name: string;
|
|
1275
|
+
/** Email */
|
|
1276
|
+
email?: string | null;
|
|
1277
|
+
}
|
|
1278
|
+
/** TextCreate */
|
|
1279
|
+
export interface ITextCreate {
|
|
1280
|
+
/**
|
|
1281
|
+
* Space Id
|
|
1282
|
+
* the space of knowledge, example: petercat bot id, github repo name
|
|
1283
|
+
*/
|
|
1284
|
+
space_id: string;
|
|
1285
|
+
/**
|
|
1286
|
+
* Knowledge Type
|
|
1287
|
+
* type of knowledge resource
|
|
1288
|
+
* @default "text"
|
|
1289
|
+
*/
|
|
1290
|
+
knowledge_type?: "text";
|
|
1291
|
+
/**
|
|
1292
|
+
* Knowledge Name
|
|
1293
|
+
* name of the knowledge resource
|
|
1294
|
+
* @maxLength 255
|
|
1295
|
+
*/
|
|
1296
|
+
knowledge_name: string;
|
|
1297
|
+
/**
|
|
1298
|
+
* Metadata
|
|
1299
|
+
* additional metadata, user can update it
|
|
1300
|
+
* @default {}
|
|
1301
|
+
*/
|
|
1302
|
+
metadata?: object;
|
|
1303
|
+
/** source type */
|
|
1304
|
+
source_type: IKnowledgeSourceEnum;
|
|
1305
|
+
/**
|
|
1306
|
+
* Embedding Model Name
|
|
1307
|
+
* name of the embedding model. you can set any other model if target embedding service registered
|
|
1308
|
+
* @default "openai"
|
|
1309
|
+
*/
|
|
1310
|
+
embedding_model_name?: IEmbeddingModelEnum | string;
|
|
1311
|
+
/**
|
|
1312
|
+
* File Sha
|
|
1313
|
+
* SHA of the file
|
|
1314
|
+
*/
|
|
1315
|
+
file_sha?: string | null;
|
|
1316
|
+
/**
|
|
1317
|
+
* File Size
|
|
1318
|
+
* size of the file
|
|
1319
|
+
*/
|
|
1320
|
+
file_size?: number | null;
|
|
1321
|
+
/**
|
|
1322
|
+
* Source Config
|
|
1323
|
+
* source config of the knowledge
|
|
1324
|
+
*/
|
|
1325
|
+
source_config: ITextSourceConfig | IOpenUrlSourceConfig | IOpenIdSourceConfig | IS3SourceConfig;
|
|
1326
|
+
/** split config of the knowledge */
|
|
1327
|
+
split_config: ITextSplitConfig;
|
|
1328
|
+
}
|
|
1329
|
+
/** TextSourceConfig */
|
|
1330
|
+
export interface ITextSourceConfig {
|
|
1331
|
+
/**
|
|
1332
|
+
* Text
|
|
1333
|
+
* Text content, length range 1-100000 characters
|
|
1334
|
+
* @minLength 1
|
|
1335
|
+
* @maxLength 100000
|
|
1336
|
+
* @default ""
|
|
1337
|
+
*/
|
|
1338
|
+
text?: string;
|
|
1339
|
+
}
|
|
1340
|
+
/**
|
|
1341
|
+
* TextSplitConfig
|
|
1342
|
+
* Plain text split configuration
|
|
1343
|
+
*/
|
|
1344
|
+
export interface ITextSplitConfig {
|
|
1345
|
+
/**
|
|
1346
|
+
* Chunk Size
|
|
1347
|
+
* @min 1
|
|
1348
|
+
* @exclusiveMax 5000
|
|
1349
|
+
* @default 1500
|
|
1350
|
+
*/
|
|
1351
|
+
chunk_size?: number;
|
|
1352
|
+
/**
|
|
1353
|
+
* Chunk Overlap
|
|
1354
|
+
* @min 0
|
|
1355
|
+
* @default 150
|
|
1356
|
+
*/
|
|
1357
|
+
chunk_overlap?: number;
|
|
1358
|
+
/**
|
|
1359
|
+
* Separators
|
|
1360
|
+
* List of separators to split the text. If None, uses default separators
|
|
1361
|
+
* @default ["\n\n"]
|
|
1362
|
+
*/
|
|
1363
|
+
separators?: string[];
|
|
1364
|
+
/**
|
|
1365
|
+
* Keep Separator
|
|
1366
|
+
* Whether to keep the separator and where to place it in each corresponding chunk (True='start')
|
|
1367
|
+
* @default false
|
|
1368
|
+
*/
|
|
1369
|
+
keep_separator?: boolean | "start" | "end" | null;
|
|
1370
|
+
/**
|
|
1371
|
+
* Strip Whitespace
|
|
1372
|
+
* If `True`, strips whitespace from the start and end of every document
|
|
1373
|
+
* @default false
|
|
1374
|
+
*/
|
|
1375
|
+
strip_whitespace?: boolean | null;
|
|
1376
|
+
}
|
|
1377
|
+
/** ValidationError */
|
|
1378
|
+
export interface IValidationError {
|
|
1379
|
+
/** Location */
|
|
1380
|
+
loc: (string | number)[];
|
|
1381
|
+
/** Message */
|
|
1382
|
+
msg: string;
|
|
1383
|
+
/** Error Type */
|
|
1384
|
+
type: string;
|
|
1385
|
+
}
|
|
1386
|
+
import type { AxiosInstance, AxiosRequestConfig, ResponseType } from "axios";
|
|
1387
|
+
export type QueryParamsType = Record<string | number, any>;
|
|
1388
|
+
export interface FullRequestParams extends Omit<AxiosRequestConfig, "data" | "params" | "url" | "responseType"> {
|
|
1389
|
+
/** set parameter to `true` for call `securityWorker` for this request */
|
|
1390
|
+
secure?: boolean;
|
|
1391
|
+
/** request path */
|
|
1392
|
+
path: string;
|
|
1393
|
+
/** content type of request body */
|
|
1394
|
+
type?: ContentType;
|
|
1395
|
+
/** query params */
|
|
1396
|
+
query?: QueryParamsType;
|
|
1397
|
+
/** format of response (i.e. response.json() -> format: "json") */
|
|
1398
|
+
format?: ResponseType;
|
|
1399
|
+
/** request body */
|
|
1400
|
+
body?: unknown;
|
|
1401
|
+
}
|
|
1402
|
+
export type RequestParams = Omit<FullRequestParams, "body" | "method" | "query" | "path">;
|
|
1403
|
+
export interface ApiConfig<SecurityDataType = unknown> extends Omit<AxiosRequestConfig, "data" | "cancelToken"> {
|
|
1404
|
+
securityWorker?: (securityData: SecurityDataType | null) => Promise<AxiosRequestConfig | void> | AxiosRequestConfig | void;
|
|
1405
|
+
secure?: boolean;
|
|
1406
|
+
format?: ResponseType;
|
|
1407
|
+
}
|
|
1408
|
+
export declare enum ContentType {
|
|
1409
|
+
Json = "application/json",
|
|
1410
|
+
FormData = "multipart/form-data",
|
|
1411
|
+
UrlEncoded = "application/x-www-form-urlencoded",
|
|
1412
|
+
Text = "text/plain"
|
|
1413
|
+
}
|
|
1414
|
+
export declare class HttpClient<SecurityDataType = unknown> {
|
|
1415
|
+
instance: AxiosInstance;
|
|
1416
|
+
private securityData;
|
|
1417
|
+
private securityWorker?;
|
|
1418
|
+
private secure?;
|
|
1419
|
+
private format?;
|
|
1420
|
+
constructor({ securityWorker, secure, format, ...axiosConfig }?: ApiConfig<SecurityDataType>);
|
|
1421
|
+
setSecurityData: (data: SecurityDataType | null) => void;
|
|
1422
|
+
protected mergeRequestParams(params1: AxiosRequestConfig, params2?: AxiosRequestConfig): AxiosRequestConfig;
|
|
1423
|
+
protected stringifyFormItem(formItem: unknown): string;
|
|
1424
|
+
protected createFormData(input: Record<string, unknown>): FormData;
|
|
1425
|
+
request: <T = any, _E = any>({ secure, path, type, query, format, body, ...params }: FullRequestParams) => Promise<T>;
|
|
1426
|
+
}
|
|
1427
|
+
/**
|
|
1428
|
+
* @title whisker rag server
|
|
1429
|
+
* @version 1.0.2
|
|
1430
|
+
*/
|
|
1431
|
+
export declare class Api<SecurityDataType extends unknown> extends HttpClient<SecurityDataType> {
|
|
1432
|
+
/**
|
|
1433
|
+
* No description
|
|
1434
|
+
*
|
|
1435
|
+
* @name HomePageGet
|
|
1436
|
+
* @summary Home Page
|
|
1437
|
+
* @request GET:/
|
|
1438
|
+
*/
|
|
1439
|
+
homePageGet: (params?: RequestParams) => Promise<any>;
|
|
1440
|
+
knowledge: {
|
|
1441
|
+
/**
|
|
1442
|
+
* @description Duplicate file_sha entries are prohibited. Any modifications to split_config or embedding model_name parameters must be performed using dedicated API endpoints."
|
|
1443
|
+
*
|
|
1444
|
+
* @tags knowledge
|
|
1445
|
+
* @name AddKnowledge
|
|
1446
|
+
* @summary Add Knowledge
|
|
1447
|
+
* @request POST:/api/knowledge/add
|
|
1448
|
+
*/
|
|
1449
|
+
addKnowledge: (data: (IKnowledgeCreate | ITextCreate | IImageCreate | IJSONCreate | IMarkdownCreate | IPDFCreate | IGithubRepoCreate | IQACreate)[], params?: RequestParams) => Promise<IResponseModelListKnowledge>;
|
|
1450
|
+
/**
|
|
1451
|
+
* No description
|
|
1452
|
+
*
|
|
1453
|
+
* @tags knowledge
|
|
1454
|
+
* @name GetKnowledgeList
|
|
1455
|
+
* @summary Get Knowledge List
|
|
1456
|
+
* @request POST:/api/knowledge/list
|
|
1457
|
+
*/
|
|
1458
|
+
getKnowledgeList: (data: IPageParamsKnowledge, params?: RequestParams) => Promise<IResponseModelPageResponseKnowledge>;
|
|
1459
|
+
/**
|
|
1460
|
+
* No description
|
|
1461
|
+
*
|
|
1462
|
+
* @tags knowledge
|
|
1463
|
+
* @name GetKnowledgeById
|
|
1464
|
+
* @summary Get Knowledge By Id
|
|
1465
|
+
* @request GET:/api/knowledge/detail
|
|
1466
|
+
*/
|
|
1467
|
+
getKnowledgeById: (query: {
|
|
1468
|
+
/** Knowledge Id */
|
|
1469
|
+
knowledge_id: string;
|
|
1470
|
+
}, params?: RequestParams) => Promise<IResponseModelKnowledge>;
|
|
1471
|
+
/**
|
|
1472
|
+
* @description Deletes a knowledge entry by its ID.
|
|
1473
|
+
*
|
|
1474
|
+
* @tags knowledge
|
|
1475
|
+
* @name DeleteKnowledge
|
|
1476
|
+
* @summary Delete Knowledge
|
|
1477
|
+
* @request DELETE:/api/knowledge/delete
|
|
1478
|
+
*/
|
|
1479
|
+
deleteKnowledge: (query: {
|
|
1480
|
+
/** Knowledge Id */
|
|
1481
|
+
knowledge_id: string;
|
|
1482
|
+
}, params?: RequestParams) => Promise<IResponseModelNoneType>;
|
|
1483
|
+
};
|
|
1484
|
+
retrieval: {
|
|
1485
|
+
/**
|
|
1486
|
+
* @description Retrieve certain chunks within a knowledge_id, for example, within a specific PDF file.
|
|
1487
|
+
*
|
|
1488
|
+
* @tags retrieval
|
|
1489
|
+
* @name RetrieveKnowledgeContent
|
|
1490
|
+
* @summary Retrieve Knowledge Content
|
|
1491
|
+
* @request POST:/api/retrieval/knowledge
|
|
1492
|
+
*/
|
|
1493
|
+
retrieveKnowledgeContent: (data: IRetrievalByKnowledgeRequest, params?: RequestParams) => Promise<IResponseModelListRetrievalChunk>;
|
|
1494
|
+
/**
|
|
1495
|
+
* @description Retrieve chunks within a space_id, for example, given a petercat bot_id, retrieve all chunks under that bot_id.
|
|
1496
|
+
*
|
|
1497
|
+
* @tags retrieval
|
|
1498
|
+
* @name RetrieveSpaceContent
|
|
1499
|
+
* @summary Retrieve Space Content
|
|
1500
|
+
* @request POST:/api/retrieval/space
|
|
1501
|
+
*/
|
|
1502
|
+
retrieveSpaceContent: (data: IRetrievalBySpaceRequest, params?: RequestParams) => Promise<IResponseModelListRetrievalChunk>;
|
|
1503
|
+
};
|
|
1504
|
+
task: {
|
|
1505
|
+
/**
|
|
1506
|
+
* No description
|
|
1507
|
+
*
|
|
1508
|
+
* @tags task
|
|
1509
|
+
* @name RestartTask
|
|
1510
|
+
* @summary Restart Task
|
|
1511
|
+
* @request POST:/api/task/restart
|
|
1512
|
+
*/
|
|
1513
|
+
restartTask: (data: ITaskRestartRequest, params?: RequestParams) => Promise<IResponseModelListTask>;
|
|
1514
|
+
/**
|
|
1515
|
+
* No description
|
|
1516
|
+
*
|
|
1517
|
+
* @tags task
|
|
1518
|
+
* @name GetTaskList
|
|
1519
|
+
* @summary Get Task List
|
|
1520
|
+
* @request POST:/api/task/list
|
|
1521
|
+
*/
|
|
1522
|
+
getTaskList: (data: IPageParamsTask, params?: RequestParams) => Promise<IResponseModelPageResponseTask>;
|
|
1523
|
+
/**
|
|
1524
|
+
* No description
|
|
1525
|
+
*
|
|
1526
|
+
* @tags task
|
|
1527
|
+
* @name GetTaskDetail
|
|
1528
|
+
* @summary Get Task Detail
|
|
1529
|
+
* @request GET:/api/task/detail
|
|
1530
|
+
*/
|
|
1531
|
+
getTaskDetail: (query: {
|
|
1532
|
+
/** Task Id */
|
|
1533
|
+
task_id: string;
|
|
1534
|
+
}, params?: RequestParams) => Promise<IResponseModelTask>;
|
|
1535
|
+
};
|
|
1536
|
+
chunk: {
|
|
1537
|
+
/**
|
|
1538
|
+
* No description
|
|
1539
|
+
*
|
|
1540
|
+
* @tags chunk
|
|
1541
|
+
* @name GetChunkList
|
|
1542
|
+
* @summary Get Chunk List
|
|
1543
|
+
* @request POST:/api/chunk/list
|
|
1544
|
+
*/
|
|
1545
|
+
getChunkList: (data: IPageParamsChunk, params?: RequestParams) => Promise<IResponseModelPageResponseChunk>;
|
|
1546
|
+
};
|
|
1547
|
+
tenant: {
|
|
1548
|
+
/**
|
|
1549
|
+
* No description
|
|
1550
|
+
*
|
|
1551
|
+
* @tags tenant
|
|
1552
|
+
* @name CreateTenant
|
|
1553
|
+
* @summary Create Tenant
|
|
1554
|
+
* @request POST:/api/tenant/create
|
|
1555
|
+
*/
|
|
1556
|
+
createTenant: (data: ITenantCreate, params?: RequestParams) => Promise<IResponseModelTenant>;
|
|
1557
|
+
/**
|
|
1558
|
+
* No description
|
|
1559
|
+
*
|
|
1560
|
+
* @tags tenant
|
|
1561
|
+
* @name GetTenant
|
|
1562
|
+
* @summary Get Tenant
|
|
1563
|
+
* @request GET:/api/tenant/me
|
|
1564
|
+
*/
|
|
1565
|
+
getTenant: (params?: RequestParams) => Promise<any>;
|
|
1566
|
+
};
|
|
1567
|
+
healthChecker: {
|
|
1568
|
+
/**
|
|
1569
|
+
* No description
|
|
1570
|
+
*
|
|
1571
|
+
* @name HealthCheckerApiHealthCheckerGet
|
|
1572
|
+
* @summary Health Checker
|
|
1573
|
+
* @request GET:/api/health_checker
|
|
1574
|
+
*/
|
|
1575
|
+
healthCheckerApiHealthCheckerGet: (params?: RequestParams) => Promise<IResponseModel>;
|
|
1576
|
+
};
|
|
1577
|
+
}
|