0.0.20241026 • Published 8 months ago

@maxim_mazurok/gapi.client.aiplatform-v1 v0.0.20241026

Weekly downloads
-
License
MIT
Repository
github
Last release
8 months ago

TypeScript typings for Vertex AI API v1

Train high-quality custom machine learning models with minimal machine learning expertise and effort. For detailed description please check documentation.

Installing

Install typings for Vertex AI API:

npm install @types/gapi.client.aiplatform-v1 --save-dev

Usage

You need to initialize Google API client in your code:

gapi.load('client', () => {
  // now we can use gapi.client
  // ...
});

Then load api client wrapper:

gapi.client.load(
  'https://aiplatform.googleapis.com/$discovery/rest?version=v1',
  () => {
    // now we can use:
    // gapi.client.aiplatform
  }
);
// Deprecated, use discovery document URL, see https://github.com/google/google-api-javascript-client/blob/master/docs/reference.md#----gapiclientloadname----version----callback--
gapi.client.load('aiplatform', 'v1', () => {
  // now we can use:
  // gapi.client.aiplatform
});

Don't forget to authenticate your client before sending any request to resources:

// declare client_id registered in Google Developers Console
var client_id = '',
  scope = [
    // See, edit, configure, and delete your Google Cloud data and see the email address for your Google Account.
    'https://www.googleapis.com/auth/cloud-platform',

    // View your data across Google Cloud services and see the email address of your Google Account
    'https://www.googleapis.com/auth/cloud-platform.read-only',
  ],
  immediate = true;
// ...

gapi.auth.authorize(
  {client_id: client_id, scope: scope, immediate: immediate},
  authResult => {
    if (authResult && !authResult.error) {
      /* handle successful authorization */
    } else {
      /* handle authorization error */
    }
  }
);

After that you can use Vertex AI API resources:

/*
Creates a Dataset.
*/
await gapi.client.aiplatform.datasets.create({});

/*
Deletes a Dataset.
*/
await gapi.client.aiplatform.datasets.delete({name: 'name'});

/*
Gets a Dataset.
*/
await gapi.client.aiplatform.datasets.get({name: 'name'});

/*
Lists Datasets in a Location.
*/
await gapi.client.aiplatform.datasets.list({});

/*
Updates a Dataset.
*/
await gapi.client.aiplatform.datasets.patch({name: 'name'});

/*
Return a list of tokens based on the input text.
*/
await gapi.client.aiplatform.endpoints.computeTokens({endpoint: 'endpoint'});

/*
Perform a token counting.
*/
await gapi.client.aiplatform.endpoints.countTokens({endpoint: 'endpoint'});

/*
Generate content with multimodal inputs.
*/
await gapi.client.aiplatform.endpoints.generateContent({model: 'model'});

/*
Generate content with multimodal inputs with streaming support.
*/
await gapi.client.aiplatform.endpoints.streamGenerateContent({model: 'model'});

/*
Gets a GenAI cache config.
*/
await gapi.client.aiplatform.projects.getCacheConfig({name: 'name'});

/*
Updates a cache config.
*/
await gapi.client.aiplatform.projects.updateCacheConfig({name: 'name'});
0.0.20241026

8 months ago

0.0.20241025

8 months ago

0.0.20240925

9 months ago

0.0.20241001

9 months ago

0.0.20241007

9 months ago

0.0.20240923

9 months ago

0.0.20240907

10 months ago

0.0.20240916

10 months ago

0.0.20240830

10 months ago

0.0.20240828

10 months ago

0.0.20240816

10 months ago

0.0.20240531

1 year ago

0.0.20240809

11 months ago

0.0.20240727

11 months ago

0.0.20240529

1 year ago

0.0.20240609

1 year ago

0.0.20240725

12 months ago

0.0.20240618

1 year ago

0.0.20240814

11 months ago

0.0.20240709

12 months ago

0.0.20240628

1 year ago

0.0.20240703

12 months ago

0.0.20240520

1 year ago

0.0.20240715

12 months ago

0.0.20240510

1 year ago

0.0.20240507

1 year ago

0.0.20240501

1 year ago

0.0.20240429

1 year ago

0.0.20240424

1 year ago

0.0.20240423

1 year ago

0.0.20240417

1 year ago

0.0.20240404

1 year ago

0.0.20240328

1 year ago

0.0.20240322

1 year ago

0.0.20240320

1 year ago

0.0.20240313

1 year ago

0.0.20240301

1 year ago

0.0.20240312

1 year ago

0.0.20240229

1 year ago

0.0.20240224

1 year ago

0.0.20240219

1 year ago

0.0.20240213

1 year ago

0.0.20240209

1 year ago

0.0.20240205

1 year ago

0.0.20240125

1 year ago

0.0.20240117

1 year ago

0.0.20240105

1 year ago

0.0.20231229

1 year ago

0.0.20231218

2 years ago

0.0.20231214

2 years ago

0.0.20231211

2 years ago

0.0.20231129

2 years ago

0.0.20231121

2 years ago

0.0.20231111

2 years ago

0.0.20231107

2 years ago

0.0.20231101

2 years ago

0.0.20231024

2 years ago

0.0.20231023

2 years ago

0.0.20231012

2 years ago

0.0.20231005

2 years ago

0.0.20230929

2 years ago

0.0.20230914

2 years ago

0.0.20230908

2 years ago

0.0.20230812

2 years ago

0.0.20230809

2 years ago

0.0.20230808

2 years ago

0.0.20230727

2 years ago

0.0.20230721

2 years ago