https://github.com/anilsingh581/vertex-ai-dotnet-csharp
https://github.com/anilsingh581/vertex-ai-dotnet-csharp
Last synced: about 2 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/anilsingh581/vertex-ai-dotnet-csharp
- Owner: anilsingh581
- Created: 2025-02-20T14:15:35.000Z (2 months ago)
- Default Branch: main
- Last Pushed: 2025-02-20T14:23:53.000Z (2 months ago)
- Last Synced: 2025-02-20T15:31:13.987Z (2 months ago)
- Size: 3.91 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Vertex AI Setup in C#
This repository provides a guide to set up and use Google Cloud's Vertex AI in a C# project. Follow the steps below to configure your environment and integrate Vertex AI functionality.
## Prerequisites
Before you begin, ensure you have the following:
1. **Google Cloud Account**: An active Google Cloud account is required.
2. **Project**: Create a project in the [Google Cloud Console](https://console.cloud.google.com/) (e.g., `ocrai-selfbill`).
3. **Billing**: Enable billing for your Google Cloud project.
4. **Visual Studio**: Install any recent version (e.g., 2019 or 2022) with the .NET workload.---
## Step 1: Enable Vertex AI API
1. Navigate to the [Google Cloud Console](https://console.cloud.google.com/).
2. Select your project (e.g., `ocrai-selfbill`).
3. Go to **APIs & Services** > **Library**.
4. Search for **Vertex AI API**.
5. Click **Enable** to activate the API for your project.---
## Step 2: Set Up Authentication
Vertex AI requires authentication via a service account. Follow these steps:
### 1. Create a Service Account
- In the Google Cloud Console, go to **IAM & Admin** > **Service Accounts**.
- Click **Create Service Account**.
- Name it (e.g., `vertex-ai-service-account`).
- Grant it the **Vertex AI User** role (or a custom role with appropriate permissions).
- Click **Create and Continue**, then **Done**.### 2. Generate a Key
- From the Service Accounts list, click on your new service account.
- Go to the **Keys** tab, then click **Add Key** > **Create New Key**.
- Select **JSON** as the key type and download the file (e.g., `ocrai-selfbill-123456789.json`).### 3. Set Environment Variable
- Place the JSON key file in a secure location on your machine.
- Set the `GOOGLE_APPLICATION_CREDENTIALS` environment variable to point to this file:**Windows:**
```cmd
set GOOGLE_APPLICATION_CREDENTIALS=C:\path\to\your\service-account-key.json