symposium 0.12.4 → 0.12.5

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 (3) hide show
  1. package/Agent.js +6 -3
  2. package/Model.js +1 -0
  3. package/package.json +1 -1
package/Agent.js CHANGED
@@ -12,7 +12,6 @@ export default class Agent {
12
12
  max_retries = 5;
13
13
  callbacks = {};
14
14
  utility = null;
15
- supports_structured_output = false;
16
15
 
17
16
  constructor(options) {
18
17
  this.options = {
@@ -105,6 +104,8 @@ export default class Agent {
105
104
  if (counter === 0)
106
105
  thread = await this.beforeExecute(thread);
107
106
 
107
+ const model = Symposium.getModelByName(thread.state.model);
108
+
108
109
  const completion_options = {};
109
110
  if (this.utility) {
110
111
  if (!['function', 'text'].includes(this.utility.type))
@@ -114,7 +115,7 @@ export default class Agent {
114
115
  if (!this.utility.function || !this.utility.function.name || !this.utility.function.parameters)
115
116
  throw new Error('Bad function definition');
116
117
 
117
- if (this.supports_structured_output) {
118
+ if (model.supports_structured_output) {
118
119
  // TODO: se ci sono più di 100 parametri, OpenAI non supporta gli structured output
119
120
  completion_options.response_format = {
120
121
  type: 'json_schema',
@@ -236,6 +237,8 @@ export default class Agent {
236
237
  }
237
238
 
238
239
  async handleCompletion(thread, completion) {
240
+ const model = Symposium.getModelByName(thread.state.model);
241
+
239
242
  const functions = [];
240
243
  for (let message of completion) {
241
244
  thread.addDirectMessage(message);
@@ -247,7 +250,7 @@ export default class Agent {
247
250
  if (this.utility) {
248
251
  if (this.utility.type === 'text')
249
252
  return this.afterHandle(thread, completion, 'return', m.content);
250
- if (this.utility.type === 'function' && this.supports_structured_output)
253
+ if (this.utility.type === 'function' && model.supports_structured_output)
251
254
  return this.afterHandle(thread, completion, 'return', JSON.parse(m.content));
252
255
  }
253
256
  await this.output(thread, m.content);
package/Model.js CHANGED
@@ -4,6 +4,7 @@ export default class Model {
4
4
  label;
5
5
  tokens;
6
6
  supports_functions = false;
7
+ supports_structured_output = false;
7
8
 
8
9
  constructor() {
9
10
  if (!this.label)
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "type": "module",
3
3
  "name": "symposium",
4
- "version": "0.12.4",
4
+ "version": "0.12.5",
5
5
  "description": "Agents",
6
6
  "main": "index.js",
7
7
  "author": "Domenico Giambra",