google.VertexClient
Gemini on Vertex AI: the same models as `google.GeminiClient`, reached through a Google Cloud project with Google Cloud credentials.
Signature
class google.VertexClientGemini on Vertex AI: the same models as google.GeminiClient, reached
through a Google Cloud project with Google Cloud credentials.
Three ways to authenticate, in the order the client tries them:
credentials_json— an inline credential document (service account, authorized user, workload identity federation, impersonated service account);credentials_file— a path to one, plus theGOOGLE_APPLICATION_CREDENTIALS_CONTENTenv var holding a document inline;- nothing — Application Default Credentials
(
GOOGLE_APPLICATION_CREDENTIALS, the well-known ADC file, the gcloud config file, the GCE metadata server).
api_key selects Vertex AI express mode instead: the key rides the URL
as ?key=…, no credentials are read, and the request goes to the
project-less global endpoint unless a project is configured.
Source:<builtin>/google/vertex.bamlbytes 936–6394
Fields
model
stringproject_id
ai.Credential | nulllocation
string | nullcredentials_json
string | nullcredentials_file
string | nullapi_key
ai.Credential | nullbase_url
ai.Credential | nullrequest_timeout_ms
int | nulltime_to_first_token_timeout_ms
int | nullrequest_body
baml.json.json | nullheaders
map<string, string> | nullquery_params
map<string, string> | nulltemperature
float | nullmax_output_tokens
int | nulltop_p
float | nulltop_k
int | nullstop_sequences
string[] | nullresponse_modalities
string[] | nullsafety_settings
google.SafetySetting[] | nullcapture_wire
boolStatic methods
new
(Creates a client. Construction reads no environment variable, so declaring one is always safe; credentials and endpoints resolve when a request is built.
Instance methods
resolved_api_key
(self) -> string | null throws baml.errors.Io | baml.errors.ParseErrorThe express-mode key, or null for OAuth2. Unlike the other providers this may legitimately be absent: credentials are the normal path.
resolved_base_url
(self) -> string | null throws baml.errors.Io | baml.errors.ParseErrorThe request-time base URL, or null to build one from project + location.
Implementations
ai.Client for google.VertexClient
Instance methods
id
(self) -> stringinvoke
(render
(Source:<builtin>/google/vertex.bamlbytes 5531–6095
ai.stream.StreamingClient for google.VertexClient
Instance methods
invoke_stream
(Source:<builtin>/google/vertex.bamlbytes 6101–6392