Skip to content

fix: warn about AFC with forced function calls - #2853

Open
uuzzrm wants to merge 1 commit into
googleapis:mainfrom
uuzzrm:codex/fix-afc-any-mode-warning
Open

fix: warn about AFC with forced function calls#2853
uuzzrm wants to merge 1 commit into
googleapis:mainfrom
uuzzrm:codex/fix-afc-any-mode-warning

Conversation

@uuzzrm

@uuzzrm uuzzrm commented Aug 11, 2026

Copy link
Copy Markdown

Summary

  • warn when FunctionCallingConfig.mode=ANY is used while automatic function calling is enabled
  • cover enabled, disabled, AUTO, and default AFC configuration paths

Why

ANY forces every model turn to produce a function call. When automatic function calling is also enabled, the SDK can consume the configured remote-call budget without producing a natural-language response. This remains a valid configuration for callers managing the loop themselves, so the SDK reports the interaction with a warning rather than rejecting the request.

Testing

  • uv run --no-project --with-requirements requirements.txt python -m pytest google/genai/tests/afc/test_raise_error_for_afc_incompatible_config.py -q
  • uv run --no-project --with-requirements requirements.txt python -m pytest google/genai/tests/afc -q --ignore=google/genai/tests/afc/test_generate_content_stream_afc_thoughts.py
  • python -m compileall on the changed modules
  • git diff --check

The full AFC directory also reached 116 passing tests; four existing replay-based streaming cases require Google credentials that are not available in this environment.

Fixes #2839

@Venkaiahbabuneelam Venkaiahbabuneelam self-assigned this Aug 12, 2026
@Venkaiahbabuneelam Venkaiahbabuneelam added the size:L Code changes between 40-100 lines label Aug 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:L Code changes between 40-100 lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

tool_config mode="ANY" with automatic function calling exhausts maximum_remote_calls and returns empty text, with no warning

2 participants