symposium 0.1.3 → 0.1.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.
package/Model.js ADDED
@@ -0,0 +1,15 @@
1
+ class Model {
2
+ name;
3
+ name_for_tiktoken;
4
+ label;
5
+ tokens;
6
+
7
+ constructor(name, label, tokens, name_for_tiktoken = null) {
8
+ this.name = name;
9
+ this.label = label;
10
+ this.tokens = tokens;
11
+ this.name_for_tiktoken = name_for_tiktoken || name;
12
+ }
13
+ }
14
+
15
+ export {Model};
package/Summarizer.js CHANGED
@@ -14,7 +14,7 @@ class Summarizer extends MemoryHandler {
14
14
  if (!model)
15
15
  return conversation;
16
16
 
17
- const encoder = encoding_for_model(model.name);
17
+ const encoder = encoding_for_model(model.name_for_tiktoken);
18
18
  const tokens = this.countTokens(encoder, conversation);
19
19
  if (tokens >= model.tokens * this.threshold)
20
20
  return await this.summarize(encoder, conversation, model.tokens * this.summary_length);
package/Symposium.js CHANGED
@@ -1,25 +1,23 @@
1
1
  import Redis from "@travio/redis";
2
2
  import OpenAI from "openai";
3
+ import {Model} from "./Model.js";
3
4
 
4
5
  class Symposium {
5
6
  static openai;
6
- static models = [
7
- {
8
- label: 'gpt-3.5',
9
- name: 'gpt-3.5-turbo-16k',
10
- tokens: 16384,
11
- },
12
- {
13
- label: 'gpt-4',
14
- name: 'gpt-4',
15
- tokens: 8192
16
- }
17
- ];
7
+ static models = [];
18
8
 
19
9
  static async init() {
10
+ this.loadModel(new Model('gpt-3.5-turbo-16k', 'gpt-3.5', 16384));
11
+ this.loadModel(new Model('gpt-4', 'gpt-4', 8192));
12
+ this.loadModel(new Model('gpt-4-1106-preview', 'gpt-4-turbo', 128000));
13
+
20
14
  return Redis.init();
21
15
  }
22
16
 
17
+ static loadModel(model) {
18
+ this.models.push(model);
19
+ }
20
+
23
21
  static async getOpenAi() {
24
22
  if (!this.openai)
25
23
  this.openai = new OpenAI({apiKey: process.env.OPENAI_API_KEY});
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "type": "module",
3
3
  "name": "symposium",
4
- "version": "0.1.3",
4
+ "version": "0.1.5",
5
5
  "description": "Agents",
6
6
  "main": "index.js",
7
7
  "scripts": {