@exulu/backend 0.3.0 → 0.3.4

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/index.d.cts CHANGED
@@ -2,8 +2,7 @@ import * as bullmq from 'bullmq';
2
2
  import { Queue } from 'bullmq';
3
3
  import { RedisClientType } from 'redis';
4
4
  import { ZodSchema, z } from 'zod';
5
- import { ToolAction, Agent } from '@mastra/core';
6
- import { LanguageModelV1 } from 'ai';
5
+ import { Tool, LanguageModelV1 } from 'ai';
7
6
  import { Express } from 'express';
8
7
  import { Knex } from 'knex';
9
8
  import { SentenceChunker, RecursiveChunker, RecursiveRules } from 'chonkie';
@@ -91,6 +90,7 @@ type ExuluAgentConfig = {
91
90
  name: string;
92
91
  instructions: string;
93
92
  model: LanguageModelV1;
93
+ outputSchema?: ZodSchema;
94
94
  memory?: {
95
95
  lastMessages: number;
96
96
  vector: boolean;
@@ -100,19 +100,38 @@ type ExuluAgentConfig = {
100
100
  };
101
101
  };
102
102
  };
103
+ type ExuluAgentEval = {
104
+ runner: ExuluEvalRunnerInstance;
105
+ };
106
+ interface ExuluAgentParams {
107
+ id: string;
108
+ name: string;
109
+ type: "agent" | "workflow";
110
+ description: string;
111
+ config: ExuluAgentConfig;
112
+ capabilities: {
113
+ tools: boolean;
114
+ images: string[];
115
+ files: string[];
116
+ audio: string[];
117
+ video: string[];
118
+ };
119
+ tools?: ExuluTool[];
120
+ evals?: ExuluAgentEval[];
121
+ outputSchema?: ZodSchema;
122
+ rateLimit?: RateLimiterRule;
123
+ }
103
124
  declare class ExuluAgent {
104
125
  id: string;
105
126
  name: string;
106
127
  description: string;
107
128
  slug: string;
108
129
  streaming: boolean;
109
- type: "agent" | "workflow";
110
- outputSchema?: ZodSchema;
111
130
  rateLimit?: RateLimiterRule;
112
131
  config: ExuluAgentConfig;
113
- private memory;
114
132
  tools?: ExuluTool[];
115
- agent?: Agent;
133
+ evals?: ExuluAgentEval[];
134
+ model?: LanguageModelV1;
116
135
  capabilities: {
117
136
  tools: boolean;
118
137
  images: string[];
@@ -120,24 +139,11 @@ declare class ExuluAgent {
120
139
  audio: string[];
121
140
  video: string[];
122
141
  };
123
- constructor({ id, name, description, outputSchema, config, rateLimit, type, capabilities, tools }: {
124
- id: string;
125
- name: string;
126
- type: "agent" | "workflow";
127
- description: string;
128
- config: ExuluAgentConfig;
129
- outputSchema?: ZodSchema;
130
- rateLimit?: RateLimiterRule;
131
- capabilities: {
132
- tools: boolean;
133
- images: string[];
134
- files: string[];
135
- audio: string[];
136
- video: string[];
137
- };
138
- tools?: ExuluTool[];
139
- });
140
- chat: () => Agent;
142
+ constructor({ id, name, description, config, rateLimit, capabilities, tools, evals }: ExuluAgentParams);
143
+ generate: ({ prompt, stream }: {
144
+ prompt: string;
145
+ stream?: boolean;
146
+ }) => Promise<any>;
141
147
  }
142
148
  type VectorOperationResponse = Promise<{
143
149
  count: number;
@@ -239,24 +245,68 @@ declare class ExuluLogger {
239
245
  write(message: string, level: "INFO" | "ERROR" | "WARNING"): Promise<void>;
240
246
  }
241
247
  type AddSourceArgs = Omit<ExuluSourceConstructorArgs, "context">;
248
+ type ExuluEvalRunnerInstance = {
249
+ name: string;
250
+ description: string;
251
+ testcases: ExuluEvalInput[];
252
+ run: ExuluEvalRunner;
253
+ };
254
+ type ExuluEvalRunner = ({ data, runner }: {
255
+ data: ExuluEvalInput;
256
+ runner: {
257
+ agent?: ExuluAgent;
258
+ workflow?: ExuluWorkflow;
259
+ };
260
+ }) => Promise<{
261
+ score: number;
262
+ comment: string;
263
+ }>;
264
+ type ExuluEvalInput = {
265
+ prompt?: string;
266
+ inputs?: any;
267
+ result?: string;
268
+ category?: string;
269
+ metadata?: Record<string, any>;
270
+ duration?: number;
271
+ reference?: string;
272
+ };
273
+ declare class ExuluEval {
274
+ name: string;
275
+ description: string;
276
+ constructor({ name, description }: {
277
+ name: string;
278
+ description: string;
279
+ });
280
+ create: {
281
+ LlmAsAJudge: {
282
+ niah: ({ label, model, needles, testDocument, contextlengths }: {
283
+ label: string;
284
+ model: LanguageModelV1;
285
+ needles: {
286
+ question: string;
287
+ answer: string;
288
+ }[];
289
+ testDocument: string;
290
+ contextlengths: (5000 | 30000 | 50000 | 128000)[];
291
+ }) => ExuluEvalRunnerInstance;
292
+ };
293
+ };
294
+ }
242
295
  declare class ExuluTool {
243
296
  id: string;
244
297
  name: string;
245
298
  description: string;
246
- inputSchema?: ZodSchema;
247
- outputSchema?: ZodSchema;
299
+ parameters?: ZodSchema;
248
300
  type: "context" | "function";
249
- private _execute;
250
- constructor({ id, name, description, inputSchema, outputSchema, type, execute }: {
301
+ tool: Tool;
302
+ constructor({ id, name, description, parameters, type, execute }: {
251
303
  id: string;
252
304
  name: string;
253
305
  description: string;
254
- inputSchema?: ZodSchema;
255
- outputSchema?: ZodSchema;
306
+ parameters: ZodSchema;
256
307
  type: "context" | "function";
257
- execute: ToolAction['execute'];
308
+ execute: (inputs: any) => Promise<any>;
258
309
  });
259
- execute: (inputs: any) => Promise<unknown>;
260
310
  }
261
311
  type ExuluContextFieldDefinition = {
262
312
  name: string;
@@ -487,6 +537,10 @@ declare const JOB_STATUS_ENUM: {
487
537
  stuck: string;
488
538
  };
489
539
 
540
+ declare const _default: {
541
+ run: (exulu: ExuluApp) => void;
542
+ };
543
+
490
544
  declare const ExuluJobs: {
491
545
  redis: typeof redisClient;
492
546
  jobs: {
@@ -510,4 +564,4 @@ declare const ExuluDatabase: {
510
564
  }>;
511
565
  };
512
566
 
513
- 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, ExuluAgent, ExuluApp, authentication as ExuluAuthentication, ExuluChunkers, ExuluContext, ExuluDatabase, ExuluEmbedder, type Job as ExuluJob, ExuluJobs, ExuluLogger, queues as ExuluQueues, ExuluSource, ExuluTool, ExuluWorkflow, type ExuluWorkflowStep, ExuluZodFileType };
567
+ 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, ExuluAgent, ExuluApp, authentication as ExuluAuthentication, ExuluChunkers, _default as ExuluCli, ExuluContext, ExuluDatabase, ExuluEmbedder, ExuluEval, type Job as ExuluJob, ExuluJobs, ExuluLogger, queues as ExuluQueues, ExuluSource, ExuluTool, ExuluWorkflow, type ExuluWorkflowStep, ExuluZodFileType };
package/dist/index.d.ts CHANGED
@@ -2,8 +2,7 @@ import * as bullmq from 'bullmq';
2
2
  import { Queue } from 'bullmq';
3
3
  import { RedisClientType } from 'redis';
4
4
  import { ZodSchema, z } from 'zod';
5
- import { ToolAction, Agent } from '@mastra/core';
6
- import { LanguageModelV1 } from 'ai';
5
+ import { Tool, LanguageModelV1 } from 'ai';
7
6
  import { Express } from 'express';
8
7
  import { Knex } from 'knex';
9
8
  import { SentenceChunker, RecursiveChunker, RecursiveRules } from 'chonkie';
@@ -91,6 +90,7 @@ type ExuluAgentConfig = {
91
90
  name: string;
92
91
  instructions: string;
93
92
  model: LanguageModelV1;
93
+ outputSchema?: ZodSchema;
94
94
  memory?: {
95
95
  lastMessages: number;
96
96
  vector: boolean;
@@ -100,19 +100,38 @@ type ExuluAgentConfig = {
100
100
  };
101
101
  };
102
102
  };
103
+ type ExuluAgentEval = {
104
+ runner: ExuluEvalRunnerInstance;
105
+ };
106
+ interface ExuluAgentParams {
107
+ id: string;
108
+ name: string;
109
+ type: "agent" | "workflow";
110
+ description: string;
111
+ config: ExuluAgentConfig;
112
+ capabilities: {
113
+ tools: boolean;
114
+ images: string[];
115
+ files: string[];
116
+ audio: string[];
117
+ video: string[];
118
+ };
119
+ tools?: ExuluTool[];
120
+ evals?: ExuluAgentEval[];
121
+ outputSchema?: ZodSchema;
122
+ rateLimit?: RateLimiterRule;
123
+ }
103
124
  declare class ExuluAgent {
104
125
  id: string;
105
126
  name: string;
106
127
  description: string;
107
128
  slug: string;
108
129
  streaming: boolean;
109
- type: "agent" | "workflow";
110
- outputSchema?: ZodSchema;
111
130
  rateLimit?: RateLimiterRule;
112
131
  config: ExuluAgentConfig;
113
- private memory;
114
132
  tools?: ExuluTool[];
115
- agent?: Agent;
133
+ evals?: ExuluAgentEval[];
134
+ model?: LanguageModelV1;
116
135
  capabilities: {
117
136
  tools: boolean;
118
137
  images: string[];
@@ -120,24 +139,11 @@ declare class ExuluAgent {
120
139
  audio: string[];
121
140
  video: string[];
122
141
  };
123
- constructor({ id, name, description, outputSchema, config, rateLimit, type, capabilities, tools }: {
124
- id: string;
125
- name: string;
126
- type: "agent" | "workflow";
127
- description: string;
128
- config: ExuluAgentConfig;
129
- outputSchema?: ZodSchema;
130
- rateLimit?: RateLimiterRule;
131
- capabilities: {
132
- tools: boolean;
133
- images: string[];
134
- files: string[];
135
- audio: string[];
136
- video: string[];
137
- };
138
- tools?: ExuluTool[];
139
- });
140
- chat: () => Agent;
142
+ constructor({ id, name, description, config, rateLimit, capabilities, tools, evals }: ExuluAgentParams);
143
+ generate: ({ prompt, stream }: {
144
+ prompt: string;
145
+ stream?: boolean;
146
+ }) => Promise<any>;
141
147
  }
142
148
  type VectorOperationResponse = Promise<{
143
149
  count: number;
@@ -239,24 +245,68 @@ declare class ExuluLogger {
239
245
  write(message: string, level: "INFO" | "ERROR" | "WARNING"): Promise<void>;
240
246
  }
241
247
  type AddSourceArgs = Omit<ExuluSourceConstructorArgs, "context">;
248
+ type ExuluEvalRunnerInstance = {
249
+ name: string;
250
+ description: string;
251
+ testcases: ExuluEvalInput[];
252
+ run: ExuluEvalRunner;
253
+ };
254
+ type ExuluEvalRunner = ({ data, runner }: {
255
+ data: ExuluEvalInput;
256
+ runner: {
257
+ agent?: ExuluAgent;
258
+ workflow?: ExuluWorkflow;
259
+ };
260
+ }) => Promise<{
261
+ score: number;
262
+ comment: string;
263
+ }>;
264
+ type ExuluEvalInput = {
265
+ prompt?: string;
266
+ inputs?: any;
267
+ result?: string;
268
+ category?: string;
269
+ metadata?: Record<string, any>;
270
+ duration?: number;
271
+ reference?: string;
272
+ };
273
+ declare class ExuluEval {
274
+ name: string;
275
+ description: string;
276
+ constructor({ name, description }: {
277
+ name: string;
278
+ description: string;
279
+ });
280
+ create: {
281
+ LlmAsAJudge: {
282
+ niah: ({ label, model, needles, testDocument, contextlengths }: {
283
+ label: string;
284
+ model: LanguageModelV1;
285
+ needles: {
286
+ question: string;
287
+ answer: string;
288
+ }[];
289
+ testDocument: string;
290
+ contextlengths: (5000 | 30000 | 50000 | 128000)[];
291
+ }) => ExuluEvalRunnerInstance;
292
+ };
293
+ };
294
+ }
242
295
  declare class ExuluTool {
243
296
  id: string;
244
297
  name: string;
245
298
  description: string;
246
- inputSchema?: ZodSchema;
247
- outputSchema?: ZodSchema;
299
+ parameters?: ZodSchema;
248
300
  type: "context" | "function";
249
- private _execute;
250
- constructor({ id, name, description, inputSchema, outputSchema, type, execute }: {
301
+ tool: Tool;
302
+ constructor({ id, name, description, parameters, type, execute }: {
251
303
  id: string;
252
304
  name: string;
253
305
  description: string;
254
- inputSchema?: ZodSchema;
255
- outputSchema?: ZodSchema;
306
+ parameters: ZodSchema;
256
307
  type: "context" | "function";
257
- execute: ToolAction['execute'];
308
+ execute: (inputs: any) => Promise<any>;
258
309
  });
259
- execute: (inputs: any) => Promise<unknown>;
260
310
  }
261
311
  type ExuluContextFieldDefinition = {
262
312
  name: string;
@@ -487,6 +537,10 @@ declare const JOB_STATUS_ENUM: {
487
537
  stuck: string;
488
538
  };
489
539
 
540
+ declare const _default: {
541
+ run: (exulu: ExuluApp) => void;
542
+ };
543
+
490
544
  declare const ExuluJobs: {
491
545
  redis: typeof redisClient;
492
546
  jobs: {
@@ -510,4 +564,4 @@ declare const ExuluDatabase: {
510
564
  }>;
511
565
  };
512
566
 
513
- 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, ExuluAgent, ExuluApp, authentication as ExuluAuthentication, ExuluChunkers, ExuluContext, ExuluDatabase, ExuluEmbedder, type Job as ExuluJob, ExuluJobs, ExuluLogger, queues as ExuluQueues, ExuluSource, ExuluTool, ExuluWorkflow, type ExuluWorkflowStep, ExuluZodFileType };
567
+ 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, ExuluAgent, ExuluApp, authentication as ExuluAuthentication, ExuluChunkers, _default as ExuluCli, ExuluContext, ExuluDatabase, ExuluEmbedder, ExuluEval, type Job as ExuluJob, ExuluJobs, ExuluLogger, queues as ExuluQueues, ExuluSource, ExuluTool, ExuluWorkflow, type ExuluWorkflowStep, ExuluZodFileType };