@exulu/backend 1.37.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/CHANGELOG.md +2 -2
- package/dist/index.cjs +484 -109
- package/dist/index.d.cts +64 -12
- package/dist/index.d.ts +64 -12
- package/dist/index.js +484 -109
- package/package.json +2 -1
- package/types/models/agent-session.ts +1 -0
- package/types/models/user.ts +2 -0
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: {
|
|
@@ -398,6 +410,14 @@ declare class ExuluAgent {
|
|
|
398
410
|
instructions?: string;
|
|
399
411
|
outputSchema?: z.ZodType;
|
|
400
412
|
}) => Promise<string | any>;
|
|
413
|
+
/**
|
|
414
|
+
* Convert file parts in messages to OpenAI Responses API compatible format.
|
|
415
|
+
* The OpenAI Responses API doesn't support inline file parts with type 'file'.
|
|
416
|
+
* This function converts:
|
|
417
|
+
* - Document files (PDF, DOCX, etc.) -> text parts with extracted content using officeparser
|
|
418
|
+
* - Image files -> image parts (which ARE supported by Responses API)
|
|
419
|
+
*/
|
|
420
|
+
private processFilePartsInMessages;
|
|
401
421
|
generateStream: ({ user, session, message, previousMessages, currentTools, allExuluTools, toolConfigs, providerapikey, contexts, exuluConfig, instructions, req, }: {
|
|
402
422
|
user?: User;
|
|
403
423
|
session?: string;
|
|
@@ -518,12 +538,12 @@ declare class ExuluTool {
|
|
|
518
538
|
}
|
|
519
539
|
type ExuluContextFieldProcessor = {
|
|
520
540
|
description: string;
|
|
521
|
-
execute: ({ item, user, role, utils,
|
|
541
|
+
execute: ({ item, user, role, utils, exuluConfig }: {
|
|
522
542
|
item: Item & {
|
|
523
543
|
field: string;
|
|
524
544
|
};
|
|
525
|
-
user
|
|
526
|
-
role
|
|
545
|
+
user?: number;
|
|
546
|
+
role?: string;
|
|
527
547
|
utils: {
|
|
528
548
|
storage: ExuluStorage;
|
|
529
549
|
items: {
|
|
@@ -532,12 +552,13 @@ type ExuluContextFieldProcessor = {
|
|
|
532
552
|
delete: ExuluContext['deleteItem'];
|
|
533
553
|
};
|
|
534
554
|
};
|
|
535
|
-
|
|
555
|
+
exuluConfig: ExuluConfig;
|
|
536
556
|
}) => Promise<string>;
|
|
537
557
|
config?: {
|
|
538
558
|
queue?: Promise<ExuluQueueConfig>;
|
|
539
559
|
timeoutInSeconds?: number;
|
|
540
|
-
trigger: "manual" | "onUpdate" | "
|
|
560
|
+
trigger: "manual" | "onUpdate" | "onInsert" | "always";
|
|
561
|
+
generateEmbeddings?: boolean;
|
|
541
562
|
};
|
|
542
563
|
};
|
|
543
564
|
type ExuluContextFieldDefinition = {
|
|
@@ -559,7 +580,7 @@ declare class ExuluStorage {
|
|
|
559
580
|
config: ExuluConfig;
|
|
560
581
|
});
|
|
561
582
|
getPresignedUrl: (key: string) => Promise<string>;
|
|
562
|
-
uploadFile: (
|
|
583
|
+
uploadFile: (file: Buffer | Uint8Array, key: string, type: string, user?: number, metadata?: Record<string, string>) => Promise<string>;
|
|
563
584
|
}
|
|
564
585
|
type ExuluContextSource = {
|
|
565
586
|
id: string;
|
|
@@ -579,7 +600,10 @@ type ExuluContextSource = {
|
|
|
579
600
|
default?: string;
|
|
580
601
|
}[];
|
|
581
602
|
};
|
|
582
|
-
execute: (inputs:
|
|
603
|
+
execute: (inputs: {
|
|
604
|
+
exuluConfig: ExuluConfig;
|
|
605
|
+
[key: string]: any;
|
|
606
|
+
}) => Promise<Item[]>;
|
|
583
607
|
};
|
|
584
608
|
declare class ExuluContext {
|
|
585
609
|
id: string;
|
|
@@ -615,14 +639,35 @@ declare class ExuluContext {
|
|
|
615
639
|
language?: "german" | "english";
|
|
616
640
|
};
|
|
617
641
|
});
|
|
618
|
-
processField: (trigger: STATISTICS_LABELS,
|
|
642
|
+
processField: (trigger: STATISTICS_LABELS, item: Item & {
|
|
619
643
|
field: string;
|
|
620
|
-
},
|
|
644
|
+
}, exuluConfig: ExuluConfig, user?: number, role?: string) => Promise<{
|
|
621
645
|
result: string;
|
|
622
646
|
job?: string;
|
|
623
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
|
+
}>;
|
|
624
669
|
deleteAll: () => Promise<VectorOperationResponse>;
|
|
625
|
-
executeSource: (source: ExuluContextSource, inputs: any) => Promise<Item[]>;
|
|
670
|
+
executeSource: (source: ExuluContextSource, inputs: any, exuluConfig: ExuluConfig) => Promise<Item[]>;
|
|
626
671
|
tableExists: () => Promise<boolean>;
|
|
627
672
|
chunksTableExists: () => Promise<boolean>;
|
|
628
673
|
createAndUpsertEmbeddings: (item: Item, config: ExuluConfig, user?: number, statistics?: ExuluStatisticParams, role?: string, job?: string) => Promise<{
|
|
@@ -630,11 +675,11 @@ declare class ExuluContext {
|
|
|
630
675
|
chunks?: number;
|
|
631
676
|
job?: string;
|
|
632
677
|
}>;
|
|
633
|
-
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<{
|
|
634
679
|
item: Item;
|
|
635
680
|
job?: string;
|
|
636
681
|
}>;
|
|
637
|
-
updateItem: (item: Item, config: ExuluConfig, user?: number, role?: string) => Promise<{
|
|
682
|
+
updateItem: (item: Item, config: ExuluConfig, user?: number, role?: string, generateEmbeddingsOverwrite?: boolean | undefined) => Promise<{
|
|
638
683
|
item: Item;
|
|
639
684
|
job?: string;
|
|
640
685
|
}>;
|
|
@@ -642,6 +687,13 @@ declare class ExuluContext {
|
|
|
642
687
|
id: string;
|
|
643
688
|
job?: string;
|
|
644
689
|
}>;
|
|
690
|
+
getItem: ({ item }: {
|
|
691
|
+
item: Item;
|
|
692
|
+
}) => Promise<Item>;
|
|
693
|
+
getItems: ({ filters, fields }: {
|
|
694
|
+
filters?: any[];
|
|
695
|
+
fields?: string[];
|
|
696
|
+
}) => Promise<Item[]>;
|
|
645
697
|
embeddings: {
|
|
646
698
|
generate: {
|
|
647
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: {
|
|
@@ -398,6 +410,14 @@ declare class ExuluAgent {
|
|
|
398
410
|
instructions?: string;
|
|
399
411
|
outputSchema?: z.ZodType;
|
|
400
412
|
}) => Promise<string | any>;
|
|
413
|
+
/**
|
|
414
|
+
* Convert file parts in messages to OpenAI Responses API compatible format.
|
|
415
|
+
* The OpenAI Responses API doesn't support inline file parts with type 'file'.
|
|
416
|
+
* This function converts:
|
|
417
|
+
* - Document files (PDF, DOCX, etc.) -> text parts with extracted content using officeparser
|
|
418
|
+
* - Image files -> image parts (which ARE supported by Responses API)
|
|
419
|
+
*/
|
|
420
|
+
private processFilePartsInMessages;
|
|
401
421
|
generateStream: ({ user, session, message, previousMessages, currentTools, allExuluTools, toolConfigs, providerapikey, contexts, exuluConfig, instructions, req, }: {
|
|
402
422
|
user?: User;
|
|
403
423
|
session?: string;
|
|
@@ -518,12 +538,12 @@ declare class ExuluTool {
|
|
|
518
538
|
}
|
|
519
539
|
type ExuluContextFieldProcessor = {
|
|
520
540
|
description: string;
|
|
521
|
-
execute: ({ item, user, role, utils,
|
|
541
|
+
execute: ({ item, user, role, utils, exuluConfig }: {
|
|
522
542
|
item: Item & {
|
|
523
543
|
field: string;
|
|
524
544
|
};
|
|
525
|
-
user
|
|
526
|
-
role
|
|
545
|
+
user?: number;
|
|
546
|
+
role?: string;
|
|
527
547
|
utils: {
|
|
528
548
|
storage: ExuluStorage;
|
|
529
549
|
items: {
|
|
@@ -532,12 +552,13 @@ type ExuluContextFieldProcessor = {
|
|
|
532
552
|
delete: ExuluContext['deleteItem'];
|
|
533
553
|
};
|
|
534
554
|
};
|
|
535
|
-
|
|
555
|
+
exuluConfig: ExuluConfig;
|
|
536
556
|
}) => Promise<string>;
|
|
537
557
|
config?: {
|
|
538
558
|
queue?: Promise<ExuluQueueConfig>;
|
|
539
559
|
timeoutInSeconds?: number;
|
|
540
|
-
trigger: "manual" | "onUpdate" | "
|
|
560
|
+
trigger: "manual" | "onUpdate" | "onInsert" | "always";
|
|
561
|
+
generateEmbeddings?: boolean;
|
|
541
562
|
};
|
|
542
563
|
};
|
|
543
564
|
type ExuluContextFieldDefinition = {
|
|
@@ -559,7 +580,7 @@ declare class ExuluStorage {
|
|
|
559
580
|
config: ExuluConfig;
|
|
560
581
|
});
|
|
561
582
|
getPresignedUrl: (key: string) => Promise<string>;
|
|
562
|
-
uploadFile: (
|
|
583
|
+
uploadFile: (file: Buffer | Uint8Array, key: string, type: string, user?: number, metadata?: Record<string, string>) => Promise<string>;
|
|
563
584
|
}
|
|
564
585
|
type ExuluContextSource = {
|
|
565
586
|
id: string;
|
|
@@ -579,7 +600,10 @@ type ExuluContextSource = {
|
|
|
579
600
|
default?: string;
|
|
580
601
|
}[];
|
|
581
602
|
};
|
|
582
|
-
execute: (inputs:
|
|
603
|
+
execute: (inputs: {
|
|
604
|
+
exuluConfig: ExuluConfig;
|
|
605
|
+
[key: string]: any;
|
|
606
|
+
}) => Promise<Item[]>;
|
|
583
607
|
};
|
|
584
608
|
declare class ExuluContext {
|
|
585
609
|
id: string;
|
|
@@ -615,14 +639,35 @@ declare class ExuluContext {
|
|
|
615
639
|
language?: "german" | "english";
|
|
616
640
|
};
|
|
617
641
|
});
|
|
618
|
-
processField: (trigger: STATISTICS_LABELS,
|
|
642
|
+
processField: (trigger: STATISTICS_LABELS, item: Item & {
|
|
619
643
|
field: string;
|
|
620
|
-
},
|
|
644
|
+
}, exuluConfig: ExuluConfig, user?: number, role?: string) => Promise<{
|
|
621
645
|
result: string;
|
|
622
646
|
job?: string;
|
|
623
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
|
+
}>;
|
|
624
669
|
deleteAll: () => Promise<VectorOperationResponse>;
|
|
625
|
-
executeSource: (source: ExuluContextSource, inputs: any) => Promise<Item[]>;
|
|
670
|
+
executeSource: (source: ExuluContextSource, inputs: any, exuluConfig: ExuluConfig) => Promise<Item[]>;
|
|
626
671
|
tableExists: () => Promise<boolean>;
|
|
627
672
|
chunksTableExists: () => Promise<boolean>;
|
|
628
673
|
createAndUpsertEmbeddings: (item: Item, config: ExuluConfig, user?: number, statistics?: ExuluStatisticParams, role?: string, job?: string) => Promise<{
|
|
@@ -630,11 +675,11 @@ declare class ExuluContext {
|
|
|
630
675
|
chunks?: number;
|
|
631
676
|
job?: string;
|
|
632
677
|
}>;
|
|
633
|
-
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<{
|
|
634
679
|
item: Item;
|
|
635
680
|
job?: string;
|
|
636
681
|
}>;
|
|
637
|
-
updateItem: (item: Item, config: ExuluConfig, user?: number, role?: string) => Promise<{
|
|
682
|
+
updateItem: (item: Item, config: ExuluConfig, user?: number, role?: string, generateEmbeddingsOverwrite?: boolean | undefined) => Promise<{
|
|
638
683
|
item: Item;
|
|
639
684
|
job?: string;
|
|
640
685
|
}>;
|
|
@@ -642,6 +687,13 @@ declare class ExuluContext {
|
|
|
642
687
|
id: string;
|
|
643
688
|
job?: string;
|
|
644
689
|
}>;
|
|
690
|
+
getItem: ({ item }: {
|
|
691
|
+
item: Item;
|
|
692
|
+
}) => Promise<Item>;
|
|
693
|
+
getItems: ({ filters, fields }: {
|
|
694
|
+
filters?: any[];
|
|
695
|
+
fields?: string[];
|
|
696
|
+
}) => Promise<Item[]>;
|
|
645
697
|
embeddings: {
|
|
646
698
|
generate: {
|
|
647
699
|
one: ({ item, user, role, trigger, config }: {
|