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
23
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.3.0 to 1.3.1

2

.release-please-manifest.json
{
".": "1.3.0"
".": "1.3.1"
}

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

function aggregateResponses(responses) {
var _a, _b;
var _a, _b, _c;
const lastResponse = responses[responses.length - 1];

@@ -162,3 +162,3 @@ if (lastResponse === undefined) {

content: {
role: (_b = response.candidates[i].content.role) !== null && _b !== void 0 ? _b : util_1.constants.MODEL_ROLE,
role: (_c = (_b = response.candidates[i].content) === null || _b === void 0 ? void 0 : _b.role) !== null && _c !== void 0 ? _c : util_1.constants.MODEL_ROLE,
parts: [{ text: '' }],

@@ -237,2 +237,4 @@ },

retrievalQueries: [],
groundingChunks: [],
groundingSupports: [],
};

@@ -253,2 +255,10 @@ const groundingMetadataAggregated = (_a = aggregatedCandidate.groundingMetadata) !== null && _a !== void 0 ? _a : emptyGroundingMetadata;

}
if (groundingMetadataChunk.groundingChunks) {
groundingMetadataAggregated.groundingChunks =
groundingMetadataAggregated.groundingChunks.concat(groundingMetadataChunk.groundingChunks);
}
if (groundingMetadataChunk.groundingSupports) {
groundingMetadataAggregated.groundingSupports =
groundingMetadataAggregated.groundingSupports.concat(groundingMetadataChunk.groundingSupports);
}
if (groundingMetadataChunk.searchEntryPoint) {

@@ -255,0 +265,0 @@ groundingMetadataAggregated.searchEntryPoint =

@@ -54,2 +54,6 @@ "use strict";

});
it('missing content, should add role and return empty content', () => {
const actualResult = (0, post_fetch_processing_1.aggregateResponses)(test_data_1.STREAM_RESPONSE_CHUNKS_4);
expect(JSON.stringify(actualResult)).toEqual(JSON.stringify(test_data_1.AGGREGATED_RESPONSE_STREAM_RESPONSE_CHUNKS_4));
});
});

@@ -56,0 +60,0 @@ describe('processUnary', () => {

@@ -24,4 +24,6 @@ /**

export declare const AGGREGATED_RESPONSE_STREAM_RESPONSE_CHUNKS_3: GenerateContentResponse;
export declare const STREAM_RESPONSE_CHUNKS_4: GenerateContentResponse[];
export declare const AGGREGATED_RESPONSE_STREAM_RESPONSE_CHUNKS_4: GenerateContentResponse;
export declare const UNARY_RESPONSE_1: GenerateContentResponse;
export declare const UNARY_RESPONSE_MISSING_ROLE_INDEX: GenerateContentResponse;
export declare const COUNT_TOKENS_RESPONSE_1: CountTokensResponse;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.COUNT_TOKENS_RESPONSE_1 = exports.UNARY_RESPONSE_MISSING_ROLE_INDEX = exports.UNARY_RESPONSE_1 = exports.AGGREGATED_RESPONSE_STREAM_RESPONSE_CHUNKS_3 = exports.STREAM_RESPONSE_CHUNKS_3 = exports.AGGREGATED_RESPONSE_STREAM_RESPONSE_CHUNKS_2 = exports.STREAM_RESPONSE_CHUNKS_2 = exports.AGGREGATED_RESPONSE_STREAM_RESPONSE_CHUNKS_1 = exports.STREAM_RESPONSE_CHUNKS_1 = void 0;
exports.COUNT_TOKENS_RESPONSE_1 = exports.UNARY_RESPONSE_MISSING_ROLE_INDEX = exports.UNARY_RESPONSE_1 = exports.AGGREGATED_RESPONSE_STREAM_RESPONSE_CHUNKS_4 = exports.STREAM_RESPONSE_CHUNKS_4 = exports.AGGREGATED_RESPONSE_STREAM_RESPONSE_CHUNKS_3 = exports.STREAM_RESPONSE_CHUNKS_3 = exports.AGGREGATED_RESPONSE_STREAM_RESPONSE_CHUNKS_2 = exports.STREAM_RESPONSE_CHUNKS_2 = exports.AGGREGATED_RESPONSE_STREAM_RESPONSE_CHUNKS_1 = exports.STREAM_RESPONSE_CHUNKS_1 = void 0;
exports.STREAM_RESPONSE_CHUNKS_1 = [

@@ -198,2 +198,19 @@ {

],
groundingChunks: [
{
web: {
uri: 'url for former chunk for first candidate',
title: 'title for former chunk for first candidate',
},
},
],
groundingSupports: [
{
segment: {
startIndex: 0,
endIndex: 421,
text: 'grounding support for former chunk for first candidate',
},
},
],
},

@@ -254,2 +271,19 @@ safetyRatings: [

],
groundingChunks: [
{
web: {
uri: 'url for former chunk for second candidate',
title: 'title for former chunk for second candidate',
},
},
],
groundingSupports: [
{
segment: {
startIndex: 0,
endIndex: 421,
text: 'grounding support for former chunk for second candidate',
},
},
],
},

@@ -310,2 +344,19 @@ safetyRatings: [

],
groundingChunks: [
{
web: {
uri: 'url for later chunk for first candidate',
title: 'title for later chunk for first candidate',
},
},
],
groundingSupports: [
{
segment: {
startIndex: 0,
endIndex: 421,
text: 'grounding support for later chunk for first candidate',
},
},
],
searchEntryPoint: {

@@ -335,2 +386,19 @@ renderedContent: 'rendered content for later chunk for first candidate',

],
groundingChunks: [
{
web: {
uri: 'url for later chunk for second candidate',
title: 'title for later chunk for second candidate',
},
},
],
groundingSupports: [
{
segment: {
startIndex: 0,
endIndex: 421,
text: 'grounding support for later chunk for second candidate',
},
},
],
searchEntryPoint: {

@@ -360,7 +428,3 @@ renderedContent: 'rendered content for later chunk for second candidate',

role: 'model',
parts: [
{
text: 'chunk1Candidate1chunk2Candidate1chunk3Candidate1',
},
],
parts: [{ text: 'chunk1Candidate1chunk2Candidate1chunk3Candidate1' }],
},

@@ -404,5 +468,3 @@ safetyRatings: [

{
segment: {
endIndex: 421,
},
segment: { endIndex: 421 },
confidenceScore: 0.8585608,

@@ -415,5 +477,3 @@ web: {

{
segment: {
endIndex: 421,
},
segment: { endIndex: 421 },
confidenceScore: 0.8585608,

@@ -427,2 +487,32 @@ web: {

retrievalQueries: [],
groundingChunks: [
{
web: {
uri: 'url for former chunk for first candidate',
title: 'title for former chunk for first candidate',
},
},
{
web: {
uri: 'url for later chunk for first candidate',
title: 'title for later chunk for first candidate',
},
},
],
groundingSupports: [
{
segment: {
startIndex: 0,
endIndex: 421,
text: 'grounding support for former chunk for first candidate',
},
},
{
segment: {
startIndex: 0,
endIndex: 421,
text: 'grounding support for later chunk for first candidate',
},
},
],
searchEntryPoint: {

@@ -438,7 +528,3 @@ renderedContent: 'rendered content for later chunk for first candidate',

role: 'model',
parts: [
{
text: 'chunk1Candidate2chunk2Candidate2chunk3Candidate2',
},
],
parts: [{ text: 'chunk1Candidate2chunk2Candidate2chunk3Candidate2' }],
},

@@ -482,5 +568,3 @@ safetyRatings: [

{
segment: {
endIndex: 421,
},
segment: { endIndex: 421 },
confidenceScore: 0.8585608,

@@ -493,5 +577,3 @@ web: {

{
segment: {
endIndex: 421,
},
segment: { endIndex: 421 },
confidenceScore: 0.8585608,

@@ -505,2 +587,32 @@ web: {

retrievalQueries: [],
groundingChunks: [
{
web: {
uri: 'url for former chunk for second candidate',
title: 'title for former chunk for second candidate',
},
},
{
web: {
uri: 'url for later chunk for second candidate',
title: 'title for later chunk for second candidate',
},
},
],
groundingSupports: [
{
segment: {
startIndex: 0,
endIndex: 421,
text: 'grounding support for former chunk for second candidate',
},
},
{
segment: {
startIndex: 0,
endIndex: 421,
text: 'grounding support for later chunk for second candidate',
},
},
],
searchEntryPoint: {

@@ -842,2 +954,18 @@ renderedContent: 'rendered content for later chunk for second candidate',

};
exports.STREAM_RESPONSE_CHUNKS_4 = [
{
candidates: [{}],
},
];
exports.AGGREGATED_RESPONSE_STREAM_RESPONSE_CHUNKS_4 = {
candidates: [
{
index: 0,
content: {
role: 'model',
parts: [{ text: '' }],
},
},
],
};
exports.UNARY_RESPONSE_1 = {

@@ -844,0 +972,0 @@ candidates: [

@@ -576,2 +576,64 @@ /**

/**
* Grounding chunk from the web.
*/
export declare interface GroundingChunkWeb {
/** Optional. URI reference of the grounding chunk. */
uri?: string;
/** Optional. Title of the grounding chunk. */
title?: string;
}
/**
* Grounding chunk from context retrieved by the retrieval tools.
*/
export declare interface GroundingChunkRetrievedContext {
/** Optional. URI reference of the attribution. */
uri?: string;
/** Optional. Title of the attribution. */
title?: string;
}
/**
* Grounding chunk.
*/
export declare interface GroundingChunk {
/** Optional. Grounding chunk from the web. */
web?: GroundingChunkWeb;
/** Optional. Grounding chunk from context retrieved by the retrieval tools. */
retrievedContext?: GroundingChunkRetrievedContext;
}
/**
* Grounding support segment.
*/
export declare interface GroundingSupportSegment {
/** Optional. The index of a Part object within its parent Content object. */
partIndex?: number;
/** Optional. Start index in the given Part, measured in bytes.
* Offset from the start of the Part, inclusive, starting at zero.
*/
startIndex?: number;
/** Optional. End index in the given Part, measured in bytes.
* Offset from the start of the Part, exclusive, starting at zero.
*/
endIndex?: number;
/** Optional. The text corresponding to the segment from the response. */
text?: string;
}
/**
* Grounding support.
*/
export declare interface GroundingSupport {
/** Optional. Segment of the content this support belongs to. */
segment?: GroundingSupportSegment;
/** Optional. A arrau of indices (into {@link GroundingChunk}) specifying the
* citations associated with the claim. For instance [1,3,4] means
* that grounding_chunk[1], grounding_chunk[3],
* grounding_chunk[4] are the retrieved content attributed to the claim.
*/
groundingChunkIndices?: number[];
/** Confidence score of the support references. Ranges from 0 to 1. 1 is the
* most confident. This list must have the same size as the
* groundingChunkIndices.
*/
confidenceScores?: number[];
}
/**
* A collection of grounding attributions for a piece of content.

@@ -590,4 +652,9 @@ */

searchEntryPoint?: SearchEntryPoint;
/** Optional. Array of supporting references retrieved from specified grounding source. {@link GroundingChunk}. */
groundingChunks?: GroundingChunk[];
/** Optional. Array of grounding support. {@link GroundingSupport}. */
groundingSupports?: GroundingSupport[];
}
/**
* @deprecated
* Grounding attribution.

@@ -609,2 +676,3 @@ */

/**
* @deprecated
* Segment of the content this attribution belongs to.

@@ -627,2 +695,3 @@ */

/**
* @deprecated
* Attribution from the web.

@@ -637,2 +706,3 @@ */

/**
* @deprecated
* Attribution from context retrieved by the retrieval tools.

@@ -639,0 +709,0 @@ */

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

export declare const SYSTEM_ROLE = "system";
export declare const USER_AGENT = "model-builder/1.3.0 grpc-node/1.3.0";
export declare const USER_AGENT = "model-builder/1.3.1 grpc-node/1.3.1";
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.3.0'; // x-release-please-version
const CLIENT_LIBRARY_VERSION = '1.3.1'; // 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}`;

# Changelog
## [1.3.1](https://github.com/googleapis/nodejs-vertexai/compare/v1.3.0...v1.3.1) (2024-07-11)
### Bug Fixes
* handle case when content is undefined in candidate. ([f16f040](https://github.com/googleapis/nodejs-vertexai/commit/f16f0405c0419152119385780ba21b2d9c18dc9b))
## [1.3.0](https://github.com/googleapis/nodejs-vertexai/compare/v1.2.0...v1.3.0) (2024-06-26)

@@ -4,0 +11,0 @@

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

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

@@ -207,3 +207,3 @@ /**

content: {
role: response.candidates[i].content.role ?? constants.MODEL_ROLE,
role: response.candidates[i].content?.role ?? constants.MODEL_ROLE,
parts: [{text: ''}],

@@ -301,2 +301,4 @@ },

retrievalQueries: [],
groundingChunks: [],
groundingSupports: [],
};

@@ -325,2 +327,14 @@ const groundingMetadataAggregated: GroundingMetadata =

}
if (groundingMetadataChunk.groundingChunks) {
groundingMetadataAggregated.groundingChunks =
groundingMetadataAggregated.groundingChunks!.concat(
groundingMetadataChunk.groundingChunks
);
}
if (groundingMetadataChunk.groundingSupports) {
groundingMetadataAggregated.groundingSupports =
groundingMetadataAggregated.groundingSupports!.concat(
groundingMetadataChunk.groundingSupports
);
}
if (groundingMetadataChunk.searchEntryPoint) {

@@ -327,0 +341,0 @@ groundingMetadataAggregated.searchEntryPoint =

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

AGGREGATED_RESPONSE_STREAM_RESPONSE_CHUNKS_3,
AGGREGATED_RESPONSE_STREAM_RESPONSE_CHUNKS_4,
COUNT_TOKENS_RESPONSE_1,

@@ -27,2 +28,3 @@ STREAM_RESPONSE_CHUNKS_1,

STREAM_RESPONSE_CHUNKS_3,
STREAM_RESPONSE_CHUNKS_4,
UNARY_RESPONSE_1,

@@ -79,2 +81,10 @@ UNARY_RESPONSE_MISSING_ROLE_INDEX,

});
it('missing content, should add role and return empty content', () => {
const actualResult = aggregateResponses(STREAM_RESPONSE_CHUNKS_4);
expect(JSON.stringify(actualResult)).toEqual(
JSON.stringify(AGGREGATED_RESPONSE_STREAM_RESPONSE_CHUNKS_4)
);
});
});

@@ -81,0 +91,0 @@

@@ -216,2 +216,19 @@ /**

],
groundingChunks: [
{
web: {
uri: 'url for former chunk for first candidate',
title: 'title for former chunk for first candidate',
},
},
],
groundingSupports: [
{
segment: {
startIndex: 0,
endIndex: 421,
text: 'grounding support for former chunk for first candidate',
},
},
],
},

@@ -272,2 +289,19 @@ safetyRatings: [

],
groundingChunks: [
{
web: {
uri: 'url for former chunk for second candidate',
title: 'title for former chunk for second candidate',
},
},
],
groundingSupports: [
{
segment: {
startIndex: 0,
endIndex: 421,
text: 'grounding support for former chunk for second candidate',
},
},
],
},

@@ -328,2 +362,19 @@ safetyRatings: [

],
groundingChunks: [
{
web: {
uri: 'url for later chunk for first candidate',
title: 'title for later chunk for first candidate',
},
},
],
groundingSupports: [
{
segment: {
startIndex: 0,
endIndex: 421,
text: 'grounding support for later chunk for first candidate',
},
},
],
searchEntryPoint: {

@@ -354,2 +405,19 @@ renderedContent:

],
groundingChunks: [
{
web: {
uri: 'url for later chunk for second candidate',
title: 'title for later chunk for second candidate',
},
},
],
groundingSupports: [
{
segment: {
startIndex: 0,
endIndex: 421,
text: 'grounding support for later chunk for second candidate',
},
},
],
searchEntryPoint: {

@@ -382,7 +450,3 @@ renderedContent:

role: 'model',
parts: [
{
text: 'chunk1Candidate1chunk2Candidate1chunk3Candidate1',
},
],
parts: [{text: 'chunk1Candidate1chunk2Candidate1chunk3Candidate1'}],
},

@@ -426,5 +490,3 @@ safetyRatings: [

{
segment: {
endIndex: 421,
},
segment: {endIndex: 421},
confidenceScore: 0.8585608,

@@ -437,5 +499,3 @@ web: {

{
segment: {
endIndex: 421,
},
segment: {endIndex: 421},
confidenceScore: 0.8585608,

@@ -449,2 +509,32 @@ web: {

retrievalQueries: [],
groundingChunks: [
{
web: {
uri: 'url for former chunk for first candidate',
title: 'title for former chunk for first candidate',
},
},
{
web: {
uri: 'url for later chunk for first candidate',
title: 'title for later chunk for first candidate',
},
},
],
groundingSupports: [
{
segment: {
startIndex: 0,
endIndex: 421,
text: 'grounding support for former chunk for first candidate',
},
},
{
segment: {
startIndex: 0,
endIndex: 421,
text: 'grounding support for later chunk for first candidate',
},
},
],
searchEntryPoint: {

@@ -461,7 +551,3 @@ renderedContent:

role: 'model',
parts: [
{
text: 'chunk1Candidate2chunk2Candidate2chunk3Candidate2',
},
],
parts: [{text: 'chunk1Candidate2chunk2Candidate2chunk3Candidate2'}],
},

@@ -505,5 +591,3 @@ safetyRatings: [

{
segment: {
endIndex: 421,
},
segment: {endIndex: 421},
confidenceScore: 0.8585608,

@@ -516,5 +600,3 @@ web: {

{
segment: {
endIndex: 421,
},
segment: {endIndex: 421},
confidenceScore: 0.8585608,

@@ -528,2 +610,32 @@ web: {

retrievalQueries: [],
groundingChunks: [
{
web: {
uri: 'url for former chunk for second candidate',
title: 'title for former chunk for second candidate',
},
},
{
web: {
uri: 'url for later chunk for second candidate',
title: 'title for later chunk for second candidate',
},
},
],
groundingSupports: [
{
segment: {
startIndex: 0,
endIndex: 421,
text: 'grounding support for former chunk for second candidate',
},
},
{
segment: {
startIndex: 0,
endIndex: 421,
text: 'grounding support for later chunk for second candidate',
},
},
],
searchEntryPoint: {

@@ -872,2 +984,22 @@ renderedContent:

} as GenerateContentResponse;
export const STREAM_RESPONSE_CHUNKS_4: GenerateContentResponse[] = [
{
candidates: [{}],
},
] as GenerateContentResponse[];
export const AGGREGATED_RESPONSE_STREAM_RESPONSE_CHUNKS_4: GenerateContentResponse =
{
candidates: [
{
index: 0,
content: {
role: 'model',
parts: [{text: ''}],
},
},
],
} as GenerateContentResponse;
export const UNARY_RESPONSE_1: GenerateContentResponse = {

@@ -874,0 +1006,0 @@ candidates: [

@@ -620,2 +620,69 @@ /**

/**
* Grounding chunk from the web.
*/
export declare interface GroundingChunkWeb {
/** Optional. URI reference of the grounding chunk. */
uri?: string;
/** Optional. Title of the grounding chunk. */
title?: string;
}
/**
* Grounding chunk from context retrieved by the retrieval tools.
*/
export declare interface GroundingChunkRetrievedContext {
/** Optional. URI reference of the attribution. */
uri?: string;
/** Optional. Title of the attribution. */
title?: string;
}
/**
* Grounding chunk.
*/
export declare interface GroundingChunk {
/** Optional. Grounding chunk from the web. */
web?: GroundingChunkWeb;
/** Optional. Grounding chunk from context retrieved by the retrieval tools. */
retrievedContext?: GroundingChunkRetrievedContext;
}
/**
* Grounding support segment.
*/
export declare interface GroundingSupportSegment {
/** Optional. The index of a Part object within its parent Content object. */
partIndex?: number;
/** Optional. Start index in the given Part, measured in bytes.
* Offset from the start of the Part, inclusive, starting at zero.
*/
startIndex?: number;
/** Optional. End index in the given Part, measured in bytes.
* Offset from the start of the Part, exclusive, starting at zero.
*/
endIndex?: number;
/** Optional. The text corresponding to the segment from the response. */
text?: string;
}
/**
* Grounding support.
*/
export declare interface GroundingSupport {
/** Optional. Segment of the content this support belongs to. */
segment?: GroundingSupportSegment;
/** Optional. A arrau of indices (into {@link GroundingChunk}) specifying the
* citations associated with the claim. For instance [1,3,4] means
* that grounding_chunk[1], grounding_chunk[3],
* grounding_chunk[4] are the retrieved content attributed to the claim.
*/
groundingChunkIndices?: number[];
/** Confidence score of the support references. Ranges from 0 to 1. 1 is the
* most confident. This list must have the same size as the
* groundingChunkIndices.
*/
confidenceScores?: number[];
}
/**
* A collection of grounding attributions for a piece of content.

@@ -634,5 +701,10 @@ */

searchEntryPoint?: SearchEntryPoint;
/** Optional. Array of supporting references retrieved from specified grounding source. {@link GroundingChunk}. */
groundingChunks?: GroundingChunk[];
/** Optional. Array of grounding support. {@link GroundingSupport}. */
groundingSupports?: GroundingSupport[];
}
/**
* @deprecated
* Grounding attribution.

@@ -655,2 +727,3 @@ */

/**
* @deprecated
* Segment of the content this attribution belongs to.

@@ -674,2 +747,3 @@ */

/**
* @deprecated
* Attribution from the web.

@@ -685,2 +759,3 @@ */

/**
* @deprecated
* Attribution from context retrieved by the retrieval tools.

@@ -687,0 +762,0 @@ */

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

const USER_AGENT_PRODUCT = 'model-builder';
const CLIENT_LIBRARY_VERSION = '1.3.0'; // x-release-please-version
const CLIENT_LIBRARY_VERSION = '1.3.1'; // 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}`;

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