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

@google-cloud/vertexai

Package Overview
Dependencies
Maintainers
2
Versions
24
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@google-cloud/vertexai - npm Package Compare versions

Comparing version 1.9.0 to 1.9.2

2

.release-please-manifest.json
{
".": "1.9.0"
".": "1.9.2"
}

@@ -36,14 +36,2 @@ "use strict";

function validateGenerateContentRequest(request) {
const contents = request.contents;
for (const content of contents) {
for (const part of content.parts) {
if ('fileData' in part) {
// @ts-ignore
const uri = part['fileData']['fileUri'];
if (!uri.startsWith('gs://')) {
throw new URIError(`Found invalid Google Cloud Storage URI ${uri}, Google Cloud Storage URIs must start with gs://`);
}
}
}
}
if (hasVertexAISearch(request) && hasVertexRagStore(request)) {

@@ -50,0 +38,0 @@ throw new errors_1.ClientError('Found both vertexAiSearch and vertexRagStore field are set in tool. Either set vertexAiSearch or vertexRagStore.');

@@ -328,8 +328,2 @@ "use strict";

});
it('raises an error when passed an invalid GCS URI', async () => {
const req = {
contents: TEST_USER_CHAT_MESSAGE_WITH_INVALID_GCS_FILE,
};
await expectAsync((0, generate_content_1.generateContent)(TEST_LOCATION, TEST_RESOURCE_PATH, TEST_TOKEN_PROMISE, req, TEST_API_ENDPOINT)).toBeRejectedWithError(URIError);
});
it('returns a GenerateContentResponse when passed safetySettings and generationConfig', async () => {

@@ -336,0 +330,0 @@ const req = {

@@ -233,3 +233,3 @@ "use strict";

const newContent = formulateNewContentFromSendMessageRequest(request);
const generateContentrequest = {
const generateContentRequest = {
contents: this.historyInternal.concat(newContent),

@@ -241,4 +241,5 @@ safetySettings: this.safetySettings,

systemInstruction: this.systemInstruction,
cachedContent: this.cachedContent,
};
const generateContentResult = await (0, generate_content_1.generateContent)(this.location, this.resourcePath, this.fetchToken(), generateContentrequest, this.apiEndpoint, this.generationConfig, this.safetySettings, this.tools, this.toolConfig, this.requestOptions).catch(e => {
const generateContentResult = await (0, generate_content_1.generateContent)(this.location, this.resourcePath, this.fetchToken(), generateContentRequest, this.apiEndpoint, this.generationConfig, this.safetySettings, this.tools, this.toolConfig, this.requestOptions).catch(e => {
throw e;

@@ -245,0 +246,0 @@ });

@@ -180,2 +180,4 @@ /**

export declare interface GenerationConfig {
/** Optional. If true, the timestamp of the audio will be included in the response. */
audioTimestamp?: boolean;
/** Optional. Number of candidates to generate. */

@@ -395,4 +397,4 @@ candidateCount?: number;

* A datatype containing media that is part of a multi-part {@link Content}
* message. A `Part` is a union type of {@link TextPart}, {@link
* InlineDataPart}, {@link FileDataPart}, and {@link FunctionResponsePart}. A
* message. A `Part` is a union type of {@link TextPart}, {@link InlineDataPart},
* {@link FileDataPart}, and {@link FunctionResponsePart}. A
* `Part` has one of the following mutually exclusive fields:

@@ -428,2 +430,4 @@ * 1. text

totalTokenCount?: number;
/** Optional. Number of tokens in the cached content. */
cachedContentTokenCount?: number;
}

@@ -896,2 +900,13 @@ /**

}
export declare enum Mode {
MODE_UNSPECIFIED = "MODE_UNSPECIFIED",
MODE_DYNAMIC = "MODE_DYNAMIC"
}
/** Describes the options to customize dynamic retrieval. */
export declare interface DynamicRetrievalConfig {
/** Optional. The threshold to be used in dynamic retrieval. If not set, a system default value is used. */
dynamicThreshold?: number;
/** The mode of the predictor to be used in dynamic retrieval. */
mode?: Mode;
}
/**

@@ -901,2 +916,4 @@ * Tool to retrieve public web data for grounding, powered by Google.

export declare interface GoogleSearchRetrieval {
/** Specifies the dynamic retrieval configuration for the given source. */
dynamicRetrievalConfig?: DynamicRetrievalConfig;
}

@@ -903,0 +920,0 @@ /**

@@ -19,3 +19,3 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
exports.FunctionDeclarationSchemaType = exports.FinishReason = exports.BlockedReason = exports.HarmSeverity = exports.HarmProbability = exports.HarmBlockThreshold = exports.HarmCategory = void 0;
exports.FunctionDeclarationSchemaType = exports.Mode = exports.FinishReason = exports.BlockedReason = exports.HarmSeverity = exports.HarmProbability = exports.HarmBlockThreshold = exports.HarmCategory = void 0;
const common_1 = require("./common");

@@ -141,3 +141,8 @@ /**

})(FinishReason || (exports.FinishReason = FinishReason = {}));
var Mode;
(function (Mode) {
Mode["MODE_UNSPECIFIED"] = "MODE_UNSPECIFIED";
Mode["MODE_DYNAMIC"] = "MODE_DYNAMIC";
})(Mode || (exports.Mode = Mode = {}));
exports.FunctionDeclarationSchemaType = { ...common_1.SchemaType };
//# sourceMappingURL=content.js.map

@@ -23,3 +23,3 @@ /**

export declare const SYSTEM_ROLE = "system";
export declare const USER_AGENT = "model-builder/1.9.0 grpc-node/1.9.0";
export declare const USER_AGENT = "model-builder/1.9.2 grpc-node/1.9.2";
export declare const CREDENTIAL_ERROR_MESSAGE = "\nUnable to authenticate your request \nDepending on your run time environment, you can get authentication by \n- if in local instance or cloud shell: `!gcloud auth login` \n- if in Colab: \n -`from google.colab import auth` \n -`auth.authenticate_user()` \n- if in service account or other: please follow guidance in https://cloud.google.com/docs/authentication";

@@ -27,3 +27,3 @@ "use strict";

const USER_AGENT_PRODUCT = 'model-builder';
const CLIENT_LIBRARY_VERSION = '1.9.0'; // x-release-please-version
const CLIENT_LIBRARY_VERSION = '1.9.2'; // x-release-please-version
const CLIENT_LIBRARY_LANGUAGE = `grpc-node/${CLIENT_LIBRARY_VERSION}`;

@@ -30,0 +30,0 @@ exports.USER_AGENT = `${USER_AGENT_PRODUCT}/${CLIENT_LIBRARY_VERSION} ${CLIENT_LIBRARY_LANGUAGE}`;

@@ -74,3 +74,6 @@ "use strict";

googleSearchRetrieval: {
disableAttribution: false,
dynamicRetrievalConfig: {
dynamicThreshold: 0.2,
mode: src_1.Mode.MODE_DYNAMIC,
},
},

@@ -532,3 +535,3 @@ },

});
it('in preview should return grounding metadata when passed a VertexRagStore', async () => {
xit('in preview should return grounding metadata when passed a VertexRagStore', async () => {
var _a, _b;

@@ -535,0 +538,0 @@ const request = {

# Changelog
## [1.9.2](https://github.com/googleapis/nodejs-vertexai/compare/v1.9.0...v1.9.2) (2024-12-05)
### Features
* add support for audioTimestamp in GenerationConfig ([#467](https://github.com/googleapis/nodejs-vertexai/issues/467)) ([598d955](https://github.com/googleapis/nodejs-vertexai/commit/598d95580fb8302bced40837b5c4bbebc84946cf))
* enable dynamic retrieval for Google Search Retrieval grounding ([3f9eee6](https://github.com/googleapis/nodejs-vertexai/commit/3f9eee6589967164b8c1b86481468eaa5347afbd))
### Bug Fixes
* fix: extend UsageMetadata interface ([#439](https://github.com/googleapis/nodejs-vertexai/pull/439))
* Add Context Cache support for ChatSessionPreview class ([#433](https://github.com/googleapis/nodejs-vertexai/issues/433)) ([df6f040](https://github.com/googleapis/nodejs-vertexai/commit/df6f0406fbaa72cd64a8f51015e51fee88518db8))
* Add Context Cache support for ChatSessionPreview class ([#433](https://github.com/googleapis/nodejs-vertexai/issues/433)) ([a3beab1](https://github.com/googleapis/nodejs-vertexai/commit/a3beab1f30540749fbeba40a13327ea078dbed69))
* include cachedContent in generate request ([#469](https://github.com/googleapis/nodejs-vertexai/issues/469)) ([a16b9d4](https://github.com/googleapis/nodejs-vertexai/commit/a16b9d48df1e3d3b8784604de08f28167f3e85bf))
* remove restriction on gsc uri for file data part. ([e694c44](https://github.com/googleapis/nodejs-vertexai/commit/e694c441b456ea7bfb3d09f89c17d71641ef355c))
### Documentation
* Fix link in Part JSDoc([#440](https://github.com/googleapis/nodejs-vertexai/pull/440))
### Miscellaneous Chores
* release as 1.9.2 ([d54a91b](https://github.com/googleapis/nodejs-vertexai/commit/d54a91bce84980ddfa90b38318a789787912833a))
## [1.9.0](https://github.com/googleapis/nodejs-vertexai/compare/v1.8.1...v1.9.0) (2024-10-14)

@@ -4,0 +30,0 @@

{
"name": "@google-cloud/vertexai",
"description": "Vertex Generative AI client for Node.js",
"version": "1.9.0",
"version": "1.9.2",
"license": "Apache-2.0",

@@ -6,0 +6,0 @@ "author": "Google LLC",

@@ -8,3 +8,3 @@ [![NPM Downloads](https://img.shields.io/npm/dm/%40google-cloud%2Fvertexai)](https://www.npmjs.com/package/@google-cloud/vertexai)

AI-powered features and applications. Both TypeScript and JavaScript are supported.
The sample code in this document is written in JavaScript.
The sample code in this document is written in JavaScript only.

@@ -46,4 +46,4 @@ For detailed samples using the Vertex AI Node.js SDK, see the

To use the Vertex AI SDK for Node.js, create an instance of `VertexAI` by
passing it your Google Cloud project ID and location. Then create a reference to
a generative model.
passing it your Google Cloud project ID and location. Then create an instance of
the GenerativeModel class using the VertexAI class methods.

@@ -60,4 +60,4 @@ ```javascript

const location = 'us-central1';
const textModel = 'gemini-1.0-pro';
const visionModel = 'gemini-1.0-pro-vision';
const textModel = 'gemini-1.5-flash';
const visionModel = 'gemini-1.5-flash';

@@ -64,0 +64,0 @@ const vertexAI = new VertexAI({project: project, location: location});

@@ -47,17 +47,2 @@ /**

) {
const contents = request.contents;
for (const content of contents) {
for (const part of content.parts) {
if ('fileData' in part) {
// @ts-ignore
const uri = part['fileData']['fileUri'];
if (!uri.startsWith('gs://')) {
throw new URIError(
`Found invalid Google Cloud Storage URI ${uri}, Google Cloud Storage URIs must start with gs://`
);
}
}
}
}
if (hasVertexAISearch(request) && hasVertexRagStore(request)) {

@@ -64,0 +49,0 @@ throw new ClientError(

@@ -440,17 +440,2 @@ /**

it('raises an error when passed an invalid GCS URI', async () => {
const req: GenerateContentRequest = {
contents: TEST_USER_CHAT_MESSAGE_WITH_INVALID_GCS_FILE,
};
await expectAsync(
generateContent(
TEST_LOCATION,
TEST_RESOURCE_PATH,
TEST_TOKEN_PROMISE,
req,
TEST_API_ENDPOINT
)
).toBeRejectedWithError(URIError);
});
it('returns a GenerateContentResponse when passed safetySettings and generationConfig', async () => {

@@ -457,0 +442,0 @@ const req: GenerateContentRequest = {

@@ -342,3 +342,3 @@ /**

formulateNewContentFromSendMessageRequest(request);
const generateContentrequest: GenerateContentRequest = {
const generateContentRequest: GenerateContentRequest = {
contents: this.historyInternal.concat(newContent),

@@ -350,2 +350,3 @@ safetySettings: this.safetySettings,

systemInstruction: this.systemInstruction,
cachedContent: this.cachedContent,
};

@@ -357,3 +358,3 @@

this.fetchToken(),
generateContentrequest,
generateContentRequest,
this.apiEndpoint,

@@ -360,0 +361,0 @@ this.generationConfig,

@@ -194,2 +194,4 @@ /**

export declare interface GenerationConfig {
/** Optional. If true, the timestamp of the audio will be included in the response. */
audioTimestamp?: boolean;
/** Optional. Number of candidates to generate. */

@@ -424,4 +426,4 @@ candidateCount?: number;

* A datatype containing media that is part of a multi-part {@link Content}
* message. A `Part` is a union type of {@link TextPart}, {@link
* InlineDataPart}, {@link FileDataPart}, and {@link FunctionResponsePart}. A
* message. A `Part` is a union type of {@link TextPart}, {@link InlineDataPart},
* {@link FileDataPart}, and {@link FunctionResponsePart}. A
* `Part` has one of the following mutually exclusive fields:

@@ -464,2 +466,4 @@ * 1. text

totalTokenCount?: number;
/** Optional. Number of tokens in the cached content. */
cachedContentTokenCount?: number;
}

@@ -971,7 +975,22 @@

export enum Mode {
MODE_UNSPECIFIED = 'MODE_UNSPECIFIED',
MODE_DYNAMIC = 'MODE_DYNAMIC',
}
/** Describes the options to customize dynamic retrieval. */
export declare interface DynamicRetrievalConfig {
/** Optional. The threshold to be used in dynamic retrieval. If not set, a system default value is used. */
dynamicThreshold?: number;
/** The mode of the predictor to be used in dynamic retrieval. */
mode?: Mode;
}
/**
* Tool to retrieve public web data for grounding, powered by Google.
*/
// eslint-disable-next-line @typescript-eslint/no-empty-interface
export declare interface GoogleSearchRetrieval {}
export declare interface GoogleSearchRetrieval {
/** Specifies the dynamic retrieval configuration for the given source. */
dynamicRetrievalConfig?: DynamicRetrievalConfig;
}

@@ -978,0 +997,0 @@ /**

@@ -24,3 +24,3 @@ /**

const USER_AGENT_PRODUCT = 'model-builder';
const CLIENT_LIBRARY_VERSION = '1.9.0'; // x-release-please-version
const CLIENT_LIBRARY_VERSION = '1.9.2'; // x-release-please-version
const CLIENT_LIBRARY_LANGUAGE = `grpc-node/${CLIENT_LIBRARY_VERSION}`;

@@ -27,0 +27,0 @@ export const USER_AGENT = `${USER_AGENT_PRODUCT}/${CLIENT_LIBRARY_VERSION} ${CLIENT_LIBRARY_LANGUAGE}`;

@@ -28,2 +28,3 @@ /**

GoogleApiError,
Mode,
} from '../src';

@@ -91,3 +92,6 @@ import {FunctionDeclarationSchemaType} from '../src/types';

googleSearchRetrieval: {
disableAttribution: false,
dynamicRetrievalConfig: {
dynamicThreshold: 0.2,
mode: Mode.MODE_DYNAMIC,
},
},

@@ -794,3 +798,3 @@ },

});
it('in preview should return grounding metadata when passed a VertexRagStore', async () => {
xit('in preview should return grounding metadata when passed a VertexRagStore', async () => {
const request = {

@@ -797,0 +801,0 @@ contents: [

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

Sorry, the diff of this file is too big to display

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 too big to display

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