@memberjunction/ai-vector-sync 1.8.1 → 2.1.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 (41) hide show
  1. package/dist/index.d.ts +719 -5
  2. package/dist/index.js +4 -21
  3. package/dist/index.js.map +1 -1
  4. package/package.json +19 -14
  5. package/dist/config.d.ts +0 -13
  6. package/dist/config.d.ts.map +0 -1
  7. package/dist/config.js +0 -21
  8. package/dist/config.js.map +0 -1
  9. package/dist/constants.d.ts +0 -2
  10. package/dist/constants.d.ts.map +0 -1
  11. package/dist/constants.js +0 -5
  12. package/dist/constants.js.map +0 -1
  13. package/dist/db/db.d.ts +0 -4
  14. package/dist/db/db.d.ts.map +0 -1
  15. package/dist/db/db.js +0 -40
  16. package/dist/db/db.js.map +0 -1
  17. package/dist/db/dbAI.d.ts +0 -4
  18. package/dist/db/dbAI.d.ts.map +0 -1
  19. package/dist/db/dbAI.js +0 -18
  20. package/dist/db/dbAI.js.map +0 -1
  21. package/dist/generic/EntityDocumentTemplateParser.d.ts +0 -18
  22. package/dist/generic/EntityDocumentTemplateParser.d.ts.map +0 -1
  23. package/dist/generic/EntityDocumentTemplateParser.js +0 -145
  24. package/dist/generic/EntityDocumentTemplateParser.js.map +0 -1
  25. package/dist/generic/entitySyncConfig.types.d.ts +0 -11
  26. package/dist/generic/entitySyncConfig.types.d.ts.map +0 -1
  27. package/dist/generic/entitySyncConfig.types.js +0 -3
  28. package/dist/generic/entitySyncConfig.types.js.map +0 -1
  29. package/dist/generic/vectorSync.types.d.ts +0 -12
  30. package/dist/generic/vectorSync.types.d.ts.map +0 -1
  31. package/dist/generic/vectorSync.types.js +0 -3
  32. package/dist/generic/vectorSync.types.js.map +0 -1
  33. package/dist/index.d.ts.map +0 -1
  34. package/dist/models/EntityDocumentCache.d.ts +0 -19
  35. package/dist/models/EntityDocumentCache.d.ts.map +0 -1
  36. package/dist/models/EntityDocumentCache.js +0 -62
  37. package/dist/models/EntityDocumentCache.js.map +0 -1
  38. package/dist/models/entityVectorSync.d.ts +0 -26
  39. package/dist/models/entityVectorSync.d.ts.map +0 -1
  40. package/dist/models/entityVectorSync.js +0 -234
  41. package/dist/models/entityVectorSync.js.map +0 -1
package/dist/index.d.ts CHANGED
@@ -1,5 +1,719 @@
1
- export * from './generic/vectorSync.types';
2
- export * from './generic/entitySyncConfig.types';
3
- export * from './models/entityVectorSync';
4
- export * from './generic/EntityDocumentTemplateParser';
5
- //# sourceMappingURL=index.d.ts.map
1
+ import { Embeddings, EmbedTextsResult } from '@memberjunction/ai';
2
+ import { VectorDBBase } from '@memberjunction/ai-vectordb';
3
+ import { BaseEntity, RunViewParams, UserInfo, EntityField, EntityInfo } from '@memberjunction/core';
4
+ import { TemplateEntityExtended } from '@memberjunction/templates-base-types';
5
+ import { VectorBase } from '@memberjunction/ai-vectors';
6
+
7
+ /**
8
+ * AI Models - strongly typed entity sub-class
9
+ * * Schema: __mj
10
+ * * Base Table: AIModel
11
+ * * Base View: vwAIModels
12
+ * * @description Catalog of all AI Models configured in the system.
13
+ * * Primary Key: ID
14
+ * @extends {BaseEntity}
15
+ * @class
16
+ * @public
17
+ */
18
+ declare class AIModelEntity extends BaseEntity {
19
+ /**
20
+ * Loads the AI Models record from the database
21
+ * @param ID: string - primary key value to load the AI Models record.
22
+ * @param EntityRelationshipsToLoad - (optional) the relationships to load
23
+ * @returns {Promise<boolean>} - true if successful, false otherwise
24
+ * @public
25
+ * @async
26
+ * @memberof AIModelEntity
27
+ * @method
28
+ * @override
29
+ */
30
+ Load(ID: string, EntityRelationshipsToLoad?: string[]): Promise<boolean>;
31
+ /**
32
+ * * Field Name: ID
33
+ * * Display Name: ID
34
+ * * SQL Data Type: uniqueidentifier
35
+ * * Default Value: newsequentialid()
36
+ */
37
+ get ID(): string;
38
+ /**
39
+ * * Field Name: Name
40
+ * * Display Name: Name
41
+ * * SQL Data Type: nvarchar(50)
42
+ */
43
+ get Name(): string;
44
+ set Name(value: string);
45
+ /**
46
+ * * Field Name: Description
47
+ * * Display Name: Description
48
+ * * SQL Data Type: nvarchar(MAX)
49
+ */
50
+ get Description(): string | null;
51
+ set Description(value: string | null);
52
+ /**
53
+ * * Field Name: Vendor
54
+ * * Display Name: Vendor
55
+ * * SQL Data Type: nvarchar(50)
56
+ */
57
+ get Vendor(): string | null;
58
+ set Vendor(value: string | null);
59
+ /**
60
+ * * Field Name: AIModelTypeID
61
+ * * Display Name: AI Model Type ID
62
+ * * SQL Data Type: uniqueidentifier
63
+ * * Related Entity/Foreign Key: AI Model Types (vwAIModelTypes.ID)
64
+ */
65
+ get AIModelTypeID(): string;
66
+ set AIModelTypeID(value: string);
67
+ /**
68
+ * * Field Name: PowerRank
69
+ * * Display Name: Power Rank
70
+ * * SQL Data Type: int
71
+ * * Description: A simplified power rank of each model for a given AI Model Type. For example, if we have GPT 3, GPT 3.5, and GPT 4, we would have a PowerRank of 1 for GPT3, 2 for GPT 3.5, and 3 for GPT 4. This can be used within model families like OpenAI or across all models. For example if you had Llama 2 in the mix which is similar to GPT 3.5 it would also have a PowerRank of 2. This can be used at runtime to pick the most/least powerful or compare model relative power.
72
+ */
73
+ get PowerRank(): number | null;
74
+ set PowerRank(value: number | null);
75
+ /**
76
+ * * Field Name: IsActive
77
+ * * Display Name: Is Active
78
+ * * SQL Data Type: bit
79
+ * * Default Value: 1
80
+ */
81
+ get IsActive(): boolean;
82
+ set IsActive(value: boolean);
83
+ /**
84
+ * * Field Name: DriverClass
85
+ * * Display Name: Driver Class
86
+ * * SQL Data Type: nvarchar(100)
87
+ */
88
+ get DriverClass(): string | null;
89
+ set DriverClass(value: string | null);
90
+ /**
91
+ * * Field Name: DriverImportPath
92
+ * * Display Name: Driver Import Path
93
+ * * SQL Data Type: nvarchar(255)
94
+ */
95
+ get DriverImportPath(): string | null;
96
+ set DriverImportPath(value: string | null);
97
+ /**
98
+ * * Field Name: APIName
99
+ * * Display Name: APIName
100
+ * * SQL Data Type: nvarchar(100)
101
+ * * Description: The name of the model to use with API calls which might differ from the Name, if APIName is not provided, Name will be used for API calls
102
+ */
103
+ get APIName(): string | null;
104
+ set APIName(value: string | null);
105
+ /**
106
+ * * Field Name: __mj_CreatedAt
107
+ * * Display Name: Created At
108
+ * * SQL Data Type: datetimeoffset
109
+ * * Default Value: getutcdate()
110
+ */
111
+ get __mj_CreatedAt(): Date;
112
+ /**
113
+ * * Field Name: __mj_UpdatedAt
114
+ * * Display Name: Updated At
115
+ * * SQL Data Type: datetimeoffset
116
+ * * Default Value: getutcdate()
117
+ */
118
+ get __mj_UpdatedAt(): Date;
119
+ /**
120
+ * * Field Name: AIModelType
121
+ * * Display Name: AIModel Type
122
+ * * SQL Data Type: nvarchar(50)
123
+ */
124
+ get AIModelType(): string;
125
+ }
126
+ /**
127
+ * Entity Documents - strongly typed entity sub-class
128
+ * * Schema: __mj
129
+ * * Base Table: EntityDocument
130
+ * * Base View: vwEntityDocuments
131
+ * * Primary Key: ID
132
+ * @extends {BaseEntity}
133
+ * @class
134
+ * @public
135
+ */
136
+ declare class EntityDocumentEntity extends BaseEntity {
137
+ /**
138
+ * Loads the Entity Documents record from the database
139
+ * @param ID: string - primary key value to load the Entity Documents record.
140
+ * @param EntityRelationshipsToLoad - (optional) the relationships to load
141
+ * @returns {Promise<boolean>} - true if successful, false otherwise
142
+ * @public
143
+ * @async
144
+ * @memberof EntityDocumentEntity
145
+ * @method
146
+ * @override
147
+ */
148
+ Load(ID: string, EntityRelationshipsToLoad?: string[]): Promise<boolean>;
149
+ /**
150
+ * Entity Documents - AllowDeleteAPI is set to 0 in the database. Delete is not allowed, so this method is generated to override the base class method and throw an error. To enable delete for this entity, set AllowDeleteAPI to 1 in the database.
151
+ * @public
152
+ * @method
153
+ * @override
154
+ * @memberof EntityDocumentEntity
155
+ * @throws {Error} - Delete is not allowed for Entity Documents, to enable it set AllowDeleteAPI to 1 in the database.
156
+ */
157
+ Delete(): Promise<boolean>;
158
+ /**
159
+ * * Field Name: ID
160
+ * * Display Name: ID
161
+ * * SQL Data Type: uniqueidentifier
162
+ * * Default Value: newsequentialid()
163
+ */
164
+ get ID(): string;
165
+ /**
166
+ * * Field Name: Name
167
+ * * Display Name: Name
168
+ * * SQL Data Type: nvarchar(250)
169
+ */
170
+ get Name(): string;
171
+ set Name(value: string);
172
+ /**
173
+ * * Field Name: TypeID
174
+ * * Display Name: Type ID
175
+ * * SQL Data Type: uniqueidentifier
176
+ * * Related Entity/Foreign Key: Entity Document Types (vwEntityDocumentTypes.ID)
177
+ */
178
+ get TypeID(): string;
179
+ set TypeID(value: string);
180
+ /**
181
+ * * Field Name: EntityID
182
+ * * Display Name: Entity ID
183
+ * * SQL Data Type: uniqueidentifier
184
+ * * Related Entity/Foreign Key: Entities (vwEntities.ID)
185
+ */
186
+ get EntityID(): string;
187
+ set EntityID(value: string);
188
+ /**
189
+ * * Field Name: VectorDatabaseID
190
+ * * Display Name: Vector Database ID
191
+ * * SQL Data Type: uniqueidentifier
192
+ * * Related Entity/Foreign Key: Vector Databases (vwVectorDatabases.ID)
193
+ */
194
+ get VectorDatabaseID(): string;
195
+ set VectorDatabaseID(value: string);
196
+ /**
197
+ * * Field Name: Status
198
+ * * Display Name: Status
199
+ * * SQL Data Type: nvarchar(15)
200
+ * * Default Value: Active
201
+ * * Value List Type: List
202
+ * * Possible Values
203
+ * * Active
204
+ * * Inactive
205
+ */
206
+ get Status(): 'Active' | 'Inactive';
207
+ set Status(value: 'Active' | 'Inactive');
208
+ /**
209
+ * * Field Name: TemplateID
210
+ * * Display Name: Template ID
211
+ * * SQL Data Type: uniqueidentifier
212
+ * * Related Entity/Foreign Key: Templates (vwTemplates.ID)
213
+ */
214
+ get TemplateID(): string;
215
+ set TemplateID(value: string);
216
+ /**
217
+ * * Field Name: AIModelID
218
+ * * Display Name: AIModel ID
219
+ * * SQL Data Type: uniqueidentifier
220
+ * * Related Entity/Foreign Key: AI Models (vwAIModels.ID)
221
+ */
222
+ get AIModelID(): string;
223
+ set AIModelID(value: string);
224
+ /**
225
+ * * Field Name: PotentialMatchThreshold
226
+ * * Display Name: Potential Match Threshold
227
+ * * SQL Data Type: numeric(12, 11)
228
+ * * Default Value: 1
229
+ * * Description: Value between 0 and 1 that determines what is considered a potential matching record. Value must be <= AbsoluteMatchThreshold. This is primarily used for duplicate detection but can be used for other applications as well where matching is relevant.
230
+ */
231
+ get PotentialMatchThreshold(): number;
232
+ set PotentialMatchThreshold(value: number);
233
+ /**
234
+ * * Field Name: AbsoluteMatchThreshold
235
+ * * Display Name: Absolute Match Threshold
236
+ * * SQL Data Type: numeric(12, 11)
237
+ * * Default Value: 1
238
+ * * Description: Value between 0 and 1 that determines what is considered an absolute matching record. Value must be >= PotentialMatchThreshold. This is primarily used for duplicate detection but can be used for other applications as well where matching is relevant.
239
+ */
240
+ get AbsoluteMatchThreshold(): number;
241
+ set AbsoluteMatchThreshold(value: number);
242
+ /**
243
+ * * Field Name: __mj_CreatedAt
244
+ * * Display Name: __mj _Created At
245
+ * * SQL Data Type: datetimeoffset
246
+ * * Default Value: getutcdate()
247
+ */
248
+ get __mj_CreatedAt(): Date;
249
+ /**
250
+ * * Field Name: __mj_UpdatedAt
251
+ * * Display Name: __mj _Updated At
252
+ * * SQL Data Type: datetimeoffset
253
+ * * Default Value: getutcdate()
254
+ */
255
+ get __mj_UpdatedAt(): Date;
256
+ /**
257
+ * * Field Name: Type
258
+ * * Display Name: Type
259
+ * * SQL Data Type: nvarchar(100)
260
+ */
261
+ get Type(): string;
262
+ /**
263
+ * * Field Name: Entity
264
+ * * Display Name: Entity
265
+ * * SQL Data Type: nvarchar(255)
266
+ */
267
+ get Entity(): string;
268
+ /**
269
+ * * Field Name: VectorDatabase
270
+ * * Display Name: Vector Database
271
+ * * SQL Data Type: nvarchar(100)
272
+ * * Default Value: null
273
+ */
274
+ get VectorDatabase(): string;
275
+ /**
276
+ * * Field Name: Template
277
+ * * Display Name: Template
278
+ * * SQL Data Type: nvarchar(255)
279
+ * * Default Value: null
280
+ */
281
+ get Template(): string;
282
+ /**
283
+ * * Field Name: AIModel
284
+ * * Display Name: AIModel
285
+ * * SQL Data Type: nvarchar(50)
286
+ * * Default Value: null
287
+ */
288
+ get AIModel(): string;
289
+ }
290
+ /**
291
+ * Template Contents - strongly typed entity sub-class
292
+ * * Schema: __mj
293
+ * * Base Table: TemplateContent
294
+ * * Base View: vwTemplateContents
295
+ * * @description Template content for different versions of a template for purposes like HTML/Text/etc
296
+ * * Primary Key: ID
297
+ * @extends {BaseEntity}
298
+ * @class
299
+ * @public
300
+ */
301
+ declare class TemplateContentEntity extends BaseEntity {
302
+ /**
303
+ * Loads the Template Contents record from the database
304
+ * @param ID: string - primary key value to load the Template Contents record.
305
+ * @param EntityRelationshipsToLoad - (optional) the relationships to load
306
+ * @returns {Promise<boolean>} - true if successful, false otherwise
307
+ * @public
308
+ * @async
309
+ * @memberof TemplateContentEntity
310
+ * @method
311
+ * @override
312
+ */
313
+ Load(ID: string, EntityRelationshipsToLoad?: string[]): Promise<boolean>;
314
+ /**
315
+ * Template Contents - AllowDeleteAPI is set to 0 in the database. Delete is not allowed, so this method is generated to override the base class method and throw an error. To enable delete for this entity, set AllowDeleteAPI to 1 in the database.
316
+ * @public
317
+ * @method
318
+ * @override
319
+ * @memberof TemplateContentEntity
320
+ * @throws {Error} - Delete is not allowed for Template Contents, to enable it set AllowDeleteAPI to 1 in the database.
321
+ */
322
+ Delete(): Promise<boolean>;
323
+ /**
324
+ * * Field Name: ID
325
+ * * Display Name: ID
326
+ * * SQL Data Type: uniqueidentifier
327
+ * * Default Value: newsequentialid()
328
+ */
329
+ get ID(): string;
330
+ /**
331
+ * * Field Name: TemplateID
332
+ * * Display Name: Template ID
333
+ * * SQL Data Type: uniqueidentifier
334
+ * * Related Entity/Foreign Key: Templates (vwTemplates.ID)
335
+ */
336
+ get TemplateID(): string;
337
+ set TemplateID(value: string);
338
+ /**
339
+ * * Field Name: TypeID
340
+ * * Display Name: Type ID
341
+ * * SQL Data Type: uniqueidentifier
342
+ * * Related Entity/Foreign Key: Template Content Types (vwTemplateContentTypes.ID)
343
+ */
344
+ get TypeID(): string;
345
+ set TypeID(value: string);
346
+ /**
347
+ * * Field Name: TemplateText
348
+ * * Display Name: Template Text
349
+ * * SQL Data Type: nvarchar(MAX)
350
+ * * Description: The actual text content for the template
351
+ */
352
+ get TemplateText(): string | null;
353
+ set TemplateText(value: string | null);
354
+ /**
355
+ * * Field Name: Priority
356
+ * * Display Name: Priority
357
+ * * SQL Data Type: int
358
+ * * Description: Priority of the content version, higher priority versions will be used ahead of lower priority versions for a given Type
359
+ */
360
+ get Priority(): number;
361
+ set Priority(value: number);
362
+ /**
363
+ * * Field Name: IsActive
364
+ * * Display Name: Is Active
365
+ * * SQL Data Type: bit
366
+ * * Default Value: 1
367
+ * * Description: Indicates whether the content is active or not. Use this to disable a particular Template Content item without having to remove it
368
+ */
369
+ get IsActive(): boolean;
370
+ set IsActive(value: boolean);
371
+ /**
372
+ * * Field Name: __mj_CreatedAt
373
+ * * Display Name: Created At
374
+ * * SQL Data Type: datetimeoffset
375
+ * * Default Value: getutcdate()
376
+ */
377
+ get __mj_CreatedAt(): Date;
378
+ /**
379
+ * * Field Name: __mj_UpdatedAt
380
+ * * Display Name: Updated At
381
+ * * SQL Data Type: datetimeoffset
382
+ * * Default Value: getutcdate()
383
+ */
384
+ get __mj_UpdatedAt(): Date;
385
+ /**
386
+ * * Field Name: Template
387
+ * * Display Name: Template
388
+ * * SQL Data Type: nvarchar(255)
389
+ */
390
+ get Template(): string;
391
+ /**
392
+ * * Field Name: Type
393
+ * * Display Name: Type
394
+ * * SQL Data Type: nvarchar(255)
395
+ */
396
+ get Type(): string;
397
+ }
398
+ /**
399
+ * Templates - strongly typed entity sub-class
400
+ * * Schema: __mj
401
+ * * Base Table: Template
402
+ * * Base View: vwTemplates
403
+ * * @description Templates are used for dynamic expansion of a static template with data from a given context. Templates can be used to create documents, messages and anything else that requires dynamic document creation merging together static text, data and lightweight logic
404
+ * * Primary Key: ID
405
+ * @extends {BaseEntity}
406
+ * @class
407
+ * @public
408
+ */
409
+ declare class TemplateEntity extends BaseEntity {
410
+ /**
411
+ * Loads the Templates record from the database
412
+ * @param ID: string - primary key value to load the Templates record.
413
+ * @param EntityRelationshipsToLoad - (optional) the relationships to load
414
+ * @returns {Promise<boolean>} - true if successful, false otherwise
415
+ * @public
416
+ * @async
417
+ * @memberof TemplateEntity
418
+ * @method
419
+ * @override
420
+ */
421
+ Load(ID: string, EntityRelationshipsToLoad?: string[]): Promise<boolean>;
422
+ /**
423
+ * Templates - AllowDeleteAPI is set to 0 in the database. Delete is not allowed, so this method is generated to override the base class method and throw an error. To enable delete for this entity, set AllowDeleteAPI to 1 in the database.
424
+ * @public
425
+ * @method
426
+ * @override
427
+ * @memberof TemplateEntity
428
+ * @throws {Error} - Delete is not allowed for Templates, to enable it set AllowDeleteAPI to 1 in the database.
429
+ */
430
+ Delete(): Promise<boolean>;
431
+ /**
432
+ * * Field Name: ID
433
+ * * Display Name: ID
434
+ * * SQL Data Type: uniqueidentifier
435
+ * * Default Value: newsequentialid()
436
+ */
437
+ get ID(): string;
438
+ /**
439
+ * * Field Name: Name
440
+ * * Display Name: Name
441
+ * * SQL Data Type: nvarchar(255)
442
+ * * Description: Name of the template
443
+ */
444
+ get Name(): string;
445
+ set Name(value: string);
446
+ /**
447
+ * * Field Name: Description
448
+ * * Display Name: Description
449
+ * * SQL Data Type: nvarchar(MAX)
450
+ * * Description: Description of the template
451
+ */
452
+ get Description(): string | null;
453
+ set Description(value: string | null);
454
+ /**
455
+ * * Field Name: CategoryID
456
+ * * Display Name: Category ID
457
+ * * SQL Data Type: uniqueidentifier
458
+ * * Related Entity/Foreign Key: Template Categories (vwTemplateCategories.ID)
459
+ */
460
+ get CategoryID(): string | null;
461
+ set CategoryID(value: string | null);
462
+ /**
463
+ * * Field Name: UserPrompt
464
+ * * Display Name: User Prompt
465
+ * * SQL Data Type: nvarchar(MAX)
466
+ * * Description: This prompt will be used by the AI to generate template content as requested by the user.
467
+ */
468
+ get UserPrompt(): string | null;
469
+ set UserPrompt(value: string | null);
470
+ /**
471
+ * * Field Name: UserID
472
+ * * Display Name: User ID
473
+ * * SQL Data Type: uniqueidentifier
474
+ * * Related Entity/Foreign Key: Users (vwUsers.ID)
475
+ */
476
+ get UserID(): string;
477
+ set UserID(value: string);
478
+ /**
479
+ * * Field Name: ActiveAt
480
+ * * Display Name: Active At
481
+ * * SQL Data Type: datetime
482
+ * * Description: Optional, if provided, this template will not be available for use until the specified date. Requires IsActive to be set to 1
483
+ */
484
+ get ActiveAt(): Date | null;
485
+ set ActiveAt(value: Date | null);
486
+ /**
487
+ * * Field Name: DisabledAt
488
+ * * Display Name: Disabled At
489
+ * * SQL Data Type: datetime
490
+ * * Description: Optional, if provided, this template will not be available for use after the specified date. If IsActive=0, this has no effect.
491
+ */
492
+ get DisabledAt(): Date | null;
493
+ set DisabledAt(value: Date | null);
494
+ /**
495
+ * * Field Name: IsActive
496
+ * * Display Name: Is Active
497
+ * * SQL Data Type: bit
498
+ * * Default Value: 1
499
+ * * Description: If set to 0, the template will be disabled regardless of the values in ActiveAt/DisabledAt.
500
+ */
501
+ get IsActive(): boolean;
502
+ set IsActive(value: boolean);
503
+ /**
504
+ * * Field Name: __mj_CreatedAt
505
+ * * Display Name: Created At
506
+ * * SQL Data Type: datetimeoffset
507
+ * * Default Value: getutcdate()
508
+ */
509
+ get __mj_CreatedAt(): Date;
510
+ /**
511
+ * * Field Name: __mj_UpdatedAt
512
+ * * Display Name: Updated At
513
+ * * SQL Data Type: datetimeoffset
514
+ * * Default Value: getutcdate()
515
+ */
516
+ get __mj_UpdatedAt(): Date;
517
+ /**
518
+ * * Field Name: Category
519
+ * * Display Name: Category
520
+ * * SQL Data Type: nvarchar(255)
521
+ */
522
+ get Category(): string | null;
523
+ /**
524
+ * * Field Name: User
525
+ * * Display Name: User
526
+ * * SQL Data Type: nvarchar(100)
527
+ */
528
+ get User(): string;
529
+ }
530
+ /**
531
+ * Vector Databases - strongly typed entity sub-class
532
+ * * Schema: __mj
533
+ * * Base Table: VectorDatabase
534
+ * * Base View: vwVectorDatabases
535
+ * * Primary Key: ID
536
+ * @extends {BaseEntity}
537
+ * @class
538
+ * @public
539
+ */
540
+ declare class VectorDatabaseEntity extends BaseEntity {
541
+ /**
542
+ * Loads the Vector Databases record from the database
543
+ * @param ID: string - primary key value to load the Vector Databases record.
544
+ * @param EntityRelationshipsToLoad - (optional) the relationships to load
545
+ * @returns {Promise<boolean>} - true if successful, false otherwise
546
+ * @public
547
+ * @async
548
+ * @memberof VectorDatabaseEntity
549
+ * @method
550
+ * @override
551
+ */
552
+ Load(ID: string, EntityRelationshipsToLoad?: string[]): Promise<boolean>;
553
+ /**
554
+ * Vector Databases - AllowDeleteAPI is set to 0 in the database. Delete is not allowed, so this method is generated to override the base class method and throw an error. To enable delete for this entity, set AllowDeleteAPI to 1 in the database.
555
+ * @public
556
+ * @method
557
+ * @override
558
+ * @memberof VectorDatabaseEntity
559
+ * @throws {Error} - Delete is not allowed for Vector Databases, to enable it set AllowDeleteAPI to 1 in the database.
560
+ */
561
+ Delete(): Promise<boolean>;
562
+ /**
563
+ * * Field Name: ID
564
+ * * Display Name: ID
565
+ * * SQL Data Type: uniqueidentifier
566
+ * * Default Value: newsequentialid()
567
+ */
568
+ get ID(): string;
569
+ /**
570
+ * * Field Name: Name
571
+ * * Display Name: Name
572
+ * * SQL Data Type: nvarchar(100)
573
+ */
574
+ get Name(): string;
575
+ set Name(value: string);
576
+ /**
577
+ * * Field Name: Description
578
+ * * Display Name: Description
579
+ * * SQL Data Type: nvarchar(MAX)
580
+ */
581
+ get Description(): string | null;
582
+ set Description(value: string | null);
583
+ /**
584
+ * * Field Name: DefaultURL
585
+ * * Display Name: Default URL
586
+ * * SQL Data Type: nvarchar(255)
587
+ */
588
+ get DefaultURL(): string | null;
589
+ set DefaultURL(value: string | null);
590
+ /**
591
+ * * Field Name: ClassKey
592
+ * * Display Name: Class Key
593
+ * * SQL Data Type: nvarchar(100)
594
+ */
595
+ get ClassKey(): string | null;
596
+ set ClassKey(value: string | null);
597
+ /**
598
+ * * Field Name: __mj_CreatedAt
599
+ * * Display Name: Created At
600
+ * * SQL Data Type: datetimeoffset
601
+ * * Default Value: getutcdate()
602
+ */
603
+ get __mj_CreatedAt(): Date;
604
+ /**
605
+ * * Field Name: __mj_UpdatedAt
606
+ * * Display Name: Updated At
607
+ * * SQL Data Type: datetimeoffset
608
+ * * Default Value: getutcdate()
609
+ */
610
+ get __mj_UpdatedAt(): Date;
611
+ }
612
+
613
+ type VectorizeEntityParams = {
614
+ entityID: string;
615
+ entityDocumentID?: string;
616
+ batchCount?: number;
617
+ options?: any;
618
+ };
619
+ type VectorizeEntityResponse = {
620
+ success: boolean;
621
+ status: string;
622
+ errorMessage: string;
623
+ };
624
+ type EmbeddingData = {
625
+ ID: number;
626
+ Vector: number[];
627
+ VectorID?: unknown;
628
+ EntityData: Record<string, any>;
629
+ __mj_recordID: unknown;
630
+ __mj_compositeKey?: unknown;
631
+ EntityDocument?: Record<string, unknown>;
632
+ TemplateContent?: string;
633
+ VectorIndexID?: unknown;
634
+ };
635
+ type VectorEmeddingData = {
636
+ embedding: Embeddings;
637
+ vectorDB: VectorDBBase;
638
+ vectorDBClassKey: string;
639
+ vectorDBAPIKey: string;
640
+ embeddingDriverClass: string;
641
+ embeddingAPIKey: string;
642
+ };
643
+ type AnnotateWorkerContext = {
644
+ executionId: number;
645
+ entity: BaseEntity;
646
+ entityDocument: Record<string, unknown>;
647
+ template: TemplateEntityExtended;
648
+ templateContent: TemplateContentEntity;
649
+ embeddingDriverClass: string;
650
+ embeddingAPIKey: string;
651
+ delayTimeMS: number;
652
+ };
653
+ type ArchiveWorkerContext = {
654
+ executionId: number;
655
+ entity: BaseEntity;
656
+ entityDocument: EntityDocumentEntity;
657
+ vectorDBClassKey: string;
658
+ vectorDBAPIKey: string;
659
+ templateContent: TemplateContentEntity;
660
+ embeddings: EmbedTextsResult;
661
+ delayTimeMS: number;
662
+ };
663
+ type TemplateParamData = {
664
+ ParamName: string;
665
+ Data: unknown[];
666
+ };
667
+
668
+ type EntitySyncConfig = {
669
+ EntityDocumentID: string;
670
+ Interval: number;
671
+ RunViewParams: RunViewParams;
672
+ IncludeInSync: boolean;
673
+ LastRunDate: string;
674
+ VectorIndexID: number;
675
+ VectorID: number;
676
+ };
677
+
678
+ declare class EntityVectorSyncer extends VectorBase {
679
+ _startTime: Date;
680
+ _endTime: Date;
681
+ constructor();
682
+ Config(forceRefresh: boolean, contextUser?: UserInfo): Promise<void>;
683
+ VectorizeEntity(params: VectorizeEntityParams, contextUser?: UserInfo): Promise<VectorizeEntityResponse>;
684
+ CreateDefaultEntityDocument(EntityID: string, VectorDatabase: VectorDatabaseEntity, AIModel: AIModelEntity): Promise<EntityDocumentEntity>;
685
+ protected GetVectorDatabaseAndEmbeddingClassByEntityDocumentID(entityDocumentID: string, createDocumentIfNotFound?: boolean): Promise<VectorEmeddingData>;
686
+ GetEntityDocument(EntityDocumentID: string): Promise<EntityDocumentEntity | null>;
687
+ GetEntityDocumentByName(EntityDocumentName: string, ContextUser?: UserInfo): Promise<EntityDocumentEntity | null>;
688
+ GetActiveEntityDocuments(entityNames?: string[]): Promise<EntityDocumentEntity[]>;
689
+ private GetOrCreateVectorIndex;
690
+ protected CreateTemplateForEntityDocument(entityDocument: EntityDocumentEntity): Promise<TemplateEntity>;
691
+ protected BuildTemplateContent(entityFields: EntityField[]): string;
692
+ protected GetEntityFieldsForSimilaritySearch(entityID: string): Promise<EntityField[]>;
693
+ protected GetTemplateData(entity: EntityInfo, record: unknown, template: TemplateEntityExtended, relatedData: TemplateParamData[]): Promise<{
694
+ [key: string]: any;
695
+ }>;
696
+ protected GetRelatedTemplateDataForBatch(entity: EntityInfo, records: unknown[], template: TemplateEntityExtended): Promise<TemplateParamData[]>;
697
+ protected UpsertEntityRecordDocumentRecords(embeddingData: EmbeddingData, contextUser: UserInfo): Promise<void>;
698
+ protected ValidateTemplateContextParamAlignment(template: TemplateEntityExtended): boolean;
699
+ }
700
+
701
+ declare abstract class EntityDocumentTemplateParserBase {
702
+ static ClearCache(): void;
703
+ static CreateCacheKey(EntityID: string, EntityRecordPrimaryKey: string, Content: string): string;
704
+ protected static __cache: {
705
+ [key: string]: string;
706
+ };
707
+ protected static get _cache(): {
708
+ [key: string]: string;
709
+ };
710
+ Parse(Template: string, EntityID: string, EntityRecord: any, ContextUser: UserInfo): Promise<string>;
711
+ protected evalSingleArgument(argument: string, entityID: string, entityRecord: any, ContextUser: UserInfo): Promise<string>;
712
+ }
713
+
714
+ declare class EntityDocumentTemplateParser extends EntityDocumentTemplateParserBase {
715
+ static CreateInstance(): EntityDocumentTemplateParser;
716
+ protected Relationship(entityID: string, entityRecord: any, ContextUser: UserInfo, relationshipName: string, maxRows: number, entityDocumentName: string): Promise<string>;
717
+ }
718
+
719
+ export { type AnnotateWorkerContext, type ArchiveWorkerContext, type EmbeddingData, EntityDocumentTemplateParser, type EntitySyncConfig, EntityVectorSyncer, type TemplateParamData, type VectorEmeddingData, type VectorizeEntityParams, type VectorizeEntityResponse };