Skip to content

Commit 6a5db58

Browse files
MarkDaoustcopybara-github
authored andcommitted
chore: Still experimental
PiperOrigin-RevId: 915659204
1 parent 2ce0298 commit 6a5db58

3 files changed

Lines changed: 34 additions & 1 deletion

File tree

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1486,6 +1486,8 @@ print(response.text)
14861486

14871487
## Interactions (Preview)
14881488

1489+
> **Warning:** The Interactions API is in **Beta**. This is a preview of an experimental feature. Features and schemas are subject to **breaking changes**.
1490+
14891491
The Interactions API is a unified interface for interacting with Gemini models and agents. It simplifies state management, tool orchestration, and long-running tasks.
14901492

14911493
See the [documentation site](https://ai.google.dev/gemini-api/docs/interactions) for more details.

google/genai/client.py

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@
4747

4848
from ._interactions.resources import AsyncInteractionsResource as AsyncNextGenInteractionsResource, InteractionsResource as NextGenInteractionsResource
4949
from ._interactions.resources import WebhooksResource, AsyncWebhooksResource
50-
50+
_interactions_experimental_warned = False
5151

5252
class AsyncGeminiNextGenAPIClientAdapter(_interactions.AsyncGeminiNextGenAPIClientAdapter):
5353
"""Adapter for the Gemini NextGen API Client."""
@@ -189,6 +189,14 @@ def _nextgen_client(self) -> AsyncGeminiNextGenAPIClient:
189189

190190
@property
191191
def interactions(self) -> AsyncNextGenInteractionsResource:
192+
global _interactions_experimental_warned
193+
if not _interactions_experimental_warned:
194+
_interactions_experimental_warned = True
195+
warnings.warn(
196+
'Interactions usage is experimental and may change in future versions.',
197+
category=UserWarning,
198+
stacklevel=1,
199+
)
192200
return self._nextgen_client.interactions
193201

194202
@property
@@ -546,6 +554,14 @@ def _nextgen_client(self) -> GeminiNextGenAPIClient:
546554

547555
@property
548556
def interactions(self) -> NextGenInteractionsResource:
557+
global _interactions_experimental_warned
558+
if not _interactions_experimental_warned:
559+
_interactions_experimental_warned = True
560+
warnings.warn(
561+
'Interactions usage is experimental and may change in future versions.',
562+
category=UserWarning,
563+
stacklevel=2,
564+
)
549565
return self._nextgen_client.interactions
550566

551567
@property

google/genai/tests/interactions/test_integration.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,21 @@
1919
pytest_plugins = ("pytest_asyncio",)
2020

2121

22+
def test_client_future_warning():
23+
with mock.patch.object(
24+
client_lib, "_interactions_experimental_warned", new=False
25+
):
26+
client = client_lib.Client(
27+
api_key="placeholder",
28+
http_options={
29+
"api_version": "v1alpha",
30+
}
31+
)
32+
with pytest.warns(
33+
UserWarning, match="Interactions.*experimental"
34+
):
35+
_ = client.interactions
36+
2237

2338
def test_client_timeout():
2439
with mock.patch.object(

0 commit comments

Comments
 (0)