Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@google/generative-ai

Package Overview
Dependencies
Maintainers
4
Versions
36
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@google/generative-ai - npm Package Compare versions

Comparing version 0.17.2 to 0.18.0

2

dist/generative-ai.d.ts

@@ -710,3 +710,3 @@ /**

*/
getGenerativeModelFromCachedContent(cachedContent: CachedContent, requestOptions?: RequestOptions): GenerativeModel;
getGenerativeModelFromCachedContent(cachedContent: CachedContent, modelParams?: Partial<ModelParams>, requestOptions?: RequestOptions): GenerativeModel;
}

@@ -713,0 +713,0 @@

@@ -286,3 +286,3 @@ 'use strict';

*/
const PACKAGE_VERSION = "0.17.2";
const PACKAGE_VERSION = "0.18.0";
const PACKAGE_LOG_HEADER = "genai-js";

@@ -1409,3 +1409,3 @@ var Task;

*/
getGenerativeModelFromCachedContent(cachedContent, requestOptions) {
getGenerativeModelFromCachedContent(cachedContent, modelParams, requestOptions) {
if (!cachedContent.name) {

@@ -1417,9 +1417,27 @@ throw new GoogleGenerativeAIRequestInputError("Cached content must contain a `name` field.");

}
const modelParamsFromCache = {
model: cachedContent.model,
tools: cachedContent.tools,
toolConfig: cachedContent.toolConfig,
systemInstruction: cachedContent.systemInstruction,
cachedContent,
};
/**
* Not checking tools and toolConfig for now as it would require a deep
* equality comparison and isn't likely to be a common case.
*/
const disallowedDuplicates = ["model", "systemInstruction"];
for (const key of disallowedDuplicates) {
if ((modelParams === null || modelParams === void 0 ? void 0 : modelParams[key]) &&
cachedContent[key] &&
(modelParams === null || modelParams === void 0 ? void 0 : modelParams[key]) !== cachedContent[key]) {
if (key === "model") {
const modelParamsComp = modelParams.model.startsWith("models/")
? modelParams.model.replace("models/", "")
: modelParams.model;
const cachedContentComp = cachedContent.model.startsWith("models/")
? cachedContent.model.replace("models/", "")
: cachedContent.model;
if (modelParamsComp === cachedContentComp) {
continue;
}
}
throw new GoogleGenerativeAIRequestInputError(`Different value for "${key}" specified in modelParams` +
` (${modelParams[key]}) and cachedContent (${cachedContent[key]})`);
}
}
const modelParamsFromCache = Object.assign(Object.assign({}, modelParams), { model: cachedContent.model, tools: cachedContent.tools, toolConfig: cachedContent.toolConfig, systemInstruction: cachedContent.systemInstruction, cachedContent });
return new GenerativeModel(this.apiKey, modelParamsFromCache, requestOptions);

@@ -1426,0 +1444,0 @@ }

@@ -72,3 +72,3 @@ 'use strict';

*/
const PACKAGE_VERSION = "0.17.2";
const PACKAGE_VERSION = "0.18.0";
const PACKAGE_LOG_HEADER = "genai-js";

@@ -75,0 +75,0 @@ var Task;

@@ -35,3 +35,3 @@ /**

*/
getGenerativeModelFromCachedContent(cachedContent: CachedContent, requestOptions?: RequestOptions): GenerativeModel;
getGenerativeModelFromCachedContent(cachedContent: CachedContent, modelParams?: Partial<ModelParams>, requestOptions?: RequestOptions): GenerativeModel;
}

@@ -35,3 +35,3 @@ /**

*/
getGenerativeModelFromCachedContent(cachedContent: CachedContent, requestOptions?: RequestOptions): GenerativeModel;
getGenerativeModelFromCachedContent(cachedContent: CachedContent, modelParams?: Partial<ModelParams>, requestOptions?: RequestOptions): GenerativeModel;
}
{
"name": "@google/generative-ai",
"version": "0.17.2",
"version": "0.18.0",
"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

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