symposium 1.4.2 → 2.0.0
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 +6 -6
- package/Model.js +2 -11
- package/{models → Models}/AnthropicModel.js +31 -5
- package/{models → Models}/DeepSeekModel.js +11 -0
- package/Models/Gpt4oTranscribe.js +18 -0
- package/{models → Models}/GrokModel.js +7 -0
- package/{models → Models}/GroqModel.js +19 -8
- package/{models → Models}/OllamaModel.js +15 -8
- package/{models → Models}/OpenAIModel.js +34 -11
- package/README.md +1 -1
- package/Symposium.js +23 -16
- package/package.json +1 -1
- package/models/Claude35Sonnet.js +0 -7
- package/models/Claude37Sonnet.js +0 -7
- package/models/Claude45Haiku.js +0 -7
- package/models/Claude45Sonnet.js +0 -7
- package/models/Claude4Opus.js +0 -7
- package/models/Claude4Sonnet.js +0 -7
- package/models/DeepSeekChat.js +0 -7
- package/models/DeepSeekReasoner.js +0 -7
- package/models/Gpt35.js +0 -7
- package/models/Gpt4.js +0 -7
- package/models/Gpt4O.js +0 -9
- package/models/Gpt4Turbo.js +0 -8
- package/models/Gpt4oTranscribe.js +0 -16
- package/models/Gpt5.js +0 -8
- package/models/Gpt5Mini.js +0 -8
- package/models/GptO1.js +0 -10
- package/models/GptO1Mini.js +0 -10
- package/models/Grok4.js +0 -7
- package/models/Llama3.js +0 -7
- package/models/Mixtral8.js +0 -7
package/Agent.js
CHANGED
|
@@ -121,7 +121,7 @@ export default class Agent {
|
|
|
121
121
|
if (is_there_on_request) {
|
|
122
122
|
context_string = '<important>Some of the context files are available to you immediately here, while longer texts may be available only on request; you are provided with a title and a description of these files. If you think it may be useful for your current task, you can request the text via the get_context tool - IMPORTANT: use the title of the file verbatim as it is provided</important>' + context_string;
|
|
123
123
|
if (!this.tools.has('get_context'))
|
|
124
|
-
this.addTool(new GetContextTool(this));
|
|
124
|
+
await this.addTool(new GetContextTool(this));
|
|
125
125
|
}
|
|
126
126
|
context_string = '\n<context_info>' + context_string + '</context_info>';
|
|
127
127
|
|
|
@@ -172,7 +172,7 @@ export default class Agent {
|
|
|
172
172
|
thread = await this.getThread(thread);
|
|
173
173
|
|
|
174
174
|
const model = Symposium.getModelByName(thread.state.model);
|
|
175
|
-
if (!model.
|
|
175
|
+
if (!model.audio && typeof content !== 'string') {
|
|
176
176
|
for (let c of content) {
|
|
177
177
|
if (c.type === 'audio' && !c.content?.transcription) {
|
|
178
178
|
const words = await this.getPromptWordsForTranscription(thread);
|
|
@@ -212,7 +212,7 @@ export default class Agent {
|
|
|
212
212
|
throw new Error('Bad function definition');
|
|
213
213
|
|
|
214
214
|
let response_format = null;
|
|
215
|
-
if (this.utility.type === 'json' && model.
|
|
215
|
+
if (this.utility.type === 'json' && model.structured_output)
|
|
216
216
|
response_format = this.convertFunctionToResponseFormat(this.utility.function.parameters);
|
|
217
217
|
|
|
218
218
|
if (response_format && response_format.count <= 100) { // OpenAI does not support structured output if there are more than 100 parameters
|
|
@@ -341,8 +341,8 @@ export default class Agent {
|
|
|
341
341
|
async generateCompletion(thread, options = {}, retry_counter = 1) {
|
|
342
342
|
try {
|
|
343
343
|
const model = Symposium.getModelByName(thread.state.model);
|
|
344
|
-
const messages = await model.generate(thread, await this.getFunctions(), options);
|
|
345
|
-
return model.
|
|
344
|
+
const messages = await model.class.generate(model, thread, await this.getFunctions(), options);
|
|
345
|
+
return model.tools ? messages : messages.map(m => this.parseFunctions(m));
|
|
346
346
|
} catch (error) {
|
|
347
347
|
if (error.response) {
|
|
348
348
|
console.error(error.response.status);
|
|
@@ -404,7 +404,7 @@ export default class Agent {
|
|
|
404
404
|
if (this.type === 'utility') {
|
|
405
405
|
if (this.utility.type === 'text')
|
|
406
406
|
return {type: 'response', value: this.afterHandle(thread, completion, m.content)};
|
|
407
|
-
if (this.utility.type === 'json' && model.
|
|
407
|
+
if (this.utility.type === 'json' && model.structured_output)
|
|
408
408
|
return {type: 'response', value: this.afterHandle(thread, completion, JSON.parse(m.content))};
|
|
409
409
|
}
|
|
410
410
|
|
package/Model.js
CHANGED
|
@@ -1,19 +1,10 @@
|
|
|
1
1
|
export default class Model {
|
|
2
2
|
type = 'llm';
|
|
3
|
-
|
|
4
|
-
label;
|
|
3
|
+
models = new Map();
|
|
5
4
|
tokens;
|
|
6
|
-
supports_functions = false;
|
|
7
|
-
supports_structured_output = false;
|
|
8
5
|
system_role_name = 'system';
|
|
9
|
-
supports_audio = false;
|
|
10
6
|
|
|
11
|
-
|
|
12
|
-
if (!this.label)
|
|
13
|
-
this.label = this.name;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
async generate(thread, functions = [], options = {}) {
|
|
7
|
+
async generate(model, thread, functions = [], options = {}) {
|
|
17
8
|
return null;
|
|
18
9
|
}
|
|
19
10
|
|
|
@@ -4,7 +4,33 @@ import Message from "../Message.js";
|
|
|
4
4
|
|
|
5
5
|
export default class AnthropicModel extends Model {
|
|
6
6
|
anthropic;
|
|
7
|
-
|
|
7
|
+
models = new Map([
|
|
8
|
+
['claude-3.7-sonnet', {
|
|
9
|
+
name: 'claude-3-7-sonnet-latest',
|
|
10
|
+
tokens: 200000,
|
|
11
|
+
tools: true,
|
|
12
|
+
}],
|
|
13
|
+
['claude-4-opus', {
|
|
14
|
+
name: 'claude-opus-4-20250514',
|
|
15
|
+
tokens: 200000,
|
|
16
|
+
tools: true,
|
|
17
|
+
}],
|
|
18
|
+
['claude-4-sonnet', {
|
|
19
|
+
name: 'claude-sonnet-4-20250514',
|
|
20
|
+
tokens: 200000,
|
|
21
|
+
tools: true,
|
|
22
|
+
}],
|
|
23
|
+
['claude-4.5-haiku', {
|
|
24
|
+
name: 'claude-haiku-4-5-20251001',
|
|
25
|
+
tokens: 200000,
|
|
26
|
+
tools: true,
|
|
27
|
+
}],
|
|
28
|
+
['claude-4.5-sonnet', {
|
|
29
|
+
name: 'claude-sonnet-4-5-20250929',
|
|
30
|
+
tokens: 200000,
|
|
31
|
+
tools: true,
|
|
32
|
+
}],
|
|
33
|
+
]);
|
|
8
34
|
|
|
9
35
|
getAnthropic() {
|
|
10
36
|
if (!this.anthropic)
|
|
@@ -13,7 +39,7 @@ export default class AnthropicModel extends Model {
|
|
|
13
39
|
return this.anthropic;
|
|
14
40
|
}
|
|
15
41
|
|
|
16
|
-
async generate(thread, functions = [], options = {}) {
|
|
42
|
+
async generate(model, thread, functions = [], options = {}) {
|
|
17
43
|
try {
|
|
18
44
|
const parsed = this.parseOptions(options, functions);
|
|
19
45
|
options = parsed.options;
|
|
@@ -21,7 +47,7 @@ export default class AnthropicModel extends Model {
|
|
|
21
47
|
|
|
22
48
|
let [system, messages] = await this.convertMessages(thread);
|
|
23
49
|
|
|
24
|
-
if (functions.length && !
|
|
50
|
+
if (functions.length && !model.tools) {
|
|
25
51
|
// Se il modello non supporta nativamente le funzioni, aggiungo il prompt al messaggio di sistema
|
|
26
52
|
const functions_prompt = this.promptFromFunctions(options, functions);
|
|
27
53
|
system += "\n\n" + functions_prompt;
|
|
@@ -29,7 +55,7 @@ export default class AnthropicModel extends Model {
|
|
|
29
55
|
}
|
|
30
56
|
|
|
31
57
|
const completion_payload = {
|
|
32
|
-
model:
|
|
58
|
+
model: model.name,
|
|
33
59
|
system,
|
|
34
60
|
max_tokens: 16000,
|
|
35
61
|
thinking: {
|
|
@@ -101,7 +127,7 @@ export default class AnthropicModel extends Model {
|
|
|
101
127
|
console.warn('Rate limite exceeded for Anthropic API, waiting 60 seconds...');
|
|
102
128
|
await new Promise(resolve => setTimeout(resolve, 60000));
|
|
103
129
|
if ((options.counter || 0) < 3)
|
|
104
|
-
return this.generate(thread, functions, {...options, counter: (options.counter || 0) + 1});
|
|
130
|
+
return this.generate(model, thread, functions, {...options, counter: (options.counter || 0) + 1});
|
|
105
131
|
else
|
|
106
132
|
throw new Error('Rate limit exceeded for Anthropic API, aborting.');
|
|
107
133
|
}
|
|
@@ -2,6 +2,17 @@ import OpenAIModel from "./OpenAIModel.js";
|
|
|
2
2
|
import OpenAI from "openai";
|
|
3
3
|
|
|
4
4
|
export default class DeepSeekModel extends OpenAIModel {
|
|
5
|
+
models = new Map([
|
|
6
|
+
['deepseek-chat', {
|
|
7
|
+
name: 'deepseek-chat',
|
|
8
|
+
tokens: 64000,
|
|
9
|
+
}],
|
|
10
|
+
['deepseek-reasoner', {
|
|
11
|
+
name: 'deepseek-reasoner',
|
|
12
|
+
tokens: 64000,
|
|
13
|
+
}],
|
|
14
|
+
]);
|
|
15
|
+
|
|
5
16
|
getOpenAi() {
|
|
6
17
|
if (!this.openai) {
|
|
7
18
|
this.openai = new OpenAI({
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import OpenAIModel from "./OpenAIModel.js";
|
|
2
|
+
|
|
3
|
+
export default class OpenAITranscribe extends OpenAIModel {
|
|
4
|
+
type = 'stt';
|
|
5
|
+
models = new Map([
|
|
6
|
+
['gpt-4o-transcribe', {name: 'gpt-4o-transcribe'}],
|
|
7
|
+
]);
|
|
8
|
+
|
|
9
|
+
async transcribe(file, model, prompt = null) {
|
|
10
|
+
const response = await this.getOpenAi().audio.transcriptions.create({
|
|
11
|
+
model: model.name,
|
|
12
|
+
file,
|
|
13
|
+
prompt,
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
return response.text;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
@@ -2,6 +2,13 @@ import OpenAIModel from "./OpenAIModel.js";
|
|
|
2
2
|
import OpenAI from "openai";
|
|
3
3
|
|
|
4
4
|
export default class GrokModel extends OpenAIModel {
|
|
5
|
+
models = new Map([
|
|
6
|
+
['grok-4', {
|
|
7
|
+
name: 'grok-4',
|
|
8
|
+
tokens: 256000,
|
|
9
|
+
}],
|
|
10
|
+
]);
|
|
11
|
+
|
|
5
12
|
getOpenAi() {
|
|
6
13
|
if (!this.openai) {
|
|
7
14
|
this.openai = new OpenAI({
|
|
@@ -4,7 +4,18 @@ import Message from "../Message.js";
|
|
|
4
4
|
|
|
5
5
|
export default class GroqModel extends Model {
|
|
6
6
|
groq;
|
|
7
|
-
|
|
7
|
+
models = new Map([
|
|
8
|
+
['llama-3', {
|
|
9
|
+
name: 'llama-3.3-70b-versatile',
|
|
10
|
+
tokens: 128000,
|
|
11
|
+
tools: true,
|
|
12
|
+
}],
|
|
13
|
+
['mixtral-8', {
|
|
14
|
+
name: 'mixtral-8x7b-32768',
|
|
15
|
+
tokens: 32768,
|
|
16
|
+
tools: true,
|
|
17
|
+
}],
|
|
18
|
+
]);
|
|
8
19
|
|
|
9
20
|
getGroq() {
|
|
10
21
|
if (!this.groq)
|
|
@@ -13,14 +24,14 @@ export default class GroqModel extends Model {
|
|
|
13
24
|
return this.groq;
|
|
14
25
|
}
|
|
15
26
|
|
|
16
|
-
async generate(thread, functions = [], options = {}) {
|
|
27
|
+
async generate(model, thread, functions = [], options = {}) {
|
|
17
28
|
const parsed = this.parseOptions(options, functions);
|
|
18
29
|
options = parsed.options;
|
|
19
30
|
functions = parsed.functions;
|
|
20
31
|
|
|
21
32
|
let messages = thread.messages;
|
|
22
33
|
|
|
23
|
-
if (functions.length && !
|
|
34
|
+
if (functions.length && !model.tools) {
|
|
24
35
|
// Se il modello non supporta nativamente le funzioni, inserisco il prompt ad hoc come ultimo messaggio di sistema
|
|
25
36
|
const functions_prompt = this.promptFromFunctions(options, functions);
|
|
26
37
|
let system_messages = [], other_messages = [], first_found = false;
|
|
@@ -42,10 +53,10 @@ export default class GroqModel extends Model {
|
|
|
42
53
|
|
|
43
54
|
const convertedMessages = [];
|
|
44
55
|
for (let m of messages)
|
|
45
|
-
convertedMessages.push(...this.convertMessage(m));
|
|
56
|
+
convertedMessages.push(...this.convertMessage(m, model));
|
|
46
57
|
|
|
47
58
|
const completion_payload = {
|
|
48
|
-
model:
|
|
59
|
+
model: model.name,
|
|
49
60
|
messages: convertedMessages,
|
|
50
61
|
tools: functions.map(f => ({
|
|
51
62
|
type: 'function',
|
|
@@ -91,7 +102,7 @@ export default class GroqModel extends Model {
|
|
|
91
102
|
];
|
|
92
103
|
}
|
|
93
104
|
|
|
94
|
-
convertMessage(message) {
|
|
105
|
+
convertMessage(message, model) {
|
|
95
106
|
const messages = [];
|
|
96
107
|
for (let c of message.content) {
|
|
97
108
|
switch (c.type) {
|
|
@@ -119,7 +130,7 @@ export default class GroqModel extends Model {
|
|
|
119
130
|
break;
|
|
120
131
|
|
|
121
132
|
case 'function':
|
|
122
|
-
if (
|
|
133
|
+
if (model.tools) {
|
|
123
134
|
messages.push({
|
|
124
135
|
role: message.role,
|
|
125
136
|
name: message.name,
|
|
@@ -142,7 +153,7 @@ export default class GroqModel extends Model {
|
|
|
142
153
|
break;
|
|
143
154
|
|
|
144
155
|
case 'function_response':
|
|
145
|
-
if (
|
|
156
|
+
if (model.tools) {
|
|
146
157
|
messages.push({
|
|
147
158
|
role: message.role,
|
|
148
159
|
tool_call_id: c.content.id,
|
|
@@ -3,16 +3,23 @@ import Model from "../Model.js";
|
|
|
3
3
|
import Message from "../Message.js";
|
|
4
4
|
|
|
5
5
|
export default class OllamaModel extends Model {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
models = new Map([ // TODO: dynamic models (via ollama API?)
|
|
7
|
+
['gpt-oss-20b', {
|
|
8
|
+
name: 'gpt-oss:20b',
|
|
9
|
+
tokens: 32768,
|
|
10
|
+
tools: true,
|
|
11
|
+
structured_output: true,
|
|
12
|
+
}]
|
|
13
|
+
]);
|
|
14
|
+
|
|
15
|
+
async generate(model, thread, functions = [], options = {}) {
|
|
9
16
|
const parsed = this.parseOptions(options, functions);
|
|
10
17
|
options = parsed.options;
|
|
11
18
|
functions = parsed.functions;
|
|
12
19
|
|
|
13
20
|
let messages = thread.messages;
|
|
14
21
|
|
|
15
|
-
if (functions.length && !
|
|
22
|
+
if (functions.length && !model.tools) {
|
|
16
23
|
// Se il modello non supporta nativamente le funzioni, inserisco il prompt ad hoc come ultimo messaggio di sistema
|
|
17
24
|
const functions_prompt = this.promptFromFunctions(options, functions);
|
|
18
25
|
let system_messages = [], other_messages = [], first_found = false;
|
|
@@ -34,7 +41,7 @@ export default class OllamaModel extends Model {
|
|
|
34
41
|
|
|
35
42
|
const convertedMessages = [];
|
|
36
43
|
for (let m of messages)
|
|
37
|
-
convertedMessages.push(...this.convertMessage(m));
|
|
44
|
+
convertedMessages.push(...this.convertMessage(m, model));
|
|
38
45
|
|
|
39
46
|
const completion_payload = {
|
|
40
47
|
model: this.name,
|
|
@@ -91,7 +98,7 @@ export default class OllamaModel extends Model {
|
|
|
91
98
|
];
|
|
92
99
|
}
|
|
93
100
|
|
|
94
|
-
convertMessage(message) {
|
|
101
|
+
convertMessage(message, model) {
|
|
95
102
|
const messages = [],
|
|
96
103
|
role = message.role === 'system' ? this.system_role_name : message.role;
|
|
97
104
|
|
|
@@ -111,7 +118,7 @@ export default class OllamaModel extends Model {
|
|
|
111
118
|
break;
|
|
112
119
|
|
|
113
120
|
case 'function':
|
|
114
|
-
if (
|
|
121
|
+
if (model.tools) {
|
|
115
122
|
messages.push({
|
|
116
123
|
role,
|
|
117
124
|
thinking: reasoning || undefined,
|
|
@@ -134,7 +141,7 @@ export default class OllamaModel extends Model {
|
|
|
134
141
|
break;
|
|
135
142
|
|
|
136
143
|
case 'function_response':
|
|
137
|
-
if (
|
|
144
|
+
if (model.tools) {
|
|
138
145
|
messages.push({
|
|
139
146
|
role: 'tool',
|
|
140
147
|
content: JSON.stringify(c.content.response),
|
|
@@ -5,8 +5,30 @@ import {encoding_for_model} from "tiktoken";
|
|
|
5
5
|
|
|
6
6
|
export default class OpenAIModel extends Model {
|
|
7
7
|
openai;
|
|
8
|
-
|
|
9
|
-
|
|
8
|
+
models = new Map([
|
|
9
|
+
['gpt-4o', {
|
|
10
|
+
name: 'gpt-4o',
|
|
11
|
+
tiktoken: 'gpt-4',
|
|
12
|
+
tokens: 128000,
|
|
13
|
+
tools: true,
|
|
14
|
+
structured_output: true,
|
|
15
|
+
}],
|
|
16
|
+
['gpt-5', {
|
|
17
|
+
name: 'gpt-5',
|
|
18
|
+
tiktoken: 'gpt-4',
|
|
19
|
+
tokens: 400000,
|
|
20
|
+
tools: true,
|
|
21
|
+
structured_output: true,
|
|
22
|
+
audio: true,
|
|
23
|
+
}],
|
|
24
|
+
['gpt-5-mini', {
|
|
25
|
+
name: 'gpt-5-mini',
|
|
26
|
+
tiktoken: 'gpt-4',
|
|
27
|
+
tokens: 400000,
|
|
28
|
+
tools: true,
|
|
29
|
+
structured_output: true,
|
|
30
|
+
}]
|
|
31
|
+
]);
|
|
10
32
|
|
|
11
33
|
getOpenAi() {
|
|
12
34
|
if (!this.openai)
|
|
@@ -15,14 +37,14 @@ export default class OpenAIModel extends Model {
|
|
|
15
37
|
return this.openai;
|
|
16
38
|
}
|
|
17
39
|
|
|
18
|
-
async generate(thread, functions = [], options = {}) {
|
|
40
|
+
async generate(model, thread, functions = [], options = {}) {
|
|
19
41
|
const parsed = this.parseOptions(options, functions);
|
|
20
42
|
options = parsed.options;
|
|
21
43
|
functions = parsed.functions;
|
|
22
44
|
|
|
23
45
|
let messages = thread.messages;
|
|
24
46
|
|
|
25
|
-
if (functions.length && !
|
|
47
|
+
if (functions.length && !model.tools) {
|
|
26
48
|
// Se il modello non supporta nativamente le funzioni, inserisco il prompt ad hoc come ultimo messaggio di sistema
|
|
27
49
|
const functions_prompt = this.promptFromFunctions(options, functions);
|
|
28
50
|
let system_messages = [], other_messages = [], first_found = false;
|
|
@@ -44,10 +66,10 @@ export default class OpenAIModel extends Model {
|
|
|
44
66
|
|
|
45
67
|
const convertedMessages = [];
|
|
46
68
|
for (let m of messages)
|
|
47
|
-
convertedMessages.push(...this.convertMessage(m));
|
|
69
|
+
convertedMessages.push(...this.convertMessage(m, model));
|
|
48
70
|
|
|
49
71
|
const completion_payload = {
|
|
50
|
-
model:
|
|
72
|
+
model: model.name,
|
|
51
73
|
messages: convertedMessages,
|
|
52
74
|
tools: functions.map(f => ({
|
|
53
75
|
type: 'function',
|
|
@@ -98,7 +120,8 @@ export default class OpenAIModel extends Model {
|
|
|
98
120
|
|
|
99
121
|
async countTokens(thread) {
|
|
100
122
|
try {
|
|
101
|
-
const
|
|
123
|
+
const model = this.models.get(thread.state.model);
|
|
124
|
+
const encoder = encoding_for_model(model.tiktoken || model.name);
|
|
102
125
|
|
|
103
126
|
const texts = [];
|
|
104
127
|
for (let message of thread.messages)
|
|
@@ -109,7 +132,7 @@ export default class OpenAIModel extends Model {
|
|
|
109
132
|
}
|
|
110
133
|
}
|
|
111
134
|
|
|
112
|
-
convertMessage(message) {
|
|
135
|
+
convertMessage(message, model) {
|
|
113
136
|
const messages = [],
|
|
114
137
|
role = message.role === 'system' ? this.system_role_name : message.role;
|
|
115
138
|
|
|
@@ -140,7 +163,7 @@ export default class OpenAIModel extends Model {
|
|
|
140
163
|
break;
|
|
141
164
|
|
|
142
165
|
case 'audio':
|
|
143
|
-
if (
|
|
166
|
+
if (model.audio) {
|
|
144
167
|
if (c.content.type !== 'base64')
|
|
145
168
|
throw new Error('Audio content must be base64 encoded for this model');
|
|
146
169
|
if (!['audio/mpeg', 'audio/wav'].includes(c.content.mime))
|
|
@@ -171,7 +194,7 @@ export default class OpenAIModel extends Model {
|
|
|
171
194
|
break;
|
|
172
195
|
|
|
173
196
|
case 'function':
|
|
174
|
-
if (
|
|
197
|
+
if (model.tools) {
|
|
175
198
|
messages.push({
|
|
176
199
|
role,
|
|
177
200
|
name: message.name,
|
|
@@ -194,7 +217,7 @@ export default class OpenAIModel extends Model {
|
|
|
194
217
|
break;
|
|
195
218
|
|
|
196
219
|
case 'function_response':
|
|
197
|
-
if (
|
|
220
|
+
if (model.tools) {
|
|
198
221
|
messages.push({
|
|
199
222
|
role,
|
|
200
223
|
tool_call_id: c.content.id,
|
package/README.md
CHANGED
|
@@ -218,7 +218,7 @@ import WeatherTool from './WeatherTool.js';
|
|
|
218
218
|
|
|
219
219
|
// ... inside main()
|
|
220
220
|
const agent = new MyChatAgent();
|
|
221
|
-
agent.addTool(new WeatherTool());
|
|
221
|
+
await agent.addTool(new WeatherTool());
|
|
222
222
|
await agent.init();
|
|
223
223
|
|
|
224
224
|
const emitter = await agent.message("What's the weather like in Paris?");
|
package/Symposium.js
CHANGED
|
@@ -25,14 +25,10 @@ export default class Symposium {
|
|
|
25
25
|
if (!file.endsWith('.js'))
|
|
26
26
|
continue;
|
|
27
27
|
|
|
28
|
-
const module = await import(`./
|
|
28
|
+
const module = await import(`./Models/${file}`);
|
|
29
29
|
const ModelClass = module.default;
|
|
30
|
-
if (ModelClass)
|
|
31
|
-
|
|
32
|
-
if (!model.name)
|
|
33
|
-
continue;
|
|
34
|
-
this.loadModel(model);
|
|
35
|
-
}
|
|
30
|
+
if (ModelClass)
|
|
31
|
+
this.loadModel(new ModelClass());
|
|
36
32
|
}
|
|
37
33
|
|
|
38
34
|
if (storage) {
|
|
@@ -41,8 +37,14 @@ export default class Symposium {
|
|
|
41
37
|
}
|
|
42
38
|
}
|
|
43
39
|
|
|
44
|
-
static loadModel(
|
|
45
|
-
|
|
40
|
+
static loadModel(model_class) {
|
|
41
|
+
for (let [key, model] of model_class.models.entries()) {
|
|
42
|
+
this.models.set(key, {
|
|
43
|
+
...model,
|
|
44
|
+
type: model_class.type,
|
|
45
|
+
class: model_class,
|
|
46
|
+
});
|
|
47
|
+
}
|
|
46
48
|
}
|
|
47
49
|
|
|
48
50
|
static getModelByName(name) {
|
|
@@ -68,9 +70,15 @@ export default class Symposium {
|
|
|
68
70
|
return functions;
|
|
69
71
|
}
|
|
70
72
|
|
|
71
|
-
static async transcribe(audio, prompt = null) {
|
|
72
|
-
|
|
73
|
-
|
|
73
|
+
static async transcribe(audio, prompt = null, model = null) {
|
|
74
|
+
model = model || process.env.TRANSCRIPTION_MODEL;
|
|
75
|
+
if (!model)
|
|
76
|
+
throw new Error('Transcription model not specified');
|
|
77
|
+
|
|
78
|
+
if (!this.transcription_model)
|
|
79
|
+
this.transcription_model = Symposium.getModelByName(model);
|
|
80
|
+
if (!this.transcription_model.type !== 'stt')
|
|
81
|
+
throw new Error('Specified model is not a transcription model');
|
|
74
82
|
|
|
75
83
|
let file;
|
|
76
84
|
switch (audio.type) {
|
|
@@ -96,10 +104,7 @@ export default class Symposium {
|
|
|
96
104
|
break;
|
|
97
105
|
}
|
|
98
106
|
|
|
99
|
-
|
|
100
|
-
this.transcription_model = Symposium.getModelByName(process.env.TRANSCRIPTION_MODEL);
|
|
101
|
-
|
|
102
|
-
return this.transcription_model.transcribe(file, prompt);
|
|
107
|
+
return this.transcription_model.transcribe(file, model, prompt);
|
|
103
108
|
}
|
|
104
109
|
|
|
105
110
|
static getExtFromMime(mime) {
|
|
@@ -124,6 +129,8 @@ export default class Symposium {
|
|
|
124
129
|
};
|
|
125
130
|
|
|
126
131
|
agent.doInitThread = async thread => {
|
|
132
|
+
if (options.model)
|
|
133
|
+
await thread.setModel(options.model);
|
|
127
134
|
await thread.addMessage('system', system);
|
|
128
135
|
};
|
|
129
136
|
|
package/package.json
CHANGED
package/models/Claude35Sonnet.js
DELETED
package/models/Claude37Sonnet.js
DELETED
package/models/Claude45Haiku.js
DELETED
package/models/Claude45Sonnet.js
DELETED
package/models/Claude4Opus.js
DELETED
package/models/Claude4Sonnet.js
DELETED
package/models/DeepSeekChat.js
DELETED
package/models/Gpt35.js
DELETED
package/models/Gpt4.js
DELETED
package/models/Gpt4O.js
DELETED
package/models/Gpt4Turbo.js
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import OpenAIModel from "./OpenAIModel.js";
|
|
2
|
-
|
|
3
|
-
export default class Gpt4oTranscribe extends OpenAIModel {
|
|
4
|
-
type = 'stt';
|
|
5
|
-
name = 'gpt-4o-transcribe';
|
|
6
|
-
|
|
7
|
-
async transcribe(file, prompt = null) {
|
|
8
|
-
const response = await this.getOpenAi().audio.transcriptions.create({
|
|
9
|
-
model: 'gpt-4o-transcribe',
|
|
10
|
-
file,
|
|
11
|
-
prompt,
|
|
12
|
-
});
|
|
13
|
-
|
|
14
|
-
return response.text;
|
|
15
|
-
}
|
|
16
|
-
}
|
package/models/Gpt5.js
DELETED
package/models/Gpt5Mini.js
DELETED
package/models/GptO1.js
DELETED
package/models/GptO1Mini.js
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import OpenAIModel from "./OpenAIModel.js";
|
|
2
|
-
|
|
3
|
-
export default class GptO1Mini extends OpenAIModel {
|
|
4
|
-
name = 'o1-mini';
|
|
5
|
-
label = 'gpt-o1-mini';
|
|
6
|
-
name_for_tiktoken = 'o1-mini';
|
|
7
|
-
tokens = 128000;
|
|
8
|
-
supports_structured_output = true;
|
|
9
|
-
system_role_name = 'developer';
|
|
10
|
-
}
|
package/models/Grok4.js
DELETED
package/models/Llama3.js
DELETED