@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.
- package/README.FR.md +58 -19
- package/README.md +40 -17
- package/agent/index.ts +54 -26
- package/dist/agent/index.d.ts +12 -8
- package/dist/agent/index.js +34 -12
- package/dist/index.d.ts +2 -1
- package/dist/index.js +2 -1
- package/dist/llm/evaluator/context.d.ts +0 -1
- package/dist/llm/evaluator/context.js +3 -12
- package/dist/llm/evaluator/index.d.ts +7 -1
- package/dist/llm/evaluator/index.js +37 -24
- package/dist/llm/interpreter/context.d.ts +32 -0
- package/dist/llm/interpreter/context.js +90 -0
- package/dist/llm/interpreter/index.d.ts +17 -0
- package/dist/llm/{synthesizer → interpreter}/index.js +18 -27
- package/dist/llm/orchestrator/context.js +1 -1
- package/dist/llm/orchestrator/index.d.ts +7 -3
- package/dist/llm/orchestrator/index.js +5 -48
- package/dist/memory/cache.d.ts +2 -2
- package/dist/memory/cache.js +4 -5
- package/dist/memory/persistent.d.ts +1 -0
- package/dist/memory/persistent.js +2 -1
- package/dist/test.d.ts +54 -0
- package/dist/test.js +125 -20
- package/dist/types.d.ts +12 -13
- package/index.ts +2 -2
- package/llm/evaluator/context.ts +3 -12
- package/llm/evaluator/index.ts +57 -27
- package/llm/interpreter/context.ts +89 -0
- package/llm/{synthesizer → interpreter}/index.ts +20 -26
- package/llm/orchestrator/context.ts +1 -1
- package/llm/orchestrator/index.ts +14 -67
- package/memory/cache.ts +5 -6
- package/memory/persistent.ts +3 -1
- package/package.json +1 -1
- package/types.ts +13 -13
- package/dist/llm/synthesizer/context.d.ts +0 -15
- package/dist/llm/synthesizer/context.js +0 -71
- package/dist/llm/synthesizer/index.d.ts +0 -14
- 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
|
-
###
|
42
|
+
### Évaluateur
|
43
43
|
|
44
|
-
|
44
|
+
L'évaluateur collabore maintenant avec les Interpreters :
|
45
45
|
|
46
|
-
-
|
47
|
-
-
|
48
|
-
|
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
|
-
###
|
50
|
+
### Interpreter
|
52
51
|
|
53
|
-
L'
|
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
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
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
|
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
|
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
|
-
-
|
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
|
-
-
|
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,
|
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
|
15
|
-
private readonly
|
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
|
-
|
24
|
-
|
26
|
+
interpreters,
|
27
|
+
memory,
|
25
28
|
stream,
|
26
29
|
maxEvaluatorIteration = 1,
|
27
30
|
}: {
|
28
|
-
user: User;
|
29
31
|
orchestrator: Orchestrator;
|
30
|
-
|
31
|
-
|
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.
|
37
|
-
this.
|
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
|
-
|
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.
|
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.
|
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
|
-
|
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
|
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
|
178
|
+
const { interpreter, initialPrompt, data } = actionsResult;
|
151
179
|
|
152
180
|
return this.stream
|
153
181
|
? (
|
154
|
-
await
|
155
|
-
|
156
|
-
|
157
|
-
)
|
182
|
+
await interpreter.streamProcess(initialPrompt, {
|
183
|
+
userRequest: initialPrompt,
|
184
|
+
results: data,
|
185
|
+
})
|
158
186
|
).toDataStreamResponse()
|
159
|
-
: await
|
160
|
-
|
161
|
-
|
162
|
-
);
|
187
|
+
: await interpreter.process(initialPrompt, {
|
188
|
+
userRequest: initialPrompt,
|
189
|
+
results: data,
|
190
|
+
});
|
163
191
|
}
|
164
192
|
|
165
193
|
private transformActions(actions: ActionSchema[]) {
|
package/dist/agent/index.d.ts
CHANGED
@@ -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
|
5
|
+
import { AgentEvent } from "../types";
|
5
6
|
export declare class Agent {
|
6
7
|
private readonly actionHandler;
|
7
8
|
private readonly orchestrator;
|
8
|
-
private readonly
|
9
|
-
private readonly
|
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,
|
15
|
-
user: User;
|
15
|
+
constructor({ orchestrator, interpreters, memory, stream, maxEvaluatorIteration, }: {
|
16
16
|
orchestrator: Orchestrator;
|
17
|
-
|
18
|
-
|
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
|
27
|
+
private getInterpreter;
|
28
|
+
private interpreterResult;
|
25
29
|
private transformActions;
|
26
30
|
private formatResults;
|
27
31
|
}
|
package/dist/agent/index.js
CHANGED
@@ -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
|
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,
|
10
|
+
constructor({ orchestrator, interpreters, memory, stream, maxEvaluatorIteration = 1, }) {
|
11
11
|
this.evaluatorIteration = 0;
|
12
12
|
this.accumulatedResults = "";
|
13
13
|
this.orchestrator = orchestrator;
|
14
|
-
this.
|
15
|
-
this.
|
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
|
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.
|
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.
|
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
|
-
|
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
|
-
|
74
|
-
|
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
|
77
|
-
|
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);
|
@@ -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
|
-
"
|
13
|
-
"
|
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
|
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
|
-
|
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
|
}
|