symposium 2.0.0 → 2.0.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 CHANGED
@@ -58,7 +58,7 @@ export default class Agent {
58
58
 
59
59
  async resetState(thread) {
60
60
  thread.state = await this.getDefaultState();
61
- thread.state.model = Symposium.getModelByLabel(this.default_model).name;
61
+ thread.state.model = this.default_model;
62
62
  }
63
63
 
64
64
  async getDefaultState() {
@@ -171,7 +171,7 @@ export default class Agent {
171
171
  if (typeof thread !== 'object')
172
172
  thread = await this.getThread(thread);
173
173
 
174
- const model = Symposium.getModelByName(thread.state.model);
174
+ const model = Symposium.getModel(thread.state.model);
175
175
  if (!model.audio && typeof content !== 'string') {
176
176
  for (let c of content) {
177
177
  if (c.type === 'audio' && !c.content?.transcription) {
@@ -203,7 +203,7 @@ export default class Agent {
203
203
  if (counter === 0)
204
204
  thread = await this.beforeExecute(thread, emitter);
205
205
 
206
- const model = Symposium.getModelByName(thread.state.model);
206
+ const model = Symposium.getModel(thread.state.model);
207
207
 
208
208
  const completion_options = {};
209
209
  if (this.type === 'utility') {
@@ -340,7 +340,7 @@ export default class Agent {
340
340
 
341
341
  async generateCompletion(thread, options = {}, retry_counter = 1) {
342
342
  try {
343
- const model = Symposium.getModelByName(thread.state.model);
343
+ const model = Symposium.getModel(thread.state.model);
344
344
  const messages = await model.class.generate(model, thread, await this.getFunctions(), options);
345
345
  return model.tools ? messages : messages.map(m => this.parseFunctions(m));
346
346
  } catch (error) {
@@ -391,7 +391,7 @@ export default class Agent {
391
391
  }
392
392
 
393
393
  async handleCompletion(thread, completion, emitter) {
394
- const model = Symposium.getModelByName(thread.state.model);
394
+ const model = Symposium.getModel(thread.state.model);
395
395
 
396
396
  const functions = [];
397
397
  for (let message of completion) {
@@ -542,7 +542,7 @@ export default class Agent {
542
542
  }
543
543
 
544
544
  async setModel(thread, label) {
545
- const model_to_switch = Symposium.getModelByLabel(label);
545
+ const model_to_switch = Symposium.getModel(label);
546
546
  if (model_to_switch && model_to_switch.type === 'llm')
547
547
  await thread.setState({model: model_to_switch.name});
548
548
  else
package/Summarizer.js CHANGED
@@ -9,7 +9,7 @@ export default class Summarizer extends ContextHandler {
9
9
  }
10
10
 
11
11
  async handle(thread) {
12
- const model = Symposium.getModelByName(thread.state.model);
12
+ const model = Symposium.getModel(thread.state.model);
13
13
  if (!model)
14
14
  return thread;
15
15
 
package/Symposium.js CHANGED
@@ -47,14 +47,10 @@ export default class Symposium {
47
47
  }
48
48
  }
49
49
 
50
- static getModelByName(name) {
50
+ static getModel(name) {
51
51
  return this.models.get(name);
52
52
  }
53
53
 
54
- static getModelByLabel(label) {
55
- return Array.from(this.models.values()).find(model => model.label === label);
56
- }
57
-
58
54
  static extractFunctionsFromResponse(messages) {
59
55
  const functions = [];
60
56
  for (let message of messages) {
@@ -76,7 +72,7 @@ export default class Symposium {
76
72
  throw new Error('Transcription model not specified');
77
73
 
78
74
  if (!this.transcription_model)
79
- this.transcription_model = Symposium.getModelByName(model);
75
+ this.transcription_model = Symposium.getModel(model);
80
76
  if (!this.transcription_model.type !== 'stt')
81
77
  throw new Error('Specified model is not a transcription model');
82
78
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "type": "module",
3
3
  "name": "symposium",
4
- "version": "2.0.0",
4
+ "version": "2.0.1",
5
5
  "description": "Agents",
6
6
  "main": "index.js",
7
7
  "author": "Domenico Giambra",