@digipair/skill-dsp 0.15.2 → 0.15.3

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/index.cjs.js CHANGED
@@ -40840,15 +40840,28 @@ let DspService = class DspService {
40840
40840
  const result = await gen.forward(input);
40841
40841
  return result;
40842
40842
  }
40843
+ async react(params, _pinsSettingsList, context) {
40844
+ // const { AxChainOfThought } = await eval(`import('@ax-llm/ax')`);
40845
+ const { model = context.privates.MODEL_DSP, functions = [], signature, input } = params;
40846
+ const modelInstance = await executePinsList(model, context);
40847
+ const gen = new AxReAct(modelInstance, signature, {
40848
+ functions: await this.prepareFunctions(functions, context)
40849
+ });
40850
+ const result = await gen.forward(input);
40851
+ return result;
40852
+ }
40843
40853
  async agent(params, _pinsSettingsList, context) {
40844
40854
  // const { AxAgent } = await eval(`import('@ax-llm/ax')`);
40845
- const { model = context.privates.MODEL_DSP, functions = [], demos = [], name, description, signature } = params;
40855
+ const { model = context.privates.MODEL_DSP, functions = [], agents = [], name, description, signature } = params;
40846
40856
  const modelInstance = await executePinsList(model, context);
40847
40857
  const agent = new AxAgent(modelInstance, {
40848
40858
  name,
40849
40859
  description,
40850
40860
  signature,
40851
- functions: await this.prepareFunctions(functions, context)
40861
+ functions: await this.prepareFunctions(functions, context),
40862
+ agents: await Promise.all(agents.map(async (execute)=>await executePinsList([
40863
+ execute
40864
+ ], context)))
40852
40865
  });
40853
40866
  return agent;
40854
40867
  }
@@ -40866,9 +40879,19 @@ const modelOpenAI = (params, pinsSettingsList, context)=>new DspService().modelO
40866
40879
  const modelAzureOpenAi = (params, pinsSettingsList, context)=>new DspService().modelAzureOpenAi(params, pinsSettingsList, context);
40867
40880
  const modelOllama = (params, pinsSettingsList, context)=>new DspService().modelOllama(params, pinsSettingsList, context);
40868
40881
  const generate = (params, pinsSettingsList, context)=>new DspService().generate(params, pinsSettingsList, context);
40882
+ const chainOfThought = (params, pinsSettingsList, context)=>new DspService().chainOfThought(params, pinsSettingsList, context);
40883
+ const react = (params, pinsSettingsList, context)=>new DspService().react(params, pinsSettingsList, context);
40884
+ const agent = (params, pinsSettingsList, context)=>new DspService().agent(params, pinsSettingsList, context);
40885
+ const forward = (params, pinsSettingsList, context)=>new DspService().forward(params, pinsSettingsList, context);
40886
+ const jsInterpreter = (params, pinsSettingsList, context)=>new DspService().jsInterpreter(params, pinsSettingsList, context);
40869
40887
 
40888
+ exports.agent = agent;
40889
+ exports.chainOfThought = chainOfThought;
40890
+ exports.forward = forward;
40870
40891
  exports.generate = generate;
40892
+ exports.jsInterpreter = jsInterpreter;
40871
40893
  exports.model = model;
40872
40894
  exports.modelAzureOpenAi = modelAzureOpenAi;
40873
40895
  exports.modelOllama = modelOllama;
40874
40896
  exports.modelOpenAI = modelOpenAI;
40897
+ exports.react = react;
package/index.esm.js CHANGED
@@ -23499,14 +23499,14 @@ function indent(str, spaces) {
23499
23499
  var match = parseIdentifier(input, i1, namePart) || namePart && parseAdditionalSymbol(input, i1) || maybeSpace && parseSpaces(input, i1);
23500
23500
  // match is required
23501
23501
  if (!match) {
23502
- return tokens = tokens1, nextMatch = nextMatch1, i = i1, {
23502
+ return nextMatch = nextMatch1, i = i1, tokens = tokens1, {
23503
23503
  v: nextMatch1
23504
23504
  };
23505
23505
  }
23506
23506
  var token = match.token, offset = match.offset;
23507
23507
  i1 += offset;
23508
23508
  if (token === " ") {
23509
- return tokens = tokens1, nextMatch = nextMatch1, i = i1, "continue";
23509
+ return nextMatch = nextMatch1, i = i1, tokens = tokens1, "continue";
23510
23510
  }
23511
23511
  tokens1 = _to_consumable_array$6(tokens1).concat([
23512
23512
  token
@@ -23525,7 +23525,7 @@ function indent(str, spaces) {
23525
23525
  if (contextKeys.some(function(el) {
23526
23526
  return el.startsWith(name);
23527
23527
  })) {
23528
- return tokens = tokens1, nextMatch = nextMatch1, i = i1, "continue";
23528
+ return nextMatch = nextMatch1, i = i1, tokens = tokens1, "continue";
23529
23529
  }
23530
23530
  if (dateTimeIdentifiers.some(function(el) {
23531
23531
  return el === name;
@@ -23544,9 +23544,9 @@ function indent(str, spaces) {
23544
23544
  if (dateTimeIdentifiers.some(function(el) {
23545
23545
  return el.startsWith(name);
23546
23546
  })) {
23547
- return tokens = tokens1, nextMatch = nextMatch1, i = i1, "continue";
23547
+ return nextMatch = nextMatch1, i = i1, tokens = tokens1, "continue";
23548
23548
  }
23549
- return tokens = tokens1, nextMatch = nextMatch1, i = i1, {
23549
+ return nextMatch = nextMatch1, i = i1, tokens = tokens1, {
23550
23550
  v: nextMatch1
23551
23551
  };
23552
23552
  };
@@ -40809,15 +40809,28 @@ let DspService = class DspService {
40809
40809
  const result = await gen.forward(input);
40810
40810
  return result;
40811
40811
  }
40812
+ async react(params, _pinsSettingsList, context) {
40813
+ // const { AxChainOfThought } = await eval(`import('@ax-llm/ax')`);
40814
+ const { model = context.privates.MODEL_DSP, functions = [], signature, input } = params;
40815
+ const modelInstance = await executePinsList(model, context);
40816
+ const gen = new AxReAct(modelInstance, signature, {
40817
+ functions: await this.prepareFunctions(functions, context)
40818
+ });
40819
+ const result = await gen.forward(input);
40820
+ return result;
40821
+ }
40812
40822
  async agent(params, _pinsSettingsList, context) {
40813
40823
  // const { AxAgent } = await eval(`import('@ax-llm/ax')`);
40814
- const { model = context.privates.MODEL_DSP, functions = [], demos = [], name, description, signature } = params;
40824
+ const { model = context.privates.MODEL_DSP, functions = [], agents = [], name, description, signature } = params;
40815
40825
  const modelInstance = await executePinsList(model, context);
40816
40826
  const agent = new AxAgent(modelInstance, {
40817
40827
  name,
40818
40828
  description,
40819
40829
  signature,
40820
- functions: await this.prepareFunctions(functions, context)
40830
+ functions: await this.prepareFunctions(functions, context),
40831
+ agents: await Promise.all(agents.map(async (execute)=>await executePinsList([
40832
+ execute
40833
+ ], context)))
40821
40834
  });
40822
40835
  return agent;
40823
40836
  }
@@ -40835,5 +40848,10 @@ const modelOpenAI = (params, pinsSettingsList, context)=>new DspService().modelO
40835
40848
  const modelAzureOpenAi = (params, pinsSettingsList, context)=>new DspService().modelAzureOpenAi(params, pinsSettingsList, context);
40836
40849
  const modelOllama = (params, pinsSettingsList, context)=>new DspService().modelOllama(params, pinsSettingsList, context);
40837
40850
  const generate = (params, pinsSettingsList, context)=>new DspService().generate(params, pinsSettingsList, context);
40851
+ const chainOfThought = (params, pinsSettingsList, context)=>new DspService().chainOfThought(params, pinsSettingsList, context);
40852
+ const react = (params, pinsSettingsList, context)=>new DspService().react(params, pinsSettingsList, context);
40853
+ const agent = (params, pinsSettingsList, context)=>new DspService().agent(params, pinsSettingsList, context);
40854
+ const forward = (params, pinsSettingsList, context)=>new DspService().forward(params, pinsSettingsList, context);
40855
+ const jsInterpreter = (params, pinsSettingsList, context)=>new DspService().jsInterpreter(params, pinsSettingsList, context);
40838
40856
 
40839
- export { generate, model, modelAzureOpenAi, modelOllama, modelOpenAI };
40857
+ export { agent, chainOfThought, forward, generate, jsInterpreter, model, modelAzureOpenAi, modelOllama, modelOpenAI, react };
@@ -1,7 +1,16 @@
1
1
  import { PinsSettings } from '@digipair/engine';
2
- import { AxAI, AxAIOpenAI, AxAIAzureOpenAI, AxAIOllama } from '@ax-llm/ax';
2
+ import { AxAI, AxAIOpenAI, AxAIAzureOpenAI, AxAIOllama, AxAgent, AxJSInterpreter } from '@ax-llm/ax';
3
3
  export declare const model: (params: any, pinsSettingsList: PinsSettings[], context: any) => Promise<AxAI>;
4
4
  export declare const modelOpenAI: (params: any, pinsSettingsList: PinsSettings[], context: any) => Promise<AxAIOpenAI<string, string>>;
5
5
  export declare const modelAzureOpenAi: (params: any, pinsSettingsList: PinsSettings[], context: any) => Promise<AxAIAzureOpenAI>;
6
6
  export declare const modelOllama: (params: any, pinsSettingsList: PinsSettings[], context: any) => Promise<AxAIOllama>;
7
7
  export declare const generate: (params: any, pinsSettingsList: PinsSettings[], context: any) => Promise<import("@ax-llm/ax").AxGenerateResult<import("@ax-llm/ax").AxGenOut>>;
8
+ export declare const chainOfThought: (params: any, pinsSettingsList: PinsSettings[], context: any) => Promise<import("@ax-llm/ax").AxGenOut & {
9
+ reason: string;
10
+ }>;
11
+ export declare const react: (params: any, pinsSettingsList: PinsSettings[], context: any) => Promise<import("@ax-llm/ax").AxGenOut & {
12
+ reason: string;
13
+ }>;
14
+ export declare const agent: (params: any, pinsSettingsList: PinsSettings[], context: any) => Promise<AxAgent<import("@ax-llm/ax").AxGenIn, import("@ax-llm/ax").AxGenOut>>;
15
+ export declare const forward: (params: any, pinsSettingsList: PinsSettings[], context: any) => Promise<any>;
16
+ export declare const jsInterpreter: (params: any, pinsSettingsList: PinsSettings[], context: any) => Promise<AxJSInterpreter>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@digipair/skill-dsp",
3
- "version": "0.15.2",
3
+ "version": "0.15.3",
4
4
  "dependencies": {},
5
5
  "main": "./index.cjs.js",
6
6
  "module": "./index.esm.js"
package/schema.json CHANGED
@@ -231,14 +231,262 @@
231
231
  "schema": {
232
232
  "type": "object"
233
233
  }
234
+ },
235
+ {
236
+ "name": "functions",
237
+ "summary": "Fonctions DSP",
238
+ "required": false,
239
+ "description": "Fonctions utilisables pour la génération",
240
+ "schema": {
241
+ "type": "array",
242
+ "items": {
243
+ "$ref": "#/components/schemas/Function"
244
+ }
245
+ }
246
+ }
247
+ ],
248
+ "x-events": []
249
+ }
250
+ },
251
+ "/chainOfThought": {
252
+ "post": {
253
+ "tags": ["service"],
254
+ "summary": "Chaine de pensée DSP",
255
+ "parameters": [
256
+ {
257
+ "name": "model",
258
+ "summary": "Modèle",
259
+ "required": false,
260
+ "description": "Modèle LLM à utiliser pour la génération",
261
+ "schema": {
262
+ "type": "array",
263
+ "items": {
264
+ "$ref": "https://schemas.digipair.ai/pinsSettings"
265
+ }
266
+ }
267
+ },
268
+ {
269
+ "name": "signature",
270
+ "summary": "Signature",
271
+ "required": true,
272
+ "description": "Signature des données à extraire",
273
+ "schema": {
274
+ "type": "string"
275
+ }
276
+ },
277
+ {
278
+ "name": "input",
279
+ "summary": "Données à traiter",
280
+ "required": true,
281
+ "description": "Données d'entrées à traiter",
282
+ "schema": {
283
+ "type": "object"
284
+ }
285
+ },
286
+ {
287
+ "name": "functions",
288
+ "summary": "Fonctions DSP",
289
+ "required": false,
290
+ "description": "Fonctions utilisables pour la chaine de pensée",
291
+ "schema": {
292
+ "type": "array",
293
+ "items": {
294
+ "$ref": "#/components/schemas/Function"
295
+ }
296
+ }
297
+ }
298
+ ],
299
+ "x-events": []
300
+ }
301
+ },
302
+ "/react": {
303
+ "post": {
304
+ "tags": ["service"],
305
+ "summary": "ReAct DSP",
306
+ "parameters": [
307
+ {
308
+ "name": "model",
309
+ "summary": "Modèle",
310
+ "required": false,
311
+ "description": "Modèle LLM à utiliser pour la génération",
312
+ "schema": {
313
+ "type": "array",
314
+ "items": {
315
+ "$ref": "https://schemas.digipair.ai/pinsSettings"
316
+ }
317
+ }
318
+ },
319
+ {
320
+ "name": "signature",
321
+ "summary": "Signature",
322
+ "required": true,
323
+ "description": "Signature des données à extraire",
324
+ "schema": {
325
+ "type": "string"
326
+ }
327
+ },
328
+ {
329
+ "name": "input",
330
+ "summary": "Données à traiter",
331
+ "required": true,
332
+ "description": "Données d'entrées à traiter",
333
+ "schema": {
334
+ "type": "object"
335
+ }
336
+ },
337
+ {
338
+ "name": "functions",
339
+ "summary": "Fonctions DSP",
340
+ "required": false,
341
+ "description": "Fonctions utilisables pour la génération",
342
+ "schema": {
343
+ "type": "array",
344
+ "items": {
345
+ "$ref": "#/components/schemas/Function"
346
+ }
347
+ }
234
348
  }
235
349
  ],
236
350
  "x-events": []
237
351
  }
352
+ },
353
+ "/agent": {
354
+ "post": {
355
+ "tags": ["service"],
356
+ "summary": "Agent DSP",
357
+ "parameters": [
358
+ {
359
+ "name": "model",
360
+ "summary": "Modèle",
361
+ "required": false,
362
+ "description": "Modèle LLM à utiliser pour la génération",
363
+ "schema": {
364
+ "type": "array",
365
+ "items": {
366
+ "$ref": "https://schemas.digipair.ai/pinsSettings"
367
+ }
368
+ }
369
+ },
370
+ {
371
+ "name": "name",
372
+ "summary": "Nom",
373
+ "required": true,
374
+ "description": "Nom de l'agent",
375
+ "schema": {
376
+ "type": "string"
377
+ }
378
+ },
379
+ {
380
+ "name": "description",
381
+ "summary": "Description",
382
+ "required": true,
383
+ "description": "Description de l'agent",
384
+ "schema": {
385
+ "type": "string"
386
+ }
387
+ },
388
+ {
389
+ "name": "signature",
390
+ "summary": "Signature",
391
+ "required": true,
392
+ "description": "Signature des données à extraire",
393
+ "schema": {
394
+ "type": "string"
395
+ }
396
+ },
397
+ {
398
+ "name": "functions",
399
+ "summary": "Fonctions DSP",
400
+ "required": false,
401
+ "description": "Fonctions utilisables pour la génération",
402
+ "schema": {
403
+ "type": "array",
404
+ "items": {
405
+ "$ref": "#/components/schemas/Function"
406
+ }
407
+ }
408
+ },
409
+ {
410
+ "name": "agents",
411
+ "summary": "Agents DSP",
412
+ "required": false,
413
+ "description": "Autres agents utilisables par l'agent",
414
+ "schema": {
415
+ "type": "array",
416
+ "items": {
417
+ "$ref": "https://schemas.digipair.ai/pinsSettings"
418
+ }
419
+ }
420
+ }
421
+ ],
422
+ "x-events": []
423
+ }
424
+ },
425
+ "/forward": {
426
+ "post": {
427
+ "tags": ["service"],
428
+ "summary": "Execute un agent DSP",
429
+ "parameters": [
430
+ {
431
+ "name": "agents",
432
+ "summary": "Agents DSP",
433
+ "required": false,
434
+ "description": "Autres agents utilisables par l'agent",
435
+ "schema": {
436
+ "type": "array",
437
+ "items": {
438
+ "$ref": "https://schemas.digipair.ai/pinsSettings"
439
+ }
440
+ }
441
+ },
442
+ {
443
+ "name": "input",
444
+ "summary": "Données à traiter",
445
+ "required": true,
446
+ "description": "Données d'entrées à traiter",
447
+ "schema": {
448
+ "type": "object"
449
+ }
450
+ }
451
+ ],
452
+ "x-events": []
453
+ }
454
+ },
455
+ "/jsInterpreter": {
456
+ "post": {
457
+ "tags": ["service"],
458
+ "summary": "Fonction DSP d'execution de code JS",
459
+ "parameters": [],
460
+ "x-events": []
461
+ }
238
462
  }
239
463
  },
240
464
  "components": {
241
- "schemas": {}
465
+ "schemas": {
466
+ "Function": {
467
+ "tags": ["service"],
468
+ "summary": "Fonction DSP",
469
+ "type": "object",
470
+ "properties": {
471
+ "name": {
472
+ "type": "string"
473
+ },
474
+ "descriptions": {
475
+ "type": "string"
476
+ },
477
+ "parameters": {
478
+ "type": "object"
479
+ },
480
+ "func": {
481
+ "type": "array",
482
+ "items": {
483
+ "$ref": "https://schemas.digipair.ai/pinsSettings"
484
+ }
485
+ }
486
+ },
487
+ "required": ["name", "description", "parameters", "func"]
488
+ }
489
+ }
242
490
  },
243
491
  "x-scene-blocks": {}
244
492
  }