New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@ai-sdk/mistral

Package Overview
Dependencies
Maintainers
0
Versions
74
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ai-sdk/mistral - npm Package Compare versions

Comparing version 0.0.42 to 0.0.43

31

./dist/index.js

@@ -41,3 +41,5 @@ "use strict";

const messages = [];
for (const { role, content } of prompt) {
for (let i = 0; i < prompt.length; i++) {
const { role, content } = prompt[i];
const isLastMessage = i === prompt.length - 1;
switch (role) {

@@ -102,2 +104,3 @@ case "system": {

content: text,
prefix: isLastMessage ? true : void 0,
tool_calls: toolCalls.length > 0 ? toolCalls : void 0

@@ -292,4 +295,9 @@ });

const choice = response.choices[0];
let text = (_a = choice.message.content) != null ? _a : void 0;
const lastMessage = rawPrompt[rawPrompt.length - 1];
if (lastMessage.role === "assistant" && (text == null ? void 0 : text.startsWith(lastMessage.content))) {
text = text.slice(lastMessage.content.length);
}
return {
text: (_a = choice.message.content) != null ? _a : void 0,
text,
toolCalls: (_b = choice.message.tool_calls) == null ? void 0 : _b.map((toolCall) => ({

@@ -331,3 +339,4 @@ toolCallType: "function",

};
let isFirstChunk = true;
let chunkNumber = 0;
let trimLeadingSpace = false;
return {

@@ -341,5 +350,5 @@ stream: response.pipeThrough(

}
chunkNumber++;
const value = chunk.value;
if (isFirstChunk) {
isFirstChunk = false;
if (chunkNumber === 1) {
controller.enqueue({

@@ -364,7 +373,17 @@ type: "response-metadata",

const delta = choice.delta;
if (chunkNumber <= 2) {
const lastMessage = rawPrompt[rawPrompt.length - 1];
if (lastMessage.role === "assistant" && delta.content === lastMessage.content.trimEnd()) {
if (delta.content.length < lastMessage.content.length) {
trimLeadingSpace = true;
}
return;
}
}
if (delta.content != null) {
controller.enqueue({
type: "text-delta",
textDelta: delta.content
textDelta: trimLeadingSpace ? delta.content.trimStart() : delta.content
});
trimLeadingSpace = false;
}

@@ -371,0 +390,0 @@ if (delta.tool_calls != null) {

# @ai-sdk/mistral
## 0.0.43
### Patch Changes
- 843656c: feat (provider/mistral): support continuation and trailing assistant messages
## 0.0.42

@@ -4,0 +10,0 @@

@@ -41,3 +41,5 @@ "use strict";

const messages = [];
for (const { role, content } of prompt) {
for (let i = 0; i < prompt.length; i++) {
const { role, content } = prompt[i];
const isLastMessage = i === prompt.length - 1;
switch (role) {

@@ -102,2 +104,3 @@ case "system": {

content: text,
prefix: isLastMessage ? true : void 0,
tool_calls: toolCalls.length > 0 ? toolCalls : void 0

@@ -292,4 +295,9 @@ });

const choice = response.choices[0];
let text = (_a = choice.message.content) != null ? _a : void 0;
const lastMessage = rawPrompt[rawPrompt.length - 1];
if (lastMessage.role === "assistant" && (text == null ? void 0 : text.startsWith(lastMessage.content))) {
text = text.slice(lastMessage.content.length);
}
return {
text: (_a = choice.message.content) != null ? _a : void 0,
text,
toolCalls: (_b = choice.message.tool_calls) == null ? void 0 : _b.map((toolCall) => ({

@@ -331,3 +339,4 @@ toolCallType: "function",

};
let isFirstChunk = true;
let chunkNumber = 0;
let trimLeadingSpace = false;
return {

@@ -341,5 +350,5 @@ stream: response.pipeThrough(

}
chunkNumber++;
const value = chunk.value;
if (isFirstChunk) {
isFirstChunk = false;
if (chunkNumber === 1) {
controller.enqueue({

@@ -364,7 +373,17 @@ type: "response-metadata",

const delta = choice.delta;
if (chunkNumber <= 2) {
const lastMessage = rawPrompt[rawPrompt.length - 1];
if (lastMessage.role === "assistant" && delta.content === lastMessage.content.trimEnd()) {
if (delta.content.length < lastMessage.content.length) {
trimLeadingSpace = true;
}
return;
}
}
if (delta.content != null) {
controller.enqueue({
type: "text-delta",
textDelta: delta.content
textDelta: trimLeadingSpace ? delta.content.trimStart() : delta.content
});
trimLeadingSpace = false;
}

@@ -371,0 +390,0 @@ if (delta.tool_calls != null) {

2

package.json
{
"name": "@ai-sdk/mistral",
"version": "0.0.42",
"version": "0.0.43",
"license": "Apache-2.0",

@@ -5,0 +5,0 @@ "sideEffects": false,

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc