symposium 0.12.3 → 0.12.4
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 +23 -7
- package/Symposium.js +9 -0
- package/models/DeepSeekChat.js +7 -0
- package/models/DeepSeekModel.js +15 -0
- package/models/DeepSeekReasoner.js +7 -0
- package/models/Gpt4O.js +1 -0
- package/models/GptO1.js +9 -0
- package/models/GptO1Mini.js +9 -0
- package/package.json +1 -1
package/Agent.js
CHANGED
|
@@ -12,6 +12,7 @@ export default class Agent {
|
|
|
12
12
|
max_retries = 5;
|
|
13
13
|
callbacks = {};
|
|
14
14
|
utility = null;
|
|
15
|
+
supports_structured_output = false;
|
|
15
16
|
|
|
16
17
|
constructor(options) {
|
|
17
18
|
this.options = {
|
|
@@ -113,10 +114,22 @@ export default class Agent {
|
|
|
113
114
|
if (!this.utility.function || !this.utility.function.name || !this.utility.function.parameters)
|
|
114
115
|
throw new Error('Bad function definition');
|
|
115
116
|
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
117
|
+
if (this.supports_structured_output) {
|
|
118
|
+
// TODO: se ci sono più di 100 parametri, OpenAI non supporta gli structured output
|
|
119
|
+
completion_options.response_format = {
|
|
120
|
+
type: 'json_schema',
|
|
121
|
+
json_schema: {
|
|
122
|
+
name: this.utility.function.name,
|
|
123
|
+
schema: this.utility.function.parameters,
|
|
124
|
+
strict: true,
|
|
125
|
+
},
|
|
126
|
+
};
|
|
127
|
+
} else {
|
|
128
|
+
completion_options.functions = [
|
|
129
|
+
this.utility.function,
|
|
130
|
+
];
|
|
131
|
+
completion_options.force_function = this.utility.function.name;
|
|
132
|
+
}
|
|
120
133
|
}
|
|
121
134
|
}
|
|
122
135
|
|
|
@@ -231,9 +244,12 @@ export default class Agent {
|
|
|
231
244
|
for (let m of message.content) {
|
|
232
245
|
switch (m.type) {
|
|
233
246
|
case 'text':
|
|
234
|
-
if (this.utility
|
|
235
|
-
|
|
236
|
-
|
|
247
|
+
if (this.utility) {
|
|
248
|
+
if (this.utility.type === 'text')
|
|
249
|
+
return this.afterHandle(thread, completion, 'return', m.content);
|
|
250
|
+
if (this.utility.type === 'function' && this.supports_structured_output)
|
|
251
|
+
return this.afterHandle(thread, completion, 'return', JSON.parse(m.content));
|
|
252
|
+
}
|
|
237
253
|
await this.output(thread, m.content);
|
|
238
254
|
break;
|
|
239
255
|
|
package/Symposium.js
CHANGED
|
@@ -2,6 +2,8 @@ import Gpt35 from "./models/Gpt35.js";
|
|
|
2
2
|
import Gpt4 from "./models/Gpt4.js";
|
|
3
3
|
import Gpt4Turbo from "./models/Gpt4Turbo.js";
|
|
4
4
|
import Gpt4O from "./models/Gpt4O.js";
|
|
5
|
+
import GptO1 from "./models/GptO1.js";
|
|
6
|
+
import GptO1Mini from "./models/GptO1Mini.js";
|
|
5
7
|
import Whisper from "./models/Whisper.js";
|
|
6
8
|
import Claude3Haiku from "./models/Claude3Haiku.js";
|
|
7
9
|
import Claude3Sonnet from "./models/Claude3Sonnet.js";
|
|
@@ -9,6 +11,8 @@ import Claude3Opus from "./models/Claude3Opus.js";
|
|
|
9
11
|
import Claude35Sonnet from "./models/Claude35Sonnet.js";
|
|
10
12
|
import Llama3 from "./models/Llama3.js";
|
|
11
13
|
import Mixtral8 from "./models/Mixtral8.js";
|
|
14
|
+
import DeepSeekChat from "./models/DeepSeekChat.js";
|
|
15
|
+
import DeepSeekReasoner from "./models/DeepSeekReasoner.js";
|
|
12
16
|
|
|
13
17
|
export default class Symposium {
|
|
14
18
|
static models = new Map();
|
|
@@ -25,6 +29,8 @@ export default class Symposium {
|
|
|
25
29
|
this.loadModel(new Gpt4());
|
|
26
30
|
this.loadModel(new Gpt4Turbo());
|
|
27
31
|
this.loadModel(new Gpt4O());
|
|
32
|
+
this.loadModel(new GptO1());
|
|
33
|
+
this.loadModel(new GptO1Mini());
|
|
28
34
|
this.loadModel(new Whisper());
|
|
29
35
|
|
|
30
36
|
this.loadModel(new Claude3Haiku());
|
|
@@ -36,6 +42,9 @@ export default class Symposium {
|
|
|
36
42
|
this.loadModel(new Llama3());
|
|
37
43
|
this.loadModel(new Mixtral8());
|
|
38
44
|
|
|
45
|
+
this.loadModel(new DeepSeekChat());
|
|
46
|
+
this.loadModel(new DeepSeekReasoner());
|
|
47
|
+
|
|
39
48
|
this.storage = storage;
|
|
40
49
|
await this.storage.init();
|
|
41
50
|
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import OpenAIModel from "./OpenAIModel.js";
|
|
2
|
+
import OpenAI from "openai";
|
|
3
|
+
|
|
4
|
+
export default class DeepSeekModel extends OpenAIModel {
|
|
5
|
+
getOpenAi() {
|
|
6
|
+
if (!this.openai) {
|
|
7
|
+
this.openai = new OpenAI({
|
|
8
|
+
baseURL: 'https://api.deepseek.com',
|
|
9
|
+
apiKey: process.env.DEEPSEEK_API_KEY,
|
|
10
|
+
});
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
return this.openai;
|
|
14
|
+
}
|
|
15
|
+
}
|
package/models/Gpt4O.js
CHANGED
package/models/GptO1.js
ADDED