@ai.ntellect/core 0.1.5 → 0.1.8
Sign up to get free protection for your applications and to get access to all the features.
- package/README.FR.md +111 -50
- package/README.md +131 -65
- package/dist/llm/orchestrator/context.js +1 -1
- package/llm/orchestrator/context.ts +1 -1
- package/package.json +1 -1
package/README.FR.md
CHANGED
@@ -6,7 +6,8 @@
|
|
6
6
|
- [Orchestrator](#orchestrator)
|
7
7
|
- [Queue Manager](#queue-manager)
|
8
8
|
- [Synthétiseur](#synthétiseur)
|
9
|
-
- [
|
9
|
+
- [Évaluateur](#évaluateur)
|
10
|
+
- [Mémoire](#architecture-mémoire)
|
10
11
|
2. [Création et gestion des actions](#création-et-gestion-des-actions)
|
11
12
|
3. [Exécution du Workflow](#exécution-du-workflow)
|
12
13
|
4. [Appels API et côté client](#appels-api-et-côté-client)
|
@@ -47,19 +48,120 @@ Le synthétiseur est responsable de la génération des réponses et de l'analys
|
|
47
48
|
- Prend les résultats des actions exécutées.
|
48
49
|
- Crée des résumés ou des réponses adaptées.
|
49
50
|
|
51
|
+
### Évaluateur
|
52
|
+
|
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.
|
54
|
+
|
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
|
65
|
+
|
66
|
+
[![Sans-titre-2024-11-08-0220.png](https://i.postimg.cc/nryjsx5y/Sans-titre-2024-11-08-0220.png)](https://postimg.cc/rR9FbBqj)
|
67
|
+
|
68
|
+
### Mémoire
|
69
|
+
|
70
|
+
Le système implémente une architecture de mémoire qui combine différentes solutions de stockage :
|
71
|
+
|
72
|
+
#### Installation et configuration
|
73
|
+
|
74
|
+
##### Meilisearch (Mémoire à long terme)
|
75
|
+
|
76
|
+
Meilisearch peut être auto-hébergé pour un contrôle total sur la mémoire à long terme de l'agent :
|
77
|
+
|
78
|
+
```bash
|
79
|
+
# Installation de Meilisearch
|
80
|
+
curl -L https://install.meilisearch.com | sh
|
81
|
+
|
82
|
+
# Lancement de Meilisearch avec une clé maître
|
83
|
+
./meilisearch --master-key="VOTRE_CLE_MAITRE"
|
84
|
+
```
|
85
|
+
|
86
|
+
##### Redis (Mémoire à court terme)
|
87
|
+
|
88
|
+
Redis gère les composants de mémoire à court terme :
|
89
|
+
|
90
|
+
```bash
|
91
|
+
# Utilisation de Docker
|
92
|
+
docker run --name redis -d -p 6379:6379 redis
|
93
|
+
|
94
|
+
# Ou installation locale
|
95
|
+
sudo apt-get install redis-server
|
96
|
+
```
|
97
|
+
|
98
|
+
2. **Configuration** :
|
99
|
+
- Port par défaut : 6379
|
100
|
+
- Configuration des limites de mémoire
|
101
|
+
- Activation de la persistance si nécessaire
|
102
|
+
|
103
|
+
#### Types de mémoire
|
104
|
+
|
105
|
+
##### Mémoire à court terme (Redis)
|
106
|
+
|
107
|
+
1. **Mémoire procédurale** :
|
108
|
+
|
109
|
+
- Stockée dans Redis pour un accès rapide
|
110
|
+
- Contient les séquences d'actions et workflows réutilisables
|
111
|
+
- Optimise les performances via le cache
|
112
|
+
- Exemple : "Séquence commune d'approbation + échange de tokens"
|
113
|
+
|
114
|
+
2. **Mémoire épisodique court terme** :
|
115
|
+
- Messages et interactions récents
|
116
|
+
- Contexte temporaire des conversations en cours
|
117
|
+
- Stockée dans Redis pour une récupération rapide
|
118
|
+
- Exemple : "10 derniers messages de la conversation actuelle"
|
119
|
+
|
120
|
+
##### Mémoire à long terme (Meilisearch)
|
121
|
+
|
122
|
+
1. **Mémoire sémantique** :
|
123
|
+
|
124
|
+
- Stockage permanent des faits et connaissances
|
125
|
+
- Indexée pour une récupération efficace
|
126
|
+
- Stocke les relations entre concepts
|
127
|
+
- Exemple : "Le token X a l'adresse de contrat Y sur le réseau Z"
|
128
|
+
|
129
|
+
2. **Mémoire épisodique long terme** :
|
130
|
+
- Interactions et expériences historiques
|
131
|
+
- Contexte persistant entre les sessions
|
132
|
+
- Recherchable par similarité vectorielle
|
133
|
+
- Exemple : "Transactions réussies passées de l'utilisateur X"
|
134
|
+
|
50
135
|
### Cache Augmented Generation (CAG)
|
51
136
|
|
52
|
-
Le CAG
|
137
|
+
Le CAG optimise l'exécution des workflows via le cache Redis :
|
53
138
|
|
54
|
-
|
139
|
+
- **Rôle principal** : Mettre en cache les modèles procéduraux fréquemment utilisés
|
140
|
+
- **Implémentation** :
|
55
141
|
|
56
|
-
-
|
57
|
-
-
|
58
|
-
-
|
59
|
-
|
60
|
-
|
142
|
+
- Utilise Redis pour un stockage haute performance
|
143
|
+
- Stocke les séquences d'actions et leurs résultats
|
144
|
+
- Permet une récupération rapide des modèles communs
|
145
|
+
|
146
|
+
- **Bénéfices** :
|
147
|
+
- Réduit la charge de calcul
|
148
|
+
- Accélère les opérations répétitives
|
149
|
+
- Optimise l'utilisation des ressources
|
150
|
+
|
151
|
+
### Retrieval Augmented Generation (RAG)
|
61
152
|
|
62
|
-
|
153
|
+
Le système RAG améliore l'accès à la mémoire à long terme via Meilisearch :
|
154
|
+
|
155
|
+
- **Implémentation** :
|
156
|
+
|
157
|
+
- Recherche vectorielle pour la similarité sémantique
|
158
|
+
- Double indexation (globale et spécifique à l'utilisateur)
|
159
|
+
- Combine avec la recherche textuelle traditionnelle
|
160
|
+
|
161
|
+
- **Fonctionnalités** :
|
162
|
+
- Récupération de mémoire sémantique et épisodique
|
163
|
+
- Capacités de recherche contextuelle
|
164
|
+
- Classement des résultats basé sur la pertinence
|
63
165
|
|
64
166
|
---
|
65
167
|
|
@@ -204,47 +306,6 @@ export function Chat({ id, initialMessages }) {
|
|
204
306
|
|
205
307
|
Voici les éléments actuellement en développement ou à améliorer :
|
206
308
|
|
207
|
-
- Voici la version corrigée avec les titres en minuscules et des checklists en français sous chaque section :
|
208
|
-
|
209
|
-
---
|
210
|
-
|
211
|
-
## Mémoire et RAG (Retrieval Augmented Generation)
|
212
|
-
|
213
|
-
**Objectif** : Créer un système de mémoire persistante qui conserve le contexte à travers les sessions et améliore l'apprentissage de l'agent au fil du temps en intégrant des sources de connaissances externes.
|
214
|
-
|
215
|
-
**Intérêt** :
|
216
|
-
|
217
|
-
- La mémoire à long terme permet à l'agent de se souvenir des interactions passées et d'accéder à des connaissances externes pertinentes.
|
218
|
-
- Des réponses plus contextuelles et personnalisées.
|
219
|
-
- Amélioration de l'efficacité et de la précision des interactions.
|
220
|
-
- Réduction des réponses incorrectes ou obsolètes.
|
221
|
-
- Permet un apprentissage et une adaptation continus.
|
222
|
-
|
223
|
-
**Étapes à mettre en place** :
|
224
|
-
|
225
|
-
**Infrastructure de mémoire** :
|
226
|
-
|
227
|
-
- [x] Intégration d'une base de données vectorielle.
|
228
|
-
- [x] Système de récupération basé sur la pertinence.
|
229
|
-
- [ ] Consolidation et nettoyage automatique de la mémoire.
|
230
|
-
- [ ] Hiérarchie de la mémoire (working/long-term memory).
|
231
|
-
|
232
|
-
**Intégration des connaissances** :
|
233
|
-
|
234
|
-
- [ ] Pipeline de traitement des documents.
|
235
|
-
- [ ] Intégration de la base de connaissances.
|
236
|
-
- [ ] Système de vérification des sources.
|
237
|
-
- [ ] Récupération contextuelle.
|
238
|
-
- [ ] Capacités de recherche sémantique.
|
239
|
-
|
240
|
-
**Types de mémoire** :
|
241
|
-
|
242
|
-
- [ ] Épisodique : Interactions et expériences passées.
|
243
|
-
- [ ] Sémantique : Connaissances et faits externes.
|
244
|
-
- [x] Procédurale : Modèles et workflows appris.
|
245
|
-
|
246
|
-
**Statut** : Implémentation de base avec Redis terminée, intégration de la base de données vectorielle et pipeline RAG en cours. Conception de l'architecture finalisée, avec une implémentation initiale lancée.
|
247
|
-
|
248
309
|
---
|
249
310
|
|
250
311
|
## Collaboration multi-agent
|
package/README.md
CHANGED
@@ -6,7 +6,8 @@
|
|
6
6
|
- [Orchestrator](#orchestrator)
|
7
7
|
- [Queue Manager](#queue-manager)
|
8
8
|
- [Synthesizer](#synthesizer)
|
9
|
-
- [
|
9
|
+
- [Evaluator](#evaluator)
|
10
|
+
- [Memory](#memory-architecture)
|
10
11
|
2. [Action Creation and Management](#action-creation-and-management)
|
11
12
|
3. [Workflow Execution](#workflow-execution)
|
12
13
|
4. [API Calls and Client Side](#api-calls-and-client-side)
|
@@ -14,7 +15,7 @@
|
|
14
15
|
|
15
16
|
---
|
16
17
|
|
17
|
-
## 1. Main
|
18
|
+
## 1. Main components
|
18
19
|
|
19
20
|
The system relies on several key components that ensure smooth and efficient management of actions and the overall workflow process.
|
20
21
|
|
@@ -24,9 +25,10 @@ The orchestrator is responsible for managing the execution of actions within a w
|
|
24
25
|
|
25
26
|
- **Main Role**: Organize and direct the execution of actions.
|
26
27
|
- **Interactions**:
|
27
|
-
-
|
28
|
-
-
|
29
|
-
-
|
28
|
+
- Analyzes user prompts to determine required actions
|
29
|
+
- Requests actions to be executed
|
30
|
+
- Uses cache memory to avoid redundancy
|
31
|
+
- Emits events to inform other components about the state of the workflow
|
30
32
|
|
31
33
|
### Queue Manager
|
32
34
|
|
@@ -42,34 +44,137 @@ The queue manager organizes the actions to be executed and manages their executi
|
|
42
44
|
|
43
45
|
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.
|
44
46
|
|
45
|
-
- **Main Role**: Transform the results of actions into a comprehensible and structured output
|
47
|
+
- **Main Role**: Transform the results of actions into a comprehensible and structured output
|
46
48
|
- **Interactions**:
|
47
|
-
- Takes the results of executed actions
|
48
|
-
- Creates summaries or tailored responses
|
49
|
+
- Takes the results of executed actions
|
50
|
+
- Creates summaries or tailored responses
|
51
|
+
- Formats final output for user consumption
|
52
|
+
- Can handle streaming responses
|
53
|
+
|
54
|
+
### Evaluator
|
55
|
+
|
56
|
+
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.
|
57
|
+
|
58
|
+
- **Main Role**: Evaluate action results and determine next steps
|
59
|
+
- **Main Functions**:
|
60
|
+
- Analyzes results from executed actions
|
61
|
+
- Determines if additional actions are needed
|
62
|
+
- Suggests next actions to the orchestrator
|
63
|
+
- Ensures completion of user requirements
|
64
|
+
- **Interactions**:
|
65
|
+
- Works with orchestrator to manage workflow
|
66
|
+
- Processes action results
|
67
|
+
- Can trigger additional action cycles
|
68
|
+
|
69
|
+
[![Sans-titre-2024-11-08-0220.png](https://i.postimg.cc/nryjsx5y/Sans-titre-2024-11-08-0220.png)](https://postimg.cc/rR9FbBqj)
|
70
|
+
|
71
|
+
### Memory
|
72
|
+
|
73
|
+
The system implements a sophisticated memory architecture that combines different storage solutions for various types of memory:
|
74
|
+
|
75
|
+
#### Installation and setup
|
76
|
+
|
77
|
+
##### Meilisearch (Long-term memory)
|
78
|
+
|
79
|
+
Meilisearch can be self-hosted for complete control over the agent's long-term memory:
|
80
|
+
|
81
|
+
```bash
|
82
|
+
# Install Meilisearch
|
83
|
+
curl -L https://install.meilisearch.com | sh
|
84
|
+
|
85
|
+
# Launch Meilisearch with a master key
|
86
|
+
./meilisearch --master-key="YOUR_MASTER_KEY"
|
87
|
+
```
|
88
|
+
|
89
|
+
##### Redis (Short-term memory)
|
90
|
+
|
91
|
+
Redis handles the short-term memory components:
|
92
|
+
|
93
|
+
```bash
|
94
|
+
# Using Docker
|
95
|
+
docker run --name redis -d -p 6379:6379 redis
|
96
|
+
|
97
|
+
# Or install locally
|
98
|
+
sudo apt-get install redis-server
|
99
|
+
```
|
100
|
+
|
101
|
+
2. **Configuration**:
|
102
|
+
- Default port: 6379
|
103
|
+
- Configure memory limits
|
104
|
+
- Enable persistence if needed
|
105
|
+
|
106
|
+
#### Memory types
|
107
|
+
|
108
|
+
#### Short-term memory (Redis)
|
109
|
+
|
110
|
+
1. **Procedural Memory**:
|
111
|
+
|
112
|
+
- Stored in Redis for fast access
|
113
|
+
- Contains reusable action sequences and workflows
|
114
|
+
- Optimizes performance through caching
|
115
|
+
- Example: "Common token approval + swap sequence"
|
116
|
+
|
117
|
+
2. **Short-term episodic memory**:
|
118
|
+
- Recent messages and interactions
|
119
|
+
- Temporary context for ongoing conversations
|
120
|
+
- Stored in Redis for quick retrieval
|
121
|
+
- Example: "Last 10 messages in current conversation"
|
122
|
+
|
123
|
+
#### Long-term memory (Meilisearch)
|
124
|
+
|
125
|
+
1. **Semantic memory**:
|
126
|
+
|
127
|
+
- Permanent storage of facts and knowledge
|
128
|
+
- Indexed for efficient retrieval
|
129
|
+
- Stores relationships between concepts
|
130
|
+
- Example: "Token X has contract address Y on network Z"
|
131
|
+
|
132
|
+
2. **Long-term episodic Memory**:
|
133
|
+
- Historical interactions and experiences
|
134
|
+
- Persistent context across sessions
|
135
|
+
- Searchable through vector similarity
|
136
|
+
- Example: "User X's past successful transactions"
|
49
137
|
|
50
138
|
### Cache Augmented Generation (CAG)
|
51
139
|
|
52
|
-
CAG
|
140
|
+
CAG optimizes workflow execution through Redis-based caching:
|
53
141
|
|
54
|
-
|
142
|
+
- **Main Role**: Cache frequently used procedural patterns
|
143
|
+
- **Implementation**:
|
55
144
|
|
56
|
-
-
|
57
|
-
-
|
58
|
-
-
|
59
|
-
|
60
|
-
|
145
|
+
- Uses Redis for high-performance storage
|
146
|
+
- Stores action sequences and their results
|
147
|
+
- Enables quick retrieval of common patterns
|
148
|
+
|
149
|
+
- **Benefits**:
|
150
|
+
- Reduces computation overhead
|
151
|
+
- Speeds up repeated operations
|
152
|
+
- Optimizes resource usage
|
153
|
+
|
154
|
+
### Retrieval Augmented Generation (RAG)
|
61
155
|
|
62
|
-
|
156
|
+
The RAG system enhances long-term memory access through Meilisearch:
|
157
|
+
|
158
|
+
- **Implementation**:
|
159
|
+
|
160
|
+
- Vector-based search for semantic similarity
|
161
|
+
- Dual indexing (global and user-specific)
|
162
|
+
- Combines with traditional text search
|
163
|
+
|
164
|
+
- **Features**:
|
165
|
+
- Semantic and episodic memory retrieval
|
166
|
+
- Context-aware search capabilities
|
167
|
+
- Relevance-based result ranking
|
63
168
|
|
64
169
|
---
|
65
170
|
|
66
|
-
## 2. Action
|
171
|
+
## 2. Action creation and management
|
67
172
|
|
68
173
|
Actions are specific tasks to be performed within a workflow. They can involve interactions with APIs, blockchain transactions, or any other necessary operations.
|
69
174
|
|
70
175
|
Each action is defined as an object containing a name, description, parameters, and an execution function.
|
71
176
|
|
72
|
-
### Example of an
|
177
|
+
### Example of an action
|
73
178
|
|
74
179
|
```typescript
|
75
180
|
import { networkConfigs } from "@config/network";
|
@@ -115,7 +220,7 @@ export const prepareTransaction = {
|
|
115
220
|
};
|
116
221
|
```
|
117
222
|
|
118
|
-
### How to
|
223
|
+
### How to define an action:
|
119
224
|
|
120
225
|
1. **Name**: Unique identifier for the action.
|
121
226
|
2. **Description**: Brief description of what the action does.
|
@@ -124,11 +229,11 @@ export const prepareTransaction = {
|
|
124
229
|
|
125
230
|
---
|
126
231
|
|
127
|
-
## 3. Workflow
|
232
|
+
## 3. Workflow execution
|
128
233
|
|
129
234
|
The workflow represents the entire process of executing a number of defined actions. When a user sends a prompt, the orchestrator determines which actions to perform based on the needs.
|
130
235
|
|
131
|
-
### Example of
|
236
|
+
### Example of creating a workflow:
|
132
237
|
|
133
238
|
```typescript
|
134
239
|
const tools = [
|
@@ -148,7 +253,7 @@ const workflow = new Workflow(
|
|
148
253
|
- **MemoryCache**: Reuses previous results.
|
149
254
|
- **EventEmitter**: Tracks and notifies the state of the workflow.
|
150
255
|
|
151
|
-
### Workflow
|
256
|
+
### Workflow process:
|
152
257
|
|
153
258
|
1. The user’s prompt is analyzed.
|
154
259
|
2. The orchestrator decides which actions are needed and their order.
|
@@ -157,7 +262,7 @@ const workflow = new Workflow(
|
|
157
262
|
|
158
263
|
---
|
159
264
|
|
160
|
-
## 4. API
|
265
|
+
## 4. API calls and client side
|
161
266
|
|
162
267
|
```typescript
|
163
268
|
fastify.post("/api/chat", {
|
@@ -204,46 +309,7 @@ Here are the elements currently in development or improvement:
|
|
204
309
|
|
205
310
|
---
|
206
311
|
|
207
|
-
##
|
208
|
-
|
209
|
-
**Objective**: Create a persistent memory system that retains context across sessions and improves the agent’s learning over time by integrating external knowledge sources.
|
210
|
-
|
211
|
-
**Interest**:
|
212
|
-
|
213
|
-
- Long-term memory allows the agent to remember past interactions and access relevant external knowledge.
|
214
|
-
- More contextual and personalized responses.
|
215
|
-
- Improved efficiency and accuracy of interactions.
|
216
|
-
- Reduction of incorrect or outdated responses.
|
217
|
-
- Enables continuous learning and adaptation.
|
218
|
-
|
219
|
-
**Steps to Implement**:
|
220
|
-
|
221
|
-
**Memory Infrastructure**:
|
222
|
-
|
223
|
-
- [x] Integration of a vector database.
|
224
|
-
- [x] Relevance-based retrieval system.
|
225
|
-
- [ ] Automatic memory consolidation and cleaning.
|
226
|
-
- [ ] Memory hierarchy (working/long-term memory).
|
227
|
-
|
228
|
-
**Knowledge Integration**:
|
229
|
-
|
230
|
-
- [ ] Document processing pipeline.
|
231
|
-
- [ ] Integration of knowledge base.
|
232
|
-
- [ ] Source verification system.
|
233
|
-
- [ ] Contextual retrieval.
|
234
|
-
- [ ] Semantic search capabilities.
|
235
|
-
|
236
|
-
**Memory Types**:
|
237
|
-
|
238
|
-
- [ ] Episodic: Past interactions and experiences.
|
239
|
-
- [ ] Semantic: External knowledge and facts.
|
240
|
-
- [x] Procedural: Learned models and workflows.
|
241
|
-
|
242
|
-
**Status**: Basic implementation with Redis complete, vector database integration and RAG pipeline in progress. Architecture design finalized, with initial implementation launched.
|
243
|
-
|
244
|
-
---
|
245
|
-
|
246
|
-
## Multi-Agent Collaboration
|
312
|
+
## Multi-agent collaboration
|
247
313
|
|
248
314
|
**Objective**: Enable multiple agents to collaborate on complex tasks with specialization and coordination.
|
249
315
|
|
@@ -259,7 +325,7 @@ Here are the elements currently in development or improvement:
|
|
259
325
|
|
260
326
|
---
|
261
327
|
|
262
|
-
## Complex
|
328
|
+
## Complex on-chain interactions management
|
263
329
|
|
264
330
|
**Objective**: Create a model for recognizing on-chain interactions and creating workflows for complex interactions.
|
265
331
|
|
@@ -279,7 +345,7 @@ Here are the elements currently in development or improvement:
|
|
279
345
|
|
280
346
|
---
|
281
347
|
|
282
|
-
## Lit Protocol
|
348
|
+
## Lit Protocol implementation
|
283
349
|
|
284
350
|
**Objective**: Add the ability to execute Lit actions, enabling decentralized and secure calculations on the Lit network.
|
285
351
|
|
@@ -9,7 +9,7 @@ exports.orchestratorContext = {
|
|
9
9
|
"If there is no action to do, you must answer in the 'answer' field.",
|
10
10
|
"If some parameters are not clear or missing, YOU MUST ask the user for them.",
|
11
11
|
"ALWAYS use the same language as user request. (If it's English, use English, if it's French, use French, etc.)",
|
12
|
-
"
|
12
|
+
"For QUESTIONS or ANALYSIS, BEFORE executing ANY actions, you MUST search in memory for similar queries AS THE ONLY ACTION TO EXECUTE.",
|
13
13
|
],
|
14
14
|
warnings: ["NEVER repeat same actions if the user doesn't ask for it."],
|
15
15
|
},
|
@@ -8,7 +8,7 @@ export const orchestratorContext = {
|
|
8
8
|
"If there is no action to do, you must answer in the 'answer' field.",
|
9
9
|
"If some parameters are not clear or missing, YOU MUST ask the user for them.",
|
10
10
|
"ALWAYS use the same language as user request. (If it's English, use English, if it's French, use French, etc.)",
|
11
|
-
"
|
11
|
+
"For QUESTIONS or ANALYSIS, BEFORE executing ANY actions, you MUST search in memory for similar queries AS THE ONLY ACTION TO EXECUTE.",
|
12
12
|
],
|
13
13
|
warnings: ["NEVER repeat same actions if the user doesn't ask for it."],
|
14
14
|
},
|