@exulu/backend 1.48.1 → 1.49.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.
Files changed (165) hide show
  1. package/README.md +2 -2
  2. package/dist/index.cjs +353 -42
  3. package/dist/index.d.cts +422 -327
  4. package/dist/index.d.ts +422 -327
  5. package/dist/index.js +341 -38
  6. package/ee/{markdown.ts → chunking/markdown.ts} +2 -2
  7. package/ee/python/README.md +295 -0
  8. package/ee/python/documents/processing/README.md +155 -0
  9. package/ee/{documents → python/documents}/processing/doc_processor.ts +25 -17
  10. package/ee/{documents/processing/pdf_to_markdown.py → python/documents/processing/document_to_markdown.py} +3 -10
  11. package/ee/python/setup.sh +180 -0
  12. package/package.json +17 -5
  13. package/scripts/postinstall.cjs +149 -0
  14. package/.agents/skills/mintlify/SKILL.md +0 -347
  15. package/.editorconfig +0 -15
  16. package/.eslintrc.json +0 -52
  17. package/.github/workflows/release-backend.yml +0 -38
  18. package/.husky/commit-msg +0 -1
  19. package/.jscpd.json +0 -18
  20. package/.mcp.json +0 -18
  21. package/.nvmrc +0 -1
  22. package/.prettierignore +0 -5
  23. package/.prettierrc.json +0 -12
  24. package/CHANGELOG.md +0 -6
  25. package/SECURITY.md +0 -5
  26. package/commitlint.config.js +0 -4
  27. package/devops/documentation/patch-older-releases.md +0 -42
  28. package/ee/documents/processing/build_pdf_processor.sh +0 -35
  29. package/ee/documents/processing/chunk_markdown.py +0 -263
  30. package/ee/documents/processing/pdf_processor.spec +0 -115
  31. package/eslint.config.js +0 -88
  32. package/jest.config.ts +0 -25
  33. package/mintlify-docs/.mintignore +0 -7
  34. package/mintlify-docs/AGENTS.md +0 -33
  35. package/mintlify-docs/CLAUDE.MD +0 -50
  36. package/mintlify-docs/CONTRIBUTING.md +0 -32
  37. package/mintlify-docs/LICENSE +0 -21
  38. package/mintlify-docs/README.md +0 -55
  39. package/mintlify-docs/ai-tools/claude-code.mdx +0 -43
  40. package/mintlify-docs/ai-tools/cursor.mdx +0 -39
  41. package/mintlify-docs/ai-tools/windsurf.mdx +0 -39
  42. package/mintlify-docs/api-reference/core-types/agent-types.mdx +0 -110
  43. package/mintlify-docs/api-reference/core-types/analytics-types.mdx +0 -95
  44. package/mintlify-docs/api-reference/core-types/configuration-types.mdx +0 -83
  45. package/mintlify-docs/api-reference/core-types/evaluation-types.mdx +0 -106
  46. package/mintlify-docs/api-reference/core-types/job-types.mdx +0 -135
  47. package/mintlify-docs/api-reference/core-types/overview.mdx +0 -73
  48. package/mintlify-docs/api-reference/core-types/prompt-types.mdx +0 -102
  49. package/mintlify-docs/api-reference/core-types/rbac-types.mdx +0 -163
  50. package/mintlify-docs/api-reference/core-types/session-types.mdx +0 -77
  51. package/mintlify-docs/api-reference/core-types/user-management.mdx +0 -112
  52. package/mintlify-docs/api-reference/core-types/workflow-types.mdx +0 -88
  53. package/mintlify-docs/api-reference/core-types.mdx +0 -585
  54. package/mintlify-docs/api-reference/dynamic-types.mdx +0 -851
  55. package/mintlify-docs/api-reference/endpoint/create.mdx +0 -4
  56. package/mintlify-docs/api-reference/endpoint/delete.mdx +0 -4
  57. package/mintlify-docs/api-reference/endpoint/get.mdx +0 -4
  58. package/mintlify-docs/api-reference/endpoint/webhook.mdx +0 -4
  59. package/mintlify-docs/api-reference/introduction.mdx +0 -661
  60. package/mintlify-docs/api-reference/mutations.mdx +0 -1012
  61. package/mintlify-docs/api-reference/openapi.json +0 -217
  62. package/mintlify-docs/api-reference/queries.mdx +0 -1154
  63. package/mintlify-docs/backend/introduction.mdx +0 -218
  64. package/mintlify-docs/changelog.mdx +0 -387
  65. package/mintlify-docs/community-edition.mdx +0 -304
  66. package/mintlify-docs/core/exulu-agent/api-reference.mdx +0 -894
  67. package/mintlify-docs/core/exulu-agent/configuration.mdx +0 -690
  68. package/mintlify-docs/core/exulu-agent/introduction.mdx +0 -552
  69. package/mintlify-docs/core/exulu-app/api-reference.mdx +0 -481
  70. package/mintlify-docs/core/exulu-app/configuration.mdx +0 -319
  71. package/mintlify-docs/core/exulu-app/introduction.mdx +0 -117
  72. package/mintlify-docs/core/exulu-authentication.mdx +0 -810
  73. package/mintlify-docs/core/exulu-chunkers/api-reference.mdx +0 -1011
  74. package/mintlify-docs/core/exulu-chunkers/configuration.mdx +0 -596
  75. package/mintlify-docs/core/exulu-chunkers/introduction.mdx +0 -403
  76. package/mintlify-docs/core/exulu-context/api-reference.mdx +0 -911
  77. package/mintlify-docs/core/exulu-context/configuration.mdx +0 -648
  78. package/mintlify-docs/core/exulu-context/introduction.mdx +0 -394
  79. package/mintlify-docs/core/exulu-database.mdx +0 -811
  80. package/mintlify-docs/core/exulu-default-agents.mdx +0 -545
  81. package/mintlify-docs/core/exulu-eval/api-reference.mdx +0 -772
  82. package/mintlify-docs/core/exulu-eval/configuration.mdx +0 -680
  83. package/mintlify-docs/core/exulu-eval/introduction.mdx +0 -459
  84. package/mintlify-docs/core/exulu-logging.mdx +0 -464
  85. package/mintlify-docs/core/exulu-otel.mdx +0 -670
  86. package/mintlify-docs/core/exulu-queues/api-reference.mdx +0 -648
  87. package/mintlify-docs/core/exulu-queues/configuration.mdx +0 -650
  88. package/mintlify-docs/core/exulu-queues/introduction.mdx +0 -474
  89. package/mintlify-docs/core/exulu-reranker/api-reference.mdx +0 -630
  90. package/mintlify-docs/core/exulu-reranker/configuration.mdx +0 -663
  91. package/mintlify-docs/core/exulu-reranker/introduction.mdx +0 -516
  92. package/mintlify-docs/core/exulu-tool/api-reference.mdx +0 -723
  93. package/mintlify-docs/core/exulu-tool/configuration.mdx +0 -805
  94. package/mintlify-docs/core/exulu-tool/introduction.mdx +0 -539
  95. package/mintlify-docs/core/exulu-variables/api-reference.mdx +0 -699
  96. package/mintlify-docs/core/exulu-variables/configuration.mdx +0 -736
  97. package/mintlify-docs/core/exulu-variables/introduction.mdx +0 -511
  98. package/mintlify-docs/development.mdx +0 -94
  99. package/mintlify-docs/docs.json +0 -248
  100. package/mintlify-docs/enterprise-edition.mdx +0 -538
  101. package/mintlify-docs/essentials/code.mdx +0 -35
  102. package/mintlify-docs/essentials/images.mdx +0 -59
  103. package/mintlify-docs/essentials/markdown.mdx +0 -88
  104. package/mintlify-docs/essentials/navigation.mdx +0 -87
  105. package/mintlify-docs/essentials/reusable-snippets.mdx +0 -110
  106. package/mintlify-docs/essentials/settings.mdx +0 -318
  107. package/mintlify-docs/favicon.svg +0 -3
  108. package/mintlify-docs/frontend/introduction.mdx +0 -39
  109. package/mintlify-docs/getting-started.mdx +0 -267
  110. package/mintlify-docs/guides/custom-agent.mdx +0 -608
  111. package/mintlify-docs/guides/first-agent.mdx +0 -315
  112. package/mintlify-docs/images/admin_ui.png +0 -0
  113. package/mintlify-docs/images/contexts.png +0 -0
  114. package/mintlify-docs/images/create_agents.png +0 -0
  115. package/mintlify-docs/images/evals.png +0 -0
  116. package/mintlify-docs/images/graphql.png +0 -0
  117. package/mintlify-docs/images/graphql_api.png +0 -0
  118. package/mintlify-docs/images/hero-dark.png +0 -0
  119. package/mintlify-docs/images/hero-light.png +0 -0
  120. package/mintlify-docs/images/hero.png +0 -0
  121. package/mintlify-docs/images/knowledge_sources.png +0 -0
  122. package/mintlify-docs/images/mcp.png +0 -0
  123. package/mintlify-docs/images/scaling.png +0 -0
  124. package/mintlify-docs/index.mdx +0 -411
  125. package/mintlify-docs/logo/dark.svg +0 -9
  126. package/mintlify-docs/logo/light.svg +0 -9
  127. package/mintlify-docs/partners.mdx +0 -558
  128. package/mintlify-docs/products.mdx +0 -77
  129. package/mintlify-docs/snippets/snippet-intro.mdx +0 -4
  130. package/mintlify-docs/styles.css +0 -207
  131. package/ngrok.bash +0 -1
  132. package/ngrok.md +0 -6
  133. package/ngrok.yml +0 -10
  134. package/release.config.cjs +0 -15
  135. package/skills-lock.json +0 -10
  136. package/types/context-processor.ts +0 -45
  137. package/types/enums/eval-types.ts +0 -5
  138. package/types/enums/field-types.ts +0 -1
  139. package/types/enums/jobs.ts +0 -11
  140. package/types/enums/statistics.ts +0 -13
  141. package/types/exulu-table-definition.ts +0 -79
  142. package/types/file-types.ts +0 -18
  143. package/types/models/agent-session.ts +0 -27
  144. package/types/models/agent.ts +0 -68
  145. package/types/models/context.ts +0 -53
  146. package/types/models/embedding.ts +0 -17
  147. package/types/models/eval-run.ts +0 -40
  148. package/types/models/exulu-agent-tool-config.ts +0 -11
  149. package/types/models/item.ts +0 -21
  150. package/types/models/job.ts +0 -8
  151. package/types/models/project.ts +0 -16
  152. package/types/models/rate-limiter-rules.ts +0 -7
  153. package/types/models/test-case.ts +0 -25
  154. package/types/models/tool.ts +0 -9
  155. package/types/models/user-role.ts +0 -12
  156. package/types/models/user.ts +0 -20
  157. package/types/models/variable.ts +0 -8
  158. package/types/models/vector-methods.ts +0 -7
  159. package/types/provider-config.ts +0 -21
  160. package/types/queue-config.ts +0 -16
  161. package/types/rbac-rights-modes.ts +0 -1
  162. package/types/statistics.ts +0 -20
  163. package/types/workflow.ts +0 -31
  164. /package/ee/{documents → python/documents}/THIRD_PARTY_LICENSES/docling.txt +0 -0
  165. /package/ee/{documents/processing → python}/requirements.txt +0 -0
package/dist/index.d.ts CHANGED
@@ -1,12 +1,12 @@
1
1
  import * as _opentelemetry_sdk_node from '@opentelemetry/sdk-node';
2
2
  import * as knex from 'knex';
3
- import { LanguageModel, UIMessage, Tool, streamText } from 'ai';
4
- import { z } from 'zod';
3
+ import { RedisClientType } from 'redis';
5
4
  import * as bullmq from 'bullmq';
6
5
  import { Queue } from 'bullmq';
7
- import { Express, Request } from 'express';
6
+ import { Request, Express } from 'express';
8
7
  import { transport } from 'winston';
9
- import { RedisClientType } from 'redis';
8
+ import { LanguageModel, Tool, UIMessage, streamText } from 'ai';
9
+ import { z } from 'zod';
10
10
  import { Tiktoken } from 'tiktoken/lite';
11
11
  import models from 'tiktoken/model_to_encoding.json';
12
12
 
@@ -31,6 +31,10 @@ type User = {
31
31
  };
32
32
  };
33
33
 
34
+ declare function redisClient(): Promise<{
35
+ client: RedisClientType | null;
36
+ }>;
37
+
34
38
  type ExuluProviderConfig = {
35
39
  name: string;
36
40
  instructions: string;
@@ -153,19 +157,61 @@ interface Item {
153
157
  [key: string]: any;
154
158
  }
155
159
 
156
- interface TestCase {
160
+ declare class ExuluTool {
157
161
  id: string;
158
162
  name: string;
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;
163
+ description: string;
164
+ category: string;
165
+ inputSchema?: z.ZodType;
166
+ type: "context" | "function" | "agent" | "web_search";
167
+ tool: Tool;
168
+ config: {
169
+ name: string;
170
+ description: string;
171
+ type: "boolean" | "string" | "number" | "variable";
172
+ default?: string | boolean | number;
173
+ }[];
174
+ constructor({ id, name, description, category, inputSchema, type, execute, config, }: {
175
+ id: string;
176
+ name: string;
177
+ description: string;
178
+ category?: string;
179
+ inputSchema?: z.ZodType;
180
+ type: "context" | "function" | "agent" | "web_search";
181
+ config: {
182
+ name: string;
183
+ description: string;
184
+ type: "boolean" | "string" | "number" | "variable";
185
+ default?: string | boolean | number;
186
+ }[];
187
+ execute: (inputs: any) => Promise<{
188
+ result?: string;
189
+ job?: string;
190
+ items?: Item[];
191
+ }> | AsyncGenerator<{
192
+ result?: string;
193
+ job?: string;
194
+ items?: Item[];
195
+ }>;
196
+ });
197
+ execute: ({ agent: agentId, config, user, inputs, project, items, }: {
198
+ agent: string;
199
+ config: ExuluConfig;
200
+ user?: User;
201
+ inputs: any;
202
+ project?: string;
203
+ items?: string[];
204
+ }) => Promise<any>;
167
205
  }
168
206
 
207
+ type ExuluFieldTypes = "text" | "longText" | "shortText" | "number" | "boolean" | "code" | "json" | "enum" | "markdown" | "file" | "date" | "uuid";
208
+
209
+ type allFileTypes = imageTypes | fileTypes | audioTypes | videoTypes;
210
+ type audioTypes = ".mp3" | ".wav" | ".m4a" | ".mp4" | ".mpeg";
211
+ type videoTypes = ".mp4" | ".m4a" | ".mp3" | ".mpeg" | ".wav";
212
+ type imageTypes = ".png" | ".jpg" | ".jpeg" | ".gif" | ".webp";
213
+ type fileTypes = ".pdf" | ".docx" | ".doc" | ".xlsx" | ".xls" | ".csv" | ".pptx" | ".ppt" | ".txt" | ".md" | ".json" | ".srt" | ".html";
214
+
169
215
  type ExuluQueueConfig = {
170
216
  queue: Queue;
171
217
  ratelimit: number;
@@ -181,123 +227,6 @@ type ExuluQueueConfig = {
181
227
  };
182
228
  };
183
229
 
184
- interface ExuluEvalParams {
185
- id: string;
186
- name: string;
187
- description: string;
188
- llm: boolean;
189
- execute: (params: {
190
- agent: ExuluAgent;
191
- provider: ExuluProvider;
192
- messages: UIMessage[];
193
- testCase: TestCase;
194
- config?: Record<string, any>;
195
- }) => Promise<number>;
196
- config?: {
197
- name: string;
198
- description: string;
199
- }[];
200
- queue: Promise<ExuluQueueConfig>;
201
- }
202
- declare class ExuluEval {
203
- id: string;
204
- name: string;
205
- description: string;
206
- llm: boolean;
207
- private execute;
208
- config?: {
209
- name: string;
210
- description: string;
211
- }[];
212
- queue?: Promise<ExuluQueueConfig>;
213
- constructor({ id, name, description, execute, config, queue, llm }: ExuluEvalParams);
214
- run(agent: ExuluAgent, provider: ExuluProvider, testCase: TestCase, messages: UIMessage[], config?: Record<string, any>): Promise<number>;
215
- }
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;
233
- };
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
230
  declare class ExuluStorage {
302
231
  private config;
303
232
  constructor({ config }: {
@@ -420,6 +349,82 @@ declare class ExuluEmbedder {
420
349
 
421
350
  type ExuluRightsMode = "private" | "users" | "roles" | "public";
422
351
 
352
+ /**
353
+ * Base operator type with comparison operations
354
+ */
355
+ type BaseOperator<T> = {
356
+ /** Equals */
357
+ eq?: T;
358
+ /** Not equals */
359
+ ne?: T;
360
+ /** In array */
361
+ in?: T[];
362
+ /** AND conditions */
363
+ and?: BaseOperator<T>[];
364
+ /** OR conditions */
365
+ or?: BaseOperator<T>[];
366
+ /** Contains (case-insensitive substring match) */
367
+ contains?: string;
368
+ };
369
+ /**
370
+ * String field filter operators
371
+ */
372
+ type StringOperator = BaseOperator<string> & {
373
+ /** Contains (case-insensitive substring match) */
374
+ contains?: string;
375
+ };
376
+ /**
377
+ * Number field filter operators
378
+ */
379
+ type NumberOperator = BaseOperator<number> & {
380
+ /** Less than or equal to */
381
+ lte?: number;
382
+ /** Greater than or equal to */
383
+ gte?: number;
384
+ };
385
+ /**
386
+ * Date field filter operators
387
+ */
388
+ type DateOperator = BaseOperator<Date | string> & {
389
+ /** Less than or equal to */
390
+ lte?: Date | string;
391
+ /** Greater than or equal to */
392
+ gte?: Date | string;
393
+ };
394
+ /**
395
+ * Boolean field filter operators
396
+ */
397
+ type BooleanOperator = BaseOperator<boolean>;
398
+ /**
399
+ * JSON field filter operators
400
+ */
401
+ type JsonOperator = BaseOperator<any> & {
402
+ /** Contains (PostgreSQL @> operator for JSON containment) */
403
+ contains?: any;
404
+ };
405
+ /**
406
+ * Filter operator type based on field type
407
+ */
408
+ type FilterOperator = BaseOperator<any> | StringOperator | NumberOperator | DateOperator | BooleanOperator | JsonOperator;
409
+ /**
410
+ * Single filter object - a record of field names to their filter operators
411
+ */
412
+ type Filter = Record<string, FilterOperator>;
413
+ /**
414
+ * Type for the filters parameter used throughout the codebase
415
+ * Filters is an array of filter objects, where each object contains field names mapped to their operators
416
+ *
417
+ * @example
418
+ * ```typescript
419
+ * const filters: Filters = [
420
+ * { name: { contains: "test" } },
421
+ * { age: { gte: 18, lte: 65 } },
422
+ * { status: { in: ["active", "pending"] } }
423
+ * ];
424
+ * ```
425
+ */
426
+ type SearchFilters = Filter[];
427
+
423
428
  declare const VectorMethodEnum: {
424
429
  readonly cosineDistance: "cosineDistance";
425
430
  readonly hybridSearch: "hybridSearch";
@@ -427,6 +432,28 @@ declare const VectorMethodEnum: {
427
432
  };
428
433
  type VectorMethod = (typeof VectorMethodEnum)[keyof typeof VectorMethodEnum];
429
434
 
435
+ type VectorSearchChunkResult = {
436
+ chunk_content: string;
437
+ chunk_index: number;
438
+ chunk_id: string;
439
+ chunk_source: string;
440
+ chunk_metadata: Record<string, string>;
441
+ chunk_created_at: string;
442
+ chunk_updated_at: string;
443
+ item_id: string;
444
+ item_external_id: string;
445
+ item_name: string;
446
+ item_updated_at: string;
447
+ item_created_at: string;
448
+ chunk_cosine_distance?: number;
449
+ chunk_fts_rank?: number;
450
+ chunk_hybrid_score?: number;
451
+ context?: {
452
+ name: string;
453
+ id: string;
454
+ };
455
+ };
456
+
430
457
  type ExuluContextFieldDefinition = {
431
458
  name: string;
432
459
  type: ExuluFieldTypes;
@@ -614,218 +641,46 @@ declare class ExuluContext {
614
641
  }) => Promise<Item[]>;
615
642
  embeddings: {
616
643
  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[];
758
- embeddings: {
759
- generate: {
760
- one: ({ context: contextId, item: itemId }: {
761
- context: string;
762
- item: string;
644
+ one: ({ item, user, role, trigger, config, }: {
645
+ item: Item;
646
+ user?: number;
647
+ role?: string;
648
+ trigger: STATISTICS_LABELS;
649
+ config: ExuluConfig;
763
650
  }) => Promise<{
764
651
  id: string;
765
652
  job?: string;
766
653
  chunks?: number;
767
654
  }>;
768
- all: ({ context: contextId }: {
769
- context: string;
770
- }) => Promise<{
655
+ all: (config: ExuluConfig, userId?: number, roleId?: string, limit?: number) => Promise<{
771
656
  jobs: string[];
772
657
  items: number;
773
658
  }>;
774
659
  };
775
660
  };
776
- bullmq: {
777
- workers: {
778
- create: (queues?: string[]) => Promise<bullmq.Worker<any, any, string>[]>;
779
- };
780
- };
781
- private server;
661
+ createItemsTable: () => Promise<void>;
662
+ createChunksTable: () => Promise<void>;
663
+ tool: () => ExuluTool | null;
782
664
  }
783
665
 
784
- declare class ExuluTool {
666
+ declare class ExuluReranker {
785
667
  id: string;
786
668
  name: string;
787
669
  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, }: {
670
+ execute: (params: {
671
+ query: string;
672
+ chunks: VectorSearchChunkResult[];
673
+ }) => Promise<VectorSearchChunkResult[]>;
674
+ constructor({ id, name, description, execute, }: {
799
675
  id: string;
800
676
  name: string;
801
677
  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
- }>;
678
+ execute: (params: {
679
+ query: string;
680
+ chunks: VectorSearchChunkResult[];
681
+ }) => Promise<VectorSearchChunkResult[]>;
820
682
  });
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>;
683
+ run(query: string, chunks: VectorSearchChunkResult[]): Promise<VectorSearchChunkResult[]>;
829
684
  }
830
685
 
831
686
  type ExuluAgentToolConfig = {
@@ -944,9 +799,154 @@ declare class ExuluProvider {
944
799
  }>;
945
800
  }
946
801
 
947
- declare function redisClient(): Promise<{
948
- client: RedisClientType | null;
949
- }>;
802
+ interface TestCase {
803
+ id: string;
804
+ name: string;
805
+ description?: string;
806
+ inputs: UIMessage[];
807
+ expected_output: string;
808
+ expected_tools?: string[];
809
+ expected_knowledge_sources?: string[];
810
+ expected_agent_tools?: string[];
811
+ createdAt: string;
812
+ updatedAt: string;
813
+ }
814
+
815
+ interface ExuluEvalParams {
816
+ id: string;
817
+ name: string;
818
+ description: string;
819
+ llm: boolean;
820
+ execute: (params: {
821
+ agent: ExuluAgent;
822
+ provider: ExuluProvider;
823
+ messages: UIMessage[];
824
+ testCase: TestCase;
825
+ config?: Record<string, any>;
826
+ }) => Promise<number>;
827
+ config?: {
828
+ name: string;
829
+ description: string;
830
+ }[];
831
+ queue: Promise<ExuluQueueConfig>;
832
+ }
833
+ declare class ExuluEval {
834
+ id: string;
835
+ name: string;
836
+ description: string;
837
+ llm: boolean;
838
+ private execute;
839
+ config?: {
840
+ name: string;
841
+ description: string;
842
+ }[];
843
+ queue?: Promise<ExuluQueueConfig>;
844
+ constructor({ id, name, description, execute, config, queue, llm }: ExuluEvalParams);
845
+ run(agent: ExuluAgent, provider: ExuluProvider, testCase: TestCase, messages: UIMessage[], config?: Record<string, any>): Promise<number>;
846
+ }
847
+
848
+ type ExuluConfig = {
849
+ telemetry?: {
850
+ enabled: boolean;
851
+ };
852
+ logger?: {
853
+ winston: {
854
+ transports: transport[];
855
+ };
856
+ };
857
+ workers: {
858
+ enabled: boolean;
859
+ logger?: {
860
+ winston: {
861
+ transports: transport[];
862
+ };
863
+ };
864
+ telemetry?: {
865
+ enabled: boolean;
866
+ };
867
+ };
868
+ MCP: {
869
+ enabled: boolean;
870
+ };
871
+ fileUploads?: {
872
+ s3region: string;
873
+ s3key: string;
874
+ s3secret: string;
875
+ s3Bucket: string;
876
+ s3endpoint?: string;
877
+ s3prefix?: string;
878
+ };
879
+ privacy?: {
880
+ systemPromptPersonalization?: boolean;
881
+ };
882
+ };
883
+ declare class ExuluApp {
884
+ private _providers;
885
+ private _agents;
886
+ private _config?;
887
+ private _evals;
888
+ private _queues;
889
+ private _rerankers;
890
+ private _contexts?;
891
+ private _tools;
892
+ private _expressApp;
893
+ constructor();
894
+ create: ({ contexts, providers, config, agents, tools, evals, rerankers, }: {
895
+ contexts?: Record<string, ExuluContext>;
896
+ config: ExuluConfig;
897
+ agents?: ExuluAgent[];
898
+ providers?: ExuluProvider[];
899
+ rerankers?: ExuluReranker[];
900
+ evals?: ExuluEval[];
901
+ tools?: ExuluTool[];
902
+ }) => Promise<ExuluApp>;
903
+ express: {
904
+ init: () => Promise<Express>;
905
+ };
906
+ get expressApp(): Express;
907
+ tool(id: string): ExuluTool | undefined;
908
+ tools(): ExuluTool[];
909
+ agent(id: string, include?: {
910
+ source: {
911
+ code: boolean;
912
+ database: boolean;
913
+ };
914
+ }): Promise<ExuluAgent | undefined>;
915
+ agents(include?: {
916
+ source: {
917
+ code: boolean;
918
+ database: boolean;
919
+ };
920
+ }): Promise<ExuluAgent[]>;
921
+ context(id: string): ExuluContext | undefined;
922
+ provider(id: string): ExuluProvider | undefined;
923
+ get contexts(): ExuluContext[];
924
+ get providers(): ExuluProvider[];
925
+ embeddings: {
926
+ generate: {
927
+ one: ({ context: contextId, item: itemId }: {
928
+ context: string;
929
+ item: string;
930
+ }) => Promise<{
931
+ id: string;
932
+ job?: string;
933
+ chunks?: number;
934
+ }>;
935
+ all: ({ context: contextId }: {
936
+ context: string;
937
+ }) => Promise<{
938
+ jobs: string[];
939
+ items: number;
940
+ }>;
941
+ };
942
+ };
943
+ bullmq: {
944
+ workers: {
945
+ create: (queues?: string[]) => Promise<bullmq.Worker<any, any, string>[]>;
946
+ };
947
+ };
948
+ private server;
949
+ }
950
950
 
951
951
  declare class ExuluQueues {
952
952
  queues: {
@@ -1897,6 +1897,95 @@ declare class MarkdownChunker {
1897
1897
  }[]>;
1898
1898
  }
1899
1899
 
1900
+ /**
1901
+ * Python Environment Setup Utility
1902
+ *
1903
+ * Provides functions to set up and validate the Python environment for Exulu backend.
1904
+ * This can be called manually by package consumers or run automatically on install.
1905
+ */
1906
+ /**
1907
+ * Options for Python environment setup
1908
+ */
1909
+ interface PythonSetupOptions {
1910
+ /**
1911
+ * Package root directory (where @exulu/backend is installed)
1912
+ * @default Auto-detected from package location
1913
+ */
1914
+ packageRoot?: string;
1915
+ /**
1916
+ * Whether to force reinstall even if environment exists
1917
+ * @default false
1918
+ */
1919
+ force?: boolean;
1920
+ /**
1921
+ * Whether to show verbose output
1922
+ * @default false
1923
+ */
1924
+ verbose?: boolean;
1925
+ /**
1926
+ * Timeout for setup process in milliseconds
1927
+ * @default 600000 (10 minutes)
1928
+ */
1929
+ timeout?: number;
1930
+ }
1931
+ /**
1932
+ * Result of Python environment setup
1933
+ */
1934
+ interface PythonSetupResult {
1935
+ /** Whether setup was successful */
1936
+ success: boolean;
1937
+ /** Message describing the result */
1938
+ message: string;
1939
+ /** Whether the environment already existed */
1940
+ alreadyExists: boolean;
1941
+ /** Python version installed */
1942
+ pythonVersion?: string;
1943
+ /** Full output from setup script */
1944
+ output?: string;
1945
+ }
1946
+ /**
1947
+ * Check if Python environment is already set up
1948
+ */
1949
+ declare function isPythonEnvironmentSetup(packageRoot?: string): boolean;
1950
+ /**
1951
+ * Set up the Python environment by running the setup script
1952
+ *
1953
+ * @param options - Setup configuration options
1954
+ * @returns Result of the setup operation
1955
+ *
1956
+ * @example
1957
+ * ```typescript
1958
+ * import { setupPythonEnvironment } from '@exulu/backend';
1959
+ *
1960
+ * // Basic usage
1961
+ * const result = await setupPythonEnvironment();
1962
+ * if (result.success) {
1963
+ * console.log('Python environment ready!');
1964
+ * }
1965
+ *
1966
+ * // With options
1967
+ * const result = await setupPythonEnvironment({
1968
+ * force: true,
1969
+ * verbose: true
1970
+ * });
1971
+ * ```
1972
+ */
1973
+ declare function setupPythonEnvironment(options?: PythonSetupOptions): Promise<PythonSetupResult>;
1974
+ /**
1975
+ * Get helpful setup instructions for users
1976
+ */
1977
+ declare function getPythonSetupInstructions(): string;
1978
+ /**
1979
+ * Validate Python environment and provide helpful error messages
1980
+ *
1981
+ * @param packageRoot - Package root directory
1982
+ * @returns Object with validation status and message
1983
+ */
1984
+ declare function validatePythonEnvironment(packageRoot?: string): Promise<{
1985
+ valid: boolean;
1986
+ message: string;
1987
+ }>;
1988
+
1900
1989
  type DocumentProcessorConfig = {
1901
1990
  vlm?: {
1902
1991
  model: LanguageModel;
@@ -2011,5 +2100,11 @@ declare const ExuluChunkers: {
2011
2100
  rules: typeof RecursiveRules;
2012
2101
  };
2013
2102
  };
2103
+ declare const ExuluPython: {
2104
+ setup: typeof setupPythonEnvironment;
2105
+ check: typeof isPythonEnvironmentSetup;
2106
+ validate: typeof validatePythonEnvironment;
2107
+ instructions: typeof getPythonSetupInstructions;
2108
+ };
2014
2109
 
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 };
2110
+ 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, type ExuluAgent, ExuluApp, ExuluAuthentication, ExuluChunkers, ExuluContext, ExuluDatabase, ExuluDefaultProviders, ExuluDocumentProcessor, ExuluEmbedder, ExuluEval, type Item as ExuluItem, ExuluJobs, ExuluOtel, ExuluProvider, ExuluPython, queues as ExuluQueues, ExuluReranker, ExuluTool, ExuluVariables };