@google/generative-ai
Advanced tools
Comparing version 0.10.0 to 0.11.0
@@ -25,5 +25,17 @@ /** | ||
uri: string; | ||
state: FileState; | ||
} | ||
/** | ||
* Processing state of the `File`. | ||
* @public | ||
*/ | ||
export declare enum FileState { | ||
STATE_UNSPECIFIED = 0, | ||
PROCESSING = 1, | ||
ACTIVE = 2, | ||
FAILED = 10 | ||
} | ||
/** | ||
* Class for managing GoogleAI file uploads. | ||
@@ -30,0 +42,0 @@ * @public |
@@ -66,3 +66,3 @@ 'use strict'; | ||
*/ | ||
const PACKAGE_VERSION = "0.10.0"; | ||
const PACKAGE_VERSION = "0.11.0"; | ||
const PACKAGE_LOG_HEADER = "genai-js"; | ||
@@ -338,3 +338,35 @@ var Task; | ||
/** | ||
* @license | ||
* Copyright 2024 Google LLC | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
/** | ||
* Processing state of the `File`. | ||
* @public | ||
*/ | ||
exports.FileState = void 0; | ||
(function (FileState) { | ||
// The default value. This value is used if the state is omitted. | ||
FileState[FileState["STATE_UNSPECIFIED"] = 0] = "STATE_UNSPECIFIED"; | ||
// File is being processed and cannot be used for inference yet. | ||
FileState[FileState["PROCESSING"] = 1] = "PROCESSING"; | ||
// File is processed and available for inference. | ||
FileState[FileState["ACTIVE"] = 2] = "ACTIVE"; | ||
// File failed processing. | ||
FileState[FileState["FAILED"] = 10] = "FAILED"; | ||
})(exports.FileState || (exports.FileState = {})); | ||
exports.GoogleAIFileManager = GoogleAIFileManager; | ||
//# sourceMappingURL=index.js.map |
@@ -48,2 +48,3 @@ /** | ||
uri: string; | ||
state: FileState; | ||
} | ||
@@ -65,1 +66,11 @@ /** | ||
} | ||
/** | ||
* Processing state of the `File`. | ||
* @public | ||
*/ | ||
export declare enum FileState { | ||
STATE_UNSPECIFIED = 0, | ||
PROCESSING = 1, | ||
ACTIVE = 2, | ||
FAILED = 10 | ||
} |
@@ -24,3 +24,3 @@ /** | ||
/** | ||
* Returns text of first candidate. | ||
* Returns all text found in all parts of first candidate. | ||
*/ | ||
@@ -27,0 +27,0 @@ export declare function getText(response: GenerateContentResponse): string; |
@@ -66,2 +66,9 @@ /** | ||
topK?: number; | ||
/** | ||
* Output response mimetype of the generated candidate text. | ||
* Supported mimetype: | ||
* `text/plain`: (default) Text output. | ||
* `application/json`: JSON response in the candidates. | ||
*/ | ||
responseMimeType?: string; | ||
} | ||
@@ -68,0 +75,0 @@ /** |
@@ -498,2 +498,9 @@ /** | ||
topK?: number; | ||
/** | ||
* Output response mimetype of the generated candidate text. | ||
* Supported mimetype: | ||
* `text/plain`: (default) Text output. | ||
* `application/json`: JSON response in the candidates. | ||
*/ | ||
responseMimeType?: string; | ||
} | ||
@@ -500,0 +507,0 @@ |
@@ -250,3 +250,3 @@ 'use strict'; | ||
*/ | ||
const PACKAGE_VERSION = "0.10.0"; | ||
const PACKAGE_VERSION = "0.11.0"; | ||
const PACKAGE_LOG_HEADER = "genai-js"; | ||
@@ -464,11 +464,17 @@ var Task; | ||
/** | ||
* Returns text of first candidate. | ||
* Returns all text found in all parts of first candidate. | ||
*/ | ||
function getText(response) { | ||
var _a, _b, _c, _d; | ||
if ((_d = (_c = (_b = (_a = response.candidates) === null || _a === void 0 ? void 0 : _a[0].content) === null || _b === void 0 ? void 0 : _b.parts) === null || _c === void 0 ? void 0 : _c[0]) === null || _d === void 0 ? void 0 : _d.text) { | ||
return response.candidates[0].content.parts | ||
.map(({ text }) => text) | ||
.join(""); | ||
const textStrings = []; | ||
if ((_b = (_a = response.candidates) === null || _a === void 0 ? void 0 : _a[0].content) === null || _b === void 0 ? void 0 : _b.parts) { | ||
for (const part of (_d = (_c = response.candidates) === null || _c === void 0 ? void 0 : _c[0].content) === null || _d === void 0 ? void 0 : _d.parts) { | ||
if (part.text) { | ||
textStrings.push(part.text); | ||
} | ||
} | ||
} | ||
if (textStrings.length > 0) { | ||
return textStrings.join(""); | ||
} | ||
else { | ||
@@ -475,0 +481,0 @@ return ""; |
@@ -48,2 +48,3 @@ /** | ||
uri: string; | ||
state: FileState; | ||
} | ||
@@ -65,1 +66,11 @@ /** | ||
} | ||
/** | ||
* Processing state of the `File`. | ||
* @public | ||
*/ | ||
export declare enum FileState { | ||
STATE_UNSPECIFIED = 0, | ||
PROCESSING = 1, | ||
ACTIVE = 2, | ||
FAILED = 10 | ||
} |
@@ -24,3 +24,3 @@ /** | ||
/** | ||
* Returns text of first candidate. | ||
* Returns all text found in all parts of first candidate. | ||
*/ | ||
@@ -27,0 +27,0 @@ export declare function getText(response: GenerateContentResponse): string; |
@@ -66,2 +66,9 @@ /** | ||
topK?: number; | ||
/** | ||
* Output response mimetype of the generated candidate text. | ||
* Supported mimetype: | ||
* `text/plain`: (default) Text output. | ||
* `application/json`: JSON response in the candidates. | ||
*/ | ||
responseMimeType?: string; | ||
} | ||
@@ -68,0 +75,0 @@ /** |
{ | ||
"name": "@google/generative-ai", | ||
"version": "0.10.0", | ||
"version": "0.11.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
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
254490
6768