@fuyun/generative-ai
Advanced tools
Comparing version
@@ -160,3 +160,3 @@ 'use strict'; | ||
*/ | ||
const PACKAGE_VERSION = "0.2.0"; | ||
const PACKAGE_VERSION = "0.2.1"; | ||
const PACKAGE_LOG_HEADER = "genai-js"; | ||
@@ -181,3 +181,3 @@ var Task; | ||
const baseURL = this.requestOptions.baseURL || 'https://generativelanguage.googleapis.com'; | ||
let url = `${baseURL}/${API_VERSION}/models/${this.model}:${this.task}`; | ||
let url = `${baseURL}/${API_VERSION}/${this.model}:${this.task}`; | ||
if (this.stream) { | ||
@@ -788,3 +788,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 }); | ||
}); | ||
@@ -817,9 +817,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}`; | ||
} | ||
@@ -826,0 +827,0 @@ this.generationConfig = modelParams.generationConfig || {}; |
{ | ||
"name": "@fuyun/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
118545
0.08%2978
0.07%