symposium 0.12.0 → 0.12.1
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 +12 -6
- package/package.json +1 -1
package/Agent.js
CHANGED
|
@@ -134,6 +134,9 @@ export default class Agent {
|
|
|
134
134
|
case 'continue':
|
|
135
135
|
return await this.execute(thread);
|
|
136
136
|
|
|
137
|
+
case 'void':
|
|
138
|
+
return;
|
|
139
|
+
|
|
137
140
|
default:
|
|
138
141
|
throw new Error('Unknown response type');
|
|
139
142
|
}
|
|
@@ -231,7 +234,7 @@ export default class Agent {
|
|
|
231
234
|
switch (m.type) {
|
|
232
235
|
case 'text':
|
|
233
236
|
if (this.utility && this.utility.type === 'text')
|
|
234
|
-
return m.content;
|
|
237
|
+
return this.afterHandle(thread, completion, 'return', m.content);
|
|
235
238
|
|
|
236
239
|
await this.output(thread, m.content);
|
|
237
240
|
break;
|
|
@@ -249,7 +252,7 @@ export default class Agent {
|
|
|
249
252
|
const response = await this.callFunction(thread, f);
|
|
250
253
|
|
|
251
254
|
if (this.utility && this.utility.type === 'function')
|
|
252
|
-
return response;
|
|
255
|
+
return this.afterHandle(thread, completion, 'return', response);
|
|
253
256
|
|
|
254
257
|
thread.addMessage('tool', [
|
|
255
258
|
{
|
|
@@ -261,15 +264,18 @@ export default class Agent {
|
|
|
261
264
|
await this.log('function_response', response);
|
|
262
265
|
}
|
|
263
266
|
|
|
264
|
-
return this.afterHandle(thread, completion,
|
|
267
|
+
return this.afterHandle(thread, completion, 'continue');
|
|
265
268
|
} else {
|
|
266
269
|
await thread.storeState();
|
|
267
|
-
return this.afterHandle(thread, completion,
|
|
270
|
+
return this.afterHandle(thread, completion, 'void');
|
|
268
271
|
}
|
|
269
272
|
}
|
|
270
273
|
|
|
271
|
-
async afterHandle(thread, completion,
|
|
272
|
-
return
|
|
274
|
+
async afterHandle(thread, completion, type, value = null) {
|
|
275
|
+
return {
|
|
276
|
+
type,
|
|
277
|
+
value,
|
|
278
|
+
};
|
|
273
279
|
}
|
|
274
280
|
|
|
275
281
|
async getFunctions(parsed = true) {
|