GoogleAIPlatformAdapter Class

The GoogleAIPlatformAdapter class provides an implementation of the IPlatformAdapter interface to integrate with Google AI Generative API. It handles authorization, URL generation, and credential management for making requests to the Google AI platform.

Definition

Namespace: GenerativeAI
Assembly: GenerativeAI (in GenerativeAI.dll) Version: 2.0.2+aa51399cad6d90cc71158d589a6268608b3c1893
C#
public class GoogleAIPlatformAdapter : IPlatformAdapter
Inheritance
Object    GoogleAIPlatformAdapter
Implements
IPlatformAdapter

Constructors

GoogleAIPlatformAdapterInitializes a new instance of the GoogleAIPlatformAdapter class

Properties

ApiVersion Gets or sets the API version used for constructing API request URLs in the integration with the Google AI platform. This property must be set to a valid version string defined in ApiVersions.
BaseUrl Gets or sets the base URL used for making requests to the Google AI Generative API. By default, this property is initialized to the URL specified in GoogleGenerativeAI. It serves as the foundational endpoint for constructing resource-specific URLs.
Credentials Gets the credentials used for authentication when making requests to the Google AI platform. This property provides an instance of GoogleAICredentials which encapsulates the API key and optionally an access token required for authorization.

Methods

AddAuthorizationAsync Adds the required authorization headers to the provided HTTP request message. This includes both API key and OAuth2 Bearer token as applicable.
AuthorizeAsync 
CreateUrlForModel Constructs a URL for a specific AI model and task by appending the model ID and task to the base URL and API version.
CreateUrlForTunedModel 
EqualsDetermines whether the specified object is equal to the current object.
(Inherited from Object)
FinalizeAllows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.
(Inherited from Object)
GetApiVersion 
GetApiVersionForFile 
GetBaseUrl Constructs and retrieves the base URL for the Google Generative AI platform, optionally appending the API version to the URL.
GetBaseUrlForFile 
GetHashCodeServes as the default hash function.
(Inherited from Object)
GetTypeGets the Type of the current instance.
(Inherited from Object)
MemberwiseCloneCreates a shallow copy of the current Object.
(Inherited from Object)
ToStringReturns a string that represents the current object.
(Inherited from Object)
ValidateCredentialsAsync(CancellationToken) 
ValidateCredentialsAsync(Boolean, CancellationToken) 

See Also