Skip to content

Python: apply function_invocation_configuration in BaseChatClient.as_agent#5198

Draft
Bortlesboat wants to merge 1 commit intomicrosoft:mainfrom
Bortlesboat:codex/issue-5180-as-agent-function-config
Draft

Python: apply function_invocation_configuration in BaseChatClient.as_agent#5198
Bortlesboat wants to merge 1 commit intomicrosoft:mainfrom
Bortlesboat:codex/issue-5180-as-agent-function-config

Conversation

@Bortlesboat
Copy link
Copy Markdown

Motivation and Context

Fixes #5180.

BaseChatClient.as_agent() currently accepts function_invocation_configuration but forwards it into Agent(**agent_kwargs), where Agent.__init__() does not accept that keyword. In practice this raises a TypeError instead of applying the configuration to function-invoking clients.

Description

This change keeps the override on the client side, which is where FunctionInvocationLayer consumes it:

  • stop passing function_invocation_configuration into Agent()
  • when the client supports FunctionInvocationLayer, normalize and apply the override directly to self.function_invocation_configuration
  • add a regression test covering as_agent(function_invocation_configuration=...) so the issue stays fixed

Contribution Checklist

  • The code builds clean without any errors or warnings
  • The PR follows the Contribution Guidelines
  • All unit tests pass, and I have added new tests where possible
  • Is this a breaking change? If yes, add "[BREAKING]" prefix to the title of the PR.

@eavanvalkenburg
Copy link
Copy Markdown
Member

just added a note on the original issue, that this is not the way to fix that issue, if you are up for it, you can change this PR, open a new PR or we can pick it up with the team

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Python: [Bug]: BaseChatClient.as_agent() passes function_invocation_configuration to Agent() which doesn't accept it

3 participants