Class Client
Client for making synchronous requests. Using this client to make a request to Gemini Developer API or Vertex AI API.
public sealed class Client : IDisposable, IAsyncDisposable
- Inheritance
-
Client
- Implements
- Inherited Members
- Extension Methods
Constructors
Client(bool?, bool?, string?, ICredential?, string?, string?, HttpOptions?, ClientOptions?)
Constructs a Client instance with the given parameters.
public Client(bool? enterprise = null, bool? vertexAI = null, string? apiKey = null, ICredential? credential = null, string? project = null, string? location = null, HttpOptions? httpOptions = null, ClientOptions? clientOptions = null)
Parameters
enterprisebool?Optional Boolean for whether to use Gemini Enterprise Agent Platform APIs. If neither is specified here nor in the environment variable, defaults to false. If both enterprise and vertexAI are set, and they have different values, an ArgumentException will be thrown.
vertexAIbool?Optional Boolean for whether to use Vertex AI APIs (now Gemini Enterprise Agent Platform). If not specified here nor in the environment variable, defaults to false. NOTE: Use enterprise parameter from now on. enterprise parameter takes precedence over this flag. If both enterprise and vertexAI are set, and they have different values, an ArgumentException will be thrown.
apiKeystringOptional String for the API key. Gemini API only.
credentialICredentialOptional GoogleCredential. Vertex AI only.
projectstringOptional String for the project ID. Vertex AI APIs only. Find your project ID.
locationstringOptional String for the location. Vertex AI APIs only.
httpOptionsHttpOptionsOptional HttpOptions for sending HTTP requests.
clientOptionsClientOptionsOptional ClientOptions for configuring the client.
Exceptions
- ArgumentException
Thrown if the project/location and API key are set together.
Properties
Batches
public Batches Batches { get; }
Property Value
Caches
public Caches Caches { get; }
Property Value
Files
public Files Files { get; }
Property Value
Live
public Live Live { get; }
Property Value
Models
public Models Models { get; }
Property Value
Operations
public Operations Operations { get; }
Property Value
Tokens
public Tokens Tokens { get; }
Property Value
Tunings
public Tunings Tunings { get; }
Property Value
Methods
Dispose()
Disposes the client and its underlying resources.
public void Dispose()
DisposeAsync()
Asynchronously disposes the client and its underlying resources.
public ValueTask DisposeAsync()
Returns
setDefaultBaseUrl(string?, string?)
public static void setDefaultBaseUrl(string? vertexBaseUrl, string? geminiBaseUrl)