symposium 2.1.8 → 2.1.10
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 +5 -1
- package/Models/OllamaModel.js +1 -1
- package/Models/OpenAIModel.js +9 -4
- package/package.json +1 -1
package/Agent.js
CHANGED
|
@@ -22,6 +22,7 @@ export default class Agent {
|
|
|
22
22
|
type = 'chat'; // chat, utility
|
|
23
23
|
utility = null;
|
|
24
24
|
initialized = false;
|
|
25
|
+
enable_image_generation = false;
|
|
25
26
|
|
|
26
27
|
constructor(options) {
|
|
27
28
|
this.options = {
|
|
@@ -341,7 +342,10 @@ export default class Agent {
|
|
|
341
342
|
async generateCompletion(thread, options = {}, retry_counter = 1) {
|
|
342
343
|
try {
|
|
343
344
|
const model = Symposium.getModel(thread.state.model);
|
|
344
|
-
const messages = await model.class.generate(model, thread, await this.getFunctions(),
|
|
345
|
+
const messages = await model.class.generate(model, thread, await this.getFunctions(), {
|
|
346
|
+
...options,
|
|
347
|
+
image_generation: this.enable_image_generation,
|
|
348
|
+
});
|
|
345
349
|
return model.tools ? messages : messages.map(m => this.parseFunctions(m));
|
|
346
350
|
} catch (error) {
|
|
347
351
|
if (error.response) {
|
package/Models/OllamaModel.js
CHANGED
|
@@ -57,7 +57,7 @@ export default class OllamaModel extends Model {
|
|
|
57
57
|
convertedMessages.push(...this.convertMessage(m, model));
|
|
58
58
|
|
|
59
59
|
const completion_payload = {
|
|
60
|
-
model:
|
|
60
|
+
model: model.name,
|
|
61
61
|
messages: convertedMessages,
|
|
62
62
|
tools: functions.map(f => ({
|
|
63
63
|
type: 'function',
|
package/Models/OpenAIModel.js
CHANGED
|
@@ -71,13 +71,18 @@ export default class OpenAIModel extends Model {
|
|
|
71
71
|
for (let m of messages)
|
|
72
72
|
convertedMessages.push(...this.convertMessage(m, model));
|
|
73
73
|
|
|
74
|
+
const tools = functions.map(f => ({
|
|
75
|
+
type: 'function',
|
|
76
|
+
function: f,
|
|
77
|
+
}));
|
|
78
|
+
|
|
79
|
+
if (model.tools && model.image_generation && options.image_generation)
|
|
80
|
+
tools.push({type: 'image_generation'});
|
|
81
|
+
|
|
74
82
|
const completion_payload = {
|
|
75
83
|
model: model.name,
|
|
76
84
|
messages: convertedMessages,
|
|
77
|
-
tools
|
|
78
|
-
type: 'function',
|
|
79
|
-
function: f,
|
|
80
|
-
})),
|
|
85
|
+
tools,
|
|
81
86
|
};
|
|
82
87
|
|
|
83
88
|
if (options.force_function) {
|