Skip to content

Commit

Permalink
feat: Add GOOGLE_LOC environment variable for configurable Google API…
Browse files Browse the repository at this point in the history
… location
  • Loading branch information
berry-13 committed Oct 13, 2024
1 parent bf5b87e commit 38276a5
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 2 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,8 @@ GOOGLE_KEY=user_provided

# GOOGLE_TITLE_MODEL=gemini-pro

# GOOGLE_LOC=us-central1

# Google Safety Settings
# NOTE: These settings apply to both Vertex AI and Gemini API (AI Studio)
#
Expand Down
4 changes: 3 additions & 1 deletion api/app/clients/GoogleClient.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ const {
} = require('./prompts');
const BaseClient = require('./BaseClient');

const loc = 'us-central1';
const loc = process.env.GOOGLE_LOC || 'us-central1';
const publisher = 'google';
const endpointPrefix = `https://${loc}-aiplatform.googleapis.com`;
// const apiEndpoint = loc + '-aiplatform.googleapis.com';
Expand Down Expand Up @@ -593,6 +593,8 @@ class GoogleClient extends BaseClient {

createLLM(clientOptions) {
const model = clientOptions.modelName ?? clientOptions.model;
clientOptions.location = loc;
clientOptions.endpoint = `${loc}-aiplatform.googleapis.com`;
if (this.project_id && this.isTextModel) {
logger.debug('Creating Google VertexAI client');
return new GoogleVertexAI(clientOptions);
Expand Down

0 comments on commit 38276a5

Please sign in to comment.