symposium 0.12.6 → 0.12.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 +5 -5
  2. package/package.json +1 -1
package/Agent.js CHANGED
@@ -108,15 +108,15 @@ export default class Agent {
108
108
 
109
109
  const completion_options = {};
110
110
  if (this.utility) {
111
- if (!['function', 'text'].includes(this.utility.type))
111
+ if (!['text', 'function', 'json'].includes(this.utility.type))
112
112
  throw new Error('Bad utility definition');
113
113
 
114
- if (this.utility.type === 'function') {
114
+ if (['function', 'json'].includes(this.utility.type)) {
115
115
  if (!this.utility.function || !this.utility.function.name || !this.utility.function.parameters)
116
116
  throw new Error('Bad function definition');
117
117
 
118
118
  let response_format = null;
119
- if (model.supports_structured_output)
119
+ if (this.utility.type === 'json' && model.supports_structured_output)
120
120
  response_format = this.convertFunctionToResponseFormat(this.utility.function.parameters);
121
121
 
122
122
  if (response_format && response_format.count <= 100) { // Se ci sono più di 100 parametri, OpenAI non supporta gli structured output
@@ -287,7 +287,7 @@ export default class Agent {
287
287
  if (this.utility) {
288
288
  if (this.utility.type === 'text')
289
289
  return this.afterHandle(thread, completion, 'return', m.content);
290
- if (this.utility.type === 'function' && model.supports_structured_output)
290
+ if (this.utility.type === 'json' && model.supports_structured_output)
291
291
  return this.afterHandle(thread, completion, 'return', JSON.parse(m.content));
292
292
  }
293
293
  await this.output(thread, m.content);
@@ -303,7 +303,7 @@ export default class Agent {
303
303
 
304
304
  if (functions.length) {
305
305
  for (let f of functions) {
306
- if (this.utility && this.utility.type === 'function')
306
+ if (this.utility && ['function', 'json'].includes(this.utility.type))
307
307
  return this.afterHandle(thread, completion, 'return', f.arguments);
308
308
 
309
309
  const response = await this.callFunction(thread, f);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "type": "module",
3
3
  "name": "symposium",
4
- "version": "0.12.6",
4
+ "version": "0.12.7",
5
5
  "description": "Agents",
6
6
  "main": "index.js",
7
7
  "author": "Domenico Giambra",