symposium 0.15.7 → 1.0.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/Agent.js +8 -7
- package/package.json +1 -1
package/Agent.js
CHANGED
|
@@ -111,7 +111,10 @@ export default class Agent {
|
|
|
111
111
|
await this.log('user_message', content);
|
|
112
112
|
thread.addMessage('user', content);
|
|
113
113
|
|
|
114
|
-
|
|
114
|
+
const emitter = new BufferedEventEmitter();
|
|
115
|
+
emitter.emit('start', thread);
|
|
116
|
+
|
|
117
|
+
return this.execute(thread, emitter);
|
|
115
118
|
}
|
|
116
119
|
|
|
117
120
|
async beforeExecute(thread, emitter) {
|
|
@@ -120,9 +123,7 @@ export default class Agent {
|
|
|
120
123
|
return thread;
|
|
121
124
|
}
|
|
122
125
|
|
|
123
|
-
async execute(thread, counter = 0
|
|
124
|
-
const emitter = existing_emitter || new BufferedEventEmitter();
|
|
125
|
-
|
|
126
|
+
async execute(thread, emitter, counter = 0) {
|
|
126
127
|
const execution = new Promise(async (resolve, reject) => {
|
|
127
128
|
try {
|
|
128
129
|
if (counter === 0)
|
|
@@ -189,7 +190,7 @@ export default class Agent {
|
|
|
189
190
|
|
|
190
191
|
case 'chat':
|
|
191
192
|
if (response?.type === 'continue')
|
|
192
|
-
return this.execute(thread,
|
|
193
|
+
return this.execute(thread, emitter);
|
|
193
194
|
|
|
194
195
|
return resolve(null);
|
|
195
196
|
|
|
@@ -200,7 +201,7 @@ export default class Agent {
|
|
|
200
201
|
console.error(e);
|
|
201
202
|
|
|
202
203
|
if (counter < this.max_retries)
|
|
203
|
-
await this.execute(thread, counter + 1
|
|
204
|
+
await this.execute(thread, emitter, counter + 1);
|
|
204
205
|
}
|
|
205
206
|
} catch (e) {
|
|
206
207
|
reject(e);
|
|
@@ -344,7 +345,7 @@ export default class Agent {
|
|
|
344
345
|
thread.addMessage('tool', [
|
|
345
346
|
{
|
|
346
347
|
type: 'function_response',
|
|
347
|
-
content: {name: f.name, function_response, id: f.id || undefined},
|
|
348
|
+
content: {name: f.name, response: function_response, id: f.id || undefined},
|
|
348
349
|
},
|
|
349
350
|
], f.name);
|
|
350
351
|
|