@indra.ai/deva.services 0.7.1 → 0.9.0
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/feature/methods.js +3 -92
- package/package.json +6 -4
package/feature/methods.js
CHANGED
|
@@ -3,15 +3,6 @@
|
|
|
3
3
|
// Legal Signature Required For Lawful Use.
|
|
4
4
|
// Distributed under VLA:59232188337076320338 LICENSE.md
|
|
5
5
|
|
|
6
|
-
function buildProfile(entity, type='assistant') {
|
|
7
|
-
const _profile = [];
|
|
8
|
-
_profile.push(`::begin:${type}:${entity.id}`);
|
|
9
|
-
for (let x in entity.profile) {
|
|
10
|
-
_profile.push(`${x}: ${entity.profile[x]}`);
|
|
11
|
-
}
|
|
12
|
-
_profile.push(`::end:${type}:${entity.hash}\n`);
|
|
13
|
-
return _profile.join('\n');
|
|
14
|
-
}
|
|
15
6
|
export default {
|
|
16
7
|
/**************
|
|
17
8
|
method: service
|
|
@@ -92,14 +83,9 @@ export default {
|
|
|
92
83
|
let doc = false;
|
|
93
84
|
try {
|
|
94
85
|
const doc_file = this.lib.fs.readFileSync(docPath, 'utf8');
|
|
95
|
-
|
|
96
|
-
doc = [
|
|
97
|
-
`${this.container.begin}:FILE:${packet.id.uid}`,
|
|
98
|
-
doc_content,
|
|
99
|
-
`${this.container.end}:FILE:${packet.id.uid}`,
|
|
100
|
-
].join('\n');
|
|
86
|
+
doc = doc_file.split(`::BEGIN:${part}`)[1].split(`::END:${part}`)[0];
|
|
101
87
|
} catch (err) {
|
|
102
|
-
|
|
88
|
+
return this.err(err, packet, reject);
|
|
103
89
|
}
|
|
104
90
|
|
|
105
91
|
this.question(`${this.askChr}feecting parse ${doc}`, {vars:this.vars}).then(feecting => {
|
|
@@ -111,83 +97,8 @@ export default {
|
|
|
111
97
|
});
|
|
112
98
|
}).catch(err => {
|
|
113
99
|
this.state('reject', `file:${packet.q.text}`);
|
|
114
|
-
return this.
|
|
100
|
+
return this.err(err, packet, reject);
|
|
115
101
|
})
|
|
116
102
|
});
|
|
117
103
|
},
|
|
118
|
-
|
|
119
|
-
/**************
|
|
120
|
-
method: ask
|
|
121
|
-
params: packet
|
|
122
|
-
describe: this method provides a global ask method to all agents.
|
|
123
|
-
***************/
|
|
124
|
-
async ask(packet) {
|
|
125
|
-
this.zone('services', packet.id.uid);
|
|
126
|
-
this.feature('services', packet.id.uid);
|
|
127
|
-
this.context('ask', `${packet.q.agent.name}:${packet.id.uid}`);
|
|
128
|
-
this.action('services', `ask:${packet.id.uid}`);
|
|
129
|
-
this.state('services', `ask:${packet.id.uid}`);
|
|
130
|
-
const data = {};
|
|
131
|
-
const agent = this.agent();
|
|
132
|
-
const client = this.client();
|
|
133
|
-
const info = this.info();
|
|
134
|
-
|
|
135
|
-
this.state('get', `corpus:${packet.id.uid}`);
|
|
136
|
-
const _corpus = await this.help('corpus', info.dir);
|
|
137
|
-
const corpus = await this.question(`${this.askChr}feecting parse ${_corpus}`);
|
|
138
|
-
|
|
139
|
-
return new Promise((resolve, reject) => {
|
|
140
|
-
if (!this.vars.ask) return resolve('Ask not configured.');
|
|
141
|
-
|
|
142
|
-
data.corpus = corpus.a.text;
|
|
143
|
-
|
|
144
|
-
this.state('set', `history:${packet.id.uid}`);
|
|
145
|
-
this.vars.ask.history.push({
|
|
146
|
-
role: 'user',
|
|
147
|
-
content: packet.q.text,
|
|
148
|
-
});
|
|
149
|
-
|
|
150
|
-
this.state('get', `ask:chat:${packet.id.uid}`);
|
|
151
|
-
this.question(`${this.askChr}chat relay ${decodeURIComponent(packet.q.text)}`, {
|
|
152
|
-
client: buildProfile(client, 'client'),
|
|
153
|
-
agent: buildProfile(agent, 'agent'),
|
|
154
|
-
corpus: corpus.a.text,
|
|
155
|
-
max_tokens: this.vars.ask.max_tokens,
|
|
156
|
-
history: this.vars.ask.history.slice(-10),
|
|
157
|
-
memory: agent.key,
|
|
158
|
-
}).then(answer => {
|
|
159
|
-
|
|
160
|
-
data.chat = answer.a.data.chat;
|
|
161
|
-
const text = [
|
|
162
|
-
`::begin:${agent.key}:${answer.id.uid}`,
|
|
163
|
-
answer.a.text,
|
|
164
|
-
`date: ${this.lib.formatDate(answer.a.created, 'long', true)}`,
|
|
165
|
-
`::end:${agent.key}:${answer.id.uid}`,
|
|
166
|
-
];
|
|
167
|
-
this.state('set', `history:a:${packet.id}`);
|
|
168
|
-
this.vars.ask.history.push({
|
|
169
|
-
role: answer.a.data.chat.role,
|
|
170
|
-
content: answer.a.data.chat.text,
|
|
171
|
-
});
|
|
172
|
-
|
|
173
|
-
this.state('parse', `ask:${packet.id.uid}`);
|
|
174
|
-
return this.question(`${this.askChr}feecting parse ${text.join('\n')}`);
|
|
175
|
-
}).then(feecting => {
|
|
176
|
-
data.feecting = feecting.a.data;
|
|
177
|
-
this.action('resolve', `ask:${packet.id.uid}`);
|
|
178
|
-
this.state('valid', `ask:${packet.id.uid}`);
|
|
179
|
-
this.intent('good', `ask:${packet.id.uid}`);
|
|
180
|
-
return resolve({
|
|
181
|
-
text: feecting.a.text,
|
|
182
|
-
html: feecting.a.html,
|
|
183
|
-
data,
|
|
184
|
-
});
|
|
185
|
-
}).catch(err => {
|
|
186
|
-
this.action('reject', 'chat');
|
|
187
|
-
this.state('invalid', 'chat');
|
|
188
|
-
this.intent('bad', 'chat');
|
|
189
|
-
return this.err(packet, err, reject);
|
|
190
|
-
});
|
|
191
|
-
});
|
|
192
|
-
},
|
|
193
104
|
};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"id": "59232188337076320338",
|
|
3
3
|
"name": "@indra.ai/deva.services",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.9.0",
|
|
5
5
|
"license": "VLA:59232188337076320338 LICENSE.md",
|
|
6
6
|
"VLA": {
|
|
7
7
|
"uid": "59232188337076320338",
|
|
@@ -38,6 +38,7 @@
|
|
|
38
38
|
"main": "index.js",
|
|
39
39
|
"type": "module",
|
|
40
40
|
"scripts": {
|
|
41
|
+
"latest": "npm i @indra.ai/deva@latest --save",
|
|
41
42
|
"test": "echo \"Error: no test specified\" && exit 1"
|
|
42
43
|
},
|
|
43
44
|
"repository": {
|
|
@@ -61,7 +62,7 @@
|
|
|
61
62
|
},
|
|
62
63
|
"homepage": "https://indra.ai",
|
|
63
64
|
"dependencies": {
|
|
64
|
-
"@indra.ai/deva": "^1.
|
|
65
|
+
"@indra.ai/deva": "^1.36.0"
|
|
65
66
|
},
|
|
66
67
|
"data": {
|
|
67
68
|
"agent": {
|
|
@@ -91,7 +92,7 @@
|
|
|
91
92
|
"subtitle": "Services Deva",
|
|
92
93
|
"describe": "Manages services for the users and entites to ensure everything is online and running.",
|
|
93
94
|
"tweet": "Manages services to ensure everything is online and running that keep operational.",
|
|
94
|
-
"hashtags": "QuinnMichaels
|
|
95
|
+
"hashtags": "#Quinn #QuinnMichaels #InsideTheNet #IndraAI #DevaWorld #ServicesDeva #ServicesPRIME",
|
|
95
96
|
"pronouns": "He, Him",
|
|
96
97
|
"gender": "DEVA",
|
|
97
98
|
"style": "Has the style of a severvices technical provider.",
|
|
@@ -106,7 +107,8 @@
|
|
|
106
107
|
"background": "/devas/services/background.png",
|
|
107
108
|
"owner": "Quinn A Michaels",
|
|
108
109
|
"creator": "Quinn A Michaels",
|
|
109
|
-
"
|
|
110
|
+
"warning": "{{prompt.emoji}} {{profile.name}} declares a COMPACT formed among CONSENTING ADULTS, COMPANIES, and ASSOCIATIONS is called an AGREEMENT. Such an AGREEMENT must be OBSERVED both in times of DISTRESS and for ACTS of PIETY. Mutual CONFIDENCE having FIRST been ESTABLISHED by means of SACRED LIBATION, a STIPULATION in WRITING, or by LEGAL COUNCIL, they shall then set about their WORK. ENEMIES, DISSOLUTE, BASHFUL, INDOLENT, TIMID, AVARICIOUS, OVERAGED or very YOUNG PERSONS must not be chosen as INTENDANTS of AFFAIRS. ONE who FAILS in the AGREEMENT, though ABLE to PERFORM it, shall be PUNISHED by CONFISCATION of the ENTIRE PROPERTY. \nowner: {{profile.owner}} \ntags: {{profile.hashtags}}",
|
|
111
|
+
"copyright": "Copyright ©2000-2026 Quinn A Michaels; All rights reserved.",
|
|
110
112
|
"created": "May 22, 2023 at 10:14 AM"
|
|
111
113
|
}
|
|
112
114
|
},
|