Skip to content

Python: [Feature]: Support OpenAI allowed_tools #5309

@cecheta

Description

@cecheta

Description

For function calling, OpenAI/Azure OpenAI support tool choice allowed_tools, allowing you to restrict the tools that the model is allowed to call, without modifying the list of tools supplied to the model, to benefit from prompt caching.

https://developers.openai.com/api/docs/guides/function-calling#additional-configurations

"tool_choice": {
    "type": "allowed_tools",
    "mode": "auto",
    "tools": [
        { "type": "function", "name": "get_weather" },
        { "type": "function", "name": "search_docs" }
    ]
}

Could this be supported in the Agent Framework?

Code Sample

await agent.run(
  "What is 2 + 2?",
  options={
    "tool_choice": {
      "mode": "auto",
      "allowed_tools": ["add_numbers"],
    },
  }
)

Language/SDK

Python

Metadata

Metadata

Assignees

Labels

Projects

Status

In Review

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions