Skip to content

Commit cb8ed10

Browse files
Merge branch 'googleapis:main' into main
2 parents 5931623 + ba41ce5 commit cb8ed10

69 files changed

Lines changed: 13307 additions & 1382 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

CHANGELOG.md

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,60 @@
11
# Changelog
22

3+
## [1.73.1](https://github.com/googleapis/python-genai/compare/v1.73.0...v1.73.1) (2026-04-14)
4+
5+
6+
### Bug Fixes
7+
8+
* Refactor Webhook types in GenAI SDKs for easier useage ([3f36ca1](https://github.com/googleapis/python-genai/commit/3f36ca11b30904c8f82dd3e7e3b59eff3bde6a3b))
9+
* Rename `webhooks.retrieve` to `webhooks.get`. ([649f4b0](https://github.com/googleapis/python-genai/commit/649f4b06d7bd78a23dd77b06713c6ca5c65321f9))
10+
11+
12+
### Documentation
13+
14+
* Update python docs for 1.73.0 ([acd3767](https://github.com/googleapis/python-genai/commit/acd3767bff513524172ddd7726b147d01c245f1c))
15+
16+
## [1.73.0](https://github.com/googleapis/python-genai/compare/v1.72.0...v1.73.0) (2026-04-13)
17+
18+
19+
### Features
20+
21+
* Add DeepResearchAgentConfig fields ([ec8ca87](https://github.com/googleapis/python-genai/commit/ec8ca87e6e0a80d363ebceadeacb623c0f479776))
22+
* Add webhook and webhookConfig for js and python sdk ([ccec350](https://github.com/googleapis/python-genai/commit/ccec35073534930130993443e4dea9bed6b07006))
23+
* Add webhook_config to batches.create() and models.generate_videos() ([772d2fc](https://github.com/googleapis/python-genai/commit/772d2fc0a716e5a23ab241b1efcb1dc5c73fde9e))
24+
* Wire the webhook into python and js client. ([841bf22](https://github.com/googleapis/python-genai/commit/841bf220d0bf1c539ab349998afb388118c6af05))
25+
26+
27+
### Bug Fixes
28+
29+
* Refine Pyink blank line insertion logic and fix range-based formatting regressions. ([b91bda5](https://github.com/googleapis/python-genai/commit/b91bda5d587ee6217fcff8f4e1b8eee4aebb9203))
30+
31+
## [1.72.0](https://github.com/googleapis/python-genai/compare/v1.71.0...v1.72.0) (2026-04-09)
32+
33+
34+
### Features
35+
36+
* Add "eu" as a supported service location for Vertex AI platform. ([888a731](https://github.com/googleapis/python-genai/commit/888a73159db17a8f08f928ee1a85e80db1a85a1a))
37+
* Add Live Avatar new fields ([ad1777e](https://github.com/googleapis/python-genai/commit/ad1777e29e28677101c9a26bdff6fd32e103340b))
38+
* Add support for new audio MIME types: opus, alaw, and mulaw ([74eb373](https://github.com/googleapis/python-genai/commit/74eb373b2e97291e1d07cedce7cbf1fb82123a18))
39+
* Add the delete method for the Agent Engine Task Store Service ([d821082](https://github.com/googleapis/python-genai/commit/d821082a91effba4dc684b03b438e51527deed03))
40+
41+
42+
### Documentation
43+
44+
* Update python docs for 1.71.0 ([e82f9fc](https://github.com/googleapis/python-genai/commit/e82f9fc9093825b3d5c4388c7faefe0c733f154b))
45+
46+
## [1.71.0](https://github.com/googleapis/python-genai/compare/v1.70.0...v1.71.0) (2026-04-08)
47+
48+
49+
### Features
50+
51+
* Introduce TYPE_L16 audio content and optional fields. ([07e932f](https://github.com/googleapis/python-genai/commit/07e932f9bc8dcb224ced2b35061ede9df25432cb))
52+
53+
54+
### Documentation
55+
56+
* Remove deprecated product recontext model samples from docstrings ([aca7dcf](https://github.com/googleapis/python-genai/commit/aca7dcf32b15ef2d945a14fb498be0e9c096c0d8))
57+
358
## [1.70.0](https://github.com/googleapis/python-genai/compare/v1.69.0...v1.70.0) (2026-03-31)
459

560

docs/genai.html

Lines changed: 8257 additions & 803 deletions
Large diffs are not rendered by default.

docs/genindex.html

Lines changed: 391 additions & 19 deletions
Large diffs are not rendered by default.

docs/index.html

Lines changed: 205 additions & 0 deletions
Large diffs are not rendered by default.

docs/modules.html

Lines changed: 205 additions & 0 deletions
Large diffs are not rendered by default.

docs/objects.inv

1.14 KB
Binary file not shown.

docs/searchindex.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

google/genai/_api_client.py

Lines changed: 24 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,8 @@
9191
INITIAL_RETRY_DELAY = 1 # second
9292
DELAY_MULTIPLIER = 2
9393

94+
_MULTI_REGIONAL_LOCATIONS = {'us', 'eu'}
95+
9496

9597
class EphemeralTokenAPIKeyError(ValueError):
9698
"""Error raised when the API key is invalid."""
@@ -702,7 +704,10 @@ def __init__(
702704
self.api_key or self.location == 'global'
703705
) and not self.custom_base_url:
704706
self._http_options.base_url = f'https://aiplatform.googleapis.com/'
705-
elif self.location == 'us' and not self.custom_base_url:
707+
elif (
708+
self.location in _MULTI_REGIONAL_LOCATIONS
709+
and not self.custom_base_url
710+
):
706711
self._http_options.base_url = (
707712
f'https://aiplatform.{self.location}.rep.googleapis.com/'
708713
)
@@ -772,7 +777,7 @@ def __init__(
772777
self._async_httpx_client = AsyncHttpxClient(**async_client_args)
773778

774779
# Initialize the aiohttp client session.
775-
self._aiohttp_session: Optional[aiohttp.ClientSession] = None
780+
self._aiohttp_session: Optional[Union['aiohttp.ClientSession', 'AsyncAuthorizedSession']] = None
776781
if self._use_aiohttp():
777782
try:
778783
import aiohttp # pylint: disable=g-import-not-at-top
@@ -836,15 +841,15 @@ async def _get_aiohttp_session(
836841
from google.auth.aio.transport.sessions import AsyncAuthorizedSession
837842

838843
async_creds = StaticCredentials(token=self._access_token()) # type: ignore[no-untyped-call]
839-
self._aiohttp_session = AsyncAuthorizedSession(async_creds) # type: ignore[no-untyped-call]
840-
return self._aiohttp_session
844+
self._aiohttp_session = AsyncAuthorizedSession(async_creds) # type: ignore[no-untyped-call,assignment]
845+
return self._aiohttp_session # type: ignore[return-value]
841846
except ImportError:
842847
pass
843848

844849
if not self._use_google_auth_async() and (
845850
self._aiohttp_session is None
846-
or self._aiohttp_session.closed
847-
or self._aiohttp_session._loop.is_closed()
851+
or self._aiohttp_session.closed # type: ignore[union-attr]
852+
or self._aiohttp_session._loop.is_closed() # type: ignore[union-attr]
848853
): # pylint: disable=protected-access
849854
# Initialize the aiohttp client session if it's not set up or closed.
850855
class AiohttpClientSession(aiohttp.ClientSession): # type: ignore[misc]
@@ -883,7 +888,7 @@ def __del__(self, _warnings: Any = warnings) -> None:
883888
read_bufsize=READ_BUFFER_SIZE,
884889
)
885890

886-
return self._aiohttp_session
891+
return self._aiohttp_session # type: ignore[return-value]
887892

888893
@staticmethod
889894
def _ensure_httpx_ssl_ctx(
@@ -1348,7 +1353,7 @@ async def _async_request_once(
13481353

13491354
if stream:
13501355
if self._use_aiohttp():
1351-
self._aiohttp_session = await self._get_aiohttp_session()
1356+
self._aiohttp_session = await self._get_aiohttp_session() # type: ignore[assignment]
13521357
url = http_request.url
13531358
if self._use_google_auth_async():
13541359
client_cert_source = mtls.default_client_cert_source() # type: ignore[no-untyped-call]
@@ -1363,7 +1368,7 @@ async def _async_request_once(
13631368
else:
13641369
url = url.replace('googleapis.com', 'mtls.googleapis.com')
13651370
try:
1366-
response = await self._aiohttp_session.request(
1371+
response = await self._aiohttp_session.request( # type: ignore[union-attr]
13671372
method=http_request.method,
13681373
url=url,
13691374
headers=http_request.headers,
@@ -1384,8 +1389,8 @@ async def _async_request_once(
13841389
self._ensure_aiohttp_ssl_ctx(self._http_options)
13851390
)
13861391
# Instantiate a new session with the updated SSL context.
1387-
self._aiohttp_session = await self._get_aiohttp_session()
1388-
response = await self._aiohttp_session.request(
1392+
self._aiohttp_session = await self._get_aiohttp_session() # type: ignore[assignment]
1393+
response = await self._aiohttp_session.request( # type: ignore[union-attr]
13891394
method=http_request.method,
13901395
url=url,
13911396
headers=http_request.headers,
@@ -1417,7 +1422,7 @@ async def _async_request_once(
14171422
return HttpResponse(client_response.headers, client_response)
14181423
else:
14191424
if self._use_aiohttp():
1420-
self._aiohttp_session = await self._get_aiohttp_session()
1425+
self._aiohttp_session = await self._get_aiohttp_session() # type: ignore[assignment]
14211426
url = http_request.url
14221427
if self._use_google_auth_async():
14231428
client_cert_source = mtls.default_client_cert_source() # type: ignore[no-untyped-call]
@@ -1432,7 +1437,7 @@ async def _async_request_once(
14321437
else:
14331438
url = url.replace('googleapis.com', 'mtls.googleapis.com')
14341439
try:
1435-
response = await self._aiohttp_session.request(
1440+
response = await self._aiohttp_session.request( # type: ignore[union-attr]
14361441
method=http_request.method,
14371442
url=url,
14381443
headers=http_request.headers,
@@ -1461,8 +1466,8 @@ async def _async_request_once(
14611466
self._ensure_aiohttp_ssl_ctx(self._http_options)
14621467
)
14631468
# Instantiate a new session with the updated SSL context.
1464-
self._aiohttp_session = await self._get_aiohttp_session()
1465-
response = await self._aiohttp_session.request(
1469+
self._aiohttp_session = await self._get_aiohttp_session() # type: ignore[assignment]
1470+
response = await self._aiohttp_session.request( # type: ignore[union-attr]
14661471
method=http_request.method,
14671472
url=url,
14681473
headers=http_request.headers,
@@ -1857,7 +1862,7 @@ async def _async_upload_fd(
18571862

18581863
# Upload the file in chunks
18591864
if self._use_aiohttp(): # pylint: disable=g-import-not-at-top
1860-
self._aiohttp_session = await self._get_aiohttp_session()
1865+
self._aiohttp_session = await self._get_aiohttp_session() # type: ignore[assignment]
18611866
while True:
18621867
if isinstance(file, io.IOBase):
18631868
file_chunk = file.read(CHUNK_SIZE)
@@ -1899,7 +1904,7 @@ async def _async_upload_fd(
18991904
retry_count = 0
19001905
response = None
19011906
while retry_count < MAX_RETRY_COUNT:
1902-
response = await self._aiohttp_session.request(
1907+
response = await self._aiohttp_session.request( # type: ignore[union-attr]
19031908
method='POST',
19041909
url=upload_url,
19051910
data=file_chunk,
@@ -2049,8 +2054,8 @@ async def async_download_file(
20492054
data = http_request.data
20502055

20512056
if self._use_aiohttp():
2052-
self._aiohttp_session = await self._get_aiohttp_session()
2053-
response = await self._aiohttp_session.request(
2057+
self._aiohttp_session = await self._get_aiohttp_session() # type: ignore[assignment]
2058+
response = await self._aiohttp_session.request( # type: ignore[union-attr]
20542059
method=http_request.method,
20552060
url=http_request.url,
20562061
headers=http_request.headers,

google/genai/_interactions/_base_client.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -550,6 +550,10 @@ def _build_request(
550550
files = cast(HttpxRequestFiles, ForceMultipartDict())
551551

552552
prepared_url = self._prepare_url(options.url)
553+
# preserve hard-coded query params from the url
554+
if params and prepared_url.query:
555+
params = {**dict(prepared_url.params.items()), **params}
556+
prepared_url = prepared_url.copy_with(raw_path=prepared_url.raw_path.split(b"?", 1)[0])
553557
if "_" in prepared_url.host:
554558
# work around https://github.com/encode/httpx/discussions/2880
555559
kwargs["extensions"] = {"sni_hostname": prepared_url.host.replace("_", "-")}

google/genai/_interactions/_client.py

Lines changed: 38 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,8 @@
4949
from ._client_adapter import GeminiNextGenAPIClientAdapter, AsyncGeminiNextGenAPIClientAdapter
5050

5151
if TYPE_CHECKING:
52-
from .resources import interactions
52+
from .resources import webhooks, interactions
53+
from .resources.webhooks import WebhooksResource, AsyncWebhooksResource
5354
from .resources.interactions import InteractionsResource, AsyncInteractionsResource
5455

5556
__all__ = [
@@ -133,6 +134,12 @@ def interactions(self) -> InteractionsResource:
133134

134135
return InteractionsResource(self)
135136

137+
@cached_property
138+
def webhooks(self) -> WebhooksResource:
139+
from .resources.webhooks import WebhooksResource
140+
141+
return WebhooksResource(self)
142+
136143
@cached_property
137144
def with_raw_response(self) -> GeminiNextGenAPIClientWithRawResponse:
138145
return GeminiNextGenAPIClientWithRawResponse(self)
@@ -354,6 +361,12 @@ def interactions(self) -> AsyncInteractionsResource:
354361

355362
return AsyncInteractionsResource(self)
356363

364+
@cached_property
365+
def webhooks(self) -> AsyncWebhooksResource:
366+
from .resources.webhooks import AsyncWebhooksResource
367+
368+
return AsyncWebhooksResource(self)
369+
357370
@cached_property
358371
def with_raw_response(self) -> AsyncGeminiNextGenAPIClientWithRawResponse:
359372
return AsyncGeminiNextGenAPIClientWithRawResponse(self)
@@ -518,6 +531,12 @@ def interactions(self) -> interactions.InteractionsResourceWithRawResponse:
518531

519532
return InteractionsResourceWithRawResponse(self._client.interactions)
520533

534+
@cached_property
535+
def webhooks(self) -> webhooks.WebhooksResourceWithRawResponse:
536+
from .resources.webhooks import WebhooksResourceWithRawResponse
537+
538+
return WebhooksResourceWithRawResponse(self._client.webhooks)
539+
521540

522541
class AsyncGeminiNextGenAPIClientWithRawResponse:
523542
_client: AsyncGeminiNextGenAPIClient
@@ -531,6 +550,12 @@ def interactions(self) -> interactions.AsyncInteractionsResourceWithRawResponse:
531550

532551
return AsyncInteractionsResourceWithRawResponse(self._client.interactions)
533552

553+
@cached_property
554+
def webhooks(self) -> webhooks.AsyncWebhooksResourceWithRawResponse:
555+
from .resources.webhooks import AsyncWebhooksResourceWithRawResponse
556+
557+
return AsyncWebhooksResourceWithRawResponse(self._client.webhooks)
558+
534559

535560
class GeminiNextGenAPIClientWithStreamedResponse:
536561
_client: GeminiNextGenAPIClient
@@ -544,6 +569,12 @@ def interactions(self) -> interactions.InteractionsResourceWithStreamingResponse
544569

545570
return InteractionsResourceWithStreamingResponse(self._client.interactions)
546571

572+
@cached_property
573+
def webhooks(self) -> webhooks.WebhooksResourceWithStreamingResponse:
574+
from .resources.webhooks import WebhooksResourceWithStreamingResponse
575+
576+
return WebhooksResourceWithStreamingResponse(self._client.webhooks)
577+
547578

548579
class AsyncGeminiNextGenAPIClientWithStreamedResponse:
549580
_client: AsyncGeminiNextGenAPIClient
@@ -557,6 +588,12 @@ def interactions(self) -> interactions.AsyncInteractionsResourceWithStreamingRes
557588

558589
return AsyncInteractionsResourceWithStreamingResponse(self._client.interactions)
559590

591+
@cached_property
592+
def webhooks(self) -> webhooks.AsyncWebhooksResourceWithStreamingResponse:
593+
from .resources.webhooks import AsyncWebhooksResourceWithStreamingResponse
594+
595+
return AsyncWebhooksResourceWithStreamingResponse(self._client.webhooks)
596+
560597

561598
Client = GeminiNextGenAPIClient
562599

0 commit comments

Comments
 (0)