@exulu/backend 5.7.1 → 5.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{catalog-3QLU2G7R.js → catalog-4P3TKOV7.js} +2 -1
- package/dist/chunk-4W3V7IHR.js +1166 -0
- package/dist/chunk-6URU62NI.js +54 -0
- package/dist/{chunk-4PDWNVNT.js → chunk-F534XOQR.js} +3 -50
- package/dist/{chunk-XNTGIQLC.js → chunk-NUEM3HMI.js} +501 -1471
- package/dist/chunk-RNZ4IDCT.js +946 -0
- package/dist/{convert-exulu-tools-to-ai-sdk-tools-XOL5J5ET.js → convert-exulu-tools-to-ai-sdk-tools-3UCQOIY6.js} +4 -2
- package/dist/doc_processor-E5GCE2ZT.js +10 -0
- package/dist/index.cjs +29509 -29270
- package/dist/index.d.cts +118 -105
- package/dist/index.d.ts +118 -105
- package/dist/index.js +154 -1053
- package/ee/invoke-skills/binary-file-guard.test.ts +22 -0
- package/ee/invoke-skills/binary-file-guard.ts +33 -0
- package/ee/invoke-skills/create-sandbox.ts +10 -0
- package/ee/python/documents/processing/doc_processor.ts +3 -3
- package/ee/workers.ts +6 -4
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -92,19 +92,6 @@ declare function redisClient(): Promise<{
|
|
|
92
92
|
client: RedisClientType | null;
|
|
93
93
|
}>;
|
|
94
94
|
|
|
95
|
-
interface TestCase {
|
|
96
|
-
id: string;
|
|
97
|
-
name: string;
|
|
98
|
-
description?: string;
|
|
99
|
-
inputs: UIMessage[];
|
|
100
|
-
expected_output: string;
|
|
101
|
-
expected_tools?: string[];
|
|
102
|
-
expected_knowledge_sources?: string[];
|
|
103
|
-
expected_agent_tools?: string[];
|
|
104
|
-
createdAt: string;
|
|
105
|
-
updatedAt: string;
|
|
106
|
-
}
|
|
107
|
-
|
|
108
95
|
interface ExuluAgent {
|
|
109
96
|
id: string;
|
|
110
97
|
modelName?: string;
|
|
@@ -188,6 +175,111 @@ type fileTypes$1 = '.pdf' | '.docx' | '.xlsx' | '.xls' | '.csv' | '.pptx' | '.pp
|
|
|
188
175
|
type audioTypes$1 = '.mp3' | '.wav' | '.m4a' | '.mp4' | '.mpeg';
|
|
189
176
|
type videoTypes$1 = '.mp4' | '.m4a' | '.mp3' | '.mpeg' | '.wav';
|
|
190
177
|
|
|
178
|
+
/**
|
|
179
|
+
* resolveOcr — the OCR-side counterpart of resolveEmbedder.
|
|
180
|
+
*
|
|
181
|
+
* Like resolveEmbedder, this is LiteLLM-ONLY: OCR always goes through the
|
|
182
|
+
* spawned LiteLLM proxy's Mistral-compatible `/v1/ocr` endpoint. There is no
|
|
183
|
+
* in-code provider/SDK fallback — a caller just names a LiteLLM `model` (e.g.
|
|
184
|
+
* "mistral-ocr", "vertex-ocr") and it works, with cost attribution via tags
|
|
185
|
+
* (user/role/project/agent/routine/context, when provided — see buildTags()).
|
|
186
|
+
*
|
|
187
|
+
* Routing OCR through the proxy means we can cost-control it through the same
|
|
188
|
+
* tag-based budgets as chat and embeddings, and switch the underlying provider
|
|
189
|
+
* (mistral / azure_ai / vertex_ai) by editing config.litellm.yaml without
|
|
190
|
+
* touching this code.
|
|
191
|
+
*
|
|
192
|
+
* LiteLLM follows the Mistral OCR request/response shape:
|
|
193
|
+
* https://docs.mistral.ai/capabilities/vision/#optical-character-recognition-ocr
|
|
194
|
+
*/
|
|
195
|
+
type ResolveOcrInput = {
|
|
196
|
+
/** LiteLLM model_name of the OCR model (e.g. "mistral-ocr"). */
|
|
197
|
+
model: string;
|
|
198
|
+
/** Context this OCR belongs to — emitted as context_id_/context_name_ tags. */
|
|
199
|
+
contextId?: string;
|
|
200
|
+
contextName?: string;
|
|
201
|
+
user?: User;
|
|
202
|
+
/** When only a numeric user id is available (background ingestion jobs). */
|
|
203
|
+
userId?: number;
|
|
204
|
+
roleId?: string;
|
|
205
|
+
project?: Project;
|
|
206
|
+
agent?: ExuluAgent;
|
|
207
|
+
routine?: {
|
|
208
|
+
id: string;
|
|
209
|
+
name: string;
|
|
210
|
+
};
|
|
211
|
+
};
|
|
212
|
+
|
|
213
|
+
type DocumentProcessorConfig = {
|
|
214
|
+
vlm?: {
|
|
215
|
+
/**
|
|
216
|
+
* LiteLLM model_name for the VLM page-validation pass (declared in
|
|
217
|
+
* config.litellm.yaml, e.g. "vertex-gemini-2.5-flash"). Resolved via
|
|
218
|
+
* resolveModel() so the VLM pass shares the same tag-based cost controls
|
|
219
|
+
* and provider-switching as chat / embeddings / OCR, and the underlying
|
|
220
|
+
* provider can be swapped without code changes.
|
|
221
|
+
*/
|
|
222
|
+
model: string;
|
|
223
|
+
concurrency: number;
|
|
224
|
+
};
|
|
225
|
+
processor: {
|
|
226
|
+
name: "liteparse" | "mistral" | "officeparser";
|
|
227
|
+
/**
|
|
228
|
+
* LiteLLM model_name for the "mistral" OCR processor (declared in
|
|
229
|
+
* config.litellm.yaml). Defaults to "mistral-ocr". OCR is routed through
|
|
230
|
+
* the LiteLLM proxy so it shares the same tag-based cost controls as chat
|
|
231
|
+
* and embeddings, and the underlying provider (mistral / azure_ai /
|
|
232
|
+
* vertex_ai) can be switched without code changes.
|
|
233
|
+
*/
|
|
234
|
+
model?: string;
|
|
235
|
+
/**
|
|
236
|
+
* Maximum pages per OCR request for the "mistral" processor.
|
|
237
|
+
* Vertex AI OCR rejects documents over 30 pages; the PDF is split into
|
|
238
|
+
* chunks of this size and each chunk is OCR'd independently.
|
|
239
|
+
* Defaults to 25 (safely under the Vertex AI 30-page limit).
|
|
240
|
+
*/
|
|
241
|
+
maxPagesPerChunk?: number;
|
|
242
|
+
};
|
|
243
|
+
/**
|
|
244
|
+
* Optional cost-attribution context, forwarded to LiteLLM as spend tags
|
|
245
|
+
* (user / role / project / context) for both the OCR pass (resolveOcr) and
|
|
246
|
+
* the VLM page-validation pass (resolveModel). Not yet populated by callers;
|
|
247
|
+
* the wiring is in place so per-user/per-context budgets work the moment
|
|
248
|
+
* attribution is threaded through.
|
|
249
|
+
*/
|
|
250
|
+
attribution?: Omit<ResolveOcrInput, "model">;
|
|
251
|
+
debugging?: {
|
|
252
|
+
deleteTempFiles?: boolean;
|
|
253
|
+
};
|
|
254
|
+
};
|
|
255
|
+
type ProcessedPage = {
|
|
256
|
+
page: number;
|
|
257
|
+
content: string;
|
|
258
|
+
headings?: any;
|
|
259
|
+
image?: string;
|
|
260
|
+
vlm_corrected_text?: string;
|
|
261
|
+
vlm_validated?: boolean;
|
|
262
|
+
};
|
|
263
|
+
type ProcessedDocument = ProcessedPage[];
|
|
264
|
+
declare function documentProcessor({ file, name, config }: {
|
|
265
|
+
file: string | Buffer;
|
|
266
|
+
name: string;
|
|
267
|
+
config?: DocumentProcessorConfig;
|
|
268
|
+
}): Promise<ProcessedDocument | undefined>;
|
|
269
|
+
|
|
270
|
+
interface TestCase {
|
|
271
|
+
id: string;
|
|
272
|
+
name: string;
|
|
273
|
+
description?: string;
|
|
274
|
+
inputs: UIMessage[];
|
|
275
|
+
expected_output: string;
|
|
276
|
+
expected_tools?: string[];
|
|
277
|
+
expected_knowledge_sources?: string[];
|
|
278
|
+
expected_agent_tools?: string[];
|
|
279
|
+
createdAt: string;
|
|
280
|
+
updatedAt: string;
|
|
281
|
+
}
|
|
282
|
+
|
|
191
283
|
type ExuluQueueConfig = {
|
|
192
284
|
queue: Queue;
|
|
193
285
|
ratelimit: number;
|
|
@@ -1131,6 +1223,19 @@ type ExuluConfig = {
|
|
|
1131
1223
|
privacy?: {
|
|
1132
1224
|
systemPromptPersonalization?: boolean;
|
|
1133
1225
|
};
|
|
1226
|
+
/**
|
|
1227
|
+
* Documents the model receives inline — chat uploads, routine mail
|
|
1228
|
+
* attachments and parse_document. With `documentProcessor` set, the same
|
|
1229
|
+
* OCR + VLM engine the knowledge bases use (ExuluDocumentProcessor) extracts
|
|
1230
|
+
* the pages, so scans and images inside PDFs are read too; without it only
|
|
1231
|
+
* the text layer is read (officeparser). Enterprise licence required for
|
|
1232
|
+
* the processor; it falls back to the text layer when unavailable. PDFs
|
|
1233
|
+
* over EXULU_ATTACHMENT_MAX_PAGES pages (default 50) are refused with a
|
|
1234
|
+
* notice instead of being read while the request waits.
|
|
1235
|
+
*/
|
|
1236
|
+
attachments?: {
|
|
1237
|
+
documentProcessor?: DocumentProcessorConfig;
|
|
1238
|
+
};
|
|
1134
1239
|
/**
|
|
1135
1240
|
* Audit logging. When enabled, structured audit events (starting with one
|
|
1136
1241
|
* per tool call) are batched to S3 as NDJSON with configurable retention.
|
|
@@ -2414,98 +2519,6 @@ declare function validatePythonEnvironment(packageRoot?: string, checkPackages?:
|
|
|
2414
2519
|
message: string;
|
|
2415
2520
|
}>;
|
|
2416
2521
|
|
|
2417
|
-
/**
|
|
2418
|
-
* resolveOcr — the OCR-side counterpart of resolveEmbedder.
|
|
2419
|
-
*
|
|
2420
|
-
* Like resolveEmbedder, this is LiteLLM-ONLY: OCR always goes through the
|
|
2421
|
-
* spawned LiteLLM proxy's Mistral-compatible `/v1/ocr` endpoint. There is no
|
|
2422
|
-
* in-code provider/SDK fallback — a caller just names a LiteLLM `model` (e.g.
|
|
2423
|
-
* "mistral-ocr", "vertex-ocr") and it works, with cost attribution via tags
|
|
2424
|
-
* (user/role/project/agent/routine/context, when provided — see buildTags()).
|
|
2425
|
-
*
|
|
2426
|
-
* Routing OCR through the proxy means we can cost-control it through the same
|
|
2427
|
-
* tag-based budgets as chat and embeddings, and switch the underlying provider
|
|
2428
|
-
* (mistral / azure_ai / vertex_ai) by editing config.litellm.yaml without
|
|
2429
|
-
* touching this code.
|
|
2430
|
-
*
|
|
2431
|
-
* LiteLLM follows the Mistral OCR request/response shape:
|
|
2432
|
-
* https://docs.mistral.ai/capabilities/vision/#optical-character-recognition-ocr
|
|
2433
|
-
*/
|
|
2434
|
-
type ResolveOcrInput = {
|
|
2435
|
-
/** LiteLLM model_name of the OCR model (e.g. "mistral-ocr"). */
|
|
2436
|
-
model: string;
|
|
2437
|
-
/** Context this OCR belongs to — emitted as context_id_/context_name_ tags. */
|
|
2438
|
-
contextId?: string;
|
|
2439
|
-
contextName?: string;
|
|
2440
|
-
user?: User;
|
|
2441
|
-
/** When only a numeric user id is available (background ingestion jobs). */
|
|
2442
|
-
userId?: number;
|
|
2443
|
-
roleId?: string;
|
|
2444
|
-
project?: Project;
|
|
2445
|
-
agent?: ExuluAgent;
|
|
2446
|
-
routine?: {
|
|
2447
|
-
id: string;
|
|
2448
|
-
name: string;
|
|
2449
|
-
};
|
|
2450
|
-
};
|
|
2451
|
-
|
|
2452
|
-
type DocumentProcessorConfig = {
|
|
2453
|
-
vlm?: {
|
|
2454
|
-
/**
|
|
2455
|
-
* LiteLLM model_name for the VLM page-validation pass (declared in
|
|
2456
|
-
* config.litellm.yaml, e.g. "vertex-gemini-2.5-flash"). Resolved via
|
|
2457
|
-
* resolveModel() so the VLM pass shares the same tag-based cost controls
|
|
2458
|
-
* and provider-switching as chat / embeddings / OCR, and the underlying
|
|
2459
|
-
* provider can be swapped without code changes.
|
|
2460
|
-
*/
|
|
2461
|
-
model: string;
|
|
2462
|
-
concurrency: number;
|
|
2463
|
-
};
|
|
2464
|
-
processor: {
|
|
2465
|
-
name: "liteparse" | "mistral" | "officeparser";
|
|
2466
|
-
/**
|
|
2467
|
-
* LiteLLM model_name for the "mistral" OCR processor (declared in
|
|
2468
|
-
* config.litellm.yaml). Defaults to "mistral-ocr". OCR is routed through
|
|
2469
|
-
* the LiteLLM proxy so it shares the same tag-based cost controls as chat
|
|
2470
|
-
* and embeddings, and the underlying provider (mistral / azure_ai /
|
|
2471
|
-
* vertex_ai) can be switched without code changes.
|
|
2472
|
-
*/
|
|
2473
|
-
model?: string;
|
|
2474
|
-
/**
|
|
2475
|
-
* Maximum pages per OCR request for the "mistral" processor.
|
|
2476
|
-
* Vertex AI OCR rejects documents over 30 pages; the PDF is split into
|
|
2477
|
-
* chunks of this size and each chunk is OCR'd independently.
|
|
2478
|
-
* Defaults to 25 (safely under the Vertex AI 30-page limit).
|
|
2479
|
-
*/
|
|
2480
|
-
maxPagesPerChunk?: number;
|
|
2481
|
-
};
|
|
2482
|
-
/**
|
|
2483
|
-
* Optional cost-attribution context, forwarded to LiteLLM as spend tags
|
|
2484
|
-
* (user / role / project / context) for both the OCR pass (resolveOcr) and
|
|
2485
|
-
* the VLM page-validation pass (resolveModel). Not yet populated by callers;
|
|
2486
|
-
* the wiring is in place so per-user/per-context budgets work the moment
|
|
2487
|
-
* attribution is threaded through.
|
|
2488
|
-
*/
|
|
2489
|
-
attribution?: Omit<ResolveOcrInput, "model">;
|
|
2490
|
-
debugging?: {
|
|
2491
|
-
deleteTempFiles?: boolean;
|
|
2492
|
-
};
|
|
2493
|
-
};
|
|
2494
|
-
type ProcessedPage = {
|
|
2495
|
-
page: number;
|
|
2496
|
-
content: string;
|
|
2497
|
-
headings?: any;
|
|
2498
|
-
image?: string;
|
|
2499
|
-
vlm_corrected_text?: string;
|
|
2500
|
-
vlm_validated?: boolean;
|
|
2501
|
-
};
|
|
2502
|
-
type ProcessedDocument = ProcessedPage[];
|
|
2503
|
-
declare function documentProcessor({ file, name, config }: {
|
|
2504
|
-
file: string | Buffer;
|
|
2505
|
-
name: string;
|
|
2506
|
-
config?: DocumentProcessorConfig;
|
|
2507
|
-
}): Promise<ProcessedDocument | undefined>;
|
|
2508
|
-
|
|
2509
2522
|
/**
|
|
2510
2523
|
* resolveReranker — the rerank-side counterpart of resolveEmbedder / resolveOcr.
|
|
2511
2524
|
*
|
package/dist/index.d.ts
CHANGED
|
@@ -92,19 +92,6 @@ declare function redisClient(): Promise<{
|
|
|
92
92
|
client: RedisClientType | null;
|
|
93
93
|
}>;
|
|
94
94
|
|
|
95
|
-
interface TestCase {
|
|
96
|
-
id: string;
|
|
97
|
-
name: string;
|
|
98
|
-
description?: string;
|
|
99
|
-
inputs: UIMessage[];
|
|
100
|
-
expected_output: string;
|
|
101
|
-
expected_tools?: string[];
|
|
102
|
-
expected_knowledge_sources?: string[];
|
|
103
|
-
expected_agent_tools?: string[];
|
|
104
|
-
createdAt: string;
|
|
105
|
-
updatedAt: string;
|
|
106
|
-
}
|
|
107
|
-
|
|
108
95
|
interface ExuluAgent {
|
|
109
96
|
id: string;
|
|
110
97
|
modelName?: string;
|
|
@@ -188,6 +175,111 @@ type fileTypes$1 = '.pdf' | '.docx' | '.xlsx' | '.xls' | '.csv' | '.pptx' | '.pp
|
|
|
188
175
|
type audioTypes$1 = '.mp3' | '.wav' | '.m4a' | '.mp4' | '.mpeg';
|
|
189
176
|
type videoTypes$1 = '.mp4' | '.m4a' | '.mp3' | '.mpeg' | '.wav';
|
|
190
177
|
|
|
178
|
+
/**
|
|
179
|
+
* resolveOcr — the OCR-side counterpart of resolveEmbedder.
|
|
180
|
+
*
|
|
181
|
+
* Like resolveEmbedder, this is LiteLLM-ONLY: OCR always goes through the
|
|
182
|
+
* spawned LiteLLM proxy's Mistral-compatible `/v1/ocr` endpoint. There is no
|
|
183
|
+
* in-code provider/SDK fallback — a caller just names a LiteLLM `model` (e.g.
|
|
184
|
+
* "mistral-ocr", "vertex-ocr") and it works, with cost attribution via tags
|
|
185
|
+
* (user/role/project/agent/routine/context, when provided — see buildTags()).
|
|
186
|
+
*
|
|
187
|
+
* Routing OCR through the proxy means we can cost-control it through the same
|
|
188
|
+
* tag-based budgets as chat and embeddings, and switch the underlying provider
|
|
189
|
+
* (mistral / azure_ai / vertex_ai) by editing config.litellm.yaml without
|
|
190
|
+
* touching this code.
|
|
191
|
+
*
|
|
192
|
+
* LiteLLM follows the Mistral OCR request/response shape:
|
|
193
|
+
* https://docs.mistral.ai/capabilities/vision/#optical-character-recognition-ocr
|
|
194
|
+
*/
|
|
195
|
+
type ResolveOcrInput = {
|
|
196
|
+
/** LiteLLM model_name of the OCR model (e.g. "mistral-ocr"). */
|
|
197
|
+
model: string;
|
|
198
|
+
/** Context this OCR belongs to — emitted as context_id_/context_name_ tags. */
|
|
199
|
+
contextId?: string;
|
|
200
|
+
contextName?: string;
|
|
201
|
+
user?: User;
|
|
202
|
+
/** When only a numeric user id is available (background ingestion jobs). */
|
|
203
|
+
userId?: number;
|
|
204
|
+
roleId?: string;
|
|
205
|
+
project?: Project;
|
|
206
|
+
agent?: ExuluAgent;
|
|
207
|
+
routine?: {
|
|
208
|
+
id: string;
|
|
209
|
+
name: string;
|
|
210
|
+
};
|
|
211
|
+
};
|
|
212
|
+
|
|
213
|
+
type DocumentProcessorConfig = {
|
|
214
|
+
vlm?: {
|
|
215
|
+
/**
|
|
216
|
+
* LiteLLM model_name for the VLM page-validation pass (declared in
|
|
217
|
+
* config.litellm.yaml, e.g. "vertex-gemini-2.5-flash"). Resolved via
|
|
218
|
+
* resolveModel() so the VLM pass shares the same tag-based cost controls
|
|
219
|
+
* and provider-switching as chat / embeddings / OCR, and the underlying
|
|
220
|
+
* provider can be swapped without code changes.
|
|
221
|
+
*/
|
|
222
|
+
model: string;
|
|
223
|
+
concurrency: number;
|
|
224
|
+
};
|
|
225
|
+
processor: {
|
|
226
|
+
name: "liteparse" | "mistral" | "officeparser";
|
|
227
|
+
/**
|
|
228
|
+
* LiteLLM model_name for the "mistral" OCR processor (declared in
|
|
229
|
+
* config.litellm.yaml). Defaults to "mistral-ocr". OCR is routed through
|
|
230
|
+
* the LiteLLM proxy so it shares the same tag-based cost controls as chat
|
|
231
|
+
* and embeddings, and the underlying provider (mistral / azure_ai /
|
|
232
|
+
* vertex_ai) can be switched without code changes.
|
|
233
|
+
*/
|
|
234
|
+
model?: string;
|
|
235
|
+
/**
|
|
236
|
+
* Maximum pages per OCR request for the "mistral" processor.
|
|
237
|
+
* Vertex AI OCR rejects documents over 30 pages; the PDF is split into
|
|
238
|
+
* chunks of this size and each chunk is OCR'd independently.
|
|
239
|
+
* Defaults to 25 (safely under the Vertex AI 30-page limit).
|
|
240
|
+
*/
|
|
241
|
+
maxPagesPerChunk?: number;
|
|
242
|
+
};
|
|
243
|
+
/**
|
|
244
|
+
* Optional cost-attribution context, forwarded to LiteLLM as spend tags
|
|
245
|
+
* (user / role / project / context) for both the OCR pass (resolveOcr) and
|
|
246
|
+
* the VLM page-validation pass (resolveModel). Not yet populated by callers;
|
|
247
|
+
* the wiring is in place so per-user/per-context budgets work the moment
|
|
248
|
+
* attribution is threaded through.
|
|
249
|
+
*/
|
|
250
|
+
attribution?: Omit<ResolveOcrInput, "model">;
|
|
251
|
+
debugging?: {
|
|
252
|
+
deleteTempFiles?: boolean;
|
|
253
|
+
};
|
|
254
|
+
};
|
|
255
|
+
type ProcessedPage = {
|
|
256
|
+
page: number;
|
|
257
|
+
content: string;
|
|
258
|
+
headings?: any;
|
|
259
|
+
image?: string;
|
|
260
|
+
vlm_corrected_text?: string;
|
|
261
|
+
vlm_validated?: boolean;
|
|
262
|
+
};
|
|
263
|
+
type ProcessedDocument = ProcessedPage[];
|
|
264
|
+
declare function documentProcessor({ file, name, config }: {
|
|
265
|
+
file: string | Buffer;
|
|
266
|
+
name: string;
|
|
267
|
+
config?: DocumentProcessorConfig;
|
|
268
|
+
}): Promise<ProcessedDocument | undefined>;
|
|
269
|
+
|
|
270
|
+
interface TestCase {
|
|
271
|
+
id: string;
|
|
272
|
+
name: string;
|
|
273
|
+
description?: string;
|
|
274
|
+
inputs: UIMessage[];
|
|
275
|
+
expected_output: string;
|
|
276
|
+
expected_tools?: string[];
|
|
277
|
+
expected_knowledge_sources?: string[];
|
|
278
|
+
expected_agent_tools?: string[];
|
|
279
|
+
createdAt: string;
|
|
280
|
+
updatedAt: string;
|
|
281
|
+
}
|
|
282
|
+
|
|
191
283
|
type ExuluQueueConfig = {
|
|
192
284
|
queue: Queue;
|
|
193
285
|
ratelimit: number;
|
|
@@ -1131,6 +1223,19 @@ type ExuluConfig = {
|
|
|
1131
1223
|
privacy?: {
|
|
1132
1224
|
systemPromptPersonalization?: boolean;
|
|
1133
1225
|
};
|
|
1226
|
+
/**
|
|
1227
|
+
* Documents the model receives inline — chat uploads, routine mail
|
|
1228
|
+
* attachments and parse_document. With `documentProcessor` set, the same
|
|
1229
|
+
* OCR + VLM engine the knowledge bases use (ExuluDocumentProcessor) extracts
|
|
1230
|
+
* the pages, so scans and images inside PDFs are read too; without it only
|
|
1231
|
+
* the text layer is read (officeparser). Enterprise licence required for
|
|
1232
|
+
* the processor; it falls back to the text layer when unavailable. PDFs
|
|
1233
|
+
* over EXULU_ATTACHMENT_MAX_PAGES pages (default 50) are refused with a
|
|
1234
|
+
* notice instead of being read while the request waits.
|
|
1235
|
+
*/
|
|
1236
|
+
attachments?: {
|
|
1237
|
+
documentProcessor?: DocumentProcessorConfig;
|
|
1238
|
+
};
|
|
1134
1239
|
/**
|
|
1135
1240
|
* Audit logging. When enabled, structured audit events (starting with one
|
|
1136
1241
|
* per tool call) are batched to S3 as NDJSON with configurable retention.
|
|
@@ -2414,98 +2519,6 @@ declare function validatePythonEnvironment(packageRoot?: string, checkPackages?:
|
|
|
2414
2519
|
message: string;
|
|
2415
2520
|
}>;
|
|
2416
2521
|
|
|
2417
|
-
/**
|
|
2418
|
-
* resolveOcr — the OCR-side counterpart of resolveEmbedder.
|
|
2419
|
-
*
|
|
2420
|
-
* Like resolveEmbedder, this is LiteLLM-ONLY: OCR always goes through the
|
|
2421
|
-
* spawned LiteLLM proxy's Mistral-compatible `/v1/ocr` endpoint. There is no
|
|
2422
|
-
* in-code provider/SDK fallback — a caller just names a LiteLLM `model` (e.g.
|
|
2423
|
-
* "mistral-ocr", "vertex-ocr") and it works, with cost attribution via tags
|
|
2424
|
-
* (user/role/project/agent/routine/context, when provided — see buildTags()).
|
|
2425
|
-
*
|
|
2426
|
-
* Routing OCR through the proxy means we can cost-control it through the same
|
|
2427
|
-
* tag-based budgets as chat and embeddings, and switch the underlying provider
|
|
2428
|
-
* (mistral / azure_ai / vertex_ai) by editing config.litellm.yaml without
|
|
2429
|
-
* touching this code.
|
|
2430
|
-
*
|
|
2431
|
-
* LiteLLM follows the Mistral OCR request/response shape:
|
|
2432
|
-
* https://docs.mistral.ai/capabilities/vision/#optical-character-recognition-ocr
|
|
2433
|
-
*/
|
|
2434
|
-
type ResolveOcrInput = {
|
|
2435
|
-
/** LiteLLM model_name of the OCR model (e.g. "mistral-ocr"). */
|
|
2436
|
-
model: string;
|
|
2437
|
-
/** Context this OCR belongs to — emitted as context_id_/context_name_ tags. */
|
|
2438
|
-
contextId?: string;
|
|
2439
|
-
contextName?: string;
|
|
2440
|
-
user?: User;
|
|
2441
|
-
/** When only a numeric user id is available (background ingestion jobs). */
|
|
2442
|
-
userId?: number;
|
|
2443
|
-
roleId?: string;
|
|
2444
|
-
project?: Project;
|
|
2445
|
-
agent?: ExuluAgent;
|
|
2446
|
-
routine?: {
|
|
2447
|
-
id: string;
|
|
2448
|
-
name: string;
|
|
2449
|
-
};
|
|
2450
|
-
};
|
|
2451
|
-
|
|
2452
|
-
type DocumentProcessorConfig = {
|
|
2453
|
-
vlm?: {
|
|
2454
|
-
/**
|
|
2455
|
-
* LiteLLM model_name for the VLM page-validation pass (declared in
|
|
2456
|
-
* config.litellm.yaml, e.g. "vertex-gemini-2.5-flash"). Resolved via
|
|
2457
|
-
* resolveModel() so the VLM pass shares the same tag-based cost controls
|
|
2458
|
-
* and provider-switching as chat / embeddings / OCR, and the underlying
|
|
2459
|
-
* provider can be swapped without code changes.
|
|
2460
|
-
*/
|
|
2461
|
-
model: string;
|
|
2462
|
-
concurrency: number;
|
|
2463
|
-
};
|
|
2464
|
-
processor: {
|
|
2465
|
-
name: "liteparse" | "mistral" | "officeparser";
|
|
2466
|
-
/**
|
|
2467
|
-
* LiteLLM model_name for the "mistral" OCR processor (declared in
|
|
2468
|
-
* config.litellm.yaml). Defaults to "mistral-ocr". OCR is routed through
|
|
2469
|
-
* the LiteLLM proxy so it shares the same tag-based cost controls as chat
|
|
2470
|
-
* and embeddings, and the underlying provider (mistral / azure_ai /
|
|
2471
|
-
* vertex_ai) can be switched without code changes.
|
|
2472
|
-
*/
|
|
2473
|
-
model?: string;
|
|
2474
|
-
/**
|
|
2475
|
-
* Maximum pages per OCR request for the "mistral" processor.
|
|
2476
|
-
* Vertex AI OCR rejects documents over 30 pages; the PDF is split into
|
|
2477
|
-
* chunks of this size and each chunk is OCR'd independently.
|
|
2478
|
-
* Defaults to 25 (safely under the Vertex AI 30-page limit).
|
|
2479
|
-
*/
|
|
2480
|
-
maxPagesPerChunk?: number;
|
|
2481
|
-
};
|
|
2482
|
-
/**
|
|
2483
|
-
* Optional cost-attribution context, forwarded to LiteLLM as spend tags
|
|
2484
|
-
* (user / role / project / context) for both the OCR pass (resolveOcr) and
|
|
2485
|
-
* the VLM page-validation pass (resolveModel). Not yet populated by callers;
|
|
2486
|
-
* the wiring is in place so per-user/per-context budgets work the moment
|
|
2487
|
-
* attribution is threaded through.
|
|
2488
|
-
*/
|
|
2489
|
-
attribution?: Omit<ResolveOcrInput, "model">;
|
|
2490
|
-
debugging?: {
|
|
2491
|
-
deleteTempFiles?: boolean;
|
|
2492
|
-
};
|
|
2493
|
-
};
|
|
2494
|
-
type ProcessedPage = {
|
|
2495
|
-
page: number;
|
|
2496
|
-
content: string;
|
|
2497
|
-
headings?: any;
|
|
2498
|
-
image?: string;
|
|
2499
|
-
vlm_corrected_text?: string;
|
|
2500
|
-
vlm_validated?: boolean;
|
|
2501
|
-
};
|
|
2502
|
-
type ProcessedDocument = ProcessedPage[];
|
|
2503
|
-
declare function documentProcessor({ file, name, config }: {
|
|
2504
|
-
file: string | Buffer;
|
|
2505
|
-
name: string;
|
|
2506
|
-
config?: DocumentProcessorConfig;
|
|
2507
|
-
}): Promise<ProcessedDocument | undefined>;
|
|
2508
|
-
|
|
2509
2522
|
/**
|
|
2510
2523
|
* resolveReranker — the rerank-side counterpart of resolveEmbedder / resolveOcr.
|
|
2511
2524
|
*
|