@google/generative-ai
Advanced tools
Comparing version 0.11.1 to 0.11.2
@@ -72,3 +72,3 @@ 'use strict'; | ||
*/ | ||
const PACKAGE_VERSION = "0.11.1"; | ||
const PACKAGE_VERSION = "0.11.2"; | ||
const PACKAGE_LOG_HEADER = "genai-js"; | ||
@@ -75,0 +75,0 @@ var Task; |
@@ -250,3 +250,3 @@ 'use strict'; | ||
*/ | ||
const PACKAGE_VERSION = "0.11.1"; | ||
const PACKAGE_VERSION = "0.11.2"; | ||
const PACKAGE_LOG_HEADER = "genai-js"; | ||
@@ -902,11 +902,4 @@ var Task; | ||
}; | ||
const VALID_PREVIOUS_CONTENT_ROLES = { | ||
user: ["model"], | ||
function: ["model"], | ||
model: ["user", "function"], | ||
// System instructions shouldn't be in history. | ||
system: [], | ||
}; | ||
function validateChatHistory(history) { | ||
let prevContent; | ||
let prevContent = false; | ||
for (const currContent of history) { | ||
@@ -946,9 +939,3 @@ const { role, parts } = currContent; | ||
} | ||
if (prevContent) { | ||
const validPreviousContentRoles = VALID_PREVIOUS_CONTENT_ROLES[role]; | ||
if (!validPreviousContentRoles.includes(prevContent.role)) { | ||
throw new GoogleGenerativeAIError(`Content with role '${role}' can't follow '${prevContent.role}'. Valid previous roles: ${JSON.stringify(VALID_PREVIOUS_CONTENT_ROLES)}`); | ||
} | ||
} | ||
prevContent = currContent; | ||
prevContent = true; | ||
} | ||
@@ -955,0 +942,0 @@ } |
{ | ||
"name": "@google/generative-ai", | ||
"version": "0.11.1", | ||
"version": "0.11.2", | ||
"description": "Google AI JavaScript SDK", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
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
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
254280
6772