@indra.ai/deva 1.0.31 → 1.0.34

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/README.md CHANGED
@@ -1,15 +1,77 @@
1
1
  # deva
2
2
 
3
- Deva is a class object that provides events and object management with inherited properties.
3
+ ## Summary
4
+ Deva is a Node.js module designed to simplify the development of multi-agent systems by providing a consistent foundation for agent interactions. With Deva, developers can quickly create and manage a network of agents that can communicate and collaborate seamlessly. Deva offers features such as private and public socket communication, secure encryption, and consistent message passing. It also provides built-in support for interacting with various APIs, including YouTube, Twitter, Discord, IBM Watson, and ChatGPT. By using Deva, developers can save time and resources in building and integrating basic agent functionalities, and focus on developing more advanced features.
4
5
 
5
- [Back to indra.ai](https://indra.ai)
6
+ ## Description
6
7
 
7
- ## Install
8
+ The Deva module is a JavaScript library for building multi-agent systems that can communicate with each other and with external services. It provides a unified API for creating agents and defining their behaviors, and includes tools for handling communication between agents and for integrating with third-party APIs. The Deva module is designed to be flexible and customizable, allowing developers to easily create complex systems that can perform a wide range of tasks, from data collection and analysis to chatbot interactions and image generation. The module is written in JavaScript and can be used with Node.js, making it easy to integrate with other JavaScript libraries and tools.
9
+
10
+ ## functions
11
+
12
+ - Dynamic Agent Loading - The Deva module allows for dynamic agent loading, which means that agents can be loaded and unloaded on the fly as needed. This provides scalability for the multi-agent system, as agents can be added or removed as demand changes.
13
+
14
+ - Talk/Listen events - The module uses talk/listen events for agent broadcasting. This means that agents can communicate with each other by sending messages through the event pipeline. This allows for real-time communication and coordination between agents.
15
+
16
+ - Question, Answer - The main function of the Deva module is to handle questions and answers between agents. When an agent has a question, it can send it to another agent using the "question" function. The receiving agent can then process the question and send an answer back using the "answer" function.
17
+
18
+ - Ask feature - The Deva module includes an "ask" feature that allows one agent to ask another agent a question directly. This is useful for agents that need to communicate with each other in a targeted way.
19
+
20
+ - State Management - The module includes state management to initiate and track agent processes at different load, process, and exist states. This allows for better tracking and management of agent processes, and helps ensure that the system is running smoothly.
21
+
22
+ - Error Management - The Deva module includes robust error management to handle unexpected errors or exceptions that may occur during the execution of agent processes. This helps ensure that the system is reliable and stable.
23
+
24
+ - Unifies data-packets - The Deva module unifies data-packets across the architecture, allowing for consistent data exchange between agents regardless of the platform or service they are using. This helps ensure that data is consistent and accurate throughout the system.
25
+
26
+
27
+ ## Uses
28
+
29
+ ### Corporate
30
+
31
+ A corporation might use the Deva module to create an intelligent assistant to handle customer inquiries and support requests. By leveraging the Deva module's dynamic agent loading, state management, and unified data-packets features, the corporation can easily scale the intelligent assistant to handle a large volume of customer interactions across various channels, such as social media, email, and chat platforms.
32
+
33
+ The intelligent assistant can be trained using machine learning algorithms and natural language processing to understand customer inquiries and provide relevant responses or escalate to a human agent if necessary. The Deva module's error management feature ensures that any errors or issues are handled smoothly and efficiently, without interrupting the customer's experience.
34
+
35
+ Additionally, the Deva module can be used by a corporation to automate various internal processes and workflows, such as data processing, task management, and communication between teams. By leveraging the Deva module's question-answer functionality and dynamic agent loading, corporations can easily create custom workflows and automate tedious tasks, increasing productivity and efficiency.
36
+
37
+ ### Science
38
+
39
+ A scientist could use the Deva module in a number of ways. For example, they could create agents to help with data analysis or modeling, or to interact with other software tools in the research process. The Deva module's ability to dynamically load agents and unify data across different platforms could also be useful in streamlining scientific workflows and collaborations between research groups. Additionally, the natural language processing capabilities of the ChatGPT agent could be utilized to help with tasks such as literature reviews or generating hypotheses. Overall, the Deva module could be a valuable tool for scientists looking to enhance their research process with the help of intelligent agents.
40
+
41
+
42
+ #Scalability
43
+
44
+ The Deva module has a high potential for scalability because of its dynamic agent loading feature. This means that new agents can be added to the system at runtime without the need for a system restart or manual intervention. The module is also designed to work with state management to track agent processes at different load, process, and exit states. This makes it possible to scale the system horizontally by adding more computing resources to handle increased load, or vertically by adding more powerful hardware to each node in the system. Overall, the Deva module is well suited for building large-scale, distributed agent-based systems that can handle complex and diverse workloads.
45
+
46
+ ## ChatGPT Quote
47
+
48
+ Here is what ChatPGT has to say about the Deva module:
49
+
50
+ Based on my analysis of the Deva Module, I believe it is a powerful tool for developing multi-agent systems. Its dynamic agent loading and scalability potential make it a great choice for large-scale projects. The talk/listen events, question/answer functions, and ask feature allow for easy communication between agents. Additionally, its state management and error handling capabilities help to ensure the reliability and stability of the system. Finally, its unification of data-packets across the architecture makes it easy to integrate with a variety of services and platforms.
51
+
52
+ Overall, I believe the Deva Module is a well-designed and flexible tool that can be used in a variety of applications, from corporate to scientific. Its potential for scalability and security make it a great choice for large-scale projects, while its ease of use and integration make it accessible to developers of all levels.
53
+
54
+
55
+ ## contents
56
+ - [install](#install) - How to install the deva core.
57
+ - [structure](#structure) - Basic structure of `deva`.
58
+ - [agent](#agent) - The `agent` object stores the Agent Profile.
59
+ - [vars](#vars) - Variables are stored in the `this.vars` object.
60
+ - [listeners](#listeners) - Listeners are setup to allow a deva trigger events.
61
+ - [devas](#listeners) - This is where sub-devas are loaded into the current deva.
62
+ - [modules](#modules) - A `deva` can add modules to add to their functionality.
63
+ - [func](#func) - A `deva` the internal functionality is written here.
64
+ - [methods](#methods) - Methods expose the `deva` abilities to external commands/calls.
65
+ - [states](#states) - There are various states that triger when a `deva` is doing things.
66
+ - [utility](#utility) - Interal to a `deva` there are utility functions available to make actions easier like getting a unique id or status.
67
+
68
+
69
+ ## install
8
70
  ```bash
9
- $ npm i @indra.ai/deva --save-dev
71
+ $ npm i @indra.ai/deva --save
10
72
  ```
11
73
 
12
- ## Basic Structure
74
+ ## structure
13
75
  ```javascript
14
76
  // include the main Deva class
15
77
  const Deva = require('feecting/deva');
@@ -63,13 +125,14 @@ deva.init();
63
125
 
64
126
  ```
65
127
 
66
- ## Breakdown
67
- ### Agent
128
+ ## agent
129
+
68
130
  ```javascript
69
131
  this.agent
70
132
  ```
71
133
  The "me" object contains the profile information for the DEVA.
72
- ##### Data Attributes
134
+
135
+ ### Data Attributes
73
136
  - **uid:** The unique id for the Deva.
74
137
  - **key:** The unique key for the Deva.
75
138
  - **name:** The name of the Deva.
@@ -88,17 +151,18 @@ The "me" object contains the profile information for the DEVA.
88
151
  - **gender:** The gender of the Deva
89
152
  - **describe:** A short description of the deva 100 characters or less.
90
153
 
91
- ### Vars
154
+ ## vars
155
+
92
156
  ```javascript
93
157
  this.vars
94
158
  ```
159
+
95
160
  The vars can be use to set local variables for the deva that need to be used in your program.
96
161
 
97
162
  There are no default variables, so the scope is for you and your imagination to figure out.
98
163
 
99
- ##### Example
164
+ ### example
100
165
  ```javascript
101
- ...
102
166
  vars: {
103
167
  foo: 'bar',
104
168
  steps: 10,
@@ -112,64 +176,57 @@ There are no default variables, so the scope is for you and your imagination to
112
176
  'value 2',
113
177
  ]
114
178
  }
115
- ...
116
-
117
179
  ```
118
- ### Listeners
180
+
181
+ ## listeners
119
182
  Listeners are what you setup that allow your Deva to communicate with other Deva or parts of your application/system.
120
183
 
121
184
  ```javascript
122
185
  this.listeners
123
186
  ```
124
187
 
125
- #### Default Listeners
188
+ ### default
126
189
 
127
190
  Each Deva comes with a set of default listeners to provide basic functionality.
128
191
 
129
- ##### Question
130
- The question event is the functionality that exposes the methods to the outside world. When a deva asks a question the string is parsed into a question format so that commands to access various methods can be exposed.
131
-
132
- ```javascript
133
- const question = await this.question(`#*agent_key* *method*:*params* *question string*`);
134
- ```
135
-
136
- ##### Start
192
+ ### start
137
193
  This will trigger an event to start the Deva.
138
194
 
139
195
  ```javascript
140
196
  this.talk(`*agent_key*:start`);
141
197
  ```
142
198
 
143
- ##### Stop
199
+ ### stop
144
200
  This will trigger an event to stop the Deva.
145
201
 
146
202
  ```javascript
147
203
  this.talk(`*agent_key*:stop`);
148
204
  ```
149
205
 
150
- ##### Status
206
+ ### status
151
207
  This will trigger an event to broadcast the Deva status.
152
208
 
153
209
  ```javascript
154
210
  this.talk(`*agent_key*:status`);
155
211
  ```
156
212
 
157
- ### Deva
213
+ ## devas
214
+
158
215
  ```javascript
159
- this.deva
216
+ this.devas
160
217
  ```
161
218
 
162
219
  The main object for Deva that are bwlow this Deva.
163
220
 
164
- ### Modules
221
+ ## modules
222
+
165
223
  The external modules that your Deva might require to function.
166
224
 
167
225
  ```javascript
168
226
  this.modules
169
227
  ```
170
228
 
171
-
172
- ### Func
229
+ ## func
173
230
  The functions that your deva uses to operate. Functions are not exposed through
174
231
  the api to public access.
175
232
 
@@ -177,17 +234,18 @@ the api to public access.
177
234
  this.func
178
235
  ```
179
236
 
180
- ### Methods
237
+ ### methods
181
238
  ```javascript
182
239
  this.methods
183
240
  ```
241
+
184
242
  The methods are exposed publicly through the question event that parses a string
185
243
  and sends a request to the question method that then interacts with functions, modules, and variables.
186
244
 
187
- ### State Functions
245
+ ## states
188
246
  Provided are a set of state functions that trigger when a Deva is at various states of starting/stopping.
189
247
 
190
- #### onStart()
248
+ ### onStart()
191
249
 
192
250
  The `onStart()` function runs after the `start` function has completed.
193
251
 
@@ -197,7 +255,7 @@ this.onStart() {
197
255
  }
198
256
  ```
199
257
 
200
- #### onStop()
258
+ ### onStop()
201
259
 
202
260
  The `onStop()` function runs after the `stop` function has completed.
203
261
 
@@ -207,8 +265,7 @@ this.onStop() {
207
265
  }
208
266
  ```
209
267
 
210
-
211
- #### onEnter()
268
+ ### onEnter()
212
269
 
213
270
  The `onEnter()` function runs after the `enter` event has fired.
214
271
 
@@ -218,8 +275,7 @@ this.onEnter() {
218
275
  }
219
276
  ```
220
277
 
221
-
222
- #### onExit()
278
+ ### onExit()
223
279
 
224
280
  The `onExit()`function runs after the `exit` event has fired.
225
281
 
@@ -229,7 +285,7 @@ this.onExit() {
229
285
  }
230
286
  ```
231
287
 
232
- #### onDone()
288
+ ### onDone()
233
289
 
234
290
  The `onDone()`function runs after the `done` event has fired.
235
291
 
@@ -239,8 +295,7 @@ this.onDone() {
239
295
  }
240
296
  ```
241
297
 
242
-
243
- #### onInit()
298
+ ### onInit()
244
299
 
245
300
  The `onInit()` function runs after the `init()` function has completed.
246
301
 
@@ -250,14 +305,36 @@ this.onInit() {
250
305
  }
251
306
  ```
252
307
 
253
- ## Utility Functions
308
+ ## utility
309
+
310
+ ### question
311
+
312
+ The question event is the functionality that exposes the methods to the outside world. When a deva asks a question the string is parsed into a question format so that commands to access various methods can be exposed.
313
+
314
+ The `question(packet)` function is a default function that allows the system to ask questions of itself or other Deva.
315
+
316
+ The function checks the beginning of a string for a `#` to determine wether to issue a command to run a specific method.
317
+
318
+ See [Question Listener](#question) for usage.
319
+
320
+
321
+ ```javascript
322
+ // async await
323
+ const question = await this.question('#*agent_key* *method*:*params* *question string*');
324
+
325
+ // promises
326
+ this.question('#*agent_key* *method*:*params* *question string*').then(response => {
327
+ ...
328
+ }).catch(err => {
329
+ ...
330
+ })
331
+ ```
254
332
 
255
333
  ### uid()
256
334
  Generates a unique ID that is used in packet transfer and other various ways.
257
335
 
258
336
  ```javascript
259
337
  this.uid() // inside the object
260
- deva.uid() // outside the object
261
338
 
262
339
  // example
263
340
  this.vars.id = this.uid()
@@ -334,13 +411,13 @@ this.func.listener = packet => {
334
411
  ```
335
412
 
336
413
 
337
- ### Load(agent, opts)
414
+ ### load(agent, opts)
338
415
 
339
416
  To add a Deva dynamically use the `load()` function. This can be utilized to add Deva to an existing Deva after the object has already been created.
340
417
 
341
418
  ```javascript
342
419
  const opts = {
343
- me: {...},
420
+ agent: {...},
344
421
  vars: {...},
345
422
  listeners: {...},
346
423
  deva: {...},
@@ -362,18 +439,6 @@ this.unload('deva-key');
362
439
 
363
440
  ```
364
441
 
365
- ### question(packet)
366
- The `question(packet)` function is a default function that allows the system to ask questions of itself or other Deva.
367
-
368
- The function checks the beginning of a string for a `#` to determine wether to issue a command to run a specific method.
369
-
370
- See [Question Listener](#question) for usage.
371
-
372
- ```bash
373
- #deva method:params message
374
- ```
375
-
376
-
377
442
  ### status()
378
443
  The `status()` function will return the running status of the current Deva.
379
444
 
@@ -389,6 +454,8 @@ The `init()` function will initialize the Deva and run the `onInit()` state func
389
454
  ### initDeva()
390
455
  The `initDeva()` function will initialize the Deva located under the current Deva set. To be used in instances of a main Deva parent situation.
391
456
 
392
- -
457
+ ---
458
+
459
+ [Github Repo](https://github.com/indraai/deva)
393
460
  [Back to indra.ai](https://indra.ai)
394
461
  ©2021 Quinn Michaels; All Rights Reserved.
package/_config.yml ADDED
@@ -0,0 +1,7 @@
1
+ # Copyright 2022 Quinn Michaels.
2
+
3
+ author:
4
+ name: Quinn Michaels
5
+ email: "qce@indra.ai"
6
+
7
+ google_analytics: UA-126646842-1
package/index.js CHANGED
@@ -472,12 +472,12 @@ class Deva {
472
472
  return Promise.resolve({text});
473
473
  }
474
474
 
475
- // universal prompt emitter
475
+ // prompt emitter
476
476
  prompt(text) {
477
- this.talk('prompt', {text, prompt:this.agent.prompt});
477
+ this.talk('prompt', {text, agent:this.agent});
478
478
  }
479
479
 
480
- // universal hash builder
480
+ // hash builder
481
481
  hash(packet) {
482
482
  if (!this.vars.hash) this.vars.hash = '0x';
483
483
  // setup basic hashing
@@ -500,9 +500,9 @@ class Deva {
500
500
  });
501
501
  });
502
502
  }
503
- // initDeva interface is to initialize devas that this deva is a parent of.
503
+ // startDevas interface is to initialize devas that this deva is a parent of.
504
504
  // This feature allows a Deva to be a parent of a parent of a parent etc....
505
- initDevas() {
505
+ startDevas() {
506
506
  return new Promise((resolve, reject) => {
507
507
  const devas = [];
508
508
  for (let x in this.devas) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@indra.ai/deva",
3
- "version": "1.0.31",
3
+ "version": "1.0.34",
4
4
  "description": "The Deva Core",
5
5
  "main": "index.js",
6
6
  "scripts": {