@google-cloud/vertexai
Advanced tools
Comparing version 1.2.0 to 1.3.0
{ | ||
".": "1.2.0" | ||
".": "1.3.0" | ||
} |
/** | ||
* @license | ||
* Copyright 2023 Google LLC | ||
* Copyright 2024 Google LLC | ||
* | ||
@@ -5,0 +5,0 @@ * Licensed under the Apache License, Version 2.0 (the "License"); |
"use strict"; | ||
/** | ||
* @license | ||
* Copyright 2023 Google LLC | ||
* Copyright 2024 Google LLC | ||
* | ||
@@ -6,0 +6,0 @@ * Licensed under the Apache License, Version 2.0 (the "License"); |
/** | ||
* @license | ||
* Copyright 2023 Google LLC | ||
* Copyright 2024 Google LLC | ||
* | ||
@@ -5,0 +5,0 @@ * Licensed under the Apache License, Version 2.0 (the "License"); |
"use strict"; | ||
/** | ||
* @license | ||
* Copyright 2023 Google LLC | ||
* Copyright 2024 Google LLC | ||
* | ||
@@ -6,0 +6,0 @@ * Licensed under the Apache License, Version 2.0 (the "License"); |
/** | ||
* @license | ||
* Copyright 2023 Google LLC | ||
* Copyright 2024 Google LLC | ||
* | ||
@@ -5,0 +5,0 @@ * Licensed under the Apache License, Version 2.0 (the "License"); |
"use strict"; | ||
/** | ||
* @license | ||
* Copyright 2023 Google LLC | ||
* Copyright 2024 Google LLC | ||
* | ||
@@ -6,0 +6,0 @@ * Licensed under the Apache License, Version 2.0 (the "License"); |
/** | ||
* @license | ||
* Copyright 2023 Google LLC | ||
* Copyright 2024 Google LLC | ||
* | ||
@@ -5,0 +5,0 @@ * Licensed under the Apache License, Version 2.0 (the "License"); |
"use strict"; | ||
/** | ||
* @license | ||
* Copyright 2023 Google LLC | ||
* Copyright 2024 Google LLC | ||
* | ||
@@ -102,3 +102,3 @@ * Licensed under the Apache License, Version 2.0 (the "License"); | ||
if (currentText.trim()) { | ||
controller.error(new errors_1.GoogleGenerativeAIError('Failed to parse final chunk of stream')); | ||
controller.error(new errors_1.GoogleGenerativeAIError(`Failed to parse final chunk of stream: ${currentText}`)); | ||
return; | ||
@@ -105,0 +105,0 @@ } |
/** | ||
* @license | ||
* Copyright 2023 Google LLC | ||
* Copyright 2024 Google LLC | ||
* | ||
@@ -5,0 +5,0 @@ * Licensed under the Apache License, Version 2.0 (the "License"); |
"use strict"; | ||
/** | ||
* @license | ||
* Copyright 2023 Google LLC | ||
* Copyright 2024 Google LLC | ||
* | ||
@@ -6,0 +6,0 @@ * Licensed under the Apache License, Version 2.0 (the "License"); |
/** | ||
* @license | ||
* Copyright 2023 Google LLC | ||
* Copyright 2024 Google LLC | ||
* | ||
@@ -5,0 +5,0 @@ * Licensed under the Apache License, Version 2.0 (the "License"); |
"use strict"; | ||
/** | ||
* @license | ||
* Copyright 2023 Google LLC | ||
* Copyright 2024 Google LLC | ||
* | ||
@@ -6,0 +6,0 @@ * Licensed under the Apache License, Version 2.0 (the "License"); |
/** | ||
* @license | ||
* Copyright 2023 Google LLC | ||
* Copyright 2024 Google LLC | ||
* | ||
@@ -5,0 +5,0 @@ * Licensed under the Apache License, Version 2.0 (the "License"); |
"use strict"; | ||
/** | ||
* @license | ||
* Copyright 2023 Google LLC | ||
* Copyright 2024 Google LLC | ||
* | ||
@@ -6,0 +6,0 @@ * Licensed under the Apache License, Version 2.0 (the "License"); |
/** | ||
* @license | ||
* Copyright 2023 Google LLC | ||
* Copyright 2024 Google LLC | ||
* | ||
@@ -5,0 +5,0 @@ * Licensed under the Apache License, Version 2.0 (the "License"); |
"use strict"; | ||
/** | ||
* @license | ||
* Copyright 2023 Google LLC | ||
* Copyright 2024 Google LLC | ||
* | ||
@@ -6,0 +6,0 @@ * Licensed under the Apache License, Version 2.0 (the "License"); |
@@ -0,1 +1,17 @@ | ||
/** | ||
* @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 | ||
* | ||
* https://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. | ||
*/ | ||
export {}; |
"use strict"; | ||
/** | ||
* @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 | ||
* | ||
* https://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. | ||
*/ | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
@@ -3,0 +19,0 @@ const post_request_1 = require("../post_request"); |
@@ -0,1 +1,17 @@ | ||
/** | ||
* @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 | ||
* | ||
* https://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. | ||
*/ | ||
export {}; |
"use strict"; | ||
/** | ||
* @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 | ||
* | ||
* https://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. | ||
*/ | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
@@ -3,0 +19,0 @@ const pre_fetch_processing_1 = require("../pre_fetch_processing"); |
/** | ||
* @license | ||
* Copyright 2023 Google LLC | ||
* Copyright 2024 Google LLC | ||
* | ||
@@ -5,0 +5,0 @@ * Licensed under the Apache License, Version 2.0 (the "License"); |
/** | ||
* @license | ||
* Copyright 2023 Google LLC | ||
* Copyright 2024 Google LLC | ||
* | ||
@@ -5,0 +5,0 @@ * Licensed under the Apache License, Version 2.0 (the "License"); |
"use strict"; | ||
/** | ||
* @license | ||
* Copyright 2023 Google LLC | ||
* Copyright 2024 Google LLC | ||
* | ||
@@ -6,0 +6,0 @@ * Licensed under the Apache License, Version 2.0 (the "License"); |
/** | ||
* @license | ||
* Copyright 2023 Google LLC | ||
* Copyright 2024 Google LLC | ||
* | ||
@@ -5,0 +5,0 @@ * Licensed under the Apache License, Version 2.0 (the "License"); |
"use strict"; | ||
/** | ||
* @license | ||
* Copyright 2023 Google LLC | ||
* Copyright 2024 Google LLC | ||
* | ||
@@ -6,0 +6,0 @@ * Licensed under the Apache License, Version 2.0 (the "License"); |
/** | ||
* @license | ||
* Copyright 2023 Google LLC | ||
* Copyright 2024 Google LLC | ||
* | ||
@@ -5,0 +5,0 @@ * Licensed under the Apache License, Version 2.0 (the "License"); |
"use strict"; | ||
/** | ||
* @license | ||
* Copyright 2023 Google LLC | ||
* Copyright 2024 Google LLC | ||
* | ||
@@ -6,0 +6,0 @@ * Licensed under the Apache License, Version 2.0 (the "License"); |
/** | ||
* @license | ||
* Copyright 2023 Google LLC | ||
* Copyright 2024 Google LLC | ||
* | ||
@@ -5,0 +5,0 @@ * Licensed under the Apache License, Version 2.0 (the "License"); |
"use strict"; | ||
/** | ||
* @license | ||
* Copyright 2023 Google LLC | ||
* Copyright 2024 Google LLC | ||
* | ||
@@ -6,0 +6,0 @@ * Licensed under the Apache License, Version 2.0 (the "License"); |
/** | ||
* @license | ||
* Copyright 2023 Google LLC | ||
* Copyright 2024 Google LLC | ||
* | ||
@@ -5,0 +5,0 @@ * Licensed under the Apache License, Version 2.0 (the "License"); |
/** | ||
* @license | ||
* Copyright 2023 Google LLC | ||
* Copyright 2024 Google LLC | ||
* | ||
@@ -5,0 +5,0 @@ * Licensed under the Apache License, Version 2.0 (the "License"); |
"use strict"; | ||
/** | ||
* @license | ||
* Copyright 2023 Google LLC | ||
* Copyright 2024 Google LLC | ||
* | ||
@@ -6,0 +6,0 @@ * Licensed under the Apache License, Version 2.0 (the "License"); |
/** | ||
* @license | ||
* Copyright 2023 Google LLC | ||
* Copyright 2024 Google LLC | ||
* | ||
@@ -5,0 +5,0 @@ * Licensed under the Apache License, Version 2.0 (the "License"); |
"use strict"; | ||
/** | ||
* @license | ||
* Copyright 2023 Google LLC | ||
* Copyright 2024 Google LLC | ||
* | ||
@@ -6,0 +6,0 @@ * Licensed under the Apache License, Version 2.0 (the "License"); |
/** | ||
* @license | ||
* Copyright 2023 Google LLC | ||
* Copyright 2024 Google LLC | ||
* | ||
@@ -5,0 +5,0 @@ * Licensed under the Apache License, Version 2.0 (the "License"); |
"use strict"; | ||
/** | ||
* @license | ||
* Copyright 2023 Google LLC | ||
* Copyright 2024 Google LLC | ||
* | ||
@@ -6,0 +6,0 @@ * Licensed under the Apache License, Version 2.0 (the "License"); |
/** | ||
* @license | ||
* Copyright 2023 Google LLC | ||
* Copyright 2024 Google LLC | ||
* | ||
@@ -22,8 +22,12 @@ * Licensed under the Apache License, Version 2.0 (the "License"); | ||
export declare interface VertexInit { | ||
/** The Google Cloud project name. It is not the numeric project ID. */ | ||
project: string; | ||
/** | ||
* Optional. The Google Cloud project ID. It is not the numeric project name. | ||
* If not provided, SDK will try to resolve it from runtime environment. | ||
* If still not cannot resovle project ID, SDK will throw exception. | ||
*/ | ||
project?: string; | ||
/** | ||
* Optional. The Google Cloud project location. If not provided, SDK will | ||
* firtly try to resolve it from run time environment. If no location resolved | ||
* from run time environment, SDK will use default value `us-central1`. | ||
* firtly try to resolve it from runtime environment. If no location resolved | ||
* from runtime environment, SDK will use default value `us-central1`. | ||
*/ | ||
@@ -580,3 +584,5 @@ location?: string; | ||
retrievalQueries?: string[]; | ||
/** Optional. Array of {@link GroundingAttribution}. */ | ||
/** @deprecated | ||
* Optional. Array of {@link GroundingAttribution} | ||
*/ | ||
groundingAttributions?: GroundingAttribution[]; | ||
@@ -786,2 +792,3 @@ /** Optional. Google search entry for the following-up web searches. {@link SearchEntryPoint} */ | ||
/** | ||
* @deprecated groundingAttributions field in {@link GroundingMetadata} is also deprecated. | ||
* Optional. Disable using the result from this tool in detecting grounding | ||
@@ -788,0 +795,0 @@ * attribution. This does not affect how the result is given to the model for |
"use strict"; | ||
/** | ||
* @license | ||
* Copyright 2023 Google LLC | ||
* Copyright 2024 Google LLC | ||
* | ||
@@ -6,0 +6,0 @@ * Licensed under the Apache License, Version 2.0 (the "License"); |
/** | ||
* @license | ||
* Copyright 2023 Google LLC | ||
* Copyright 2024 Google LLC | ||
* | ||
@@ -40,2 +40,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); | ||
} | ||
export { ClientError, GoogleAuthError, GoogleGenerativeAIError }; | ||
/** | ||
* IllegalArgumentError is thrown when the request or operation is invalid | ||
*/ | ||
declare class IllegalArgumentError extends Error { | ||
readonly stackTrace: any; | ||
constructor(message: string, stackTrace?: any); | ||
} | ||
export { ClientError, GoogleAuthError, GoogleGenerativeAIError, IllegalArgumentError, }; |
"use strict"; | ||
/** | ||
* @license | ||
* Copyright 2023 Google LLC | ||
* Copyright 2024 Google LLC | ||
* | ||
@@ -19,3 +19,3 @@ * Licensed under the Apache License, Version 2.0 (the "License"); | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.GoogleGenerativeAIError = exports.GoogleAuthError = exports.ClientError = void 0; | ||
exports.IllegalArgumentError = exports.GoogleGenerativeAIError = exports.GoogleAuthError = exports.ClientError = void 0; | ||
/** | ||
@@ -62,2 +62,15 @@ * GoogleAuthError is thrown when there is authentication issue with the request | ||
exports.GoogleGenerativeAIError = GoogleGenerativeAIError; | ||
/** | ||
* IllegalArgumentError is thrown when the request or operation is invalid | ||
*/ | ||
class IllegalArgumentError extends Error { | ||
constructor(message, stackTrace = undefined) { | ||
super(message); | ||
this.stackTrace = undefined; | ||
this.message = constructErrorMessage('IllegalArgumentError', message); | ||
this.name = 'IllegalArgumentError'; | ||
this.stackTrace = stackTrace; | ||
} | ||
} | ||
exports.IllegalArgumentError = IllegalArgumentError; | ||
function constructErrorMessage(exceptionClass, message) { | ||
@@ -64,0 +77,0 @@ return `[VertexAI.${exceptionClass}]: ${message}`; |
/** | ||
* @license | ||
* Copyright 2023 Google LLC | ||
* Copyright 2024 Google LLC | ||
* | ||
@@ -5,0 +5,0 @@ * Licensed under the Apache License, Version 2.0 (the "License"); |
"use strict"; | ||
/** | ||
* @license | ||
* Copyright 2023 Google LLC | ||
* Copyright 2024 Google LLC | ||
* | ||
@@ -6,0 +6,0 @@ * Licensed under the Apache License, Version 2.0 (the "License"); |
/** | ||
* @license | ||
* Copyright 2023 Google LLC | ||
* Copyright 2024 Google LLC | ||
* | ||
@@ -5,0 +5,0 @@ * Licensed under the Apache License, Version 2.0 (the "License"); |
"use strict"; | ||
/** | ||
* @license | ||
* Copyright 2023 Google LLC | ||
* Copyright 2024 Google LLC | ||
* | ||
@@ -6,0 +6,0 @@ * Licensed under the Apache License, Version 2.0 (the "License"); |
/** | ||
* @license | ||
* Copyright 2023 Google LLC | ||
* Copyright 2024 Google LLC | ||
* | ||
@@ -23,3 +23,3 @@ * Licensed under the Apache License, Version 2.0 (the "License"); | ||
export declare const SYSTEM_ROLE = "system"; | ||
export declare const USER_AGENT = "model-builder/1.2.0 grpc-node/1.2.0"; | ||
export declare const USER_AGENT = "model-builder/1.3.0 grpc-node/1.3.0"; | ||
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"; |
@@ -6,3 +6,3 @@ "use strict"; | ||
* @license | ||
* Copyright 2023 Google LLC | ||
* Copyright 2024 Google LLC | ||
* | ||
@@ -28,3 +28,3 @@ * Licensed under the Apache License, Version 2.0 (the "License"); | ||
const USER_AGENT_PRODUCT = 'model-builder'; | ||
const CLIENT_LIBRARY_VERSION = '1.2.0'; // x-release-please-version | ||
const CLIENT_LIBRARY_VERSION = '1.3.0'; // x-release-please-version | ||
const CLIENT_LIBRARY_LANGUAGE = `grpc-node/${CLIENT_LIBRARY_VERSION}`; | ||
@@ -31,0 +31,0 @@ exports.USER_AGENT = `${USER_AGENT_PRODUCT}/${CLIENT_LIBRARY_VERSION} ${CLIENT_LIBRARY_LANGUAGE}`; |
/** | ||
* @license | ||
* Copyright 2023 Google LLC | ||
* Copyright 2024 Google LLC | ||
* | ||
@@ -5,0 +5,0 @@ * Licensed under the Apache License, Version 2.0 (the "License"); |
"use strict"; | ||
/** | ||
* @license | ||
* Copyright 2023 Google LLC | ||
* Copyright 2024 Google LLC | ||
* | ||
@@ -6,0 +6,0 @@ * Licensed under the Apache License, Version 2.0 (the "License"); |
/** | ||
* @license | ||
* Copyright 2023 Google LLC | ||
* Copyright 2024 Google LLC | ||
* | ||
@@ -37,2 +37,4 @@ * Licensed under the Apache License, Version 2.0 (the "License"); | ||
* client. | ||
* @throws {IllegalArgumentError} | ||
*/ | ||
@@ -86,2 +88,4 @@ constructor(init: VertexInit); | ||
getGenerativeModel(modelParams: ModelParams, requestOptions?: RequestOptions): GenerativeModel; | ||
protected getProject(): string; | ||
protected getLocation(): string; | ||
} | ||
@@ -88,0 +92,0 @@ /** |
"use strict"; | ||
/** | ||
* @license | ||
* Copyright 2023 Google LLC | ||
* Copyright 2024 Google LLC | ||
* | ||
@@ -36,7 +36,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); | ||
* client. | ||
* @throws {IllegalArgumentError} | ||
*/ | ||
constructor(init) { | ||
const opts = validateGoogleAuthOptions(init.project, init.googleAuthOptions); | ||
this.project = init.project; | ||
this.location = resolveLocation(init.location); | ||
this.project = resolveProject(init.project); | ||
this.googleAuth = new google_auth_library_1.GoogleAuth(opts); | ||
@@ -106,2 +108,8 @@ this.apiEndpoint = init.apiEndpoint; | ||
} | ||
getProject() { | ||
return this.project; | ||
} | ||
getLocation() { | ||
return this.location; | ||
} | ||
} | ||
@@ -179,2 +187,16 @@ exports.VertexAI = VertexAI; | ||
} | ||
function resolveProject(projectFromInput) { | ||
const projectNotFoundErrorMessage = 'Unable to infer your project.' + | ||
'Please provide a project Id by one of the following:' + | ||
'\n- Passing a constructor argument by using new VertexAI({project: my-project})' + | ||
'\n- Setting project using `gcloud config set project my-project`'; | ||
if (projectFromInput) { | ||
return projectFromInput; | ||
} | ||
const inferredProjectFromEnv = process.env['GOOGLE_CLOUD_PROJECT']; | ||
if (inferredProjectFromEnv) { | ||
return inferredProjectFromEnv; | ||
} | ||
throw new errors_1.IllegalArgumentError(projectNotFoundErrorMessage); | ||
} | ||
function resolveLocation(locationFromInput) { | ||
@@ -181,0 +203,0 @@ if (locationFromInput) { |
/** | ||
* @license | ||
* Copyright 2023 Google LLC | ||
* Copyright 2024 Google LLC | ||
* | ||
@@ -5,0 +5,0 @@ * Licensed under the Apache License, Version 2.0 (the "License"); |
"use strict"; | ||
/** | ||
* @license | ||
* Copyright 2023 Google LLC | ||
* Copyright 2024 Google LLC | ||
* | ||
@@ -6,0 +6,0 @@ * Licensed under the Apache License, Version 2.0 (the "License"); |
/** | ||
* @license | ||
* Copyright 2023 Google LLC | ||
* Copyright 2024 Google LLC | ||
* | ||
@@ -5,0 +5,0 @@ * Licensed under the Apache License, Version 2.0 (the "License"); |
"use strict"; | ||
/** | ||
* @license | ||
* Copyright 2023 Google LLC | ||
* Copyright 2024 Google LLC | ||
* | ||
@@ -6,0 +6,0 @@ * Licensed under the Apache License, Version 2.0 (the "License"); |
@@ -0,1 +1,17 @@ | ||
/** | ||
* @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 | ||
* | ||
* https://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. | ||
*/ | ||
export {}; |
"use strict"; | ||
/** | ||
* @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 | ||
* | ||
* https://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. | ||
*/ | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
@@ -8,5 +24,14 @@ const vertex_ai_1 = require("../src/vertex_ai"); | ||
const LOCATION = 'test_location'; | ||
class VertexAIForTest extends vertex_ai_1.VertexAI { | ||
getProject() { | ||
return super.getProject(); | ||
} | ||
getLocation() { | ||
return super.getLocation(); | ||
} | ||
} | ||
describe('VertexAI', () => { | ||
let vertexai; | ||
beforeEach(() => { | ||
cleanupEnvironmentVariable(); | ||
vertexai = new vertex_ai_1.VertexAI({ | ||
@@ -18,3 +43,5 @@ project: PROJECT, | ||
it('no location given, should instantiate VertexAI and VertexAIPreview', () => { | ||
const vertexaiNoLocation = new vertex_ai_1.VertexAI({ project: PROJECT }); | ||
const vertexaiNoLocation = new vertex_ai_1.VertexAI({ | ||
project: PROJECT, | ||
}); | ||
const generativeModel = vertexaiNoLocation.getGenerativeModel({ | ||
@@ -26,2 +53,3 @@ model: 'gemini-pro', | ||
}); | ||
expect(vertexaiNoLocation.getLocation()).toEqual('us-central1'); | ||
expect(vertexaiNoLocation).toBeInstanceOf(vertex_ai_1.VertexAI); | ||
@@ -32,4 +60,7 @@ expect(generativeModel).toBeInstanceOf(models_1.GenerativeModel); | ||
it('location in run time env GOOGLE_CLOUD_REGION, should instantiate VertexAI and VertexAIPreview', () => { | ||
process.env['GOOGLE_CLOUD_REGION'] = 'us-central1'; | ||
const vertexaiNoLocation = new vertex_ai_1.VertexAI({ project: PROJECT }); | ||
process.env['GOOGLE_CLOUD_REGION'] = 'us-central2'; | ||
process.env['CLOUD_ML_REGION'] = 'us-central3'; | ||
const vertexaiNoLocation = new vertex_ai_1.VertexAI({ | ||
project: PROJECT, | ||
}); | ||
const generativeModel = vertexaiNoLocation.getGenerativeModel({ | ||
@@ -41,2 +72,3 @@ model: 'gemini-pro', | ||
}); | ||
expect(vertexaiNoLocation.getLocation()).toEqual('us-central2'); | ||
expect(vertexaiNoLocation).toBeInstanceOf(vertex_ai_1.VertexAI); | ||
@@ -47,4 +79,6 @@ expect(generativeModel).toBeInstanceOf(models_1.GenerativeModel); | ||
it('location in run time env CLOUD_ML_REGION, should instantiate VertexAI and VertexAIPreview', () => { | ||
process.env['CLOUD_ML_REGION'] = 'us-central1'; | ||
const vertexaiNoLocation = new vertex_ai_1.VertexAI({ project: PROJECT }); | ||
process.env['CLOUD_ML_REGION'] = 'us-central3'; | ||
const vertexaiNoLocation = new vertex_ai_1.VertexAI({ | ||
project: PROJECT, | ||
}); | ||
const generativeModel = vertexaiNoLocation.getGenerativeModel({ | ||
@@ -56,2 +90,3 @@ model: 'gemini-pro', | ||
}); | ||
expect(vertexaiNoLocation.getLocation()).toEqual('us-central3'); | ||
expect(vertexaiNoLocation).toBeInstanceOf(vertex_ai_1.VertexAI); | ||
@@ -61,2 +96,28 @@ expect(generativeModel).toBeInstanceOf(models_1.GenerativeModel); | ||
}); | ||
it('location in run time env GOOGLE_CLOUD_REGION, project in GOOGLE_CLOUD_PROJECT, should instantiate VertexAI and VertexAIPreview', () => { | ||
process.env['GOOGLE_CLOUD_REGION'] = 'us-central2'; | ||
process.env['CLOUD_ML_REGION'] = 'us-central3'; | ||
process.env['GOOGLE_CLOUD_PROJECT'] = 'my-project'; | ||
const vertexaiNoArgs = new vertex_ai_1.VertexAI({}); | ||
const generativeModel = vertexaiNoArgs.getGenerativeModel({ | ||
model: 'gemini-pro', | ||
}); | ||
const generativeModelPreview = vertexaiNoArgs.preview.getGenerativeModel({ | ||
model: 'gemini-pro', | ||
}); | ||
expect(vertexaiNoArgs.getLocation()).toEqual('us-central2'); | ||
expect(vertexaiNoArgs.getProject()).toEqual('my-project'); | ||
expect(vertexaiNoArgs).toBeInstanceOf(vertex_ai_1.VertexAI); | ||
expect(generativeModel).toBeInstanceOf(models_1.GenerativeModel); | ||
expect(generativeModelPreview).toBeInstanceOf(models_1.GenerativeModelPreview); | ||
}); | ||
it('cannot resolve project, should throw', () => { | ||
const expectedProjectNotFoundErrorMessage = 'Unable to infer your project.' + | ||
'Please provide a project Id by one of the following:' + | ||
'\n- Passing a constructor argument by using new VertexAI({project: my-project})' + | ||
'\n- Setting project using `gcloud config set project my-project`'; | ||
expect(() => { | ||
new vertex_ai_1.VertexAI({}); | ||
}).toThrow(new errors_1.IllegalArgumentError(expectedProjectNotFoundErrorMessage)); | ||
}); | ||
it('given undefined google auth options, should be instantiated', () => { | ||
@@ -127,2 +188,7 @@ expect(vertexai).toBeInstanceOf(vertex_ai_1.VertexAI); | ||
}); | ||
function cleanupEnvironmentVariable() { | ||
delete process.env['GOOGLE_CLOUD_REGION']; | ||
delete process.env['CLOUD_ML_REGION']; | ||
delete process.env['GOOGLE_CLOUD_PROJECT']; | ||
} | ||
//# sourceMappingURL=vertex_ai_test.js.map |
# Changelog | ||
## [1.3.0](https://github.com/googleapis/nodejs-vertexai/compare/v1.2.0...v1.3.0) (2024-06-26) | ||
### Features | ||
* infer project ID when user don't specify and throw if inference fails ([6b3e68e](https://github.com/googleapis/nodejs-vertexai/commit/6b3e68e3b869659d17ef584995de7d7bfc1b1f3b)) | ||
### Bug Fixes | ||
* improve error message to help with debugging ([8a937d5](https://github.com/googleapis/nodejs-vertexai/commit/8a937d5f534f54867fd62a988dbd84ebafb5b76a)) | ||
## [1.2.0](https://github.com/googleapis/nodejs-vertexai/compare/v1.1.0...v1.2.0) (2024-05-22) | ||
@@ -4,0 +16,0 @@ |
{ | ||
"name": "@google-cloud/vertexai", | ||
"description": "Vertex Generative AI client for Node.js", | ||
"version": "1.2.0", | ||
"version": "1.3.0", | ||
"license": "Apache-2.0", | ||
@@ -6,0 +6,0 @@ "author": "Google LLC", |
/** | ||
* @license | ||
* Copyright 2023 Google LLC | ||
* Copyright 2024 Google LLC | ||
* | ||
@@ -5,0 +5,0 @@ * Licensed under the Apache License, Version 2.0 (the "License"); |
/** | ||
* @license | ||
* Copyright 2023 Google LLC | ||
* Copyright 2024 Google LLC | ||
* | ||
@@ -5,0 +5,0 @@ * Licensed under the Apache License, Version 2.0 (the "License"); |
/** | ||
* @license | ||
* Copyright 2023 Google LLC | ||
* Copyright 2024 Google LLC | ||
* | ||
@@ -5,0 +5,0 @@ * Licensed under the Apache License, Version 2.0 (the "License"); |
/** | ||
* @license | ||
* Copyright 2023 Google LLC | ||
* Copyright 2024 Google LLC | ||
* | ||
@@ -134,3 +134,3 @@ * Licensed under the Apache License, Version 2.0 (the "License"); | ||
new GoogleGenerativeAIError( | ||
'Failed to parse final chunk of stream' | ||
`Failed to parse final chunk of stream: ${currentText}` | ||
) | ||
@@ -137,0 +137,0 @@ ); |
/** | ||
* @license | ||
* Copyright 2023 Google LLC | ||
* Copyright 2024 Google LLC | ||
* | ||
@@ -5,0 +5,0 @@ * Licensed under the Apache License, Version 2.0 (the "License"); |
/** | ||
* @license | ||
* Copyright 2023 Google LLC | ||
* Copyright 2024 Google LLC | ||
* | ||
@@ -5,0 +5,0 @@ * Licensed under the Apache License, Version 2.0 (the "License"); |
/** | ||
* @license | ||
* Copyright 2023 Google LLC | ||
* Copyright 2024 Google LLC | ||
* | ||
@@ -5,0 +5,0 @@ * Licensed under the Apache License, Version 2.0 (the "License"); |
/** | ||
* @license | ||
* Copyright 2023 Google LLC | ||
* Copyright 2024 Google LLC | ||
* | ||
@@ -5,0 +5,0 @@ * Licensed under the Apache License, Version 2.0 (the "License"); |
@@ -0,1 +1,18 @@ | ||
/** | ||
* @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 | ||
* | ||
* https://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. | ||
*/ | ||
import {GenerateContentRequest, RequestOptions} from '../../types'; | ||
@@ -2,0 +19,0 @@ import {postRequest} from '../post_request'; |
@@ -0,1 +1,18 @@ | ||
/** | ||
* @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 | ||
* | ||
* https://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. | ||
*/ | ||
import {Tool} from '../../types/content'; | ||
@@ -2,0 +19,0 @@ import { |
/** | ||
* @license | ||
* Copyright 2023 Google LLC | ||
* Copyright 2024 Google LLC | ||
* | ||
@@ -5,0 +5,0 @@ * Licensed under the Apache License, Version 2.0 (the "License"); |
/** | ||
* @license | ||
* Copyright 2023 Google LLC | ||
* Copyright 2024 Google LLC | ||
* | ||
@@ -5,0 +5,0 @@ * Licensed under the Apache License, Version 2.0 (the "License"); |
/** | ||
* @license | ||
* Copyright 2023 Google LLC | ||
* Copyright 2024 Google LLC | ||
* | ||
@@ -5,0 +5,0 @@ * Licensed under the Apache License, Version 2.0 (the "License"); |
/** | ||
* @license | ||
* Copyright 2023 Google LLC | ||
* Copyright 2024 Google LLC | ||
* | ||
@@ -5,0 +5,0 @@ * Licensed under the Apache License, Version 2.0 (the "License"); |
/** | ||
* @license | ||
* Copyright 2023 Google LLC | ||
* Copyright 2024 Google LLC | ||
* | ||
@@ -5,0 +5,0 @@ * Licensed under the Apache License, Version 2.0 (the "License"); |
/** | ||
* @license | ||
* Copyright 2023 Google LLC | ||
* Copyright 2024 Google LLC | ||
* | ||
@@ -5,0 +5,0 @@ * Licensed under the Apache License, Version 2.0 (the "License"); |
/** | ||
* @license | ||
* Copyright 2023 Google LLC | ||
* Copyright 2024 Google LLC | ||
* | ||
@@ -5,0 +5,0 @@ * Licensed under the Apache License, Version 2.0 (the "License"); |
/** | ||
* @license | ||
* Copyright 2023 Google LLC | ||
* Copyright 2024 Google LLC | ||
* | ||
@@ -5,0 +5,0 @@ * Licensed under the Apache License, Version 2.0 (the "License"); |
/** | ||
* @license | ||
* Copyright 2023 Google LLC | ||
* Copyright 2024 Google LLC | ||
* | ||
@@ -25,8 +25,12 @@ * Licensed under the Apache License, Version 2.0 (the "License"); | ||
export declare interface VertexInit { | ||
/** The Google Cloud project name. It is not the numeric project ID. */ | ||
project: string; | ||
/** | ||
* Optional. The Google Cloud project ID. It is not the numeric project name. | ||
* If not provided, SDK will try to resolve it from runtime environment. | ||
* If still not cannot resovle project ID, SDK will throw exception. | ||
*/ | ||
project?: string; | ||
/** | ||
* Optional. The Google Cloud project location. If not provided, SDK will | ||
* firtly try to resolve it from run time environment. If no location resolved | ||
* from run time environment, SDK will use default value `us-central1`. | ||
* firtly try to resolve it from runtime environment. If no location resolved | ||
* from runtime environment, SDK will use default value `us-central1`. | ||
*/ | ||
@@ -624,3 +628,5 @@ location?: string; | ||
retrievalQueries?: string[]; | ||
/** Optional. Array of {@link GroundingAttribution}. */ | ||
/** @deprecated | ||
* Optional. Array of {@link GroundingAttribution} | ||
*/ | ||
groundingAttributions?: GroundingAttribution[]; | ||
@@ -853,2 +859,3 @@ /** Optional. Google search entry for the following-up web searches. {@link SearchEntryPoint} */ | ||
/** | ||
* @deprecated groundingAttributions field in {@link GroundingMetadata} is also deprecated. | ||
* Optional. Disable using the result from this tool in detecting grounding | ||
@@ -855,0 +862,0 @@ * attribution. This does not affect how the result is given to the model for |
/** | ||
* @license | ||
* Copyright 2023 Google LLC | ||
* Copyright 2024 Google LLC | ||
* | ||
@@ -59,2 +59,15 @@ * Licensed under the Apache License, Version 2.0 (the "License"); | ||
/** | ||
* IllegalArgumentError is thrown when the request or operation is invalid | ||
*/ | ||
class IllegalArgumentError extends Error { | ||
public readonly stackTrace: any = undefined; | ||
constructor(message: string, stackTrace: any = undefined) { | ||
super(message); | ||
this.message = constructErrorMessage('IllegalArgumentError', message); | ||
this.name = 'IllegalArgumentError'; | ||
this.stackTrace = stackTrace; | ||
} | ||
} | ||
function constructErrorMessage( | ||
@@ -67,2 +80,7 @@ exceptionClass: string, | ||
export {ClientError, GoogleAuthError, GoogleGenerativeAIError}; | ||
export { | ||
ClientError, | ||
GoogleAuthError, | ||
GoogleGenerativeAIError, | ||
IllegalArgumentError, | ||
}; |
/** | ||
* @license | ||
* Copyright 2023 Google LLC | ||
* Copyright 2024 Google LLC | ||
* | ||
@@ -5,0 +5,0 @@ * Licensed under the Apache License, Version 2.0 (the "License"); |
/** | ||
* @license | ||
* Copyright 2023 Google LLC | ||
* Copyright 2024 Google LLC | ||
* | ||
@@ -5,0 +5,0 @@ * Licensed under the Apache License, Version 2.0 (the "License"); |
/** | ||
* @license | ||
* Copyright 2023 Google LLC | ||
* Copyright 2024 Google LLC | ||
* | ||
@@ -24,3 +24,3 @@ * Licensed under the Apache License, Version 2.0 (the "License"); | ||
const USER_AGENT_PRODUCT = 'model-builder'; | ||
const CLIENT_LIBRARY_VERSION = '1.2.0'; // x-release-please-version | ||
const CLIENT_LIBRARY_VERSION = '1.3.0'; // 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}`; |
/** | ||
* @license | ||
* Copyright 2023 Google LLC | ||
* Copyright 2024 Google LLC | ||
* | ||
@@ -5,0 +5,0 @@ * Licensed under the Apache License, Version 2.0 (the "License"); |
/** | ||
* @license | ||
* Copyright 2023 Google LLC | ||
* Copyright 2024 Google LLC | ||
* | ||
@@ -28,3 +28,3 @@ * Licensed under the Apache License, Version 2.0 (the "License"); | ||
} from './types/content'; | ||
import {GoogleAuthError} from './types/errors'; | ||
import {GoogleAuthError, IllegalArgumentError} from './types/errors'; | ||
@@ -49,2 +49,4 @@ /** | ||
* client. | ||
* @throws {IllegalArgumentError} | ||
*/ | ||
@@ -56,4 +58,4 @@ constructor(init: VertexInit) { | ||
); | ||
this.project = init.project; | ||
this.location = resolveLocation(init.location); | ||
this.project = resolveProject(init.project); | ||
this.googleAuth = new GoogleAuth(opts); | ||
@@ -132,2 +134,10 @@ this.apiEndpoint = init.apiEndpoint; | ||
} | ||
protected getProject(): string { | ||
return this.project; | ||
} | ||
protected getLocation(): string { | ||
return this.location; | ||
} | ||
} | ||
@@ -198,3 +208,3 @@ | ||
function validateGoogleAuthOptions( | ||
project: string, | ||
project?: string, | ||
googleAuthOptions?: GoogleAuthOptions | ||
@@ -231,2 +241,18 @@ ): GoogleAuthOptions { | ||
function resolveProject(projectFromInput?: string): string { | ||
const projectNotFoundErrorMessage = | ||
'Unable to infer your project.' + | ||
'Please provide a project Id by one of the following:' + | ||
'\n- Passing a constructor argument by using new VertexAI({project: my-project})' + | ||
'\n- Setting project using `gcloud config set project my-project`'; | ||
if (projectFromInput) { | ||
return projectFromInput; | ||
} | ||
const inferredProjectFromEnv = process.env['GOOGLE_CLOUD_PROJECT']; | ||
if (inferredProjectFromEnv) { | ||
return inferredProjectFromEnv; | ||
} | ||
throw new IllegalArgumentError(projectNotFoundErrorMessage); | ||
} | ||
function resolveLocation(locationFromInput?: string): string { | ||
@@ -233,0 +259,0 @@ if (locationFromInput) { |
/** | ||
* @license | ||
* Copyright 2023 Google LLC | ||
* Copyright 2024 Google LLC | ||
* | ||
@@ -5,0 +5,0 @@ * Licensed under the Apache License, Version 2.0 (the "License"); |
/** | ||
* @license | ||
* Copyright 2023 Google LLC | ||
* Copyright 2024 Google LLC | ||
* | ||
@@ -5,0 +5,0 @@ * Licensed under the Apache License, Version 2.0 (the "License"); |
/** | ||
* @license | ||
* Copyright 2023 Google LLC | ||
* Copyright 2024 Google LLC | ||
* | ||
@@ -5,0 +5,0 @@ * Licensed under the Apache License, Version 2.0 (the "License"); |
@@ -0,7 +1,34 @@ | ||
/** | ||
* @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 | ||
* | ||
* https://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. | ||
*/ | ||
import {VertexAI} from '../src/vertex_ai'; | ||
import {GenerativeModelPreview, GenerativeModel} from '../src/models'; | ||
import {GoogleAuthError} from '../src/types/errors'; | ||
import {GoogleAuthError, IllegalArgumentError} from '../src/types/errors'; | ||
const PROJECT = 'test_project'; | ||
const LOCATION = 'test_location'; | ||
class VertexAIForTest extends VertexAI { | ||
public override getProject(): string { | ||
return super.getProject(); | ||
} | ||
public override getLocation(): string { | ||
return super.getLocation(); | ||
} | ||
} | ||
describe('VertexAI', () => { | ||
@@ -11,2 +38,3 @@ let vertexai: VertexAI; | ||
beforeEach(() => { | ||
cleanupEnvironmentVariable(); | ||
vertexai = new VertexAI({ | ||
@@ -19,3 +47,5 @@ project: PROJECT, | ||
it('no location given, should instantiate VertexAI and VertexAIPreview', () => { | ||
const vertexaiNoLocation = new VertexAI({project: PROJECT}); | ||
const vertexaiNoLocation = new VertexAI({ | ||
project: PROJECT, | ||
}) as VertexAIForTest; | ||
const generativeModel = vertexaiNoLocation.getGenerativeModel({ | ||
@@ -28,2 +58,3 @@ model: 'gemini-pro', | ||
}); | ||
expect(vertexaiNoLocation.getLocation()).toEqual('us-central1'); | ||
expect(vertexaiNoLocation).toBeInstanceOf(VertexAI); | ||
@@ -35,4 +66,7 @@ expect(generativeModel).toBeInstanceOf(GenerativeModel); | ||
it('location in run time env GOOGLE_CLOUD_REGION, should instantiate VertexAI and VertexAIPreview', () => { | ||
process.env['GOOGLE_CLOUD_REGION'] = 'us-central1'; | ||
const vertexaiNoLocation = new VertexAI({project: PROJECT}); | ||
process.env['GOOGLE_CLOUD_REGION'] = 'us-central2'; | ||
process.env['CLOUD_ML_REGION'] = 'us-central3'; | ||
const vertexaiNoLocation = new VertexAI({ | ||
project: PROJECT, | ||
}) as VertexAIForTest; | ||
const generativeModel = vertexaiNoLocation.getGenerativeModel({ | ||
@@ -45,2 +79,3 @@ model: 'gemini-pro', | ||
}); | ||
expect(vertexaiNoLocation.getLocation()).toEqual('us-central2'); | ||
expect(vertexaiNoLocation).toBeInstanceOf(VertexAI); | ||
@@ -52,4 +87,6 @@ expect(generativeModel).toBeInstanceOf(GenerativeModel); | ||
it('location in run time env CLOUD_ML_REGION, should instantiate VertexAI and VertexAIPreview', () => { | ||
process.env['CLOUD_ML_REGION'] = 'us-central1'; | ||
const vertexaiNoLocation = new VertexAI({project: PROJECT}); | ||
process.env['CLOUD_ML_REGION'] = 'us-central3'; | ||
const vertexaiNoLocation = new VertexAI({ | ||
project: PROJECT, | ||
}) as VertexAIForTest; | ||
const generativeModel = vertexaiNoLocation.getGenerativeModel({ | ||
@@ -62,2 +99,3 @@ model: 'gemini-pro', | ||
}); | ||
expect(vertexaiNoLocation.getLocation()).toEqual('us-central3'); | ||
expect(vertexaiNoLocation).toBeInstanceOf(VertexAI); | ||
@@ -68,2 +106,31 @@ expect(generativeModel).toBeInstanceOf(GenerativeModel); | ||
it('location in run time env GOOGLE_CLOUD_REGION, project in GOOGLE_CLOUD_PROJECT, should instantiate VertexAI and VertexAIPreview', () => { | ||
process.env['GOOGLE_CLOUD_REGION'] = 'us-central2'; | ||
process.env['CLOUD_ML_REGION'] = 'us-central3'; | ||
process.env['GOOGLE_CLOUD_PROJECT'] = 'my-project'; | ||
const vertexaiNoArgs = new VertexAI({}) as VertexAIForTest; | ||
const generativeModel = vertexaiNoArgs.getGenerativeModel({ | ||
model: 'gemini-pro', | ||
}); | ||
const generativeModelPreview = vertexaiNoArgs.preview.getGenerativeModel({ | ||
model: 'gemini-pro', | ||
}); | ||
expect(vertexaiNoArgs.getLocation()).toEqual('us-central2'); | ||
expect(vertexaiNoArgs.getProject()).toEqual('my-project'); | ||
expect(vertexaiNoArgs).toBeInstanceOf(VertexAI); | ||
expect(generativeModel).toBeInstanceOf(GenerativeModel); | ||
expect(generativeModelPreview).toBeInstanceOf(GenerativeModelPreview); | ||
}); | ||
it('cannot resolve project, should throw', () => { | ||
const expectedProjectNotFoundErrorMessage = | ||
'Unable to infer your project.' + | ||
'Please provide a project Id by one of the following:' + | ||
'\n- Passing a constructor argument by using new VertexAI({project: my-project})' + | ||
'\n- Setting project using `gcloud config set project my-project`'; | ||
expect(() => { | ||
new VertexAI({}); | ||
}).toThrow(new IllegalArgumentError(expectedProjectNotFoundErrorMessage)); | ||
}); | ||
it('given undefined google auth options, should be instantiated', () => { | ||
@@ -152,1 +219,7 @@ expect(vertexai).toBeInstanceOf(VertexAI); | ||
}); | ||
function cleanupEnvironmentVariable() { | ||
delete process.env['GOOGLE_CLOUD_REGION']; | ||
delete process.env['CLOUD_ML_REGION']; | ||
delete process.env['GOOGLE_CLOUD_PROJECT']; | ||
} |
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 not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
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
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
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
1142126
21026
14