Skip to content

GenAI automatic_function_calling config not passed through to GenerateContentConfig. #1953

@kunalchamoli

Description

@kunalchamoli
  • This is actually a bug report.
  • I have tried searching the documentation and have not found an answer.

What Model are you using?

  • Gemini models

Describe the bug
When using instructor.from_genai() with Mode.GENAI_STRUCTURED_OUTPUTS, the automatic_function_calling configuration is not preserved when the library constructs the GenerateContentConfig.
This causes AFC to remain enabled by default, resulting in noisy log messages:
AFC is enabled with max remote calls: 10.
To Reproduce
Steps to reproduce the behavior, including code snippets of the model and the input data and openai response.

Expected behavior
When passing a config with automatic_function_calling=AutomaticFunctionCallingConfig(disable=True) the setting should be forwarded to the underlying Google GenAI client.

Current Behavior
The handle_genai_structured_outputs() function in instructor/providers/gemini/utils.py creates a new GenerateContentConfig but does not include automatic_function_calling in the update_genai_kwargs() function, causing the setting to be lost.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions