modelmix 3.0.4 → 3.0.6
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/index.js +2 -2
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -237,7 +237,7 @@ class MessageHandler {
|
|
|
237
237
|
this.options.response_format = { type: "json_object" };
|
|
238
238
|
if (schemaExample) {
|
|
239
239
|
const schema = generateJsonSchema(schemaExample, schemaDescription);
|
|
240
|
-
this.addText("Output expected JSON Schema: \n```\n" + JSON.stringify(schema
|
|
240
|
+
this.addText("Output expected JSON Schema: \n```\n" + JSON.stringify(schema) + "\n```");
|
|
241
241
|
}
|
|
242
242
|
return JSON.parse(await this.message());
|
|
243
243
|
}
|
|
@@ -315,7 +315,6 @@ class MessageHandler {
|
|
|
315
315
|
async prepareMessages() {
|
|
316
316
|
await this.processImageUrls();
|
|
317
317
|
this.applyTemplate();
|
|
318
|
-
this.messages = this.messages.slice(-this.config.max_history);
|
|
319
318
|
this.messages = this.groupByRoles(this.messages);
|
|
320
319
|
this.options.messages = this.messages;
|
|
321
320
|
}
|
|
@@ -332,6 +331,7 @@ class MessageHandler {
|
|
|
332
331
|
try {
|
|
333
332
|
const result = await this.modelEntry.create({ options: this.options, config: this.config });
|
|
334
333
|
this.messages.push({ role: "assistant", content: result.message });
|
|
334
|
+
this.messages = this.messages.slice(-this.config.max_history);
|
|
335
335
|
return result;
|
|
336
336
|
} catch (error) {
|
|
337
337
|
// If there are fallback models available, try the next one
|