@ai.ntellect/core 0.2.8 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (40) hide show
  1. package/README.FR.md +58 -19
  2. package/README.md +40 -17
  3. package/agent/index.ts +54 -26
  4. package/dist/agent/index.d.ts +12 -8
  5. package/dist/agent/index.js +34 -12
  6. package/dist/index.d.ts +2 -1
  7. package/dist/index.js +2 -1
  8. package/dist/llm/evaluator/context.d.ts +0 -1
  9. package/dist/llm/evaluator/context.js +3 -12
  10. package/dist/llm/evaluator/index.d.ts +7 -1
  11. package/dist/llm/evaluator/index.js +37 -24
  12. package/dist/llm/interpreter/context.d.ts +32 -0
  13. package/dist/llm/interpreter/context.js +90 -0
  14. package/dist/llm/interpreter/index.d.ts +17 -0
  15. package/dist/llm/{synthesizer → interpreter}/index.js +18 -27
  16. package/dist/llm/orchestrator/context.js +1 -1
  17. package/dist/llm/orchestrator/index.d.ts +7 -3
  18. package/dist/llm/orchestrator/index.js +5 -48
  19. package/dist/memory/cache.d.ts +2 -2
  20. package/dist/memory/cache.js +4 -5
  21. package/dist/memory/persistent.d.ts +1 -0
  22. package/dist/memory/persistent.js +2 -1
  23. package/dist/test.d.ts +54 -0
  24. package/dist/test.js +125 -20
  25. package/dist/types.d.ts +12 -13
  26. package/index.ts +2 -2
  27. package/llm/evaluator/context.ts +3 -12
  28. package/llm/evaluator/index.ts +57 -27
  29. package/llm/interpreter/context.ts +89 -0
  30. package/llm/{synthesizer → interpreter}/index.ts +20 -26
  31. package/llm/orchestrator/context.ts +1 -1
  32. package/llm/orchestrator/index.ts +14 -67
  33. package/memory/cache.ts +5 -6
  34. package/memory/persistent.ts +3 -1
  35. package/package.json +1 -1
  36. package/types.ts +13 -13
  37. package/dist/llm/synthesizer/context.d.ts +0 -15
  38. package/dist/llm/synthesizer/context.js +0 -71
  39. package/dist/llm/synthesizer/index.d.ts +0 -14
  40. package/llm/synthesizer/context.ts +0 -68
package/README.FR.md CHANGED
@@ -5,8 +5,8 @@
5
5
  1. [Composants principaux](#composants-principaux)
6
6
  - [Orchestrator](#orchestrator)
7
7
  - [Queue Manager](#queue-manager)
8
- - [Synthétiseur](#synthétiseur)
9
8
  - [Évaluateur](#évaluateur)
9
+ - [Interpreter](#interpreter)
10
10
  - [Mémoire](#architecture-mémoire)
11
11
  2. [Création et gestion des actions](#création-et-gestion-des-actions)
12
12
  3. [Exécution du Workflow](#exécution-du-workflow)
@@ -39,29 +39,47 @@ Le gestionnaire de la file d'attente (Queue Manager) organise les actions à ex
39
39
  - Gérer les priorités des actions.
40
40
  - Assurer une exécution correcte et en temps voulu des actions.
41
41
 
42
- ### Synthétiseur
42
+ ### Évaluateur
43
43
 
44
- Le synthétiseur est responsable de la génération des réponses et de l'analyse des actions en fonction des résultats obtenus dans le workflow. Il peut créer des résumés ou des réponses plus complexes à partir des résultats bruts obtenus lors de l'exécution des actions.
44
+ L'évaluateur collabore maintenant avec les Interpreters :
45
45
 
46
- - **Rôle principal** : Transformer les résultats des actions en une sortie compréhensible et structurée.
47
- - **Interactions** :
48
- - Prend les résultats des actions exécutées.
49
- - Crée des résumés ou des réponses adaptées.
46
+ - Analyse les résultats des actions exécutées
47
+ - Détermine si des actions supplémentaires sont nécessaires et renvoie à la Queue Manager
48
+ - Sinon, il sélectionne l'Interpreter approprié selon le type de demande
50
49
 
51
- ### Évaluateur
50
+ ### Interpreter
52
51
 
53
- L'évaluateur est responsable de l'évaluation des résultats des actions exécutées et de la détermination des actions supplémentaires nécessaires. Il travaille en collaboration avec l'orchestrateur pour s'assurer que toutes les exigences de l'utilisateur sont satisfaites.
52
+ L'Interpreter est le composant spécialisé dans l'interprétation des résultats d'actions et la génération de réponses adaptées. Chaque Interpreter est configuré avec un contexte spécifique et produit des réponses dans un format adapté à son domaine d'expertise.
54
53
 
55
- - **Rôle principal** : Évaluer les résultats des actions et déterminer les prochaines étapes
56
- - **Fonctions principales** :
57
- - Analyse les résultats des actions exécutées
58
- - Détermine si des actions supplémentaires sont nécessaires
59
- - Suggère les prochaines actions à l'orchestrateur
60
- - Assure la réalisation complète des objectifs
61
- - **Interactions** :
62
- - Collabore avec l'orchestrateur pour gérer le workflow
63
- - Traite les résultats des actions
64
- - Peut déclencher des cycles d'actions supplémentaires
54
+ **Caractéristiques principales** :
55
+
56
+ - Configuration avec un contexte métier spécifique
57
+ - Format de réponse adapté au domaine
58
+ - Traitement spécialisé des données selon le contexte
59
+
60
+ **Fonctionnement** :
61
+
62
+ - Reçoit les résultats des actions via l'Evaluator
63
+ - Analyse les données selon son contexte spécifique
64
+ - Produit une réponse formatée selon les règles de son domaine
65
+
66
+ Voici quelques exemples d'Interpreters qui peuvent être implémentés :
67
+
68
+ 1. **MarketInterpreter**
69
+
70
+ - Spécialisé dans l'analyse des données de marché
71
+ - Format adapté aux analyses financières
72
+
73
+ 2. **SecurityInterpreter**
74
+
75
+ - Dédié aux vérifications de sécurité
76
+ - Format optimisé pour les rapports de sécurité
77
+
78
+ 3. **GeneralInterpreter**
79
+ - Traitement des requêtes générales
80
+ - Format flexible selon le contexte
81
+
82
+ Ces exemples illustrent la flexibilité du système, qui peut être étendu avec d'autres types d'Interpreters selon les besoins.
65
83
 
66
84
  [![Sans-titre-2024-11-08-0220.png](https://i.postimg.cc/nryjsx5y/Sans-titre-2024-11-08-0220.png)](https://postimg.cc/rR9FbBqj)
67
85
 
@@ -329,3 +347,24 @@ Voici les éléments actuellement en développement ou à améliorer :
329
347
  - [ ] Tester l'intégration, la sécurité et la transparence des actions Lit pour garantir leur bon fonctionnement.
330
348
 
331
349
  **Statut** : En cours d'étude pour déterminer la faisabilité et les implications techniques, notamment en ce qui concerne l'intégration de la décentralisation dans le système existant.
350
+
351
+ ### Exemple d'utilisation
352
+
353
+ ```typescript
354
+ const securityInterpreter = new Interpreter("security", securityContext);
355
+ const marketInterpreter = new Interpreter("market", marketContext);
356
+ const generalInterpreter = new Interpreter("general", generalContext);
357
+
358
+ const agent = new Agent({
359
+ interpreters: [securityInterpreter, marketInterpreter, generalInterpreter],
360
+ orchestrator,
361
+ memory: {
362
+ persistent: memory,
363
+ cache: cacheMemory,
364
+ },
365
+ stream: false,
366
+ maxEvaluatorIteration: 1,
367
+ });
368
+
369
+ const result = await agent.process(prompt, context);
370
+ ```
package/README.md CHANGED
@@ -5,8 +5,8 @@
5
5
  1. [Main components](#main-components)
6
6
  - [Agent](#agent)
7
7
  - [Orchestrator](#orchestrator)
8
- - [Synthesizer](#synthesizer)
9
8
  - [Evaluator](#evaluator)
9
+ - [Interpreter](#interpreter)
10
10
  - [Memory](#memory-architecture)
11
11
  2. [Action creation and management](#action-creation-and-management)
12
12
  3. [Agent processing](#agent-processing)
@@ -41,31 +41,54 @@ The orchestrator works under the agent's direction to manage the execution of ac
41
41
  - Uses memory for context and caching
42
42
  - Coordinates with evaluator for result assessment
43
43
 
44
- ### Synthesizer
45
-
46
- The synthesizer is responsible for generating responses and analyzing actions based on the results obtained in the workflow. It can create summaries or more complex responses from the raw results obtained during the execution of actions.
47
-
48
- - **Main role**: Transform the results of actions into a comprehensible and structured output
49
- - **Interactions**:
50
- - Takes the results of executed actions
51
- - Creates summaries or tailored responses
52
- - Formats final output for user consumption
53
- - Can handle streaming responses
54
-
55
44
  ### Evaluator
56
45
 
57
- The evaluator is responsible for assessing the results of executed actions and determining if additional actions are needed. It works in conjunction with the orchestrator to ensure all user requirements are met.
46
+ The evaluator now collaborates with Interpreters to process action results and determine the next steps in the workflow.
58
47
 
59
- - **Main role**: Evaluate action results and determine next steps
48
+ - **Main role**: Evaluate action results and coordinate with appropriate Interpreters
60
49
  - **Main functions**:
61
50
  - Analyzes results from executed actions
62
51
  - Determines if additional actions are needed
63
- - Suggests next actions to the orchestrator
52
+ - Routes results to appropriate Interpreter
64
53
  - Ensures completion of user requirements
65
54
  - **Interactions**:
66
55
  - Works with orchestrator to manage workflow
67
- - Processes action results
68
- - Can trigger additional action cycles
56
+ - Coordinates with Interpreters for specialized processing
57
+ - Can trigger additional action cycles if needed
58
+
59
+ ### Interpreter
60
+
61
+ The Interpreter is a specialized component responsible for interpreting action results and generating appropriate responses. Each Interpreter is configured with a specific business context and produces responses in a format adapted to its domain of expertise.
62
+
63
+ **Key characteristics**:
64
+
65
+ - Business-specific context configuration
66
+ - Domain-adapted response formatting
67
+ - Specialized data processing based on context
68
+
69
+ **Operation flow**:
70
+
71
+ - Receives action results via the Evaluator
72
+ - Analyzes data according to its specific context
73
+ - Produces formatted responses following domain rules
74
+
75
+ Examples of Interpreter implementations:
76
+
77
+ 1. **MarketInterpreter**
78
+
79
+ - Specialized in market data analysis
80
+ - Format adapted for financial analysis
81
+
82
+ 2. **SecurityInterpreter**
83
+
84
+ - Dedicated to security verifications
85
+ - Optimized format for security reports
86
+
87
+ 3. **GeneralInterpreter**
88
+ - Handles general purpose requests
89
+ - Flexible formatting based on context
90
+
91
+ These examples demonstrate the system's flexibility, which can be extended with additional Interpreter types as needed.
69
92
 
70
93
  [![Sans-titre-2024-11-08-0220.png](https://i.postimg.cc/nryjsx5y/Sans-titre-2024-11-08-0220.png)](https://postimg.cc/rR9FbBqj)
71
94
 
package/agent/index.ts CHANGED
@@ -1,9 +1,9 @@
1
1
  import { Evaluator } from "../llm/evaluator";
2
+ import { Interpreter } from "../llm/interpreter";
2
3
  import { Orchestrator } from "../llm/orchestrator";
3
- import { Synthesizer } from "../llm/synthesizer";
4
4
  import { CacheMemory } from "../memory/cache";
5
5
  import { PersistentMemory } from "../memory/persistent";
6
- import { ActionSchema, AgentEvent, QueueResult, User } from "../types";
6
+ import { ActionSchema, AgentEvent, MemoryScope, QueueResult } from "../types";
7
7
  import { QueueItemTransformer } from "../utils/queue-item-transformer";
8
8
  import { ResultSanitizer } from "../utils/sanitize-results";
9
9
  import { ActionHandler } from "./handlers/ActionHandler";
@@ -11,8 +11,11 @@ import { ActionHandler } from "./handlers/ActionHandler";
11
11
  export class Agent {
12
12
  private readonly actionHandler: ActionHandler;
13
13
  private readonly orchestrator: Orchestrator;
14
- private readonly persistentMemory: PersistentMemory;
15
- private readonly cacheMemory: CacheMemory | undefined;
14
+ private readonly interpreters: Interpreter[];
15
+ private readonly memory: {
16
+ persistent: PersistentMemory;
17
+ cache?: CacheMemory;
18
+ };
16
19
  private readonly stream: boolean;
17
20
  private readonly maxEvaluatorIteration: number;
18
21
  private evaluatorIteration = 0;
@@ -20,21 +23,23 @@ export class Agent {
20
23
 
21
24
  constructor({
22
25
  orchestrator,
23
- persistentMemory,
24
- cacheMemory,
26
+ interpreters,
27
+ memory,
25
28
  stream,
26
29
  maxEvaluatorIteration = 1,
27
30
  }: {
28
- user: User;
29
31
  orchestrator: Orchestrator;
30
- persistentMemory: PersistentMemory;
31
- cacheMemory?: CacheMemory;
32
+ interpreters: Interpreter[];
33
+ memory: {
34
+ persistent: PersistentMemory;
35
+ cache?: CacheMemory;
36
+ };
32
37
  stream: boolean;
33
38
  maxEvaluatorIteration: number;
34
39
  }) {
35
40
  this.orchestrator = orchestrator;
36
- this.cacheMemory = cacheMemory;
37
- this.persistentMemory = persistentMemory;
41
+ this.interpreters = interpreters;
42
+ this.memory = memory;
38
43
  this.stream = stream;
39
44
  this.maxEvaluatorIteration = maxEvaluatorIteration;
40
45
  this.actionHandler = new ActionHandler();
@@ -45,9 +50,18 @@ export class Agent {
45
50
  this.accumulatedResults = "";
46
51
  this.evaluatorIteration = 0;
47
52
  console.log("Requesting orchestrator for actions..");
53
+ const cacheMemories = await this.memory.cache?.findSimilarActions(prompt, {
54
+ similarityThreshold: 70,
55
+ maxResults: 5,
56
+ userId: "1",
57
+ scope: MemoryScope.GLOBAL,
58
+ });
59
+ console.log("✅ RECENT_ACTIONS: ", cacheMemories);
48
60
  const request = await this.orchestrator.process(
49
61
  prompt,
50
- this.accumulatedResults
62
+ `## RECENT_ACTIONS: ${JSON.stringify(
63
+ cacheMemories
64
+ )} ## CURRENT_RESULTS: ${this.accumulatedResults}`
51
65
  );
52
66
  events.onMessage?.(request);
53
67
 
@@ -107,15 +121,17 @@ export class Agent {
107
121
  }
108
122
 
109
123
  if (this.evaluatorIteration >= this.maxEvaluatorIteration) {
110
- return this.handleActionResults({
124
+ return this.interpreterResult({
111
125
  data: this.accumulatedResults,
112
126
  initialPrompt,
127
+ interpreter: this.interpreters[0],
113
128
  });
114
129
  }
115
130
 
116
131
  const evaluator = new Evaluator(
117
132
  this.orchestrator.tools,
118
- this.persistentMemory
133
+ this.memory,
134
+ this.interpreters
119
135
  );
120
136
 
121
137
  // const sanitizedResults = ResultSanitizer.sanitize(this.accumulatedResults);
@@ -136,30 +152,42 @@ export class Agent {
136
152
  events
137
153
  );
138
154
  }
139
-
140
- return this.handleActionResults({
155
+ const interpreter = this.getInterpreter(
156
+ this.interpreters,
157
+ evaluation.interpreter
158
+ );
159
+ if (!interpreter) {
160
+ throw new Error("Interpreter not found");
161
+ }
162
+ return this.interpreterResult({
141
163
  data: this.accumulatedResults,
142
164
  initialPrompt,
165
+ interpreter,
143
166
  });
144
167
  }
145
168
 
146
- private async handleActionResults(actionsResult: {
169
+ private getInterpreter(interpreters: Interpreter[], name: string) {
170
+ return interpreters.find((interpreter) => interpreter.name === name);
171
+ }
172
+
173
+ private async interpreterResult(actionsResult: {
147
174
  data: string;
148
175
  initialPrompt: string;
176
+ interpreter: Interpreter;
149
177
  }) {
150
- const synthesizer = new Synthesizer();
178
+ const { interpreter, initialPrompt, data } = actionsResult;
151
179
 
152
180
  return this.stream
153
181
  ? (
154
- await synthesizer.streamProcess(
155
- actionsResult.initialPrompt,
156
- actionsResult.data
157
- )
182
+ await interpreter.streamProcess(initialPrompt, {
183
+ userRequest: initialPrompt,
184
+ results: data,
185
+ })
158
186
  ).toDataStreamResponse()
159
- : await synthesizer.process(
160
- actionsResult.initialPrompt,
161
- actionsResult.data
162
- );
187
+ : await interpreter.process(initialPrompt, {
188
+ userRequest: initialPrompt,
189
+ results: data,
190
+ });
163
191
  }
164
192
 
165
193
  private transformActions(actions: ActionSchema[]) {
@@ -1,27 +1,31 @@
1
+ import { Interpreter } from "../llm/interpreter";
1
2
  import { Orchestrator } from "../llm/orchestrator";
2
3
  import { CacheMemory } from "../memory/cache";
3
4
  import { PersistentMemory } from "../memory/persistent";
4
- import { AgentEvent, User } from "../types";
5
+ import { AgentEvent } from "../types";
5
6
  export declare class Agent {
6
7
  private readonly actionHandler;
7
8
  private readonly orchestrator;
8
- private readonly persistentMemory;
9
- private readonly cacheMemory;
9
+ private readonly interpreters;
10
+ private readonly memory;
10
11
  private readonly stream;
11
12
  private readonly maxEvaluatorIteration;
12
13
  private evaluatorIteration;
13
14
  private accumulatedResults;
14
- constructor({ orchestrator, persistentMemory, cacheMemory, stream, maxEvaluatorIteration, }: {
15
- user: User;
15
+ constructor({ orchestrator, interpreters, memory, stream, maxEvaluatorIteration, }: {
16
16
  orchestrator: Orchestrator;
17
- persistentMemory: PersistentMemory;
18
- cacheMemory?: CacheMemory;
17
+ interpreters: Interpreter[];
18
+ memory: {
19
+ persistent: PersistentMemory;
20
+ cache?: CacheMemory;
21
+ };
19
22
  stream: boolean;
20
23
  maxEvaluatorIteration: number;
21
24
  });
22
25
  process(prompt: string, events: AgentEvent): Promise<any>;
23
26
  private handleActions;
24
- private handleActionResults;
27
+ private getInterpreter;
28
+ private interpreterResult;
25
29
  private transformActions;
26
30
  private formatResults;
27
31
  }
@@ -2,17 +2,17 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.Agent = void 0;
4
4
  const evaluator_1 = require("../llm/evaluator");
5
- const synthesizer_1 = require("../llm/synthesizer");
5
+ const types_1 = require("../types");
6
6
  const queue_item_transformer_1 = require("../utils/queue-item-transformer");
7
7
  const sanitize_results_1 = require("../utils/sanitize-results");
8
8
  const ActionHandler_1 = require("./handlers/ActionHandler");
9
9
  class Agent {
10
- constructor({ orchestrator, persistentMemory, cacheMemory, stream, maxEvaluatorIteration = 1, }) {
10
+ constructor({ orchestrator, interpreters, memory, stream, maxEvaluatorIteration = 1, }) {
11
11
  this.evaluatorIteration = 0;
12
12
  this.accumulatedResults = "";
13
13
  this.orchestrator = orchestrator;
14
- this.cacheMemory = cacheMemory;
15
- this.persistentMemory = persistentMemory;
14
+ this.interpreters = interpreters;
15
+ this.memory = memory;
16
16
  this.stream = stream;
17
17
  this.maxEvaluatorIteration = maxEvaluatorIteration;
18
18
  this.actionHandler = new ActionHandler_1.ActionHandler();
@@ -22,7 +22,14 @@ class Agent {
22
22
  this.accumulatedResults = "";
23
23
  this.evaluatorIteration = 0;
24
24
  console.log("Requesting orchestrator for actions..");
25
- const request = await this.orchestrator.process(prompt, this.accumulatedResults);
25
+ const cacheMemories = await this.memory.cache?.findSimilarActions(prompt, {
26
+ similarityThreshold: 70,
27
+ maxResults: 5,
28
+ userId: "1",
29
+ scope: types_1.MemoryScope.GLOBAL,
30
+ });
31
+ console.log("✅ RECENT_ACTIONS: ", cacheMemories);
32
+ const request = await this.orchestrator.process(prompt, `## RECENT_ACTIONS: ${JSON.stringify(cacheMemories)} ## CURRENT_RESULTS: ${this.accumulatedResults}`);
26
33
  events.onMessage?.(request);
27
34
  return request.actions.length > 0
28
35
  ? this.handleActions({
@@ -49,12 +56,13 @@ class Agent {
49
56
  };
50
57
  }
51
58
  if (this.evaluatorIteration >= this.maxEvaluatorIteration) {
52
- return this.handleActionResults({
59
+ return this.interpreterResult({
53
60
  data: this.accumulatedResults,
54
61
  initialPrompt,
62
+ interpreter: this.interpreters[0],
55
63
  });
56
64
  }
57
- const evaluator = new evaluator_1.Evaluator(this.orchestrator.tools, this.persistentMemory);
65
+ const evaluator = new evaluator_1.Evaluator(this.orchestrator.tools, this.memory, this.interpreters);
58
66
  // const sanitizedResults = ResultSanitizer.sanitize(this.accumulatedResults);
59
67
  const evaluation = await evaluator.process(initialPrompt, this.accumulatedResults);
60
68
  events.onMessage?.(evaluation);
@@ -65,16 +73,30 @@ class Agent {
65
73
  actions: evaluation.nextActionsNeeded,
66
74
  }, events);
67
75
  }
68
- return this.handleActionResults({
76
+ const interpreter = this.getInterpreter(this.interpreters, evaluation.interpreter);
77
+ if (!interpreter) {
78
+ throw new Error("Interpreter not found");
79
+ }
80
+ return this.interpreterResult({
69
81
  data: this.accumulatedResults,
70
82
  initialPrompt,
83
+ interpreter,
71
84
  });
72
85
  }
73
- async handleActionResults(actionsResult) {
74
- const synthesizer = new synthesizer_1.Synthesizer();
86
+ getInterpreter(interpreters, name) {
87
+ return interpreters.find((interpreter) => interpreter.name === name);
88
+ }
89
+ async interpreterResult(actionsResult) {
90
+ const { interpreter, initialPrompt, data } = actionsResult;
75
91
  return this.stream
76
- ? (await synthesizer.streamProcess(actionsResult.initialPrompt, actionsResult.data)).toDataStreamResponse()
77
- : await synthesizer.process(actionsResult.initialPrompt, actionsResult.data);
92
+ ? (await interpreter.streamProcess(initialPrompt, {
93
+ userRequest: initialPrompt,
94
+ results: data,
95
+ })).toDataStreamResponse()
96
+ : await interpreter.process(initialPrompt, {
97
+ userRequest: initialPrompt,
98
+ results: data,
99
+ });
78
100
  }
79
101
  transformActions(actions) {
80
102
  let predefinedActions = queue_item_transformer_1.QueueItemTransformer.transformActionsToQueueItems(actions) || [];
package/dist/index.d.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  export * from "./agent";
2
+ export * from "./llm/interpreter";
3
+ export * from "./llm/interpreter/context";
2
4
  export * from "./llm/orchestrator";
3
- export * from "./llm/synthesizer";
4
5
  export * from "./types";
5
6
  export * from "./memory/cache";
6
7
  export * from "./memory/persistent";
package/dist/index.js CHANGED
@@ -15,8 +15,9 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./agent"), exports);
18
+ __exportStar(require("./llm/interpreter"), exports);
19
+ __exportStar(require("./llm/interpreter/context"), exports);
18
20
  __exportStar(require("./llm/orchestrator"), exports);
19
- __exportStar(require("./llm/synthesizer"), exports);
20
21
  __exportStar(require("./types"), exports);
21
22
  __exportStar(require("./memory/cache"), exports);
22
23
  __exportStar(require("./memory/persistent"), exports);
@@ -5,7 +5,6 @@ export declare const evaluatorContext: {
5
5
  guidelines: {
6
6
  important: string[];
7
7
  warnings: string[];
8
- steps: string[];
9
8
  };
10
9
  };
11
10
  };
@@ -9,23 +9,14 @@ exports.evaluatorContext = {
9
9
  important: [
10
10
  "Verify if all required actions were executed successfully.",
11
11
  "Check if the results align with the initial goal.",
12
- "Identify and extract additional relevant information naturally during the process. Examples:",
13
- " - Link a token symbol (e.g., 'USDC') to its address (e.g., '0xA0b8...6EB48').",
14
- " - Associate a wallet address (e.g., '0x1234...abcd') to a user-friendly name (e.g., 'Work Wallet').",
15
- " - Map a token address (e.g., '0x6B17...71d0F') back to its symbol or name (e.g., 'DAI').",
16
- "Store these facts in memory with their type (episodic, semantic, or procedural).",
12
+ "If you retrieved the informations from your internal knowledge base, no need to store them in 'extraInformationsToStore'.",
13
+ "Store ONLY extra new needed informations in 'extraInformationsToStore' (choose the most relevant informations and memory type: episodic, semantic, or procedural).",
17
14
  ],
18
15
  warnings: [
19
- "NEVER modify the results directly.",
16
+ "NEVER store an old data you retrieve from your internal knowledge base.",
20
17
  "NEVER make assumptions about missing data.",
21
18
  "NEVER repeat actions already completed unless explicitly required.",
22
19
  ],
23
- steps: [
24
- "Verify success: Confirm if the goal has been fully or partially achieved. If partially, describe what's missing.",
25
- "Recommend next actions: Clearly state what needs to be done next (if applicable) and why.",
26
- "Store key facts: Store any relevant information in memory with their type (episodic, semantic, or procedural).",
27
- "Be clear, concise, and prioritize storing key facts that may help improve future interactions.",
28
- ],
29
20
  },
30
21
  },
31
22
  };
@@ -1,10 +1,16 @@
1
+ import { CacheMemory } from "../../memory/cache";
1
2
  import { PersistentMemory } from "../../memory/persistent";
2
3
  import { ActionSchema, State } from "../../types";
4
+ import { Interpreter } from "../interpreter";
3
5
  export declare class Evaluator {
4
6
  private readonly model;
5
7
  tools: ActionSchema[];
6
8
  private memory;
7
- constructor(tools: ActionSchema[], memory: PersistentMemory);
9
+ private interpreters;
10
+ constructor(tools: ActionSchema[], memory: {
11
+ persistent: PersistentMemory;
12
+ cache?: CacheMemory;
13
+ }, interpreters: Interpreter[]);
8
14
  composeContext(state: State): string;
9
15
  process(prompt: string, results: string): Promise<any>;
10
16
  }