Table of Contents

Class VertexAI

Namespace
GenerativeAI
Assembly
GenerativeAI.dll

Represents the Vertex AI implementation of the generative AI platform.

public class VertexAI : GenAI, IGenerativeAI
Inheritance
VertexAI
Implements
Inherited Members
Extension Methods

Constructors

VertexAI(IPlatformAdapter, HttpClient?, ILogger?)

Initializes a new instance of the VertexAI class with a platform adapter, an optional HTTP client, and an optional logger.

public VertexAI(IPlatformAdapter platformAdapter, HttpClient? client = null, ILogger? logger = null)

Parameters

platformAdapter IPlatformAdapter

The platform adapter to use for requests.

client HttpClient

Optional HTTP client for making requests.

logger ILogger

Optional logger to log messages.

VertexAI(string?, string?, string?, bool, string?, string?, HttpClient?, IGoogleAuthenticator?, ILogger?)

Initializes a new instance of the VertexAI class with project-specific configuration and credentials.

public VertexAI(string? projectId = null, string? region = null, string? accessToken = null, bool expressMode = false, string? apiKey = null, string? apiVersion = null, HttpClient? httpClient = null, IGoogleAuthenticator? authenticator = null, ILogger? logger = null)

Parameters

projectId string

The ID of the Google Cloud project.

region string

The region to use for the Vertex AI platform.

accessToken string

The access token for authorization.

expressMode bool

Specifies whether express mode is enabled.

apiKey string

The API key for authentication.

apiVersion string

The API version to use. Defaults to GOOGLE_GENAI_API_VERSION when set, otherwise v1beta1.

httpClient HttpClient

Optional HTTP client for making requests.

authenticator IGoogleAuthenticator

Optional Google authenticator for handling authentication.

logger ILogger

Optional logger to log messages.

Methods

CreateGenerativeModel(string, GenerationConfig?, ICollection<SafetySetting>?, string?, string?, RagRetrievalConfig?)

Creates an instance of the GenerativeModel class with the specified model name, generation configuration, safety settings, system instructions, and an optional corpus ID for Retriever-Augmented Generation (RAG).

public GenerativeModel CreateGenerativeModel(string modelName, GenerationConfig? config = null, ICollection<SafetySetting>? safetyRatings = null, string? systemInstruction = null, string? corpusIdForRag = null, RagRetrievalConfig? ragRetrievalConfig = null)

Parameters

modelName string

The name of the generative model to create.

config GenerationConfig

Optional configuration for controlling generation behavior.

safetyRatings ICollection<SafetySetting>

Optional collection of safety settings to apply during the generation process.

systemInstruction string

Optional instruction to guide model behavior during generation.

corpusIdForRag string

Optional identifier for the corpus to use with the Retriever-Augmented Generation (RAG) tool.

ragRetrievalConfig RagRetrievalConfig

Configuration settings for the Retriever-Augmented Generation (RAG) tool.

Returns

GenerativeModel

A new GenerativeModel instance configured with the specified parameters.

CreateImageTextModel()

Creates and returns a new instance of the ImageTextModel class initialized with the platform adapter, HTTP client, and logger available in the current VertexAI instance.

public ImageTextModel CreateImageTextModel()

Returns

ImageTextModel

An instance of ImageTextModel configured with the current platform adapter, HTTP client, and logger.

CreateRagManager()

Creates a new instance of the VertexRagManager class, which provides functions for managing Vertex AI Retrieval-Augmented Generation functionality.

public VertexRagManager CreateRagManager()

Returns

VertexRagManager

A new instance of VertexRagManager configured with the current platform, HTTP client, and logger.

CreateVideoGenerationModel(string)

Retrieves an instance of the VideoGenerationModel using the specified model name.

public VideoGenerationModel CreateVideoGenerationModel(string modelName = "veo-2.0-generate-001")

Parameters

modelName string

The name of the video generation model to instantiate. Defaults to "veo-2.0-generate-001".

Returns

VideoGenerationModel

An instance of VideoGenerationModel configured with the specified model name.