diff --git a/CHANGELOG.md b/CHANGELOG.md index fc6548877..bb0d8ea2d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,28 +1,5 @@ # Changelog -## [2.18.0](https://github.com/googleapis/python-genai/compare/v2.17.0...v2.18.0) (2026-08-12) - - -### Features - -* Add interaction_status to LiveServerContent ([66e224c](https://github.com/googleapis/python-genai/commit/66e224c39c9527e0fef3a4f049ac33ec941e2f99)) -* **api:** Make the deferred service tier publicly available on Vertex ([e1f7c40](https://github.com/googleapis/python-genai/commit/e1f7c40f0a831f25ee71294fc8c195576d5fd126)) -* Enable json schema in FunctionDeclaration parser ([62d50d6](https://github.com/googleapis/python-genai/commit/62d50d6f172da5d6efa30838ab92da95b1327b5e)) -* Make speech_config a structured object. ([cc0d42e](https://github.com/googleapis/python-genai/commit/cc0d42e84583ed927b6c0dfae38da7f5f544b2da)) -* Support injecting httpx2 client. ([012804d](https://github.com/googleapis/python-genai/commit/012804d9b649a20da46a6041e37d126b9a0b79e0)), refs [#2680](https://github.com/googleapis/python-genai/issues/2680) - - -### Bug Fixes - -* Improve AFC(automatic function calling) in chat including fixing bugs in AFC for generate_content_stream. also log warnings in generate_content, generate_content_stream and their async variants that AFC is meant to be used in chat experience, not directly in models module. ([fe6118e](https://github.com/googleapis/python-genai/commit/fe6118e3c7a9e83406bc722e34b7efca75f1ef13)) - - -### Performance Improvements - -* Build model validators on first use instead of at import ([66bfe95](https://github.com/googleapis/python-genai/commit/66bfe956f7a8b6c8d7c7eb949a9b6a499a4e2860)), refs [#2784](https://github.com/googleapis/python-genai/issues/2784) -* Lazily import the interactions API to speed up import google.genai ([89dcfe5](https://github.com/googleapis/python-genai/commit/89dcfe5b28f5e794f9a5ac84e2d45e9e7b7bd803)) -* Stop importing the requests HTTP stack at module scope ([3a44936](https://github.com/googleapis/python-genai/commit/3a44936ea783363489967bd9d219fb26401585dd)) - ## [2.17.0](https://github.com/googleapis/python-genai/compare/v2.16.0...v2.17.0) (2026-08-06) diff --git a/google/genai/models.py b/google/genai/models.py index 1d8dbd8d6..e0c417b71 100644 --- a/google/genai/models.py +++ b/google/genai/models.py @@ -6405,6 +6405,7 @@ def _generate_videos( return return_value _logged_generate_videos_deprecation_warning = False + _logged_afc_warning = False def embed_content( self, @@ -6572,6 +6573,15 @@ def generate_content( logger.info( f'AFC is enabled with max remote calls: {remaining_remote_calls_afc}.' ) + if not Models._logged_afc_warning: + logger.warning( + 'Direct use of automatic function calling (AFC) in' + ' Models.generate_content is not recommended. Instead, we recommend' + ' to use AFC in Chat.send_message. Similarly, direct use of AFC in' + ' Models.generate_content_stream is not recommended. Instead, we' + ' recommend to use AFC in Chat.send_message_stream.' + ) + Models._logged_afc_warning = True automatic_function_calling_history: list[types.Content] = [] response = types.GenerateContentResponse() i = 0 @@ -6736,6 +6746,15 @@ def generate_content_stream( logger.info( f'AFC is enabled with max remote calls: {remaining_remote_calls_afc}.' ) + if not Models._logged_afc_warning: + logger.warning( + 'Direct use of automatic function calling (AFC) in ' + 'Models.generate_content_stream is not recommended. Instead, we ' + 'recommend to use AFC in Chat.send_message_stream. Similarly, direct ' + 'use of AFC in Models.generate_content is not recommended. Instead, ' + 'we recommend to use AFC in Chat.send_message.' + ) + Models._logged_afc_warning = True automatic_function_calling_history: list[types.Content] = [] i = 0 while remaining_remote_calls_afc > 0: @@ -8604,6 +8623,7 @@ async def _generate_videos( return return_value _logged_generate_videos_deprecation_warning = False + _logged_afc_warning = False async def generate_content( self, @@ -8737,6 +8757,16 @@ async def generate_content( logger.info( f'AFC is enabled with max remote calls: {remaining_remote_calls_afc}.' ) + if not AsyncModels._logged_afc_warning: + logger.warning( + 'Direct use of automatic function calling (AFC) in ' + 'AsyncModels.generate_content is not recommended. Instead, we ' + 'recommend to use AFC in AsyncChat.send_message. Similarly, direct ' + 'use of AFC in AsyncModels.generate_content_stream is not ' + 'recommended. Instead, we recommend to use AFC in ' + 'AsyncChat.send_message_stream.' + ) + AsyncModels._logged_afc_warning = True automatic_function_calling_history: list[types.Content] = [] response = types.GenerateContentResponse() @@ -8973,6 +9003,16 @@ async def stream_generator(): # type: ignore[no-untyped-def] 'AFC is enabled with max remote calls:' f' {remaining_remote_calls_afc}.' ) + if not AsyncModels._logged_afc_warning: + logger.warning( + 'Direct use of automatic function calling (AFC) in ' + 'AsyncModels.generate_content_stream is not recommended. ' + 'Instead, we recommend to use AFC in ' + 'AsyncChat.send_message_stream. Similarly, direct use of AFC in ' + 'AsyncModels.generate_content is not recommended. ' + 'Instead, we recommend to use AFC in AsyncChat.send_message.' + ) + AsyncModels._logged_afc_warning = True automatic_function_calling_history: list[types.Content] = [] i = 0 loop_contents = contents diff --git a/google/genai/version.py b/google/genai/version.py index 5b34e530c..602b199e4 100644 --- a/google/genai/version.py +++ b/google/genai/version.py @@ -13,4 +13,4 @@ # limitations under the License. # -__version__ = '2.18.0' # x-release-please-version +__version__ = '2.17.0' # x-release-please-version diff --git a/pyproject.toml b/pyproject.toml index 0987a777e..b58055fa4 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -3,7 +3,7 @@ requires = ["setuptools", "wheel", "twine>=6.1.0", "packaging>=24.2", "pkginfo>= [project] name = "google-genai" -version = "2.18.0" +version = "2.17.0" description = "GenAI Python SDK" readme = "README.md" license = "Apache-2.0"