@ai-sdk/google-vertex
Advanced tools
Comparing version 0.0.14 to 0.0.15
@@ -43,16 +43,18 @@ "use strict"; | ||
}) { | ||
let systemInstruction = void 0; | ||
const systemInstructionParts = []; | ||
const contents = []; | ||
let systemMessagesAllowed = true; | ||
for (const { role, content } of prompt) { | ||
switch (role) { | ||
case "system": { | ||
if (systemInstruction != null) { | ||
if (!systemMessagesAllowed) { | ||
throw new import_provider.UnsupportedFunctionalityError({ | ||
functionality: "Multiple system messages" | ||
functionality: "system messages are only supported at the beginning of the conversation" | ||
}); | ||
} | ||
systemInstruction = content; | ||
systemInstructionParts.push({ text: content }); | ||
break; | ||
} | ||
case "user": { | ||
systemMessagesAllowed = false; | ||
const parts = []; | ||
@@ -98,2 +100,3 @@ for (const part of content) { | ||
case "assistant": { | ||
systemMessagesAllowed = false; | ||
contents.push({ | ||
@@ -126,2 +129,3 @@ role: "assistant", | ||
case "tool": { | ||
systemMessagesAllowed = false; | ||
contents.push({ | ||
@@ -147,3 +151,3 @@ role: "user", | ||
return { | ||
systemInstruction, | ||
systemInstruction: systemInstructionParts.length > 0 ? { role: "system", parts: systemInstructionParts } : void 0, | ||
contents | ||
@@ -150,0 +154,0 @@ }; |
@@ -43,16 +43,18 @@ "use strict"; | ||
}) { | ||
let systemInstruction = void 0; | ||
const systemInstructionParts = []; | ||
const contents = []; | ||
let systemMessagesAllowed = true; | ||
for (const { role, content } of prompt) { | ||
switch (role) { | ||
case "system": { | ||
if (systemInstruction != null) { | ||
if (!systemMessagesAllowed) { | ||
throw new import_provider.UnsupportedFunctionalityError({ | ||
functionality: "Multiple system messages" | ||
functionality: "system messages are only supported at the beginning of the conversation" | ||
}); | ||
} | ||
systemInstruction = content; | ||
systemInstructionParts.push({ text: content }); | ||
break; | ||
} | ||
case "user": { | ||
systemMessagesAllowed = false; | ||
const parts = []; | ||
@@ -98,2 +100,3 @@ for (const part of content) { | ||
case "assistant": { | ||
systemMessagesAllowed = false; | ||
contents.push({ | ||
@@ -126,2 +129,3 @@ role: "assistant", | ||
case "tool": { | ||
systemMessagesAllowed = false; | ||
contents.push({ | ||
@@ -147,3 +151,3 @@ role: "user", | ||
return { | ||
systemInstruction, | ||
systemInstruction: systemInstructionParts.length > 0 ? { role: "system", parts: systemInstructionParts } : void 0, | ||
contents | ||
@@ -150,0 +154,0 @@ }; |
{ | ||
"name": "@ai-sdk/google-vertex", | ||
"version": "0.0.14", | ||
"version": "0.0.15", | ||
"license": "Apache-2.0", | ||
@@ -23,3 +23,3 @@ "sideEffects": false, | ||
"@ai-sdk/provider-utils": "1.0.2", | ||
"@google-cloud/vertexai": "1.2.0", | ||
"@google-cloud/vertexai": "1.3.1", | ||
"json-schema": "0.4.0" | ||
@@ -26,0 +26,0 @@ }, |
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
128258
1803
+ Added@google-cloud/vertexai@1.3.1(transitive)
- Removed@google-cloud/vertexai@1.2.0(transitive)
Updated@google-cloud/vertexai@1.3.1