symposium 0.12.0 → 0.12.2

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.
Files changed (2) hide show
  1. package/Agent.js +14 -8
  2. 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;
@@ -246,10 +249,10 @@ export default class Agent {
246
249
 
247
250
  if (functions.length) {
248
251
  for (let f of functions) {
249
- const response = await this.callFunction(thread, f);
250
-
251
252
  if (this.utility && this.utility.type === 'function')
252
- return response;
253
+ return this.afterHandle(thread, completion, 'return', f.arguments);
254
+
255
+ const response = await this.callFunction(thread, f);
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, true);
267
+ return this.afterHandle(thread, completion, 'continue');
265
268
  } else {
266
269
  await thread.storeState();
267
- return this.afterHandle(thread, completion, false);
270
+ return this.afterHandle(thread, completion, 'void');
268
271
  }
269
272
  }
270
273
 
271
- async afterHandle(thread, completion, executed_function) {
272
- return !executed_function;
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) {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "type": "module",
3
3
  "name": "symposium",
4
- "version": "0.12.0",
4
+ "version": "0.12.2",
5
5
  "description": "Agents",
6
6
  "main": "index.js",
7
7
  "author": "Domenico Giambra",