# Google Vertex AI

The Vertex AI implementation is meant to be used in Node.js and not
directly in a browser, since it requires a service account to use.

Before running this code, you should make sure the Vertex AI API is
enabled for the relevant project in your Google Cloud dashboard and that you've authenticated to
Google Cloud using one of these methods:

- You are logged into an account (using `gcloud auth application-default login`)
  permitted to that project.
- You are running on a machine using a service account that is permitted
  to the project.
- You have downloaded the credentials for a service account that is permitted
  to the project and set the `GOOGLE_APPLICATION_CREDENTIALS` environment
  variable to the path of this file.

```bash npm2yarn
npm install google-auth-library
```

import CodeBlock from "@theme/CodeBlock";
import GoogleVertexAIExample from "@examples/llms/googlevertexai.ts";

<CodeBlock language="typescript">{GoogleVertexAIExample}</CodeBlock>

Google also has separate models for their "Codey" code generation models.

The "code-gecko" model is useful for code completion:

import GoogleVertexAICodeGeckoExample from "@examples/llms/googlevertexai-code-gecko.ts";

<CodeBlock language="typescript">{GoogleVertexAICodeGeckoExample}</CodeBlock>

While the "code-bison" model is better at larger code generation based on
a text prompt:

import GoogleVertexAICodeBisonExample from "@examples/llms/googlevertexai-code-bison.ts";

<CodeBlock language="typescript">{GoogleVertexAICodeBisonExample}</CodeBlock>