@exulu/backend 1.38.0 → 1.39.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.
package/dist/index.d.cts CHANGED
@@ -83,6 +83,9 @@ type ExuluConfig = {
83
83
  s3endpoint?: string;
84
84
  s3prefix?: string;
85
85
  };
86
+ privacy?: {
87
+ systemPromptPersonalization?: boolean;
88
+ };
86
89
  };
87
90
  declare class ExuluApp {
88
91
  private _agents;
@@ -138,6 +141,8 @@ declare class ExuluApp {
138
141
 
139
142
  type User = {
140
143
  id: number;
144
+ firstname?: string;
145
+ lastname?: string;
141
146
  email: string;
142
147
  emailVerified?: string;
143
148
  type?: "api" | "user";
@@ -235,6 +240,13 @@ interface TestCase {
235
240
  updatedAt: string;
236
241
  }
237
242
 
243
+ declare const VectorMethodEnum: {
244
+ readonly cosineDistance: "cosineDistance";
245
+ readonly hybridSearch: "hybridSearch";
246
+ readonly tsvector: "tsvector";
247
+ };
248
+ type VectorMethod = (typeof VectorMethodEnum)[keyof typeof VectorMethodEnum];
249
+
238
250
  interface RateLimiterRule {
239
251
  name?: string;
240
252
  rate_limit: {
@@ -526,12 +538,12 @@ declare class ExuluTool {
526
538
  }
527
539
  type ExuluContextFieldProcessor = {
528
540
  description: string;
529
- execute: ({ item, user, role, utils, config }: {
541
+ execute: ({ item, user, role, utils, exuluConfig }: {
530
542
  item: Item & {
531
543
  field: string;
532
544
  };
533
- user: number;
534
- role: string;
545
+ user?: number;
546
+ role?: string;
535
547
  utils: {
536
548
  storage: ExuluStorage;
537
549
  items: {
@@ -540,12 +552,13 @@ type ExuluContextFieldProcessor = {
540
552
  delete: ExuluContext['deleteItem'];
541
553
  };
542
554
  };
543
- config: ExuluConfig;
555
+ exuluConfig: ExuluConfig;
544
556
  }) => Promise<string>;
545
557
  config?: {
546
558
  queue?: Promise<ExuluQueueConfig>;
547
559
  timeoutInSeconds?: number;
548
- trigger: "manual" | "onUpdate" | "onCreate" | "always";
560
+ trigger: "manual" | "onUpdate" | "onInsert" | "always";
561
+ generateEmbeddings?: boolean;
549
562
  };
550
563
  };
551
564
  type ExuluContextFieldDefinition = {
@@ -567,7 +580,7 @@ declare class ExuluStorage {
567
580
  config: ExuluConfig;
568
581
  });
569
582
  getPresignedUrl: (key: string) => Promise<string>;
570
- uploadFile: (user: number, file: Buffer | Uint8Array, key: string, type: string, metadata?: Record<string, string>) => Promise<string>;
583
+ uploadFile: (file: Buffer | Uint8Array, key: string, type: string, user?: number, metadata?: Record<string, string>) => Promise<string>;
571
584
  }
572
585
  type ExuluContextSource = {
573
586
  id: string;
@@ -587,7 +600,10 @@ type ExuluContextSource = {
587
600
  default?: string;
588
601
  }[];
589
602
  };
590
- execute: (inputs: any) => Promise<Item[]>;
603
+ execute: (inputs: {
604
+ exuluConfig: ExuluConfig;
605
+ [key: string]: any;
606
+ }) => Promise<Item[]>;
591
607
  };
592
608
  declare class ExuluContext {
593
609
  id: string;
@@ -623,14 +639,35 @@ declare class ExuluContext {
623
639
  language?: "german" | "english";
624
640
  };
625
641
  });
626
- processField: (trigger: STATISTICS_LABELS, user: number, role: string, item: Item & {
642
+ processField: (trigger: STATISTICS_LABELS, item: Item & {
627
643
  field: string;
628
- }, config: ExuluConfig) => Promise<{
644
+ }, exuluConfig: ExuluConfig, user?: number, role?: string) => Promise<{
629
645
  result: string;
630
646
  job?: string;
631
647
  }>;
648
+ search: (options: {
649
+ query: string;
650
+ filters: any[];
651
+ user?: User;
652
+ role?: string;
653
+ method: VectorMethod;
654
+ sort: any;
655
+ trigger: STATISTICS_LABELS;
656
+ limit: number;
657
+ page: number;
658
+ }) => Promise<{
659
+ filters: any[];
660
+ query: string;
661
+ method: VectorMethod;
662
+ context: {
663
+ name: string;
664
+ id: string;
665
+ embedder: string;
666
+ };
667
+ items: any[];
668
+ }>;
632
669
  deleteAll: () => Promise<VectorOperationResponse>;
633
- executeSource: (source: ExuluContextSource, inputs: any) => Promise<Item[]>;
670
+ executeSource: (source: ExuluContextSource, inputs: any, exuluConfig: ExuluConfig) => Promise<Item[]>;
634
671
  tableExists: () => Promise<boolean>;
635
672
  chunksTableExists: () => Promise<boolean>;
636
673
  createAndUpsertEmbeddings: (item: Item, config: ExuluConfig, user?: number, statistics?: ExuluStatisticParams, role?: string, job?: string) => Promise<{
@@ -638,11 +675,11 @@ declare class ExuluContext {
638
675
  chunks?: number;
639
676
  job?: string;
640
677
  }>;
641
- createItem: (item: Item, config: ExuluConfig, user?: number, role?: string, upsert?: boolean) => Promise<{
678
+ createItem: (item: Item, config: ExuluConfig, user?: number, role?: string, upsert?: boolean, generateEmbeddingsOverwrite?: boolean | undefined) => Promise<{
642
679
  item: Item;
643
680
  job?: string;
644
681
  }>;
645
- updateItem: (item: Item, config: ExuluConfig, user?: number, role?: string) => Promise<{
682
+ updateItem: (item: Item, config: ExuluConfig, user?: number, role?: string, generateEmbeddingsOverwrite?: boolean | undefined) => Promise<{
646
683
  item: Item;
647
684
  job?: string;
648
685
  }>;
@@ -650,6 +687,13 @@ declare class ExuluContext {
650
687
  id: string;
651
688
  job?: string;
652
689
  }>;
690
+ getItem: ({ item }: {
691
+ item: Item;
692
+ }) => Promise<Item>;
693
+ getItems: ({ filters, fields }: {
694
+ filters?: any[];
695
+ fields?: string[];
696
+ }) => Promise<Item[]>;
653
697
  embeddings: {
654
698
  generate: {
655
699
  one: ({ item, user, role, trigger, config }: {
package/dist/index.d.ts CHANGED
@@ -83,6 +83,9 @@ type ExuluConfig = {
83
83
  s3endpoint?: string;
84
84
  s3prefix?: string;
85
85
  };
86
+ privacy?: {
87
+ systemPromptPersonalization?: boolean;
88
+ };
86
89
  };
87
90
  declare class ExuluApp {
88
91
  private _agents;
@@ -138,6 +141,8 @@ declare class ExuluApp {
138
141
 
139
142
  type User = {
140
143
  id: number;
144
+ firstname?: string;
145
+ lastname?: string;
141
146
  email: string;
142
147
  emailVerified?: string;
143
148
  type?: "api" | "user";
@@ -235,6 +240,13 @@ interface TestCase {
235
240
  updatedAt: string;
236
241
  }
237
242
 
243
+ declare const VectorMethodEnum: {
244
+ readonly cosineDistance: "cosineDistance";
245
+ readonly hybridSearch: "hybridSearch";
246
+ readonly tsvector: "tsvector";
247
+ };
248
+ type VectorMethod = (typeof VectorMethodEnum)[keyof typeof VectorMethodEnum];
249
+
238
250
  interface RateLimiterRule {
239
251
  name?: string;
240
252
  rate_limit: {
@@ -526,12 +538,12 @@ declare class ExuluTool {
526
538
  }
527
539
  type ExuluContextFieldProcessor = {
528
540
  description: string;
529
- execute: ({ item, user, role, utils, config }: {
541
+ execute: ({ item, user, role, utils, exuluConfig }: {
530
542
  item: Item & {
531
543
  field: string;
532
544
  };
533
- user: number;
534
- role: string;
545
+ user?: number;
546
+ role?: string;
535
547
  utils: {
536
548
  storage: ExuluStorage;
537
549
  items: {
@@ -540,12 +552,13 @@ type ExuluContextFieldProcessor = {
540
552
  delete: ExuluContext['deleteItem'];
541
553
  };
542
554
  };
543
- config: ExuluConfig;
555
+ exuluConfig: ExuluConfig;
544
556
  }) => Promise<string>;
545
557
  config?: {
546
558
  queue?: Promise<ExuluQueueConfig>;
547
559
  timeoutInSeconds?: number;
548
- trigger: "manual" | "onUpdate" | "onCreate" | "always";
560
+ trigger: "manual" | "onUpdate" | "onInsert" | "always";
561
+ generateEmbeddings?: boolean;
549
562
  };
550
563
  };
551
564
  type ExuluContextFieldDefinition = {
@@ -567,7 +580,7 @@ declare class ExuluStorage {
567
580
  config: ExuluConfig;
568
581
  });
569
582
  getPresignedUrl: (key: string) => Promise<string>;
570
- uploadFile: (user: number, file: Buffer | Uint8Array, key: string, type: string, metadata?: Record<string, string>) => Promise<string>;
583
+ uploadFile: (file: Buffer | Uint8Array, key: string, type: string, user?: number, metadata?: Record<string, string>) => Promise<string>;
571
584
  }
572
585
  type ExuluContextSource = {
573
586
  id: string;
@@ -587,7 +600,10 @@ type ExuluContextSource = {
587
600
  default?: string;
588
601
  }[];
589
602
  };
590
- execute: (inputs: any) => Promise<Item[]>;
603
+ execute: (inputs: {
604
+ exuluConfig: ExuluConfig;
605
+ [key: string]: any;
606
+ }) => Promise<Item[]>;
591
607
  };
592
608
  declare class ExuluContext {
593
609
  id: string;
@@ -623,14 +639,35 @@ declare class ExuluContext {
623
639
  language?: "german" | "english";
624
640
  };
625
641
  });
626
- processField: (trigger: STATISTICS_LABELS, user: number, role: string, item: Item & {
642
+ processField: (trigger: STATISTICS_LABELS, item: Item & {
627
643
  field: string;
628
- }, config: ExuluConfig) => Promise<{
644
+ }, exuluConfig: ExuluConfig, user?: number, role?: string) => Promise<{
629
645
  result: string;
630
646
  job?: string;
631
647
  }>;
648
+ search: (options: {
649
+ query: string;
650
+ filters: any[];
651
+ user?: User;
652
+ role?: string;
653
+ method: VectorMethod;
654
+ sort: any;
655
+ trigger: STATISTICS_LABELS;
656
+ limit: number;
657
+ page: number;
658
+ }) => Promise<{
659
+ filters: any[];
660
+ query: string;
661
+ method: VectorMethod;
662
+ context: {
663
+ name: string;
664
+ id: string;
665
+ embedder: string;
666
+ };
667
+ items: any[];
668
+ }>;
632
669
  deleteAll: () => Promise<VectorOperationResponse>;
633
- executeSource: (source: ExuluContextSource, inputs: any) => Promise<Item[]>;
670
+ executeSource: (source: ExuluContextSource, inputs: any, exuluConfig: ExuluConfig) => Promise<Item[]>;
634
671
  tableExists: () => Promise<boolean>;
635
672
  chunksTableExists: () => Promise<boolean>;
636
673
  createAndUpsertEmbeddings: (item: Item, config: ExuluConfig, user?: number, statistics?: ExuluStatisticParams, role?: string, job?: string) => Promise<{
@@ -638,11 +675,11 @@ declare class ExuluContext {
638
675
  chunks?: number;
639
676
  job?: string;
640
677
  }>;
641
- createItem: (item: Item, config: ExuluConfig, user?: number, role?: string, upsert?: boolean) => Promise<{
678
+ createItem: (item: Item, config: ExuluConfig, user?: number, role?: string, upsert?: boolean, generateEmbeddingsOverwrite?: boolean | undefined) => Promise<{
642
679
  item: Item;
643
680
  job?: string;
644
681
  }>;
645
- updateItem: (item: Item, config: ExuluConfig, user?: number, role?: string) => Promise<{
682
+ updateItem: (item: Item, config: ExuluConfig, user?: number, role?: string, generateEmbeddingsOverwrite?: boolean | undefined) => Promise<{
646
683
  item: Item;
647
684
  job?: string;
648
685
  }>;
@@ -650,6 +687,13 @@ declare class ExuluContext {
650
687
  id: string;
651
688
  job?: string;
652
689
  }>;
690
+ getItem: ({ item }: {
691
+ item: Item;
692
+ }) => Promise<Item>;
693
+ getItems: ({ filters, fields }: {
694
+ filters?: any[];
695
+ fields?: string[];
696
+ }) => Promise<Item[]>;
653
697
  embeddings: {
654
698
  generate: {
655
699
  one: ({ item, user, role, trigger, config }: {