symposium 0.1.2 → 0.1.3
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 +3 -24
- package/Summarizer.js +2 -1
- package/Symposium.js +20 -0
- package/package.json +1 -1
package/Agent.js
CHANGED
|
@@ -20,19 +20,6 @@ class Agent {
|
|
|
20
20
|
if (this.options.memory_handler)
|
|
21
21
|
this.options.memory_handler.setAgent(this);
|
|
22
22
|
|
|
23
|
-
this.models = [
|
|
24
|
-
{
|
|
25
|
-
label: 'gpt-3.5',
|
|
26
|
-
name: 'gpt-3.5-turbo-16k',
|
|
27
|
-
tokens: 16384,
|
|
28
|
-
},
|
|
29
|
-
{
|
|
30
|
-
label: 'gpt-4',
|
|
31
|
-
name: 'gpt-4',
|
|
32
|
-
tokens: 8192
|
|
33
|
-
}
|
|
34
|
-
];
|
|
35
|
-
|
|
36
23
|
this.commands = new Map();
|
|
37
24
|
|
|
38
25
|
this.commands.set('start', {
|
|
@@ -48,15 +35,15 @@ class Agent {
|
|
|
48
35
|
show_in_help: true,
|
|
49
36
|
exec: async (conversation, args) => {
|
|
50
37
|
if (args) {
|
|
51
|
-
const model_to_switch =
|
|
38
|
+
const model_to_switch = Symposium.getModelByLabel(args);
|
|
52
39
|
if (model_to_switch) {
|
|
53
40
|
await conversation.setState({model: model_to_switch.name});
|
|
54
41
|
await conversation.reply('# Da ora in poi uso ' + model_to_switch.label + '!');
|
|
55
42
|
} else {
|
|
56
|
-
await conversation.reply("# Versione modello non riconosciuta!\nModelli disponibili:\n" +
|
|
43
|
+
await conversation.reply("# Versione modello non riconosciuta!\nModelli disponibili:\n" + Symposium.models.map(m => m.label).join("\n"));
|
|
57
44
|
}
|
|
58
45
|
} else {
|
|
59
|
-
const currentModel =
|
|
46
|
+
const currentModel = Symposium.getModelByName(conversation.state.model);
|
|
60
47
|
await conversation.reply('# Il modello attualmente in uso è ' + currentModel.label);
|
|
61
48
|
}
|
|
62
49
|
},
|
|
@@ -112,14 +99,6 @@ class Agent {
|
|
|
112
99
|
await conversation.storeState();
|
|
113
100
|
}
|
|
114
101
|
|
|
115
|
-
getModelFromLabel(label) {
|
|
116
|
-
return this.models.find(model => model.label === label);
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
getModelFromName(name) {
|
|
120
|
-
return this.models.find(model => model.name === name);
|
|
121
|
-
}
|
|
122
|
-
|
|
123
102
|
async resetState(conversation) {
|
|
124
103
|
conversation.state = await this.getDefaultState();
|
|
125
104
|
}
|
package/Summarizer.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import {Symposium} from "./Symposium.js";
|
|
1
2
|
import {MemoryHandler} from "./MemoryHandler.js";
|
|
2
3
|
import {encoding_for_model} from "tiktoken";
|
|
3
4
|
|
|
@@ -9,7 +10,7 @@ class Summarizer extends MemoryHandler {
|
|
|
9
10
|
}
|
|
10
11
|
|
|
11
12
|
async handle(conversation) {
|
|
12
|
-
const model =
|
|
13
|
+
const model = Symposium.getModelByName(conversation.state.model);
|
|
13
14
|
if (!model)
|
|
14
15
|
return conversation;
|
|
15
16
|
|
package/Symposium.js
CHANGED
|
@@ -3,6 +3,18 @@ import OpenAI from "openai";
|
|
|
3
3
|
|
|
4
4
|
class Symposium {
|
|
5
5
|
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
|
+
];
|
|
6
18
|
|
|
7
19
|
static async init() {
|
|
8
20
|
return Redis.init();
|
|
@@ -15,6 +27,14 @@ class Symposium {
|
|
|
15
27
|
return this.openai;
|
|
16
28
|
}
|
|
17
29
|
|
|
30
|
+
static getModelByLabel(label) {
|
|
31
|
+
return this.models.find(model => model.label === label);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
static getModelByName(name) {
|
|
35
|
+
return this.models.find(model => model.name === name);
|
|
36
|
+
}
|
|
37
|
+
|
|
18
38
|
static async transcribe(agent, file, conversation) {
|
|
19
39
|
let words = await agent.getPromptWordsForTranscription(conversation);
|
|
20
40
|
|