symposium 0.15.5 → 0.15.7

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 +12 -7
  2. package/package.json +1 -1
package/Agent.js CHANGED
@@ -182,10 +182,13 @@ export default class Agent {
182
182
 
183
183
  switch (this.type) {
184
184
  case 'utility':
185
- return resolve(response);
185
+ if (response.type !== 'response')
186
+ throw new Error('Utility agent did not return a response');
187
+
188
+ return resolve(response.value);
186
189
 
187
190
  case 'chat':
188
- if (response.type === 'continue')
191
+ if (response?.type === 'continue')
189
192
  return this.execute(thread, 0, emitter);
190
193
 
191
194
  return resolve(null);
@@ -315,9 +318,9 @@ export default class Agent {
315
318
  case 'text':
316
319
  if (this.type === 'utility') {
317
320
  if (this.utility.type === 'text')
318
- return this.afterHandle(thread, completion, m.content);
321
+ return {type: 'response', value: this.afterHandle(thread, completion, m.content)};
319
322
  if (this.utility.type === 'json' && model.supports_structured_output)
320
- return this.afterHandle(thread, completion, JSON.parse(m.content));
323
+ return {type: 'response', value: this.afterHandle(thread, completion, JSON.parse(m.content))};
321
324
  }
322
325
 
323
326
  emitter.emit('output', m.content);
@@ -334,7 +337,7 @@ export default class Agent {
334
337
  if (functions.length) {
335
338
  for (let f of functions) {
336
339
  if (this.utility && ['function', 'json'].includes(this.utility.type))
337
- return this.afterHandle(thread, completion, f.arguments);
340
+ return {type: 'response', value: this.afterHandle(thread, completion, f.arguments)};
338
341
 
339
342
  const function_response = await this.callFunction(thread, f, emitter);
340
343
 
@@ -348,10 +351,12 @@ export default class Agent {
348
351
  await this.log('function_response', function_response);
349
352
  }
350
353
 
351
- return this.afterHandle(thread, completion);
354
+ await this.afterHandle(thread, completion);
355
+ return {type: 'continue'};
352
356
  } else {
353
357
  await thread.storeState();
354
- return this.afterHandle(thread, completion);
358
+ await this.afterHandle(thread, completion);
359
+ return {type: 'void'};
355
360
  }
356
361
  }
357
362
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "type": "module",
3
3
  "name": "symposium",
4
- "version": "0.15.5",
4
+ "version": "0.15.7",
5
5
  "description": "Agents",
6
6
  "main": "index.js",
7
7
  "author": "Domenico Giambra",