@exulu/backend 1.40.0 → 1.41.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 +4 -3
- package/dist/index.cjs +480 -416
- package/dist/index.d.cts +66 -22
- package/dist/index.d.ts +66 -22
- package/dist/index.js +480 -416
- package/package.json +1 -1
- package/types/models/context.ts +6 -6
- package/types/models/item.ts +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -40,12 +40,12 @@ interface Item {
|
|
|
40
40
|
source?: string;
|
|
41
41
|
tags?: string[];
|
|
42
42
|
textlength?: number;
|
|
43
|
+
last_processed_at?: string;
|
|
43
44
|
chunks?: {
|
|
44
45
|
id: string;
|
|
45
46
|
index: number;
|
|
46
47
|
content: string;
|
|
47
48
|
source: string;
|
|
48
|
-
embedding_size: number;
|
|
49
49
|
createdAt: string;
|
|
50
50
|
updatedAt: string;
|
|
51
51
|
}[];
|
|
@@ -160,6 +160,31 @@ type User = {
|
|
|
160
160
|
};
|
|
161
161
|
};
|
|
162
162
|
|
|
163
|
+
declare const VectorMethodEnum: {
|
|
164
|
+
readonly cosineDistance: "cosineDistance";
|
|
165
|
+
readonly hybridSearch: "hybridSearch";
|
|
166
|
+
readonly tsvector: "tsvector";
|
|
167
|
+
};
|
|
168
|
+
type VectorMethod = (typeof VectorMethodEnum)[keyof typeof VectorMethodEnum];
|
|
169
|
+
|
|
170
|
+
type VectorSearchChunkResult = {
|
|
171
|
+
chunk_content: string;
|
|
172
|
+
chunk_index: number;
|
|
173
|
+
chunk_id: string;
|
|
174
|
+
chunk_source: string;
|
|
175
|
+
chunk_metadata: Record<string, string>;
|
|
176
|
+
chunk_created_at: string;
|
|
177
|
+
chunk_updated_at: string;
|
|
178
|
+
item_id: string;
|
|
179
|
+
item_external_id: string;
|
|
180
|
+
item_name: string;
|
|
181
|
+
item_updated_at: string;
|
|
182
|
+
item_created_at: string;
|
|
183
|
+
chunk_cosine_distance?: number;
|
|
184
|
+
chunk_fts_rank?: number;
|
|
185
|
+
chunk_hybrid_score?: number;
|
|
186
|
+
};
|
|
187
|
+
|
|
163
188
|
interface Agent {
|
|
164
189
|
id: string;
|
|
165
190
|
modelName?: string;
|
|
@@ -236,13 +261,6 @@ interface TestCase {
|
|
|
236
261
|
updatedAt: string;
|
|
237
262
|
}
|
|
238
263
|
|
|
239
|
-
declare const VectorMethodEnum: {
|
|
240
|
-
readonly cosineDistance: "cosineDistance";
|
|
241
|
-
readonly hybridSearch: "hybridSearch";
|
|
242
|
-
readonly tsvector: "tsvector";
|
|
243
|
-
};
|
|
244
|
-
type VectorMethod = (typeof VectorMethodEnum)[keyof typeof VectorMethodEnum];
|
|
245
|
-
|
|
246
264
|
interface RateLimiterRule {
|
|
247
265
|
name?: string;
|
|
248
266
|
rate_limit: {
|
|
@@ -535,12 +553,11 @@ declare class ExuluTool {
|
|
|
535
553
|
}>;
|
|
536
554
|
});
|
|
537
555
|
}
|
|
538
|
-
type
|
|
556
|
+
type ExuluContextProcessor = {
|
|
557
|
+
name: string;
|
|
539
558
|
description: string;
|
|
540
559
|
execute: ({ item, user, role, utils, exuluConfig }: {
|
|
541
|
-
item: Item
|
|
542
|
-
field: string;
|
|
543
|
-
};
|
|
560
|
+
item: Item;
|
|
544
561
|
user?: number;
|
|
545
562
|
role?: string;
|
|
546
563
|
utils: {
|
|
@@ -565,7 +582,6 @@ type ExuluContextFieldDefinition = {
|
|
|
565
582
|
index?: boolean;
|
|
566
583
|
enumValues?: string[];
|
|
567
584
|
allowedFileTypes?: allFileTypes[];
|
|
568
|
-
processor?: ExuluContextFieldProcessor;
|
|
569
585
|
};
|
|
570
586
|
type ExuluRightsMode = "private" | "users" | "roles" | "public";
|
|
571
587
|
declare class ExuluStorage {
|
|
@@ -604,18 +620,43 @@ declare class ExuluContext {
|
|
|
604
620
|
name: string;
|
|
605
621
|
active: boolean;
|
|
606
622
|
fields: ExuluContextFieldDefinition[];
|
|
623
|
+
processor?: ExuluContextProcessor;
|
|
607
624
|
rateLimit?: RateLimiterRule;
|
|
608
625
|
description: string;
|
|
609
626
|
embedder?: ExuluEmbedder;
|
|
610
627
|
queryRewriter?: (query: string) => Promise<string>;
|
|
611
|
-
resultReranker?: (results:
|
|
628
|
+
resultReranker?: (results: {
|
|
629
|
+
chunk_content: string;
|
|
630
|
+
chunk_index: number;
|
|
631
|
+
chunk_id: string;
|
|
632
|
+
chunk_source: string;
|
|
633
|
+
chunk_metadata: Record<string, string>;
|
|
634
|
+
chunk_created_at: string;
|
|
635
|
+
chunk_updated_at: string;
|
|
636
|
+
item_id: string;
|
|
637
|
+
item_external_id: string;
|
|
638
|
+
item_name: string;
|
|
639
|
+
}[]) => Promise<{
|
|
640
|
+
chunk_content: string;
|
|
641
|
+
chunk_index: number;
|
|
642
|
+
chunk_id: string;
|
|
643
|
+
chunk_source: string;
|
|
644
|
+
chunk_metadata: Record<string, string>;
|
|
645
|
+
chunk_created_at: string;
|
|
646
|
+
chunk_updated_at: string;
|
|
647
|
+
item_id: string;
|
|
648
|
+
item_external_id: string;
|
|
649
|
+
item_name: string;
|
|
650
|
+
}[]>;
|
|
612
651
|
configuration: {
|
|
613
652
|
calculateVectors?: "manual" | "onUpdate" | "onInsert" | "always";
|
|
653
|
+
maxRetrievalResults?: number;
|
|
614
654
|
defaultRightsMode?: ExuluRightsMode;
|
|
655
|
+
enableAsTool?: boolean;
|
|
615
656
|
language?: "german" | "english";
|
|
616
657
|
};
|
|
617
658
|
sources: ExuluContextSource[];
|
|
618
|
-
constructor({ id, name, description, embedder, active, rateLimit, fields, queryRewriter, resultReranker, configuration, sources }: {
|
|
659
|
+
constructor({ id, name, description, embedder, processor, active, rateLimit, fields, queryRewriter, resultReranker, configuration, sources }: {
|
|
619
660
|
id: string;
|
|
620
661
|
name: string;
|
|
621
662
|
fields: ExuluContextFieldDefinition[];
|
|
@@ -624,19 +665,20 @@ declare class ExuluContext {
|
|
|
624
665
|
sources: ExuluContextSource[];
|
|
625
666
|
category?: string;
|
|
626
667
|
active: boolean;
|
|
668
|
+
processor?: ExuluContextProcessor;
|
|
627
669
|
rateLimit?: RateLimiterRule;
|
|
628
670
|
queryRewriter?: (query: string) => Promise<string>;
|
|
629
671
|
resultReranker?: (results: any[]) => Promise<any[]>;
|
|
630
672
|
configuration?: {
|
|
631
673
|
calculateVectors?: "manual" | "onUpdate" | "onInsert" | "always";
|
|
632
674
|
defaultRightsMode?: ExuluRightsMode;
|
|
675
|
+
enableAsTool?: boolean;
|
|
633
676
|
language?: "german" | "english";
|
|
677
|
+
maxRetrievalResults?: number;
|
|
634
678
|
};
|
|
635
679
|
});
|
|
636
|
-
processField: (trigger: STATISTICS_LABELS, item: Item
|
|
637
|
-
|
|
638
|
-
}, exuluConfig: ExuluConfig, user?: number, role?: string) => Promise<{
|
|
639
|
-
result: Item;
|
|
680
|
+
processField: (trigger: STATISTICS_LABELS, item: Item, exuluConfig: ExuluConfig, user?: number, role?: string) => Promise<{
|
|
681
|
+
result: Item | undefined;
|
|
640
682
|
job?: string;
|
|
641
683
|
}>;
|
|
642
684
|
search: (options: {
|
|
@@ -658,7 +700,7 @@ declare class ExuluContext {
|
|
|
658
700
|
id: string;
|
|
659
701
|
embedder: string;
|
|
660
702
|
};
|
|
661
|
-
|
|
703
|
+
chunks: VectorSearchChunkResult[];
|
|
662
704
|
}>;
|
|
663
705
|
deleteAll: () => Promise<VectorOperationResponse>;
|
|
664
706
|
executeSource: (source: ExuluContextSource, inputs: any, exuluConfig: ExuluConfig) => Promise<Item[]>;
|
|
@@ -709,7 +751,7 @@ declare class ExuluContext {
|
|
|
709
751
|
};
|
|
710
752
|
createItemsTable: () => Promise<void>;
|
|
711
753
|
createChunksTable: () => Promise<void>;
|
|
712
|
-
tool: () => ExuluTool;
|
|
754
|
+
tool: () => ExuluTool | null;
|
|
713
755
|
}
|
|
714
756
|
type STATISTICS_LABELS = "tool" | "agent" | "flow" | "api" | "claude-code" | "user" | "processor";
|
|
715
757
|
type ExuluStatistic = {
|
|
@@ -741,6 +783,7 @@ declare class ExuluQueues {
|
|
|
741
783
|
worker: number;
|
|
742
784
|
queue: number;
|
|
743
785
|
};
|
|
786
|
+
timeoutInSeconds: number;
|
|
744
787
|
}[];
|
|
745
788
|
constructor();
|
|
746
789
|
list: Map<string, {
|
|
@@ -750,6 +793,7 @@ declare class ExuluQueues {
|
|
|
750
793
|
queue: number;
|
|
751
794
|
};
|
|
752
795
|
ratelimit: number;
|
|
796
|
+
timeoutInSeconds: number;
|
|
753
797
|
use: () => Promise<ExuluQueueConfig>;
|
|
754
798
|
}>;
|
|
755
799
|
queue(name: string): {
|
|
@@ -763,7 +807,7 @@ declare class ExuluQueues {
|
|
|
763
807
|
register: (name: string, concurrency: {
|
|
764
808
|
worker: number;
|
|
765
809
|
queue: number;
|
|
766
|
-
}, ratelimit?: number) => {
|
|
810
|
+
}, ratelimit?: number, timeoutInSeconds?: number) => {
|
|
767
811
|
use: () => Promise<ExuluQueueConfig>;
|
|
768
812
|
};
|
|
769
813
|
}
|
package/dist/index.d.ts
CHANGED
|
@@ -40,12 +40,12 @@ interface Item {
|
|
|
40
40
|
source?: string;
|
|
41
41
|
tags?: string[];
|
|
42
42
|
textlength?: number;
|
|
43
|
+
last_processed_at?: string;
|
|
43
44
|
chunks?: {
|
|
44
45
|
id: string;
|
|
45
46
|
index: number;
|
|
46
47
|
content: string;
|
|
47
48
|
source: string;
|
|
48
|
-
embedding_size: number;
|
|
49
49
|
createdAt: string;
|
|
50
50
|
updatedAt: string;
|
|
51
51
|
}[];
|
|
@@ -160,6 +160,31 @@ type User = {
|
|
|
160
160
|
};
|
|
161
161
|
};
|
|
162
162
|
|
|
163
|
+
declare const VectorMethodEnum: {
|
|
164
|
+
readonly cosineDistance: "cosineDistance";
|
|
165
|
+
readonly hybridSearch: "hybridSearch";
|
|
166
|
+
readonly tsvector: "tsvector";
|
|
167
|
+
};
|
|
168
|
+
type VectorMethod = (typeof VectorMethodEnum)[keyof typeof VectorMethodEnum];
|
|
169
|
+
|
|
170
|
+
type VectorSearchChunkResult = {
|
|
171
|
+
chunk_content: string;
|
|
172
|
+
chunk_index: number;
|
|
173
|
+
chunk_id: string;
|
|
174
|
+
chunk_source: string;
|
|
175
|
+
chunk_metadata: Record<string, string>;
|
|
176
|
+
chunk_created_at: string;
|
|
177
|
+
chunk_updated_at: string;
|
|
178
|
+
item_id: string;
|
|
179
|
+
item_external_id: string;
|
|
180
|
+
item_name: string;
|
|
181
|
+
item_updated_at: string;
|
|
182
|
+
item_created_at: string;
|
|
183
|
+
chunk_cosine_distance?: number;
|
|
184
|
+
chunk_fts_rank?: number;
|
|
185
|
+
chunk_hybrid_score?: number;
|
|
186
|
+
};
|
|
187
|
+
|
|
163
188
|
interface Agent {
|
|
164
189
|
id: string;
|
|
165
190
|
modelName?: string;
|
|
@@ -236,13 +261,6 @@ interface TestCase {
|
|
|
236
261
|
updatedAt: string;
|
|
237
262
|
}
|
|
238
263
|
|
|
239
|
-
declare const VectorMethodEnum: {
|
|
240
|
-
readonly cosineDistance: "cosineDistance";
|
|
241
|
-
readonly hybridSearch: "hybridSearch";
|
|
242
|
-
readonly tsvector: "tsvector";
|
|
243
|
-
};
|
|
244
|
-
type VectorMethod = (typeof VectorMethodEnum)[keyof typeof VectorMethodEnum];
|
|
245
|
-
|
|
246
264
|
interface RateLimiterRule {
|
|
247
265
|
name?: string;
|
|
248
266
|
rate_limit: {
|
|
@@ -535,12 +553,11 @@ declare class ExuluTool {
|
|
|
535
553
|
}>;
|
|
536
554
|
});
|
|
537
555
|
}
|
|
538
|
-
type
|
|
556
|
+
type ExuluContextProcessor = {
|
|
557
|
+
name: string;
|
|
539
558
|
description: string;
|
|
540
559
|
execute: ({ item, user, role, utils, exuluConfig }: {
|
|
541
|
-
item: Item
|
|
542
|
-
field: string;
|
|
543
|
-
};
|
|
560
|
+
item: Item;
|
|
544
561
|
user?: number;
|
|
545
562
|
role?: string;
|
|
546
563
|
utils: {
|
|
@@ -565,7 +582,6 @@ type ExuluContextFieldDefinition = {
|
|
|
565
582
|
index?: boolean;
|
|
566
583
|
enumValues?: string[];
|
|
567
584
|
allowedFileTypes?: allFileTypes[];
|
|
568
|
-
processor?: ExuluContextFieldProcessor;
|
|
569
585
|
};
|
|
570
586
|
type ExuluRightsMode = "private" | "users" | "roles" | "public";
|
|
571
587
|
declare class ExuluStorage {
|
|
@@ -604,18 +620,43 @@ declare class ExuluContext {
|
|
|
604
620
|
name: string;
|
|
605
621
|
active: boolean;
|
|
606
622
|
fields: ExuluContextFieldDefinition[];
|
|
623
|
+
processor?: ExuluContextProcessor;
|
|
607
624
|
rateLimit?: RateLimiterRule;
|
|
608
625
|
description: string;
|
|
609
626
|
embedder?: ExuluEmbedder;
|
|
610
627
|
queryRewriter?: (query: string) => Promise<string>;
|
|
611
|
-
resultReranker?: (results:
|
|
628
|
+
resultReranker?: (results: {
|
|
629
|
+
chunk_content: string;
|
|
630
|
+
chunk_index: number;
|
|
631
|
+
chunk_id: string;
|
|
632
|
+
chunk_source: string;
|
|
633
|
+
chunk_metadata: Record<string, string>;
|
|
634
|
+
chunk_created_at: string;
|
|
635
|
+
chunk_updated_at: string;
|
|
636
|
+
item_id: string;
|
|
637
|
+
item_external_id: string;
|
|
638
|
+
item_name: string;
|
|
639
|
+
}[]) => Promise<{
|
|
640
|
+
chunk_content: string;
|
|
641
|
+
chunk_index: number;
|
|
642
|
+
chunk_id: string;
|
|
643
|
+
chunk_source: string;
|
|
644
|
+
chunk_metadata: Record<string, string>;
|
|
645
|
+
chunk_created_at: string;
|
|
646
|
+
chunk_updated_at: string;
|
|
647
|
+
item_id: string;
|
|
648
|
+
item_external_id: string;
|
|
649
|
+
item_name: string;
|
|
650
|
+
}[]>;
|
|
612
651
|
configuration: {
|
|
613
652
|
calculateVectors?: "manual" | "onUpdate" | "onInsert" | "always";
|
|
653
|
+
maxRetrievalResults?: number;
|
|
614
654
|
defaultRightsMode?: ExuluRightsMode;
|
|
655
|
+
enableAsTool?: boolean;
|
|
615
656
|
language?: "german" | "english";
|
|
616
657
|
};
|
|
617
658
|
sources: ExuluContextSource[];
|
|
618
|
-
constructor({ id, name, description, embedder, active, rateLimit, fields, queryRewriter, resultReranker, configuration, sources }: {
|
|
659
|
+
constructor({ id, name, description, embedder, processor, active, rateLimit, fields, queryRewriter, resultReranker, configuration, sources }: {
|
|
619
660
|
id: string;
|
|
620
661
|
name: string;
|
|
621
662
|
fields: ExuluContextFieldDefinition[];
|
|
@@ -624,19 +665,20 @@ declare class ExuluContext {
|
|
|
624
665
|
sources: ExuluContextSource[];
|
|
625
666
|
category?: string;
|
|
626
667
|
active: boolean;
|
|
668
|
+
processor?: ExuluContextProcessor;
|
|
627
669
|
rateLimit?: RateLimiterRule;
|
|
628
670
|
queryRewriter?: (query: string) => Promise<string>;
|
|
629
671
|
resultReranker?: (results: any[]) => Promise<any[]>;
|
|
630
672
|
configuration?: {
|
|
631
673
|
calculateVectors?: "manual" | "onUpdate" | "onInsert" | "always";
|
|
632
674
|
defaultRightsMode?: ExuluRightsMode;
|
|
675
|
+
enableAsTool?: boolean;
|
|
633
676
|
language?: "german" | "english";
|
|
677
|
+
maxRetrievalResults?: number;
|
|
634
678
|
};
|
|
635
679
|
});
|
|
636
|
-
processField: (trigger: STATISTICS_LABELS, item: Item
|
|
637
|
-
|
|
638
|
-
}, exuluConfig: ExuluConfig, user?: number, role?: string) => Promise<{
|
|
639
|
-
result: Item;
|
|
680
|
+
processField: (trigger: STATISTICS_LABELS, item: Item, exuluConfig: ExuluConfig, user?: number, role?: string) => Promise<{
|
|
681
|
+
result: Item | undefined;
|
|
640
682
|
job?: string;
|
|
641
683
|
}>;
|
|
642
684
|
search: (options: {
|
|
@@ -658,7 +700,7 @@ declare class ExuluContext {
|
|
|
658
700
|
id: string;
|
|
659
701
|
embedder: string;
|
|
660
702
|
};
|
|
661
|
-
|
|
703
|
+
chunks: VectorSearchChunkResult[];
|
|
662
704
|
}>;
|
|
663
705
|
deleteAll: () => Promise<VectorOperationResponse>;
|
|
664
706
|
executeSource: (source: ExuluContextSource, inputs: any, exuluConfig: ExuluConfig) => Promise<Item[]>;
|
|
@@ -709,7 +751,7 @@ declare class ExuluContext {
|
|
|
709
751
|
};
|
|
710
752
|
createItemsTable: () => Promise<void>;
|
|
711
753
|
createChunksTable: () => Promise<void>;
|
|
712
|
-
tool: () => ExuluTool;
|
|
754
|
+
tool: () => ExuluTool | null;
|
|
713
755
|
}
|
|
714
756
|
type STATISTICS_LABELS = "tool" | "agent" | "flow" | "api" | "claude-code" | "user" | "processor";
|
|
715
757
|
type ExuluStatistic = {
|
|
@@ -741,6 +783,7 @@ declare class ExuluQueues {
|
|
|
741
783
|
worker: number;
|
|
742
784
|
queue: number;
|
|
743
785
|
};
|
|
786
|
+
timeoutInSeconds: number;
|
|
744
787
|
}[];
|
|
745
788
|
constructor();
|
|
746
789
|
list: Map<string, {
|
|
@@ -750,6 +793,7 @@ declare class ExuluQueues {
|
|
|
750
793
|
queue: number;
|
|
751
794
|
};
|
|
752
795
|
ratelimit: number;
|
|
796
|
+
timeoutInSeconds: number;
|
|
753
797
|
use: () => Promise<ExuluQueueConfig>;
|
|
754
798
|
}>;
|
|
755
799
|
queue(name: string): {
|
|
@@ -763,7 +807,7 @@ declare class ExuluQueues {
|
|
|
763
807
|
register: (name: string, concurrency: {
|
|
764
808
|
worker: number;
|
|
765
809
|
queue: number;
|
|
766
|
-
}, ratelimit?: number) => {
|
|
810
|
+
}, ratelimit?: number, timeoutInSeconds?: number) => {
|
|
767
811
|
use: () => Promise<ExuluQueueConfig>;
|
|
768
812
|
};
|
|
769
813
|
}
|