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
platformAdapterIPlatformAdapterThe platform adapter to use for requests.
clientHttpClientOptional HTTP client for making requests.
loggerILoggerOptional 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
projectIdstringThe ID of the Google Cloud project.
regionstringThe region to use for the Vertex AI platform.
accessTokenstringThe access token for authorization.
expressModeboolSpecifies whether express mode is enabled.
apiKeystringThe API key for authentication.
apiVersionstringThe API version to use. Defaults to GOOGLE_GENAI_API_VERSION when set, otherwise v1beta1.
httpClientHttpClientOptional HTTP client for making requests.
authenticatorIGoogleAuthenticatorOptional Google authenticator for handling authentication.
loggerILoggerOptional 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
modelNamestringThe name of the generative model to create.
configGenerationConfigOptional configuration for controlling generation behavior.
safetyRatingsICollection<SafetySetting>Optional collection of safety settings to apply during the generation process.
systemInstructionstringOptional instruction to guide model behavior during generation.
corpusIdForRagstringOptional identifier for the corpus to use with the Retriever-Augmented Generation (RAG) tool.
ragRetrievalConfigRagRetrievalConfigConfiguration 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
modelNamestringThe 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.