@exulu/backend 1.46.1 → 1.48.1
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/.agents/skills/mintlify/SKILL.md +347 -0
- package/.editorconfig +15 -0
- package/.eslintrc.json +52 -0
- package/.jscpd.json +18 -0
- package/.prettierignore +5 -0
- package/.prettierrc.json +12 -0
- package/CHANGELOG.md +2 -2
- package/README.md +747 -0
- package/SECURITY.md +5 -0
- package/dist/index.cjs +11747 -10227
- package/dist/index.d.cts +725 -667
- package/dist/index.d.ts +725 -667
- package/dist/index.js +12043 -10516
- package/ee/LICENSE.md +62 -0
- package/ee/agentic-retrieval/index.ts +1109 -0
- package/ee/documents/THIRD_PARTY_LICENSES/docling.txt +31 -0
- package/ee/documents/processing/build_pdf_processor.sh +35 -0
- package/ee/documents/processing/chunk_markdown.py +263 -0
- package/ee/documents/processing/doc_processor.ts +635 -0
- package/ee/documents/processing/pdf_processor.spec +115 -0
- package/ee/documents/processing/pdf_to_markdown.py +420 -0
- package/ee/documents/processing/requirements.txt +4 -0
- package/ee/entitlements.ts +49 -0
- package/ee/markdown.ts +686 -0
- package/ee/queues/decorator.ts +140 -0
- package/ee/queues/queues.ts +156 -0
- package/ee/queues/server.ts +6 -0
- package/ee/rbac-resolver.ts +51 -0
- package/ee/rbac-update.ts +111 -0
- package/ee/schemas.ts +348 -0
- package/ee/tokenizer.ts +80 -0
- package/ee/workers.ts +1423 -0
- package/eslint.config.js +88 -0
- package/jest.config.ts +25 -0
- package/license.md +73 -49
- package/mintlify-docs/.mintignore +7 -0
- package/mintlify-docs/AGENTS.md +33 -0
- package/mintlify-docs/CLAUDE.MD +50 -0
- package/mintlify-docs/CONTRIBUTING.md +32 -0
- package/mintlify-docs/LICENSE +21 -0
- package/mintlify-docs/README.md +55 -0
- package/mintlify-docs/ai-tools/claude-code.mdx +43 -0
- package/mintlify-docs/ai-tools/cursor.mdx +39 -0
- package/mintlify-docs/ai-tools/windsurf.mdx +39 -0
- package/mintlify-docs/api-reference/core-types/agent-types.mdx +110 -0
- package/mintlify-docs/api-reference/core-types/analytics-types.mdx +95 -0
- package/mintlify-docs/api-reference/core-types/configuration-types.mdx +83 -0
- package/mintlify-docs/api-reference/core-types/evaluation-types.mdx +106 -0
- package/mintlify-docs/api-reference/core-types/job-types.mdx +135 -0
- package/mintlify-docs/api-reference/core-types/overview.mdx +73 -0
- package/mintlify-docs/api-reference/core-types/prompt-types.mdx +102 -0
- package/mintlify-docs/api-reference/core-types/rbac-types.mdx +163 -0
- package/mintlify-docs/api-reference/core-types/session-types.mdx +77 -0
- package/mintlify-docs/api-reference/core-types/user-management.mdx +112 -0
- package/mintlify-docs/api-reference/core-types/workflow-types.mdx +88 -0
- package/mintlify-docs/api-reference/core-types.mdx +585 -0
- package/mintlify-docs/api-reference/dynamic-types.mdx +851 -0
- package/mintlify-docs/api-reference/endpoint/create.mdx +4 -0
- package/mintlify-docs/api-reference/endpoint/delete.mdx +4 -0
- package/mintlify-docs/api-reference/endpoint/get.mdx +4 -0
- package/mintlify-docs/api-reference/endpoint/webhook.mdx +4 -0
- package/mintlify-docs/api-reference/introduction.mdx +661 -0
- package/mintlify-docs/api-reference/mutations.mdx +1012 -0
- package/mintlify-docs/api-reference/openapi.json +217 -0
- package/mintlify-docs/api-reference/queries.mdx +1154 -0
- package/mintlify-docs/backend/introduction.mdx +218 -0
- package/mintlify-docs/changelog.mdx +387 -0
- package/mintlify-docs/community-edition.mdx +304 -0
- package/mintlify-docs/core/exulu-agent/api-reference.mdx +894 -0
- package/mintlify-docs/core/exulu-agent/configuration.mdx +690 -0
- package/mintlify-docs/core/exulu-agent/introduction.mdx +552 -0
- package/mintlify-docs/core/exulu-app/api-reference.mdx +481 -0
- package/mintlify-docs/core/exulu-app/configuration.mdx +319 -0
- package/mintlify-docs/core/exulu-app/introduction.mdx +117 -0
- package/mintlify-docs/core/exulu-authentication.mdx +810 -0
- package/mintlify-docs/core/exulu-chunkers/api-reference.mdx +1011 -0
- package/mintlify-docs/core/exulu-chunkers/configuration.mdx +596 -0
- package/mintlify-docs/core/exulu-chunkers/introduction.mdx +403 -0
- package/mintlify-docs/core/exulu-context/api-reference.mdx +911 -0
- package/mintlify-docs/core/exulu-context/configuration.mdx +648 -0
- package/mintlify-docs/core/exulu-context/introduction.mdx +394 -0
- package/mintlify-docs/core/exulu-database.mdx +811 -0
- package/mintlify-docs/core/exulu-default-agents.mdx +545 -0
- package/mintlify-docs/core/exulu-eval/api-reference.mdx +772 -0
- package/mintlify-docs/core/exulu-eval/configuration.mdx +680 -0
- package/mintlify-docs/core/exulu-eval/introduction.mdx +459 -0
- package/mintlify-docs/core/exulu-logging.mdx +464 -0
- package/mintlify-docs/core/exulu-otel.mdx +670 -0
- package/mintlify-docs/core/exulu-queues/api-reference.mdx +648 -0
- package/mintlify-docs/core/exulu-queues/configuration.mdx +650 -0
- package/mintlify-docs/core/exulu-queues/introduction.mdx +474 -0
- package/mintlify-docs/core/exulu-reranker/api-reference.mdx +630 -0
- package/mintlify-docs/core/exulu-reranker/configuration.mdx +663 -0
- package/mintlify-docs/core/exulu-reranker/introduction.mdx +516 -0
- package/mintlify-docs/core/exulu-tool/api-reference.mdx +723 -0
- package/mintlify-docs/core/exulu-tool/configuration.mdx +805 -0
- package/mintlify-docs/core/exulu-tool/introduction.mdx +539 -0
- package/mintlify-docs/core/exulu-variables/api-reference.mdx +699 -0
- package/mintlify-docs/core/exulu-variables/configuration.mdx +736 -0
- package/mintlify-docs/core/exulu-variables/introduction.mdx +511 -0
- package/mintlify-docs/development.mdx +94 -0
- package/mintlify-docs/docs.json +248 -0
- package/mintlify-docs/enterprise-edition.mdx +538 -0
- package/mintlify-docs/essentials/code.mdx +35 -0
- package/mintlify-docs/essentials/images.mdx +59 -0
- package/mintlify-docs/essentials/markdown.mdx +88 -0
- package/mintlify-docs/essentials/navigation.mdx +87 -0
- package/mintlify-docs/essentials/reusable-snippets.mdx +110 -0
- package/mintlify-docs/essentials/settings.mdx +318 -0
- package/mintlify-docs/favicon.svg +3 -0
- package/mintlify-docs/frontend/introduction.mdx +39 -0
- package/mintlify-docs/getting-started.mdx +267 -0
- package/mintlify-docs/guides/custom-agent.mdx +608 -0
- package/mintlify-docs/guides/first-agent.mdx +315 -0
- package/mintlify-docs/images/admin_ui.png +0 -0
- package/mintlify-docs/images/contexts.png +0 -0
- package/mintlify-docs/images/create_agents.png +0 -0
- package/mintlify-docs/images/evals.png +0 -0
- package/mintlify-docs/images/graphql.png +0 -0
- package/mintlify-docs/images/graphql_api.png +0 -0
- package/mintlify-docs/images/hero-dark.png +0 -0
- package/mintlify-docs/images/hero-light.png +0 -0
- package/mintlify-docs/images/hero.png +0 -0
- package/mintlify-docs/images/knowledge_sources.png +0 -0
- package/mintlify-docs/images/mcp.png +0 -0
- package/mintlify-docs/images/scaling.png +0 -0
- package/mintlify-docs/index.mdx +411 -0
- package/mintlify-docs/logo/dark.svg +9 -0
- package/mintlify-docs/logo/light.svg +9 -0
- package/mintlify-docs/partners.mdx +558 -0
- package/mintlify-docs/products.mdx +77 -0
- package/mintlify-docs/snippets/snippet-intro.mdx +4 -0
- package/mintlify-docs/styles.css +207 -0
- package/package.json +35 -4
- package/skills-lock.json +10 -0
- package/types/context-processor.ts +45 -0
- package/types/exulu-table-definition.ts +79 -0
- package/types/file-types.ts +18 -0
- package/types/models/agent.ts +10 -12
- package/types/models/exulu-agent-tool-config.ts +11 -0
- package/types/models/rate-limiter-rules.ts +7 -0
- package/types/provider-config.ts +21 -0
- package/types/queue-config.ts +16 -0
- package/types/rbac-rights-modes.ts +1 -0
- package/types/statistics.ts +20 -0
- package/types/workflow.ts +31 -0
- package/changelogs/10.11.2025_03.12.2025.md +0 -316
- package/documentation/logging.md +0 -122
- package/documentation/otel.md +0 -145
- package/types/models/agent-backend.ts +0 -15
- /package/{documentation → devops/documentation}/patch-older-releases.md +0 -0
package/dist/index.d.cts
CHANGED
|
@@ -1,145 +1,15 @@
|
|
|
1
1
|
import * as _opentelemetry_sdk_node from '@opentelemetry/sdk-node';
|
|
2
|
+
import * as knex from 'knex';
|
|
3
|
+
import { LanguageModel, UIMessage, Tool, streamText } from 'ai';
|
|
4
|
+
import { z } from 'zod';
|
|
2
5
|
import * as bullmq from 'bullmq';
|
|
3
6
|
import { Queue } from 'bullmq';
|
|
4
|
-
import { RedisClientType } from 'redis';
|
|
5
|
-
import { z } from 'zod';
|
|
6
|
-
import { UIMessage, LanguageModel, Tool, streamText } from 'ai';
|
|
7
7
|
import { Express, Request } from 'express';
|
|
8
8
|
import { transport } from 'winston';
|
|
9
|
-
import {
|
|
9
|
+
import { RedisClientType } from 'redis';
|
|
10
10
|
import { Tiktoken } from 'tiktoken/lite';
|
|
11
11
|
import models from 'tiktoken/model_to_encoding.json';
|
|
12
12
|
|
|
13
|
-
declare function redisClient(): Promise<{
|
|
14
|
-
client: RedisClientType | null;
|
|
15
|
-
}>;
|
|
16
|
-
|
|
17
|
-
type STATISTICS_TYPE = "CONTEXT_RETRIEVE" | "SOURCE_UPDATE" | "EMBEDDER_UPSERT" | "EMBEDDER_GENERATE" | "EMBEDDER_DELETE" | "WORKFLOW_RUN" | "CONTEXT_UPSERT" | "TOOL_CALL" | "AGENT_RUN";
|
|
18
|
-
declare const STATISTICS_TYPE_ENUM: {
|
|
19
|
-
CONTEXT_RETRIEVE: string;
|
|
20
|
-
SOURCE_UPDATE: string;
|
|
21
|
-
EMBEDDER_UPSERT: string;
|
|
22
|
-
EMBEDDER_GENERATE: string;
|
|
23
|
-
EMBEDDER_DELETE: string;
|
|
24
|
-
WORKFLOW_RUN: string;
|
|
25
|
-
CONTEXT_UPSERT: string;
|
|
26
|
-
TOOL_CALL: string;
|
|
27
|
-
AGENT_RUN: string;
|
|
28
|
-
};
|
|
29
|
-
|
|
30
|
-
type ExuluFieldTypes = "text" | "longText" | "shortText" | "number" | "boolean" | "code" | "json" | "enum" | "markdown" | "file" | "date" | "uuid";
|
|
31
|
-
|
|
32
|
-
interface Item {
|
|
33
|
-
id?: string;
|
|
34
|
-
name?: string;
|
|
35
|
-
description?: string;
|
|
36
|
-
createdAt?: string;
|
|
37
|
-
updatedAt?: string;
|
|
38
|
-
external_id?: string;
|
|
39
|
-
source?: string;
|
|
40
|
-
tags?: string[];
|
|
41
|
-
textlength?: number;
|
|
42
|
-
last_processed_at?: string;
|
|
43
|
-
chunks?: {
|
|
44
|
-
id: string;
|
|
45
|
-
index: number;
|
|
46
|
-
content: string;
|
|
47
|
-
source: string;
|
|
48
|
-
createdAt: string;
|
|
49
|
-
updatedAt: string;
|
|
50
|
-
}[];
|
|
51
|
-
[key: string]: any;
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
type ExuluConfig = {
|
|
55
|
-
telemetry?: {
|
|
56
|
-
enabled: boolean;
|
|
57
|
-
};
|
|
58
|
-
logger?: {
|
|
59
|
-
winston: {
|
|
60
|
-
transports: transport[];
|
|
61
|
-
};
|
|
62
|
-
};
|
|
63
|
-
workers: {
|
|
64
|
-
enabled: boolean;
|
|
65
|
-
logger?: {
|
|
66
|
-
winston: {
|
|
67
|
-
transports: transport[];
|
|
68
|
-
};
|
|
69
|
-
};
|
|
70
|
-
telemetry?: {
|
|
71
|
-
enabled: boolean;
|
|
72
|
-
};
|
|
73
|
-
};
|
|
74
|
-
MCP: {
|
|
75
|
-
enabled: boolean;
|
|
76
|
-
};
|
|
77
|
-
fileUploads?: {
|
|
78
|
-
s3region: string;
|
|
79
|
-
s3key: string;
|
|
80
|
-
s3secret: string;
|
|
81
|
-
s3Bucket: string;
|
|
82
|
-
s3endpoint?: string;
|
|
83
|
-
s3prefix?: string;
|
|
84
|
-
};
|
|
85
|
-
privacy?: {
|
|
86
|
-
systemPromptPersonalization?: boolean;
|
|
87
|
-
};
|
|
88
|
-
};
|
|
89
|
-
declare class ExuluApp {
|
|
90
|
-
private _agents;
|
|
91
|
-
private _config?;
|
|
92
|
-
private _evals;
|
|
93
|
-
private _queues;
|
|
94
|
-
private _rerankers;
|
|
95
|
-
private _contexts?;
|
|
96
|
-
private _tools;
|
|
97
|
-
private _expressApp;
|
|
98
|
-
constructor();
|
|
99
|
-
create: ({ contexts, agents, config, tools, evals, rerankers, }: {
|
|
100
|
-
contexts?: Record<string, ExuluContext>;
|
|
101
|
-
config: ExuluConfig;
|
|
102
|
-
agents?: ExuluAgent[];
|
|
103
|
-
rerankers?: ExuluReranker[];
|
|
104
|
-
evals?: ExuluEval[];
|
|
105
|
-
tools?: ExuluTool[];
|
|
106
|
-
}) => Promise<ExuluApp>;
|
|
107
|
-
express: {
|
|
108
|
-
init: () => Promise<Express>;
|
|
109
|
-
};
|
|
110
|
-
get expressApp(): Express;
|
|
111
|
-
tool(id: string): ExuluTool | undefined;
|
|
112
|
-
tools(): ExuluTool[];
|
|
113
|
-
context(id: string): ExuluContext | undefined;
|
|
114
|
-
agent(id: string): ExuluAgent | undefined;
|
|
115
|
-
get contexts(): ExuluContext[];
|
|
116
|
-
get agents(): ExuluAgent[];
|
|
117
|
-
embeddings: {
|
|
118
|
-
generate: {
|
|
119
|
-
one: ({ context: contextId, item: itemId, }: {
|
|
120
|
-
context: string;
|
|
121
|
-
item: string;
|
|
122
|
-
}) => Promise<{
|
|
123
|
-
id: string;
|
|
124
|
-
job?: string;
|
|
125
|
-
chunks?: number;
|
|
126
|
-
}>;
|
|
127
|
-
all: ({ context: contextId }: {
|
|
128
|
-
context: string;
|
|
129
|
-
}) => Promise<{
|
|
130
|
-
jobs: string[];
|
|
131
|
-
items: number;
|
|
132
|
-
}>;
|
|
133
|
-
};
|
|
134
|
-
};
|
|
135
|
-
bullmq: {
|
|
136
|
-
workers: {
|
|
137
|
-
create: (queues?: string[] | undefined) => Promise<bullmq.Worker<any, any, string>[]>;
|
|
138
|
-
};
|
|
139
|
-
};
|
|
140
|
-
private server;
|
|
141
|
-
}
|
|
142
|
-
|
|
143
13
|
type User = {
|
|
144
14
|
id: number;
|
|
145
15
|
firstname?: string;
|
|
@@ -161,125 +31,41 @@ type User = {
|
|
|
161
31
|
};
|
|
162
32
|
};
|
|
163
33
|
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
*/
|
|
174
|
-
type BaseOperator<T> = {
|
|
175
|
-
/** Equals */
|
|
176
|
-
eq?: T;
|
|
177
|
-
/** Not equals */
|
|
178
|
-
ne?: T;
|
|
179
|
-
/** In array */
|
|
180
|
-
in?: T[];
|
|
181
|
-
/** AND conditions */
|
|
182
|
-
and?: BaseOperator<T>[];
|
|
183
|
-
/** OR conditions */
|
|
184
|
-
or?: BaseOperator<T>[];
|
|
185
|
-
};
|
|
186
|
-
/**
|
|
187
|
-
* String field filter operators
|
|
188
|
-
*/
|
|
189
|
-
type StringOperator = BaseOperator<string> & {
|
|
190
|
-
/** Contains (case-insensitive substring match) */
|
|
191
|
-
contains?: string;
|
|
192
|
-
};
|
|
193
|
-
/**
|
|
194
|
-
* Number field filter operators
|
|
195
|
-
*/
|
|
196
|
-
type NumberOperator = BaseOperator<number> & {
|
|
197
|
-
/** Less than or equal to */
|
|
198
|
-
lte?: number;
|
|
199
|
-
/** Greater than or equal to */
|
|
200
|
-
gte?: number;
|
|
201
|
-
};
|
|
202
|
-
/**
|
|
203
|
-
* Date field filter operators
|
|
204
|
-
*/
|
|
205
|
-
type DateOperator = BaseOperator<Date | string> & {
|
|
206
|
-
/** Less than or equal to */
|
|
207
|
-
lte?: Date | string;
|
|
208
|
-
/** Greater than or equal to */
|
|
209
|
-
gte?: Date | string;
|
|
210
|
-
};
|
|
211
|
-
/**
|
|
212
|
-
* Boolean field filter operators
|
|
213
|
-
*/
|
|
214
|
-
type BooleanOperator = BaseOperator<boolean>;
|
|
215
|
-
/**
|
|
216
|
-
* JSON field filter operators
|
|
217
|
-
*/
|
|
218
|
-
type JsonOperator = BaseOperator<any> & {
|
|
219
|
-
/** Contains (PostgreSQL @> operator for JSON containment) */
|
|
220
|
-
contains?: any;
|
|
221
|
-
};
|
|
222
|
-
/**
|
|
223
|
-
* Filter operator type based on field type
|
|
224
|
-
*/
|
|
225
|
-
type FilterOperator = BaseOperator<any> | StringOperator | NumberOperator | DateOperator | BooleanOperator | JsonOperator;
|
|
226
|
-
/**
|
|
227
|
-
* Single filter object - a record of field names to their filter operators
|
|
228
|
-
*/
|
|
229
|
-
type Filter = Record<string, FilterOperator>;
|
|
230
|
-
/**
|
|
231
|
-
* Type for the filters parameter used throughout the codebase
|
|
232
|
-
* Filters is an array of filter objects, where each object contains field names mapped to their operators
|
|
233
|
-
*
|
|
234
|
-
* @example
|
|
235
|
-
* ```typescript
|
|
236
|
-
* const filters: Filters = [
|
|
237
|
-
* { name: { contains: "test" } },
|
|
238
|
-
* { age: { gte: 18, lte: 65 } },
|
|
239
|
-
* { status: { in: ["active", "pending"] } }
|
|
240
|
-
* ];
|
|
241
|
-
* ```
|
|
242
|
-
*/
|
|
243
|
-
type SearchFilters = Filter[];
|
|
244
|
-
type VectorSearchChunkResult = {
|
|
245
|
-
chunk_content: string;
|
|
246
|
-
chunk_index: number;
|
|
247
|
-
chunk_id: string;
|
|
248
|
-
chunk_source: string;
|
|
249
|
-
chunk_metadata: Record<string, string>;
|
|
250
|
-
chunk_created_at: string;
|
|
251
|
-
chunk_updated_at: string;
|
|
252
|
-
item_id: string;
|
|
253
|
-
item_external_id: string;
|
|
254
|
-
item_name: string;
|
|
255
|
-
item_updated_at: string;
|
|
256
|
-
item_created_at: string;
|
|
257
|
-
chunk_cosine_distance?: number;
|
|
258
|
-
chunk_fts_rank?: number;
|
|
259
|
-
chunk_hybrid_score?: number;
|
|
260
|
-
context?: {
|
|
34
|
+
type ExuluProviderConfig = {
|
|
35
|
+
name: string;
|
|
36
|
+
instructions: string;
|
|
37
|
+
model: {
|
|
38
|
+
create: ({ apiKey }: {
|
|
39
|
+
apiKey?: string | undefined;
|
|
40
|
+
}) => LanguageModel;
|
|
41
|
+
};
|
|
42
|
+
custom?: {
|
|
261
43
|
name: string;
|
|
262
|
-
|
|
44
|
+
description: string;
|
|
45
|
+
}[];
|
|
46
|
+
memory?: {
|
|
47
|
+
lastMessages: number;
|
|
48
|
+
vector: boolean;
|
|
49
|
+
semanticRecall: {
|
|
50
|
+
topK: number;
|
|
51
|
+
messageRange: number;
|
|
52
|
+
};
|
|
263
53
|
};
|
|
264
54
|
};
|
|
265
55
|
|
|
266
|
-
interface
|
|
56
|
+
interface ExuluAgent {
|
|
267
57
|
id: string;
|
|
268
58
|
modelName?: string;
|
|
269
59
|
providerName?: string;
|
|
270
|
-
|
|
60
|
+
provider: string;
|
|
61
|
+
source: "code" | "database";
|
|
271
62
|
memory?: string;
|
|
272
63
|
welcomemessage?: string;
|
|
273
64
|
type: "agent";
|
|
274
65
|
name: string;
|
|
275
66
|
image?: string;
|
|
276
67
|
providerapikey?: string;
|
|
277
|
-
workflows?:
|
|
278
|
-
enabled: boolean;
|
|
279
|
-
queue?: {
|
|
280
|
-
name: string;
|
|
281
|
-
};
|
|
282
|
-
};
|
|
68
|
+
workflows?: ExuluProviderWorkflowConfig;
|
|
283
69
|
firewall?: {
|
|
284
70
|
enabled: boolean;
|
|
285
71
|
scanners?: {
|
|
@@ -293,6 +79,7 @@ interface Agent {
|
|
|
293
79
|
active?: boolean;
|
|
294
80
|
description?: string;
|
|
295
81
|
instructions?: string;
|
|
82
|
+
feedback?: boolean;
|
|
296
83
|
slug?: string;
|
|
297
84
|
tools?: {
|
|
298
85
|
id: string;
|
|
@@ -316,7 +103,7 @@ interface Agent {
|
|
|
316
103
|
video: videoTypes$1[];
|
|
317
104
|
};
|
|
318
105
|
rights_mode?: 'private' | 'users' | 'roles' | 'public';
|
|
319
|
-
created_by?: string;
|
|
106
|
+
created_by?: string | number;
|
|
320
107
|
RBAC?: {
|
|
321
108
|
type?: string;
|
|
322
109
|
users?: Array<{
|
|
@@ -332,23 +119,10 @@ interface Agent {
|
|
|
332
119
|
updatedAt?: string;
|
|
333
120
|
}
|
|
334
121
|
type imageTypes$1 = '.png' | '.jpg' | '.jpeg' | '.gif' | '.webp';
|
|
335
|
-
type fileTypes$1 = '.pdf' | '.docx' | '.xlsx' | '.xls' | '.csv' | '.pptx' | '.ppt';
|
|
122
|
+
type fileTypes$1 = '.pdf' | '.docx' | '.xlsx' | '.xls' | '.csv' | '.pptx' | '.ppt' | '.txt' | '.md' | '.json';
|
|
336
123
|
type audioTypes$1 = '.mp3' | '.wav' | '.m4a' | '.mp4' | '.mpeg';
|
|
337
124
|
type videoTypes$1 = '.mp4' | '.m4a' | '.mp3' | '.mpeg' | '.wav';
|
|
338
125
|
|
|
339
|
-
interface TestCase {
|
|
340
|
-
id: string;
|
|
341
|
-
name: string;
|
|
342
|
-
description?: string;
|
|
343
|
-
inputs: UIMessage[];
|
|
344
|
-
expected_output: string;
|
|
345
|
-
expected_tools?: string[];
|
|
346
|
-
expected_knowledge_sources?: string[];
|
|
347
|
-
expected_agent_tools?: string[];
|
|
348
|
-
createdAt: string;
|
|
349
|
-
updatedAt: string;
|
|
350
|
-
}
|
|
351
|
-
|
|
352
126
|
interface RateLimiterRule {
|
|
353
127
|
name?: string;
|
|
354
128
|
rate_limit: {
|
|
@@ -356,84 +130,42 @@ interface RateLimiterRule {
|
|
|
356
130
|
limit: number;
|
|
357
131
|
};
|
|
358
132
|
}
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
};
|
|
379
|
-
};
|
|
380
|
-
};
|
|
381
|
-
type imageTypes = '.png' | '.jpg' | '.jpeg' | '.gif' | '.webp';
|
|
382
|
-
type fileTypes = '.pdf' | '.docx' | '.doc' | '.xlsx' | '.xls' | '.csv' | '.pptx' | '.ppt' | '.txt' | '.md' | '.json' | '.srt' | '.html';
|
|
383
|
-
type audioTypes = '.mp3' | '.wav' | '.m4a' | '.mp4' | '.mpeg';
|
|
384
|
-
type videoTypes = '.mp4' | '.m4a' | '.mp3' | '.mpeg' | '.wav';
|
|
385
|
-
type allFileTypes = imageTypes | fileTypes | audioTypes | videoTypes;
|
|
386
|
-
interface ExuluAgentParams {
|
|
387
|
-
id: string;
|
|
388
|
-
name: string;
|
|
389
|
-
type: "agent";
|
|
390
|
-
description: string;
|
|
391
|
-
config?: ExuluAgentConfig | undefined;
|
|
392
|
-
queue?: ExuluQueueConfig;
|
|
393
|
-
maxContextLength?: number;
|
|
394
|
-
authenticationInformation?: string;
|
|
395
|
-
provider: string;
|
|
396
|
-
workflows?: ExuluAgentWorkflowConfig;
|
|
397
|
-
capabilities?: {
|
|
398
|
-
text: boolean;
|
|
399
|
-
images: imageTypes[];
|
|
400
|
-
files: fileTypes[];
|
|
401
|
-
audio: audioTypes[];
|
|
402
|
-
video: videoTypes[];
|
|
403
|
-
};
|
|
404
|
-
outputSchema?: z.ZodType;
|
|
405
|
-
rateLimit?: RateLimiterRule;
|
|
406
|
-
}
|
|
407
|
-
interface ExuluAgentToolConfig {
|
|
408
|
-
id: string;
|
|
409
|
-
type: string;
|
|
410
|
-
config: {
|
|
411
|
-
name: string;
|
|
412
|
-
variable: string | boolean | number;
|
|
413
|
-
type: "boolean" | "string" | "number" | "variable";
|
|
414
|
-
value?: any;
|
|
415
|
-
default?: string | boolean | number;
|
|
133
|
+
|
|
134
|
+
interface Item {
|
|
135
|
+
id?: string;
|
|
136
|
+
name?: string;
|
|
137
|
+
description?: string;
|
|
138
|
+
createdAt?: string;
|
|
139
|
+
updatedAt?: string;
|
|
140
|
+
external_id?: string;
|
|
141
|
+
source?: string;
|
|
142
|
+
tags?: string[];
|
|
143
|
+
textlength?: number;
|
|
144
|
+
last_processed_at?: string;
|
|
145
|
+
chunks?: {
|
|
146
|
+
id: string;
|
|
147
|
+
index: number;
|
|
148
|
+
content: string;
|
|
149
|
+
source: string;
|
|
150
|
+
createdAt: string;
|
|
151
|
+
updatedAt: string;
|
|
416
152
|
}[];
|
|
153
|
+
[key: string]: any;
|
|
417
154
|
}
|
|
418
|
-
|
|
155
|
+
|
|
156
|
+
interface TestCase {
|
|
419
157
|
id: string;
|
|
420
158
|
name: string;
|
|
421
|
-
description
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
description: string;
|
|
430
|
-
execute: (params: {
|
|
431
|
-
query: string;
|
|
432
|
-
chunks: VectorSearchChunkResult[];
|
|
433
|
-
}) => Promise<VectorSearchChunkResult[]>;
|
|
434
|
-
});
|
|
435
|
-
run(query: string, chunks: VectorSearchChunkResult[]): Promise<VectorSearchChunkResult[]>;
|
|
159
|
+
description?: string;
|
|
160
|
+
inputs: UIMessage[];
|
|
161
|
+
expected_output: string;
|
|
162
|
+
expected_tools?: string[];
|
|
163
|
+
expected_knowledge_sources?: string[];
|
|
164
|
+
expected_agent_tools?: string[];
|
|
165
|
+
createdAt: string;
|
|
166
|
+
updatedAt: string;
|
|
436
167
|
}
|
|
168
|
+
|
|
437
169
|
type ExuluQueueConfig = {
|
|
438
170
|
queue: Queue;
|
|
439
171
|
ratelimit: number;
|
|
@@ -444,29 +176,19 @@ type ExuluQueueConfig = {
|
|
|
444
176
|
};
|
|
445
177
|
retries?: number;
|
|
446
178
|
backoff?: {
|
|
447
|
-
type:
|
|
179
|
+
type: "exponential" | "linear";
|
|
448
180
|
delay: number;
|
|
449
181
|
};
|
|
450
182
|
};
|
|
451
|
-
|
|
452
|
-
totalTokens?: number;
|
|
453
|
-
reasoningTokens?: number;
|
|
454
|
-
inputTokens?: number;
|
|
455
|
-
outputTokens?: number;
|
|
456
|
-
cachedInputTokens?: number;
|
|
457
|
-
};
|
|
458
|
-
type ExuluEvalMetadata = {
|
|
459
|
-
tokens?: ExuluEvalTokenMetadata;
|
|
460
|
-
duration?: number;
|
|
461
|
-
};
|
|
183
|
+
|
|
462
184
|
interface ExuluEvalParams {
|
|
463
185
|
id: string;
|
|
464
186
|
name: string;
|
|
465
187
|
description: string;
|
|
466
188
|
llm: boolean;
|
|
467
189
|
execute: (params: {
|
|
468
|
-
agent:
|
|
469
|
-
|
|
190
|
+
agent: ExuluAgent;
|
|
191
|
+
provider: ExuluProvider;
|
|
470
192
|
messages: UIMessage[];
|
|
471
193
|
testCase: TestCase;
|
|
472
194
|
config?: Record<string, any>;
|
|
@@ -489,94 +211,167 @@ declare class ExuluEval {
|
|
|
489
211
|
}[];
|
|
490
212
|
queue?: Promise<ExuluQueueConfig>;
|
|
491
213
|
constructor({ id, name, description, execute, config, queue, llm }: ExuluEvalParams);
|
|
492
|
-
run(agent:
|
|
214
|
+
run(agent: ExuluAgent, provider: ExuluProvider, testCase: TestCase, messages: UIMessage[], config?: Record<string, any>): Promise<number>;
|
|
493
215
|
}
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
216
|
+
|
|
217
|
+
/**
|
|
218
|
+
* Base operator type with comparison operations
|
|
219
|
+
*/
|
|
220
|
+
type BaseOperator<T> = {
|
|
221
|
+
/** Equals */
|
|
222
|
+
eq?: T;
|
|
223
|
+
/** Not equals */
|
|
224
|
+
ne?: T;
|
|
225
|
+
/** In array */
|
|
226
|
+
in?: T[];
|
|
227
|
+
/** AND conditions */
|
|
228
|
+
and?: BaseOperator<T>[];
|
|
229
|
+
/** OR conditions */
|
|
230
|
+
or?: BaseOperator<T>[];
|
|
231
|
+
/** Contains (case-insensitive substring match) */
|
|
232
|
+
contains?: string;
|
|
497
233
|
};
|
|
498
|
-
|
|
499
|
-
|
|
234
|
+
/**
|
|
235
|
+
* String field filter operators
|
|
236
|
+
*/
|
|
237
|
+
type StringOperator = BaseOperator<string> & {
|
|
238
|
+
/** Contains (case-insensitive substring match) */
|
|
239
|
+
contains?: string;
|
|
240
|
+
};
|
|
241
|
+
/**
|
|
242
|
+
* Number field filter operators
|
|
243
|
+
*/
|
|
244
|
+
type NumberOperator = BaseOperator<number> & {
|
|
245
|
+
/** Less than or equal to */
|
|
246
|
+
lte?: number;
|
|
247
|
+
/** Greater than or equal to */
|
|
248
|
+
gte?: number;
|
|
249
|
+
};
|
|
250
|
+
/**
|
|
251
|
+
* Date field filter operators
|
|
252
|
+
*/
|
|
253
|
+
type DateOperator = BaseOperator<Date | string> & {
|
|
254
|
+
/** Less than or equal to */
|
|
255
|
+
lte?: Date | string;
|
|
256
|
+
/** Greater than or equal to */
|
|
257
|
+
gte?: Date | string;
|
|
258
|
+
};
|
|
259
|
+
/**
|
|
260
|
+
* Boolean field filter operators
|
|
261
|
+
*/
|
|
262
|
+
type BooleanOperator = BaseOperator<boolean>;
|
|
263
|
+
/**
|
|
264
|
+
* JSON field filter operators
|
|
265
|
+
*/
|
|
266
|
+
type JsonOperator = BaseOperator<any> & {
|
|
267
|
+
/** Contains (PostgreSQL @> operator for JSON containment) */
|
|
268
|
+
contains?: any;
|
|
269
|
+
};
|
|
270
|
+
/**
|
|
271
|
+
* Filter operator type based on field type
|
|
272
|
+
*/
|
|
273
|
+
type FilterOperator = BaseOperator<any> | StringOperator | NumberOperator | DateOperator | BooleanOperator | JsonOperator;
|
|
274
|
+
/**
|
|
275
|
+
* Single filter object - a record of field names to their filter operators
|
|
276
|
+
*/
|
|
277
|
+
type Filter = Record<string, FilterOperator>;
|
|
278
|
+
/**
|
|
279
|
+
* Type for the filters parameter used throughout the codebase
|
|
280
|
+
* Filters is an array of filter objects, where each object contains field names mapped to their operators
|
|
281
|
+
*
|
|
282
|
+
* @example
|
|
283
|
+
* ```typescript
|
|
284
|
+
* const filters: Filters = [
|
|
285
|
+
* { name: { contains: "test" } },
|
|
286
|
+
* { age: { gte: 18, lte: 65 } },
|
|
287
|
+
* { status: { in: ["active", "pending"] } }
|
|
288
|
+
* ];
|
|
289
|
+
* ```
|
|
290
|
+
*/
|
|
291
|
+
type SearchFilters = Filter[];
|
|
292
|
+
|
|
293
|
+
type ExuluFieldTypes = "text" | "longText" | "shortText" | "number" | "boolean" | "code" | "json" | "enum" | "markdown" | "file" | "date" | "uuid";
|
|
294
|
+
|
|
295
|
+
type allFileTypes = imageTypes | fileTypes | audioTypes | videoTypes;
|
|
296
|
+
type audioTypes = ".mp3" | ".wav" | ".m4a" | ".mp4" | ".mpeg";
|
|
297
|
+
type videoTypes = ".mp4" | ".m4a" | ".mp3" | ".mpeg" | ".wav";
|
|
298
|
+
type imageTypes = ".png" | ".jpg" | ".jpeg" | ".gif" | ".webp";
|
|
299
|
+
type fileTypes = ".pdf" | ".docx" | ".doc" | ".xlsx" | ".xls" | ".csv" | ".pptx" | ".ppt" | ".txt" | ".md" | ".json" | ".srt" | ".html";
|
|
300
|
+
|
|
301
|
+
declare class ExuluStorage {
|
|
302
|
+
private config;
|
|
303
|
+
constructor({ config }: {
|
|
304
|
+
config: ExuluConfig;
|
|
305
|
+
});
|
|
306
|
+
getPresignedUrl: (key: string) => Promise<string>;
|
|
307
|
+
uploadFile: (file: Buffer | Uint8Array, fileName: string, type: string, user?: number, metadata?: Record<string, string>, customBucket?: string) => Promise<string>;
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
type ExuluContextProcessor = {
|
|
500
311
|
name: string;
|
|
501
|
-
provider: string;
|
|
502
312
|
description: string;
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
313
|
+
filter: ({ item, user, role, utils, exuluConfig, }: {
|
|
314
|
+
item: Item;
|
|
315
|
+
user?: number;
|
|
316
|
+
role?: string;
|
|
317
|
+
utils: {
|
|
318
|
+
storage: ExuluStorage;
|
|
319
|
+
};
|
|
320
|
+
exuluConfig: ExuluConfig;
|
|
321
|
+
}) => Promise<Item | undefined | null>;
|
|
322
|
+
execute: ({ item, user, role, utils, exuluConfig, }: {
|
|
323
|
+
item: Item;
|
|
324
|
+
user?: number;
|
|
325
|
+
role?: string;
|
|
326
|
+
utils: {
|
|
327
|
+
storage: ExuluStorage;
|
|
328
|
+
};
|
|
329
|
+
exuluConfig: ExuluConfig;
|
|
330
|
+
}) => Promise<Item>;
|
|
331
|
+
config?: {
|
|
332
|
+
queue?: Promise<ExuluQueueConfig>;
|
|
333
|
+
timeoutInSeconds?: number;
|
|
334
|
+
trigger: "manual" | "onUpdate" | "onInsert" | "always";
|
|
335
|
+
generateEmbeddings?: boolean;
|
|
523
336
|
};
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
allExuluTools?: ExuluTool[];
|
|
563
|
-
toolConfigs?: ExuluAgentToolConfig[];
|
|
564
|
-
providerapikey?: string | undefined;
|
|
565
|
-
contexts?: ExuluContext[] | undefined;
|
|
566
|
-
rerankers?: ExuluReranker[] | undefined;
|
|
567
|
-
exuluConfig?: ExuluConfig;
|
|
568
|
-
instructions?: string;
|
|
569
|
-
req?: Request;
|
|
570
|
-
}) => Promise<{
|
|
571
|
-
stream: ReturnType<typeof streamText>;
|
|
572
|
-
originalMessages: UIMessage[];
|
|
573
|
-
previousMessages: UIMessage[];
|
|
574
|
-
}>;
|
|
575
|
-
}
|
|
576
|
-
type VectorOperationResponse = Promise<{
|
|
577
|
-
count: number;
|
|
578
|
-
results: any;
|
|
579
|
-
errors?: string[];
|
|
337
|
+
};
|
|
338
|
+
|
|
339
|
+
type STATISTICS_TYPE = "CONTEXT_RETRIEVE" | "SOURCE_UPDATE" | "EMBEDDER_UPSERT" | "EMBEDDER_GENERATE" | "EMBEDDER_DELETE" | "WORKFLOW_RUN" | "CONTEXT_UPSERT" | "TOOL_CALL" | "AGENT_RUN";
|
|
340
|
+
declare const STATISTICS_TYPE_ENUM: {
|
|
341
|
+
CONTEXT_RETRIEVE: string;
|
|
342
|
+
SOURCE_UPDATE: string;
|
|
343
|
+
EMBEDDER_UPSERT: string;
|
|
344
|
+
EMBEDDER_GENERATE: string;
|
|
345
|
+
EMBEDDER_DELETE: string;
|
|
346
|
+
WORKFLOW_RUN: string;
|
|
347
|
+
CONTEXT_UPSERT: string;
|
|
348
|
+
TOOL_CALL: string;
|
|
349
|
+
AGENT_RUN: string;
|
|
350
|
+
};
|
|
351
|
+
|
|
352
|
+
type ExuluStatisticParams = Omit<ExuluStatistic, "total" | "name" | "type">;
|
|
353
|
+
type ExuluStatistic = {
|
|
354
|
+
name: string;
|
|
355
|
+
label: string;
|
|
356
|
+
type: STATISTICS_TYPE;
|
|
357
|
+
trigger: STATISTICS_LABELS;
|
|
358
|
+
total: number;
|
|
359
|
+
};
|
|
360
|
+
type STATISTICS_LABELS = "tool" | "agent" | "flow" | "api" | "claude-code" | "user" | "processor";
|
|
361
|
+
|
|
362
|
+
type ExuluEmbedderConfig = {
|
|
363
|
+
name: string;
|
|
364
|
+
description: string;
|
|
365
|
+
default?: string;
|
|
366
|
+
};
|
|
367
|
+
type VectorGenerationResponse = Promise<{
|
|
368
|
+
id: string;
|
|
369
|
+
chunks: {
|
|
370
|
+
content: string;
|
|
371
|
+
index: number;
|
|
372
|
+
metadata: Record<string, string>;
|
|
373
|
+
vector: number[];
|
|
374
|
+
}[];
|
|
580
375
|
}>;
|
|
581
376
|
type VectorGenerateOperation = (inputs: ChunkerResponse, settings: Record<string, string>) => VectorGenerationResponse;
|
|
582
377
|
type ChunkerOperation = (item: Item & {
|
|
@@ -593,20 +388,6 @@ type ChunkerResponse = {
|
|
|
593
388
|
index: number;
|
|
594
389
|
}[];
|
|
595
390
|
};
|
|
596
|
-
type VectorGenerationResponse = Promise<{
|
|
597
|
-
id: string;
|
|
598
|
-
chunks: {
|
|
599
|
-
content: string;
|
|
600
|
-
index: number;
|
|
601
|
-
metadata: Record<string, string>;
|
|
602
|
-
vector: number[];
|
|
603
|
-
}[];
|
|
604
|
-
}>;
|
|
605
|
-
type ExuluEmbedderConfig = {
|
|
606
|
-
name: string;
|
|
607
|
-
description: string;
|
|
608
|
-
default?: string;
|
|
609
|
-
};
|
|
610
391
|
declare class ExuluEmbedder {
|
|
611
392
|
id: string;
|
|
612
393
|
name: string;
|
|
@@ -618,7 +399,7 @@ declare class ExuluEmbedder {
|
|
|
618
399
|
config?: ExuluEmbedderConfig[];
|
|
619
400
|
maxChunkSize: number;
|
|
620
401
|
_chunker: ChunkerOperation;
|
|
621
|
-
constructor({ id, name, description, generateEmbeddings, queue, vectorDimensions, maxChunkSize, chunker, config }: {
|
|
402
|
+
constructor({ id, name, description, generateEmbeddings, queue, vectorDimensions, maxChunkSize, chunker, config, }: {
|
|
622
403
|
id: string;
|
|
623
404
|
name: string;
|
|
624
405
|
description: string;
|
|
@@ -636,80 +417,16 @@ declare class ExuluEmbedder {
|
|
|
636
417
|
generateFromQuery(context: string, query: string, statistics?: ExuluStatisticParams, user?: number, role?: string): VectorGenerationResponse;
|
|
637
418
|
generateFromDocument(context: string, input: Item, config: ExuluConfig, statistics?: ExuluStatisticParams, user?: number, role?: string): VectorGenerationResponse;
|
|
638
419
|
}
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
tool: Tool;
|
|
647
|
-
config: {
|
|
648
|
-
name: string;
|
|
649
|
-
description: string;
|
|
650
|
-
type: "boolean" | "string" | "number" | "variable";
|
|
651
|
-
default?: string | boolean | number | "variable";
|
|
652
|
-
}[];
|
|
653
|
-
constructor({ id, name, description, category, inputSchema, type, execute, config }: {
|
|
654
|
-
id: string;
|
|
655
|
-
name: string;
|
|
656
|
-
description: string;
|
|
657
|
-
category?: string;
|
|
658
|
-
inputSchema?: z.ZodType;
|
|
659
|
-
type: "context" | "function" | "agent" | "web_search";
|
|
660
|
-
config: {
|
|
661
|
-
name: string;
|
|
662
|
-
description: string;
|
|
663
|
-
type: "boolean" | "string" | "number" | "variable";
|
|
664
|
-
default?: string | boolean | number | "variable";
|
|
665
|
-
}[];
|
|
666
|
-
execute: (inputs: any) => Promise<{
|
|
667
|
-
result?: string;
|
|
668
|
-
job?: string;
|
|
669
|
-
items?: Item[];
|
|
670
|
-
}> | AsyncGenerator<{
|
|
671
|
-
result?: string;
|
|
672
|
-
job?: string;
|
|
673
|
-
items?: Item[];
|
|
674
|
-
}>;
|
|
675
|
-
});
|
|
676
|
-
execute: ({ agent, config, user, inputs, project, items }: {
|
|
677
|
-
agent: string;
|
|
678
|
-
config: ExuluConfig;
|
|
679
|
-
user?: User;
|
|
680
|
-
inputs: any;
|
|
681
|
-
project?: string;
|
|
682
|
-
items?: string[];
|
|
683
|
-
}) => Promise<any>;
|
|
684
|
-
}
|
|
685
|
-
type ExuluContextProcessor = {
|
|
686
|
-
name: string;
|
|
687
|
-
description: string;
|
|
688
|
-
filter: ({ item, user, role, utils, exuluConfig }: {
|
|
689
|
-
item: Item;
|
|
690
|
-
user?: number;
|
|
691
|
-
role?: string;
|
|
692
|
-
utils: {
|
|
693
|
-
storage: ExuluStorage;
|
|
694
|
-
};
|
|
695
|
-
exuluConfig: ExuluConfig;
|
|
696
|
-
}) => Promise<Item | undefined | null>;
|
|
697
|
-
execute: ({ item, user, role, utils, exuluConfig }: {
|
|
698
|
-
item: Item;
|
|
699
|
-
user?: number;
|
|
700
|
-
role?: string;
|
|
701
|
-
utils: {
|
|
702
|
-
storage: ExuluStorage;
|
|
703
|
-
};
|
|
704
|
-
exuluConfig: ExuluConfig;
|
|
705
|
-
}) => Promise<Item>;
|
|
706
|
-
config?: {
|
|
707
|
-
queue?: Promise<ExuluQueueConfig>;
|
|
708
|
-
timeoutInSeconds?: number;
|
|
709
|
-
trigger: "manual" | "onUpdate" | "onInsert" | "always";
|
|
710
|
-
generateEmbeddings?: boolean;
|
|
711
|
-
};
|
|
420
|
+
|
|
421
|
+
type ExuluRightsMode = "private" | "users" | "roles" | "public";
|
|
422
|
+
|
|
423
|
+
declare const VectorMethodEnum: {
|
|
424
|
+
readonly cosineDistance: "cosineDistance";
|
|
425
|
+
readonly hybridSearch: "hybridSearch";
|
|
426
|
+
readonly tsvector: "tsvector";
|
|
712
427
|
};
|
|
428
|
+
type VectorMethod = (typeof VectorMethodEnum)[keyof typeof VectorMethodEnum];
|
|
429
|
+
|
|
713
430
|
type ExuluContextFieldDefinition = {
|
|
714
431
|
name: string;
|
|
715
432
|
type: ExuluFieldTypes;
|
|
@@ -722,15 +439,6 @@ type ExuluContextFieldDefinition = {
|
|
|
722
439
|
enumValues?: string[];
|
|
723
440
|
allowedFileTypes?: allFileTypes[];
|
|
724
441
|
};
|
|
725
|
-
type ExuluRightsMode = "private" | "users" | "roles" | "public";
|
|
726
|
-
declare class ExuluStorage {
|
|
727
|
-
private config;
|
|
728
|
-
constructor({ config }: {
|
|
729
|
-
config: ExuluConfig;
|
|
730
|
-
});
|
|
731
|
-
getPresignedUrl: (key: string) => Promise<string>;
|
|
732
|
-
uploadFile: (file: Buffer | Uint8Array, fileName: string, type: string, user?: number, metadata?: Record<string, string>, customBucket?: string) => Promise<string>;
|
|
733
|
-
}
|
|
734
442
|
type ExuluContextSource = {
|
|
735
443
|
id: string;
|
|
736
444
|
name: string;
|
|
@@ -740,7 +448,7 @@ type ExuluContextSource = {
|
|
|
740
448
|
queue?: Promise<ExuluQueueConfig>;
|
|
741
449
|
retries?: number;
|
|
742
450
|
backoff?: {
|
|
743
|
-
type:
|
|
451
|
+
type: "exponential" | "linear";
|
|
744
452
|
delay: number;
|
|
745
453
|
};
|
|
746
454
|
params?: {
|
|
@@ -801,10 +509,10 @@ declare class ExuluContext {
|
|
|
801
509
|
before?: number;
|
|
802
510
|
after?: number;
|
|
803
511
|
};
|
|
804
|
-
|
|
512
|
+
languages?: ("german" | "english")[];
|
|
805
513
|
};
|
|
806
514
|
sources: ExuluContextSource[];
|
|
807
|
-
constructor({ id, name, description, embedder, processor, active, rateLimit, fields, queryRewriter, resultReranker, configuration, sources }: {
|
|
515
|
+
constructor({ id, name, description, embedder, processor, active, rateLimit, fields, queryRewriter, resultReranker, configuration, sources, }: {
|
|
808
516
|
id: string;
|
|
809
517
|
name: string;
|
|
810
518
|
fields: ExuluContextFieldDefinition[];
|
|
@@ -821,7 +529,7 @@ declare class ExuluContext {
|
|
|
821
529
|
calculateVectors?: "manual" | "onUpdate" | "onInsert" | "always";
|
|
822
530
|
defaultRightsMode?: ExuluRightsMode;
|
|
823
531
|
enableAsTool?: boolean;
|
|
824
|
-
|
|
532
|
+
languages?: ("german" | "english")[];
|
|
825
533
|
maxRetrievalResults?: number;
|
|
826
534
|
expand?: {
|
|
827
535
|
before?: number;
|
|
@@ -870,79 +578,374 @@ declare class ExuluContext {
|
|
|
870
578
|
id: string;
|
|
871
579
|
embedder: string;
|
|
872
580
|
};
|
|
873
|
-
chunks: VectorSearchChunkResult[];
|
|
874
|
-
}>;
|
|
875
|
-
deleteAll: () => Promise<
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
job?: string;
|
|
887
|
-
}>;
|
|
888
|
-
|
|
889
|
-
item: Item;
|
|
890
|
-
job?: string;
|
|
891
|
-
}>;
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
job?: string;
|
|
895
|
-
}>;
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
}) => Promise<Item
|
|
581
|
+
chunks: VectorSearchChunkResult[];
|
|
582
|
+
}>;
|
|
583
|
+
deleteAll: () => Promise<{
|
|
584
|
+
count: number;
|
|
585
|
+
results: any;
|
|
586
|
+
errors?: string[];
|
|
587
|
+
}>;
|
|
588
|
+
executeSource: (source: ExuluContextSource, inputs: any, exuluConfig: ExuluConfig) => Promise<Item[]>;
|
|
589
|
+
tableExists: () => Promise<boolean>;
|
|
590
|
+
chunksTableExists: () => Promise<boolean>;
|
|
591
|
+
createAndUpsertEmbeddings: (item: Item, config: ExuluConfig, user?: number, statistics?: ExuluStatisticParams, role?: string, job?: string) => Promise<{
|
|
592
|
+
id: string;
|
|
593
|
+
chunks?: number;
|
|
594
|
+
job?: string;
|
|
595
|
+
}>;
|
|
596
|
+
createItem: (item: Item, config: ExuluConfig, user?: number, role?: string, upsert?: boolean, generateEmbeddingsOverwrite?: boolean) => Promise<{
|
|
597
|
+
item: Item;
|
|
598
|
+
job?: string;
|
|
599
|
+
}>;
|
|
600
|
+
updateItem: (item: Item, config: ExuluConfig, user?: number, role?: string, generateEmbeddingsOverwrite?: boolean) => Promise<{
|
|
601
|
+
item: Item;
|
|
602
|
+
job?: string;
|
|
603
|
+
}>;
|
|
604
|
+
deleteItem: (item: Item, user?: number, role?: string) => Promise<{
|
|
605
|
+
id: string;
|
|
606
|
+
job?: string;
|
|
607
|
+
}>;
|
|
608
|
+
getItem: ({ item }: {
|
|
609
|
+
item: Item;
|
|
610
|
+
}) => Promise<Item>;
|
|
611
|
+
getItems: ({ filters, fields, }: {
|
|
612
|
+
filters?: any[];
|
|
613
|
+
fields?: string[];
|
|
614
|
+
}) => Promise<Item[]>;
|
|
615
|
+
embeddings: {
|
|
616
|
+
generate: {
|
|
617
|
+
one: ({ item, user, role, trigger, config, }: {
|
|
618
|
+
item: Item;
|
|
619
|
+
user?: number;
|
|
620
|
+
role?: string;
|
|
621
|
+
trigger: STATISTICS_LABELS;
|
|
622
|
+
config: ExuluConfig;
|
|
623
|
+
}) => Promise<{
|
|
624
|
+
id: string;
|
|
625
|
+
job?: string;
|
|
626
|
+
chunks?: number;
|
|
627
|
+
}>;
|
|
628
|
+
all: (config: ExuluConfig, userId?: number, roleId?: string, limit?: number) => Promise<{
|
|
629
|
+
jobs: string[];
|
|
630
|
+
items: number;
|
|
631
|
+
}>;
|
|
632
|
+
};
|
|
633
|
+
};
|
|
634
|
+
createItemsTable: () => Promise<void>;
|
|
635
|
+
createChunksTable: () => Promise<void>;
|
|
636
|
+
tool: () => ExuluTool | null;
|
|
637
|
+
}
|
|
638
|
+
|
|
639
|
+
type VectorSearchChunkResult = {
|
|
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
|
+
item_updated_at: string;
|
|
651
|
+
item_created_at: string;
|
|
652
|
+
chunk_cosine_distance?: number;
|
|
653
|
+
chunk_fts_rank?: number;
|
|
654
|
+
chunk_hybrid_score?: number;
|
|
655
|
+
context?: {
|
|
656
|
+
name: string;
|
|
657
|
+
id: string;
|
|
658
|
+
};
|
|
659
|
+
};
|
|
660
|
+
|
|
661
|
+
declare class ExuluReranker {
|
|
662
|
+
id: string;
|
|
663
|
+
name: string;
|
|
664
|
+
description: string;
|
|
665
|
+
execute: (params: {
|
|
666
|
+
query: string;
|
|
667
|
+
chunks: VectorSearchChunkResult[];
|
|
668
|
+
}) => Promise<VectorSearchChunkResult[]>;
|
|
669
|
+
constructor({ id, name, description, execute, }: {
|
|
670
|
+
id: string;
|
|
671
|
+
name: string;
|
|
672
|
+
description: string;
|
|
673
|
+
execute: (params: {
|
|
674
|
+
query: string;
|
|
675
|
+
chunks: VectorSearchChunkResult[];
|
|
676
|
+
}) => Promise<VectorSearchChunkResult[]>;
|
|
677
|
+
});
|
|
678
|
+
run(query: string, chunks: VectorSearchChunkResult[]): Promise<VectorSearchChunkResult[]>;
|
|
679
|
+
}
|
|
680
|
+
|
|
681
|
+
type ExuluConfig = {
|
|
682
|
+
telemetry?: {
|
|
683
|
+
enabled: boolean;
|
|
684
|
+
};
|
|
685
|
+
logger?: {
|
|
686
|
+
winston: {
|
|
687
|
+
transports: transport[];
|
|
688
|
+
};
|
|
689
|
+
};
|
|
690
|
+
workers: {
|
|
691
|
+
enabled: boolean;
|
|
692
|
+
logger?: {
|
|
693
|
+
winston: {
|
|
694
|
+
transports: transport[];
|
|
695
|
+
};
|
|
696
|
+
};
|
|
697
|
+
telemetry?: {
|
|
698
|
+
enabled: boolean;
|
|
699
|
+
};
|
|
700
|
+
};
|
|
701
|
+
MCP: {
|
|
702
|
+
enabled: boolean;
|
|
703
|
+
};
|
|
704
|
+
fileUploads?: {
|
|
705
|
+
s3region: string;
|
|
706
|
+
s3key: string;
|
|
707
|
+
s3secret: string;
|
|
708
|
+
s3Bucket: string;
|
|
709
|
+
s3endpoint?: string;
|
|
710
|
+
s3prefix?: string;
|
|
711
|
+
};
|
|
712
|
+
privacy?: {
|
|
713
|
+
systemPromptPersonalization?: boolean;
|
|
714
|
+
};
|
|
715
|
+
};
|
|
716
|
+
declare class ExuluApp {
|
|
717
|
+
private _providers;
|
|
718
|
+
private _agents;
|
|
719
|
+
private _config?;
|
|
720
|
+
private _evals;
|
|
721
|
+
private _queues;
|
|
722
|
+
private _rerankers;
|
|
723
|
+
private _contexts?;
|
|
724
|
+
private _tools;
|
|
725
|
+
private _expressApp;
|
|
726
|
+
constructor();
|
|
727
|
+
create: ({ contexts, providers, config, agents, tools, evals, rerankers, }: {
|
|
728
|
+
contexts?: Record<string, ExuluContext>;
|
|
729
|
+
config: ExuluConfig;
|
|
730
|
+
agents?: ExuluAgent[];
|
|
731
|
+
providers?: ExuluProvider[];
|
|
732
|
+
rerankers?: ExuluReranker[];
|
|
733
|
+
evals?: ExuluEval[];
|
|
734
|
+
tools?: ExuluTool[];
|
|
735
|
+
}) => Promise<ExuluApp>;
|
|
736
|
+
express: {
|
|
737
|
+
init: () => Promise<Express>;
|
|
738
|
+
};
|
|
739
|
+
get expressApp(): Express;
|
|
740
|
+
tool(id: string): ExuluTool | undefined;
|
|
741
|
+
tools(): ExuluTool[];
|
|
742
|
+
agent(id: string, include?: {
|
|
743
|
+
source: {
|
|
744
|
+
code: boolean;
|
|
745
|
+
database: boolean;
|
|
746
|
+
};
|
|
747
|
+
}): Promise<ExuluAgent | undefined>;
|
|
748
|
+
agents(include?: {
|
|
749
|
+
source: {
|
|
750
|
+
code: boolean;
|
|
751
|
+
database: boolean;
|
|
752
|
+
};
|
|
753
|
+
}): Promise<ExuluAgent[]>;
|
|
754
|
+
context(id: string): ExuluContext | undefined;
|
|
755
|
+
provider(id: string): ExuluProvider | undefined;
|
|
756
|
+
get contexts(): ExuluContext[];
|
|
757
|
+
get providers(): ExuluProvider[];
|
|
903
758
|
embeddings: {
|
|
904
759
|
generate: {
|
|
905
|
-
one: ({
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
role?: string;
|
|
909
|
-
trigger: STATISTICS_LABELS;
|
|
910
|
-
config: ExuluConfig;
|
|
760
|
+
one: ({ context: contextId, item: itemId }: {
|
|
761
|
+
context: string;
|
|
762
|
+
item: string;
|
|
911
763
|
}) => Promise<{
|
|
912
764
|
id: string;
|
|
913
765
|
job?: string;
|
|
914
766
|
chunks?: number;
|
|
915
767
|
}>;
|
|
916
|
-
all: (
|
|
768
|
+
all: ({ context: contextId }: {
|
|
769
|
+
context: string;
|
|
770
|
+
}) => Promise<{
|
|
917
771
|
jobs: string[];
|
|
918
772
|
items: number;
|
|
919
773
|
}>;
|
|
920
774
|
};
|
|
921
775
|
};
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
776
|
+
bullmq: {
|
|
777
|
+
workers: {
|
|
778
|
+
create: (queues?: string[]) => Promise<bullmq.Worker<any, any, string>[]>;
|
|
779
|
+
};
|
|
780
|
+
};
|
|
781
|
+
private server;
|
|
925
782
|
}
|
|
926
|
-
|
|
927
|
-
|
|
783
|
+
|
|
784
|
+
declare class ExuluTool {
|
|
785
|
+
id: string;
|
|
928
786
|
name: string;
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
787
|
+
description: string;
|
|
788
|
+
category: string;
|
|
789
|
+
inputSchema?: z.ZodType;
|
|
790
|
+
type: "context" | "function" | "agent" | "web_search";
|
|
791
|
+
tool: Tool;
|
|
792
|
+
config: {
|
|
793
|
+
name: string;
|
|
794
|
+
description: string;
|
|
795
|
+
type: "boolean" | "string" | "number" | "variable";
|
|
796
|
+
default?: string | boolean | number;
|
|
797
|
+
}[];
|
|
798
|
+
constructor({ id, name, description, category, inputSchema, type, execute, config, }: {
|
|
799
|
+
id: string;
|
|
800
|
+
name: string;
|
|
801
|
+
description: string;
|
|
802
|
+
category?: string;
|
|
803
|
+
inputSchema?: z.ZodType;
|
|
804
|
+
type: "context" | "function" | "agent" | "web_search";
|
|
805
|
+
config: {
|
|
806
|
+
name: string;
|
|
807
|
+
description: string;
|
|
808
|
+
type: "boolean" | "string" | "number" | "variable";
|
|
809
|
+
default?: string | boolean | number;
|
|
810
|
+
}[];
|
|
811
|
+
execute: (inputs: any) => Promise<{
|
|
812
|
+
result?: string;
|
|
813
|
+
job?: string;
|
|
814
|
+
items?: Item[];
|
|
815
|
+
}> | AsyncGenerator<{
|
|
816
|
+
result?: string;
|
|
817
|
+
job?: string;
|
|
818
|
+
items?: Item[];
|
|
819
|
+
}>;
|
|
820
|
+
});
|
|
821
|
+
execute: ({ agent: agentId, config, user, inputs, project, items, }: {
|
|
822
|
+
agent: string;
|
|
823
|
+
config: ExuluConfig;
|
|
824
|
+
user?: User;
|
|
825
|
+
inputs: any;
|
|
826
|
+
project?: string;
|
|
827
|
+
items?: string[];
|
|
828
|
+
}) => Promise<any>;
|
|
829
|
+
}
|
|
830
|
+
|
|
831
|
+
type ExuluAgentToolConfig = {
|
|
832
|
+
id: string;
|
|
833
|
+
type: string;
|
|
834
|
+
config: {
|
|
835
|
+
name: string;
|
|
836
|
+
variable: string | boolean | number;
|
|
837
|
+
type: "boolean" | "string" | "number" | "variable";
|
|
838
|
+
value?: any;
|
|
839
|
+
default?: string | boolean | number;
|
|
840
|
+
}[];
|
|
933
841
|
};
|
|
934
|
-
type ExuluStatisticParams = Omit<ExuluStatistic, "total" | "name" | "type">;
|
|
935
842
|
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
843
|
+
type ExuluProviderWorkflowConfig = {
|
|
844
|
+
enabled: boolean;
|
|
845
|
+
queue?: Promise<ExuluQueueConfig>;
|
|
846
|
+
};
|
|
847
|
+
interface ExuluProviderParams {
|
|
848
|
+
id: string;
|
|
849
|
+
name: string;
|
|
850
|
+
type: "agent";
|
|
851
|
+
description: string;
|
|
852
|
+
config?: ExuluProviderConfig | undefined;
|
|
853
|
+
queue?: ExuluQueueConfig;
|
|
854
|
+
maxContextLength?: number;
|
|
855
|
+
authenticationInformation?: string;
|
|
856
|
+
provider: string;
|
|
857
|
+
workflows?: ExuluProviderWorkflowConfig;
|
|
858
|
+
capabilities?: {
|
|
859
|
+
text: boolean;
|
|
860
|
+
images: imageTypes$1[];
|
|
861
|
+
files: fileTypes$1[];
|
|
862
|
+
audio: audioTypes$1[];
|
|
863
|
+
video: videoTypes$1[];
|
|
864
|
+
};
|
|
865
|
+
outputSchema?: z.ZodType;
|
|
866
|
+
rateLimit?: RateLimiterRule;
|
|
867
|
+
}
|
|
868
|
+
declare class ExuluProvider {
|
|
869
|
+
id: string;
|
|
870
|
+
name: string;
|
|
871
|
+
provider: string;
|
|
872
|
+
description: string;
|
|
873
|
+
slug: string;
|
|
874
|
+
type: "agent";
|
|
875
|
+
streaming: boolean;
|
|
876
|
+
authenticationInformation?: string;
|
|
877
|
+
maxContextLength?: number;
|
|
878
|
+
workflows?: ExuluProviderWorkflowConfig;
|
|
879
|
+
queue?: ExuluQueueConfig;
|
|
880
|
+
rateLimit?: RateLimiterRule;
|
|
881
|
+
config?: ExuluProviderConfig | undefined;
|
|
882
|
+
model?: {
|
|
883
|
+
create: ({ apiKey }: {
|
|
884
|
+
apiKey?: string | undefined;
|
|
885
|
+
}) => LanguageModel;
|
|
886
|
+
};
|
|
887
|
+
capabilities: {
|
|
888
|
+
text: boolean;
|
|
889
|
+
images: string[];
|
|
890
|
+
files: string[];
|
|
891
|
+
audio: string[];
|
|
892
|
+
video: string[];
|
|
893
|
+
};
|
|
894
|
+
constructor({ id, name, description, config, rateLimit, capabilities, type, maxContextLength, provider, queue, authenticationInformation, workflows, }: ExuluProviderParams);
|
|
895
|
+
get providerName(): string;
|
|
896
|
+
get modelName(): string;
|
|
897
|
+
tool: (instance: string, providers: ExuluProvider[], contexts: ExuluContext[], rerankers: ExuluReranker[]) => Promise<ExuluTool | null>;
|
|
898
|
+
generateSync: ({ prompt, req, user, session, inputMessages, currentTools, allExuluTools, statistics, toolConfigs, providerapikey, contexts, rerankers, exuluConfig, outputSchema, agent, instructions, }: {
|
|
899
|
+
prompt?: string;
|
|
900
|
+
user?: User;
|
|
901
|
+
req?: Request;
|
|
902
|
+
session?: string;
|
|
903
|
+
agent?: ExuluAgent;
|
|
904
|
+
inputMessages?: UIMessage[];
|
|
905
|
+
currentTools?: ExuluTool[];
|
|
906
|
+
allExuluTools?: ExuluTool[];
|
|
907
|
+
statistics?: ExuluStatisticParams;
|
|
908
|
+
toolConfigs?: ExuluAgentToolConfig[];
|
|
909
|
+
providerapikey?: string | undefined;
|
|
910
|
+
contexts?: ExuluContext[] | undefined;
|
|
911
|
+
rerankers?: ExuluReranker[] | undefined;
|
|
912
|
+
exuluConfig?: ExuluConfig;
|
|
913
|
+
instructions?: string;
|
|
914
|
+
outputSchema?: z.ZodType;
|
|
915
|
+
}) => Promise<any>;
|
|
916
|
+
/**
|
|
917
|
+
* Convert file parts in messages to OpenAI Responses API compatible format.
|
|
918
|
+
* The OpenAI Responses API doesn't support inline file parts with type 'file'.
|
|
919
|
+
* This function converts:
|
|
920
|
+
* - Document files (PDF, DOCX, etc.) -> text parts with extracted content using officeparser
|
|
921
|
+
* - Image files -> image parts (which ARE supported by Responses API)
|
|
922
|
+
*/
|
|
923
|
+
private processFilePartsInMessages;
|
|
924
|
+
generateStream: ({ user, session, agent, message, previousMessages, currentTools, approvedTools, allExuluTools, toolConfigs, providerapikey, contexts, rerankers, exuluConfig, instructions, req, }: {
|
|
925
|
+
user?: User;
|
|
926
|
+
session?: string;
|
|
927
|
+
agent?: ExuluAgent;
|
|
928
|
+
message?: UIMessage;
|
|
929
|
+
previousMessages?: UIMessage[];
|
|
930
|
+
currentTools?: ExuluTool[];
|
|
931
|
+
approvedTools?: string[];
|
|
932
|
+
allExuluTools?: ExuluTool[];
|
|
933
|
+
toolConfigs?: ExuluAgentToolConfig[];
|
|
934
|
+
providerapikey?: string | undefined;
|
|
935
|
+
contexts?: ExuluContext[] | undefined;
|
|
936
|
+
rerankers?: ExuluReranker[] | undefined;
|
|
937
|
+
exuluConfig?: ExuluConfig;
|
|
938
|
+
instructions?: string;
|
|
939
|
+
req?: Request;
|
|
940
|
+
}) => Promise<{
|
|
941
|
+
stream: ReturnType<typeof streamText>;
|
|
942
|
+
originalMessages: UIMessage[];
|
|
943
|
+
previousMessages: UIMessage[];
|
|
944
|
+
}>;
|
|
945
|
+
}
|
|
946
|
+
|
|
947
|
+
declare function redisClient(): Promise<{
|
|
948
|
+
client: RedisClientType | null;
|
|
946
949
|
}>;
|
|
947
950
|
|
|
948
951
|
declare class ExuluQueues {
|
|
@@ -983,29 +986,6 @@ declare class ExuluQueues {
|
|
|
983
986
|
}
|
|
984
987
|
declare const queues: ExuluQueues;
|
|
985
988
|
|
|
986
|
-
/**
|
|
987
|
-
* Create metadata for console logging that will be used by S3 transport
|
|
988
|
-
* to group logs by ID and store them in S3 with the ID as prefix
|
|
989
|
-
*
|
|
990
|
-
* @param id - The ID to group logs by (e.g., job ID, request ID, etc.)
|
|
991
|
-
* @param additionalMetadata - Any additional metadata to include with the log
|
|
992
|
-
* @returns Metadata object to pass as the last argument to console methods
|
|
993
|
-
*
|
|
994
|
-
* @example
|
|
995
|
-
* ```typescript
|
|
996
|
-
* import { logMetadata } from './registry/log-metadata';
|
|
997
|
-
*
|
|
998
|
-
* const jobId = 'job-123';
|
|
999
|
-
* console.log('Starting job', logMetadata(jobId));
|
|
1000
|
-
* console.log('Processing...', logMetadata(jobId, { step: 'validation' }));
|
|
1001
|
-
* console.error('Job failed', logMetadata(jobId, { error: 'timeout' }));
|
|
1002
|
-
* ```
|
|
1003
|
-
*/
|
|
1004
|
-
declare function logMetadata(id: string, additionalMetadata?: Record<string, any>): {
|
|
1005
|
-
__logMetadata: boolean;
|
|
1006
|
-
id: string;
|
|
1007
|
-
};
|
|
1008
|
-
|
|
1009
989
|
/**
|
|
1010
990
|
* Represents the data structure for a chunk object.
|
|
1011
991
|
*
|
|
@@ -1092,7 +1072,7 @@ declare class Chunk {
|
|
|
1092
1072
|
*
|
|
1093
1073
|
* @enum {string}
|
|
1094
1074
|
*/
|
|
1095
|
-
type IncludeDelim =
|
|
1075
|
+
type IncludeDelim = "prev" | "next";
|
|
1096
1076
|
/** Interface for RecursiveLevel data
|
|
1097
1077
|
*
|
|
1098
1078
|
* @interface RecursiveLevelData
|
|
@@ -1147,13 +1127,6 @@ declare class RecursiveLevel {
|
|
|
1147
1127
|
* @returns {RecursiveLevel} The RecursiveLevel object.
|
|
1148
1128
|
*/
|
|
1149
1129
|
static fromDict(data: RecursiveLevelData): RecursiveLevel;
|
|
1150
|
-
/** Create RecursiveLevel object from a recipe
|
|
1151
|
-
*
|
|
1152
|
-
* @param {string} name - The name of the recipe.
|
|
1153
|
-
* @param {string} lang - The language of the recipe.
|
|
1154
|
-
* @returns {Promise<RecursiveLevel>} The RecursiveLevel object.
|
|
1155
|
-
*/
|
|
1156
|
-
static fromRecipe(name: string, lang?: string): Promise<RecursiveLevel>;
|
|
1157
1130
|
}
|
|
1158
1131
|
/** Interface for RecursiveRules data
|
|
1159
1132
|
*
|
|
@@ -1204,14 +1177,6 @@ declare class RecursiveRules {
|
|
|
1204
1177
|
* @returns {RecursiveRulesData} The dictionary-like object.
|
|
1205
1178
|
*/
|
|
1206
1179
|
toDict(): RecursiveRulesData;
|
|
1207
|
-
/** Create a RecursiveRules object from a recipe
|
|
1208
|
-
*
|
|
1209
|
-
* @param {string} name - The name of the recipe.
|
|
1210
|
-
* @param {string} lang - The language of the recipe.
|
|
1211
|
-
* @param {string} path - The path to the recipe.
|
|
1212
|
-
* @returns {Promise<RecursiveRules>} The RecursiveRules object.
|
|
1213
|
-
*/
|
|
1214
|
-
static fromRecipe(name?: string, lang?: string, path?: string): Promise<RecursiveRules>;
|
|
1215
1180
|
}
|
|
1216
1181
|
/** Interface for RecursiveChunk data
|
|
1217
1182
|
*
|
|
@@ -1372,15 +1337,19 @@ declare abstract class BaseChunker {
|
|
|
1372
1337
|
*
|
|
1373
1338
|
* @interface RecursiveChunkerOptions
|
|
1374
1339
|
* @property {string | Tokenizer} [tokenizer] - The tokenizer to use for text processing. Can be a string identifier (default: "Xenova/gpt2") or a Tokenizer instance.
|
|
1375
|
-
* @property {number} [chunkSize] - The maximum number
|
|
1340
|
+
* @property {number} [chunkSize] - The maximum number Thof tokens per chunk. Must be greater than 0. Default: 512.
|
|
1376
1341
|
* @property {RecursiveRules} [rules] - The rules that define how text should be recursively chunked. Default: new RecursiveRules().
|
|
1377
1342
|
* @property {number} [minCharactersPerChunk] - The minimum number of characters that should be in each chunk. Must be greater than 0. Default: 24.
|
|
1343
|
+
* @property {string} [prefix] - Optional prefix to prepend to each chunk. The token count of the prefix will be subtracted from the chunk size.
|
|
1344
|
+
* @property {boolean} [retainHeaders] - Whether to retain headers in each chunk for context. Headers (HTML h1-h6 or Markdown #-######) will be prepended to chunks. Default: false.
|
|
1378
1345
|
*/
|
|
1379
1346
|
interface RecursiveChunkerOptions {
|
|
1380
1347
|
tokenizer?: TokenizerModelName;
|
|
1381
1348
|
chunkSize?: number;
|
|
1382
1349
|
rules?: RecursiveRules;
|
|
1383
1350
|
minCharactersPerChunk?: number;
|
|
1351
|
+
prefix?: string;
|
|
1352
|
+
retainHeaders?: boolean;
|
|
1384
1353
|
}
|
|
1385
1354
|
/**
|
|
1386
1355
|
* Represents a RecursiveChunker instance that is also directly callable as a function.
|
|
@@ -1414,7 +1383,7 @@ interface RecursiveChunkerOptions {
|
|
|
1414
1383
|
*/
|
|
1415
1384
|
type CallableRecursiveChunker = RecursiveChunker & {
|
|
1416
1385
|
(text: string, showProgress?: boolean): Promise<RecursiveChunk[]>;
|
|
1417
|
-
(texts: string[], showProgress?: boolean): Promise<
|
|
1386
|
+
(texts: string[], showProgress?: boolean): Promise<RecursiveChunk[][]>;
|
|
1418
1387
|
};
|
|
1419
1388
|
/**
|
|
1420
1389
|
* Recursively chunk text using a set of rules.
|
|
@@ -1424,10 +1393,13 @@ type CallableRecursiveChunker = RecursiveChunker & {
|
|
|
1424
1393
|
* delimiters, whitespace, and token-based chunking.
|
|
1425
1394
|
*
|
|
1426
1395
|
* @extends BaseChunker
|
|
1427
|
-
* @property {number} chunkSize - The maximum number of tokens per chunk.
|
|
1396
|
+
* @property {number} chunkSize - The maximum number of tokens per chunk (adjusted for prefix if provided).
|
|
1428
1397
|
* @property {number} minCharactersPerChunk - The minimum number of characters per chunk.
|
|
1429
1398
|
* @property {RecursiveRules} rules - The rules that define how text should be recursively chunked.
|
|
1430
1399
|
* @property {string} sep - The separator string used for internal splitting (usually "✄").
|
|
1400
|
+
* @property {string} [prefix] - Optional prefix prepended to each chunk.
|
|
1401
|
+
* @property {number} prefixTokenCount - The number of tokens in the prefix (0 if no prefix).
|
|
1402
|
+
* @property {boolean} retainHeaders - Whether to retain headers in each chunk for context.
|
|
1431
1403
|
*
|
|
1432
1404
|
* @method chunk - Recursively chunk a single text into chunks or strings.
|
|
1433
1405
|
* @method chunkBatch - Recursively chunk a batch of texts.
|
|
@@ -1450,7 +1422,12 @@ declare class RecursiveChunker extends BaseChunker {
|
|
|
1450
1422
|
readonly minCharactersPerChunk: number;
|
|
1451
1423
|
readonly rules: RecursiveRules;
|
|
1452
1424
|
readonly sep: string;
|
|
1425
|
+
readonly prefix?: string;
|
|
1426
|
+
readonly prefixTokenCount: number;
|
|
1427
|
+
readonly retainHeaders: boolean;
|
|
1453
1428
|
private readonly _CHARS_PER_TOKEN;
|
|
1429
|
+
private _headers;
|
|
1430
|
+
private _headerHierarchy;
|
|
1454
1431
|
/**
|
|
1455
1432
|
* Private constructor. Use `RecursiveChunker.create()` to instantiate.
|
|
1456
1433
|
*/
|
|
@@ -1466,6 +1443,7 @@ declare class RecursiveChunker extends BaseChunker {
|
|
|
1466
1443
|
* @param {number} [options.chunkSize=512] - Maximum number of tokens per chunk. Must be > 0.
|
|
1467
1444
|
* @param {RecursiveRules} [options.rules=new RecursiveRules()] - Rules for recursive chunking. See {@link RecursiveRules} for customization.
|
|
1468
1445
|
* @param {number} [options.minCharactersPerChunk=24] - Minimum number of characters per chunk. Must be > 0.
|
|
1446
|
+
* @param {string} [options.prefix] - Optional prefix to prepend to each chunk. The token count of the prefix will be subtracted from the chunk size.
|
|
1469
1447
|
*
|
|
1470
1448
|
* @returns {Promise<CallableRecursiveChunker>} Promise resolving to a callable RecursiveChunker instance.
|
|
1471
1449
|
*
|
|
@@ -1485,6 +1463,10 @@ declare class RecursiveChunker extends BaseChunker {
|
|
|
1485
1463
|
* const chunker = await RecursiveChunker.create();
|
|
1486
1464
|
* const chunks = await chunker.chunk("Some text"); // Use as object method
|
|
1487
1465
|
*
|
|
1466
|
+
* @example <caption>Using a prefix</caption>
|
|
1467
|
+
* const chunker = await RecursiveChunker.create({ chunkSize: 512, prefix: "Context: " });
|
|
1468
|
+
* const chunks = await chunker("Some text to chunk");
|
|
1469
|
+
*
|
|
1488
1470
|
* @note
|
|
1489
1471
|
* The returned instance is both callable (like a function) and has all properties/methods of RecursiveChunker.
|
|
1490
1472
|
* You can use it as a drop-in replacement for a function or a class instance.
|
|
@@ -1494,6 +1476,21 @@ declare class RecursiveChunker extends BaseChunker {
|
|
|
1494
1476
|
* See {@link RecursiveRules} and {@link RecursiveLevel} for rule structure.
|
|
1495
1477
|
*/
|
|
1496
1478
|
static create(options?: RecursiveChunkerOptions): Promise<CallableRecursiveChunker>;
|
|
1479
|
+
/**
|
|
1480
|
+
* Extract all headers from the text (both HTML and Markdown).
|
|
1481
|
+
*
|
|
1482
|
+
* @param {string} text - The text to extract headers from
|
|
1483
|
+
* @returns {HeaderInfo[]} Array of header information
|
|
1484
|
+
* @private
|
|
1485
|
+
*/
|
|
1486
|
+
private _extractHeaders;
|
|
1487
|
+
/**
|
|
1488
|
+
* Get the current header context as a formatted string.
|
|
1489
|
+
*
|
|
1490
|
+
* @returns {string} The formatted header context
|
|
1491
|
+
* @private
|
|
1492
|
+
*/
|
|
1493
|
+
private _getHeaderContext;
|
|
1497
1494
|
/**
|
|
1498
1495
|
* Estimates the number of tokens in a given text.
|
|
1499
1496
|
*
|
|
@@ -1552,6 +1549,7 @@ declare class RecursiveChunker extends BaseChunker {
|
|
|
1552
1549
|
*
|
|
1553
1550
|
* This method is the main entry point for chunking text using the RecursiveChunker.
|
|
1554
1551
|
* It takes a single text string and returns an array of RecursiveChunk objects.
|
|
1552
|
+
* If a prefix was provided during instantiation, it will be prepended to each chunk.
|
|
1555
1553
|
*
|
|
1556
1554
|
* @param {string} text - The text to be chunked
|
|
1557
1555
|
* @returns {Promise<RecursiveChunk[]>} A promise that resolves to an array of RecursiveChunk objects
|
|
@@ -1561,7 +1559,7 @@ declare class RecursiveChunker extends BaseChunker {
|
|
|
1561
1559
|
* Return a string representation of the RecursiveChunker.
|
|
1562
1560
|
*
|
|
1563
1561
|
* This method provides a string representation of the RecursiveChunker instance,
|
|
1564
|
-
* including its tokenizer, rules, chunk size, minimum characters per chunk, and
|
|
1562
|
+
* including its tokenizer, rules, chunk size, minimum characters per chunk, and prefix (if any).
|
|
1565
1563
|
*
|
|
1566
1564
|
* @returns {string} A string representation of the RecursiveChunker
|
|
1567
1565
|
*/
|
|
@@ -1861,6 +1859,66 @@ declare class SentenceChunker extends BaseChunker {
|
|
|
1861
1859
|
toString(): string;
|
|
1862
1860
|
}
|
|
1863
1861
|
|
|
1862
|
+
declare class MarkdownChunker {
|
|
1863
|
+
private readonly _CHARS_PER_TOKEN;
|
|
1864
|
+
constructor();
|
|
1865
|
+
/**
|
|
1866
|
+
* Converts markdown tables to LLM-friendly numbered list format.
|
|
1867
|
+
* Example:
|
|
1868
|
+
* | First name | Last name | Age |
|
|
1869
|
+
* | -------- | -------- | -------- |
|
|
1870
|
+
* | John | Doe | 30 |
|
|
1871
|
+
* | Jane | Smith | 25 |
|
|
1872
|
+
*
|
|
1873
|
+
* Becomes:
|
|
1874
|
+
* 1. First name: John, Last name: Doe, Age: 30
|
|
1875
|
+
* 2. First name: Jane, Last name: Smith, Age: 25
|
|
1876
|
+
*
|
|
1877
|
+
* Handles malformed tables gracefully by validating structure and skipping invalid tables.
|
|
1878
|
+
*/
|
|
1879
|
+
convertTablesToText(text: string): string;
|
|
1880
|
+
/**
|
|
1881
|
+
* Find the nearest logical breakpoint working backwards from the end of the text.
|
|
1882
|
+
* Logical breakpoints are prioritized as follows:
|
|
1883
|
+
* 1. Before markdown headers (##) or HTML headers (<h1>-<h6>)
|
|
1884
|
+
* 2. Paragraph breaks (double newlines)
|
|
1885
|
+
* 3. Single newlines after list items or content
|
|
1886
|
+
* 4. End of sentences (. ! ? followed by space)
|
|
1887
|
+
* 5. Any whitespace
|
|
1888
|
+
*
|
|
1889
|
+
* Only considers breakpoints in the last 50% of the text to avoid creating very small chunks.
|
|
1890
|
+
* Returns the position of the breakpoint, or null if none found
|
|
1891
|
+
*/
|
|
1892
|
+
private findLogicalBreakpoint;
|
|
1893
|
+
private headers;
|
|
1894
|
+
chunk(text: string, chunkSize: number, prefix?: string): Promise<{
|
|
1895
|
+
text: string;
|
|
1896
|
+
page: number;
|
|
1897
|
+
}[]>;
|
|
1898
|
+
}
|
|
1899
|
+
|
|
1900
|
+
type DocumentProcessorConfig = {
|
|
1901
|
+
vlm?: {
|
|
1902
|
+
model: LanguageModel;
|
|
1903
|
+
concurrency: number;
|
|
1904
|
+
};
|
|
1905
|
+
docling?: boolean;
|
|
1906
|
+
};
|
|
1907
|
+
type ProcessedPage = {
|
|
1908
|
+
page: number;
|
|
1909
|
+
content: string;
|
|
1910
|
+
headings?: any;
|
|
1911
|
+
image?: string;
|
|
1912
|
+
vlm_corrected_text?: string;
|
|
1913
|
+
vlm_validated?: boolean;
|
|
1914
|
+
};
|
|
1915
|
+
type ProcessedDocument = ProcessedPage[];
|
|
1916
|
+
declare function documentProcessor({ file, name, config }: {
|
|
1917
|
+
file: string | Buffer;
|
|
1918
|
+
name: string;
|
|
1919
|
+
config?: DocumentProcessorConfig;
|
|
1920
|
+
}): Promise<ProcessedDocument | undefined>;
|
|
1921
|
+
|
|
1864
1922
|
type JOB_STATUS = "completed" | "failed" | "delayed" | "active" | "waiting" | "paused" | "stuck";
|
|
1865
1923
|
declare const JOB_STATUS_ENUM: {
|
|
1866
1924
|
completed: string;
|
|
@@ -1874,70 +1932,69 @@ declare const JOB_STATUS_ENUM: {
|
|
|
1874
1932
|
|
|
1875
1933
|
declare const ExuluJobs: {
|
|
1876
1934
|
redis: typeof redisClient;
|
|
1877
|
-
jobs: {
|
|
1878
|
-
validate: (job: bullmq.Job) => bullmq.Job<any, any, string>;
|
|
1879
|
-
};
|
|
1880
1935
|
};
|
|
1881
|
-
declare const
|
|
1936
|
+
declare const ExuluDefaultProviders: {
|
|
1882
1937
|
anthropic: {
|
|
1883
|
-
opus4:
|
|
1884
|
-
sonnet4:
|
|
1885
|
-
sonnet45:
|
|
1938
|
+
opus4: ExuluProvider;
|
|
1939
|
+
sonnet4: ExuluProvider;
|
|
1940
|
+
sonnet45: ExuluProvider;
|
|
1886
1941
|
};
|
|
1887
1942
|
cerebras: {
|
|
1888
|
-
gptOss120b:
|
|
1889
|
-
llama38b:
|
|
1890
|
-
llama3370b:
|
|
1943
|
+
gptOss120b: ExuluProvider;
|
|
1944
|
+
llama38b: ExuluProvider;
|
|
1945
|
+
llama3370b: ExuluProvider;
|
|
1891
1946
|
};
|
|
1892
1947
|
google: {
|
|
1893
|
-
vertexGemini25Flash:
|
|
1894
|
-
vertexGemini25Pro:
|
|
1895
|
-
vertexGemini3Pro:
|
|
1948
|
+
vertexGemini25Flash: ExuluProvider;
|
|
1949
|
+
vertexGemini25Pro: ExuluProvider;
|
|
1950
|
+
vertexGemini3Pro: ExuluProvider;
|
|
1896
1951
|
};
|
|
1897
1952
|
openai: {
|
|
1898
|
-
gpt5Mini:
|
|
1899
|
-
gpt5:
|
|
1900
|
-
gpt5pro:
|
|
1901
|
-
gpt5Codex:
|
|
1902
|
-
gpt5Nano:
|
|
1903
|
-
gpt41:
|
|
1904
|
-
gpt41Mini:
|
|
1905
|
-
gpt4o:
|
|
1906
|
-
gpt4oMini:
|
|
1953
|
+
gpt5Mini: ExuluProvider;
|
|
1954
|
+
gpt5: ExuluProvider;
|
|
1955
|
+
gpt5pro: ExuluProvider;
|
|
1956
|
+
gpt5Codex: ExuluProvider;
|
|
1957
|
+
gpt5Nano: ExuluProvider;
|
|
1958
|
+
gpt41: ExuluProvider;
|
|
1959
|
+
gpt41Mini: ExuluProvider;
|
|
1960
|
+
gpt4o: ExuluProvider;
|
|
1961
|
+
gpt4oMini: ExuluProvider;
|
|
1907
1962
|
};
|
|
1908
1963
|
};
|
|
1909
1964
|
declare const ExuluVariables: {
|
|
1910
1965
|
get: (name: string) => Promise<string>;
|
|
1911
1966
|
};
|
|
1912
|
-
declare const
|
|
1913
|
-
|
|
1914
|
-
|
|
1915
|
-
|
|
1916
|
-
|
|
1917
|
-
|
|
1918
|
-
|
|
1919
|
-
|
|
1920
|
-
|
|
1921
|
-
|
|
1922
|
-
|
|
1923
|
-
|
|
1924
|
-
|
|
1925
|
-
|
|
1926
|
-
|
|
1927
|
-
}) => Promise<any>;
|
|
1967
|
+
declare const ExuluAuthentication: {
|
|
1968
|
+
authenticate: ({ apikey, authtoken, internalkey, db, }: {
|
|
1969
|
+
authtoken?: any;
|
|
1970
|
+
apikey?: string;
|
|
1971
|
+
internalkey?: string;
|
|
1972
|
+
db: knex.Knex;
|
|
1973
|
+
}) => Promise<{
|
|
1974
|
+
error: boolean;
|
|
1975
|
+
message?: string;
|
|
1976
|
+
code?: number;
|
|
1977
|
+
user?: User;
|
|
1978
|
+
}>;
|
|
1979
|
+
};
|
|
1980
|
+
declare const ExuluDocumentProcessor: {
|
|
1981
|
+
process: typeof documentProcessor;
|
|
1928
1982
|
};
|
|
1929
1983
|
declare const ExuluOtel: {
|
|
1930
|
-
create: ({ SIGNOZ_ACCESS_TOKEN, SIGNOZ_TRACES_URL, SIGNOZ_LOGS_URL }: {
|
|
1984
|
+
create: ({ SIGNOZ_ACCESS_TOKEN, SIGNOZ_TRACES_URL, SIGNOZ_LOGS_URL, }: {
|
|
1931
1985
|
SIGNOZ_ACCESS_TOKEN: string;
|
|
1932
1986
|
SIGNOZ_TRACES_URL: string;
|
|
1933
1987
|
SIGNOZ_LOGS_URL: string;
|
|
1934
1988
|
}) => _opentelemetry_sdk_node.NodeSDK;
|
|
1935
1989
|
};
|
|
1936
1990
|
|
|
1937
|
-
declare const
|
|
1991
|
+
declare const ExuluDatabase: {
|
|
1938
1992
|
init: ({ contexts }: {
|
|
1939
1993
|
contexts: ExuluContext[];
|
|
1940
1994
|
}) => Promise<void>;
|
|
1995
|
+
update: ({ contexts }: {
|
|
1996
|
+
contexts: ExuluContext[];
|
|
1997
|
+
}) => Promise<void>;
|
|
1941
1998
|
api: {
|
|
1942
1999
|
key: {
|
|
1943
2000
|
generate: (name: string, email: string) => Promise<{
|
|
@@ -1948,10 +2005,11 @@ declare const db: {
|
|
|
1948
2005
|
};
|
|
1949
2006
|
declare const ExuluChunkers: {
|
|
1950
2007
|
sentence: typeof SentenceChunker;
|
|
2008
|
+
markdown: typeof MarkdownChunker;
|
|
1951
2009
|
recursive: {
|
|
1952
2010
|
function: typeof RecursiveChunker;
|
|
1953
2011
|
rules: typeof RecursiveRules;
|
|
1954
2012
|
};
|
|
1955
2013
|
};
|
|
1956
2014
|
|
|
1957
|
-
export { type JOB_STATUS as EXULU_JOB_STATUS, JOB_STATUS_ENUM as EXULU_JOB_STATUS_ENUM, type STATISTICS_TYPE as EXULU_STATISTICS_TYPE, STATISTICS_TYPE_ENUM as EXULU_STATISTICS_TYPE_ENUM,
|
|
2015
|
+
export { type JOB_STATUS as EXULU_JOB_STATUS, JOB_STATUS_ENUM as EXULU_JOB_STATUS_ENUM, type STATISTICS_TYPE as EXULU_STATISTICS_TYPE, STATISTICS_TYPE_ENUM as EXULU_STATISTICS_TYPE_ENUM, ExuluApp, ExuluAuthentication, ExuluChunkers, ExuluContext, ExuluDatabase, ExuluDefaultProviders, ExuluDocumentProcessor, ExuluEmbedder, ExuluEval, type Item as ExuluItem, ExuluJobs, ExuluOtel, queues as ExuluQueues, ExuluReranker, ExuluTool, ExuluVariables };
|