Google Gen AI SDK (Python) 3.0.0 sürüm notları
Google Gen AI SDK (Python) 3.0.0 sürümünün yayın tarihi 6 Kasım 2026. En güncel sürüm 3.6.1.
Bu sürümün notları kırıcı değişikliklerden bahsediyor.
Orijinal sürüm notları
3.0.0 (2026-11-05)
⚠ BREAKING CHANGES
Default Gemini Developer API version is now
v1(wasv1beta) (2d0f947)- Clients targeting the Gemini Developer API now default to API version
v1instead ofv1beta. - No effect on Gemini Enterprise (Vertex AI) defaults: Clients with
vertexai=True/enterprise=Trueare unaffected by this default change and continue to default tov1beta1. - Some models are not available on
v1, notably: thegemini-flash-latest,gemini-flash-lite-latestandgemini-pro-latestaliases, and some-previewmodels. They exist only onv1beta. To keep using them, use a specific stable model version, or switch back tov1betaas shown below. - The Live API and context caching (
caches) are not available onv1. The Gemini Developer API serves them only onv1beta. To keep using them, switch back tov1betaas shown below. - Some model aliases are not available on
v1, notably:gemini-flash-latest,gemini-flash-lite-latestandgemini-pro-latest. They exist only onv1beta. To keep using them, use a specific model version, or switch back tov1betaas shown below. - How to configure or restore the previous default via environment variable: Set
GOOGLE_GENAI_API_VERSION(works for both Gemini Developer API and Enterprise / Vertex AI clients when no version is set in code):# Restores the beta default ('v1beta' on Gemini Developer API, 'v1beta1' on Enterprise / Vertex AI) export GOOGLE_GENAI_API_VERSION=beta # Or set an explicit API version string on either platform (e.g. 'v1', 'v1beta', 'v1beta1') export GOOGLE_GENAI_API_VERSION=v1beta - How to set the API version in code: Pass
api_versioninHttpOptions(takes precedence overGOOGLE_GENAI_API_VERSION):from google import genai from google.genai import types client = genai.Client( http_options=types.HttpOptions(api_version='v1beta') )
- Clients targeting the Gemini Developer API now default to API version
Default HTTP client is now
httpx2(washttpx), andhttpxis no longer installed by default (51285c8)httpxis no longer installed by default.httpx2is now the required dependency and default HTTP client.- How to restore the previous
httpxdefault via environment variable: Becausehttpx2is installed by default, installinggoogle-genai[httpx]alone only makesimport httpxavailable; to switch the SDK's default client back tohttpxwithout code changes, both install thehttpxextra and setGOOGLE_GENAI_HTTP_CLIENT=httpx:pip install "google-genai[httpx]" export GOOGLE_GENAI_HTTP_CLIENT=httpx - How to pass an
httpxclient in code: After installinggoogle-genai[httpx], you can passhttpx.Client/httpx.AsyncClientdirectly viaHttpOptions:import httpx from google import genai from google.genai import types client = genai.Client( http_options=types.HttpOptions( httpx_client=httpx.Client(), httpx_async_client=httpx.AsyncClient(), ) ) - Migrating existing
httpxcode tohttpx2: In most cases, updating your imports withimport httpx2 as httpxis sufficient. - SSL certificate verification: By default,
httpx2uses the OS certificate trust store (viatruststore/httpx2.create_ssl_context()) instead ofcertifiwhenSSL_CERT_FILEandSSL_CERT_DIRare not set. - When
httpxvs.httpx2types matter: Package-specific objects passed inHttpOptions(client_args=..., async_client_args=...)(such asTimeout,Limits,MockTransport/BaseTransport, or customAuthsubclasses) and unwrapped transport exceptions caught fromclient.models,client.files, etc. (TimeoutException,ConnectError,HTTPError) must match the active HTTP client. (WhenGOOGLE_GENAI_HTTP_CLIENTis unset orauto, passinghttpxobjects inHttpOptionswill also auto-select thehttpxbackend ifgoogle-genai[httpx]is installed.)
interactions:
CodeExecutionResultStep.resultchanges fromstringto theCodeExecutionResultStepResultunion. Code that readsresultas a string must now check which variant is present and read the string from it. The JSON for text-only results is unchanged.
Features
- Add
source_texttoAudioTranscriptionConfigandSmartTranscriptionMode. (1ac3c91) - Add MALFORMED_RESPONSE to FinishReason (6eb8523), refs #2937
- cli: Use gemini-3.5-transcribe as default model for transcribe command (b18fd3c)
- Default Gemini API version to v1 instead of v1beta across SDKs (2d0f947)
- Disable GenerateVideos for Gemini API, update tests/READMEs (8ddc655)
- interactions: Add Office and OpenDocument MIME types (753cc1c)
- interactions: Support multimodal content in CodeExecutionResultStep.result (a216d95)
- Support GOOGLE_GENAI_API_VERSION environment variable across SDKs (2d0f947)
- Switch default HTTP client to httpx2 and use OS trust store by default (51285c8)
- Update discovery doc (5647e1e)
Bug Fixes
- interactions: Retries = attempts - 1 (0f688a6)
- Preserve unknown fields and open-union variants in Interactions models (2eaf2d8)
- Respect configured and default API version for Gemini API file uploads across SDKs (ddc45d0)
Documentation
Kaynak: GitHub sürümü v3.0.0