@google/generative-ai
Advanced tools
Comparing version 0.2.0 to 0.2.1
@@ -161,3 +161,3 @@ 'use strict'; | ||
*/ | ||
const PACKAGE_VERSION = "0.2.0"; | ||
const PACKAGE_VERSION = "0.2.1"; | ||
const PACKAGE_LOG_HEADER = "genai-js"; | ||
@@ -180,3 +180,3 @@ var Task; | ||
toString() { | ||
let url = `${BASE_URL}/${API_VERSION}/models/${this.model}:${this.task}`; | ||
let url = `${BASE_URL}/${API_VERSION}/${this.model}:${this.task}`; | ||
if (this.stream) { | ||
@@ -787,3 +787,3 @@ url += "?alt=sse"; | ||
const requestsWithModel = params.requests.map((request) => { | ||
return Object.assign(Object.assign({}, request), { model: `models/${model}` }); | ||
return Object.assign(Object.assign({}, request), { model }); | ||
}); | ||
@@ -816,9 +816,10 @@ const response = await makeRequest(url, JSON.stringify({ requests: requestsWithModel }), requestOptions); | ||
constructor(apiKey, modelParams, requestOptions) { | ||
var _a; | ||
this.apiKey = apiKey; | ||
if (modelParams.model.startsWith("models/")) { | ||
this.model = (_a = modelParams.model.split("models/")) === null || _a === void 0 ? void 0 : _a[1]; | ||
if (modelParams.model.includes("/")) { | ||
// Models may be named "models/model-name" or "tunedModels/model-name" | ||
this.model = modelParams.model; | ||
} | ||
else { | ||
this.model = modelParams.model; | ||
// If path is not included, assume it's a non-tuned model. | ||
this.model = `models/${modelParams.model}`; | ||
} | ||
@@ -825,0 +826,0 @@ this.generationConfig = modelParams.generationConfig || {}; |
{ | ||
"name": "@google/generative-ai", | ||
"version": "0.2.0", | ||
"version": "0.2.1", | ||
"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
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
117992
2973