OpenAI API option Tool_choice: "required" #6352
-
From the OpenAI api docs:
This does not seem to be abstracted or exposed in any way as far as I can find. We'd like to give the model a number of tools and require it use one of them rather than just give a response, and then this seems useful. Is it possible to use this setting, or thoughts on adding support for it? Thanks |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
That support was only very recently added to OpenAI. ToolCallBehavior currently has a RequireFunction method that accepts a single function: It should be trivial to add an overload that accepts an enumerable of functions. There is also work underway to abstract all of this away in order to allow it all to be used in a service-agnostic way, and that abstraction already factors in this capability. |
Beta Was this translation helpful? Give feedback.
-
Yep, the new abstraction will accept many functions as required ones. The Azure.AI.OpenAI SDK, which SK uses to talk to the {Azure}OpenAI service, should add support for that as well before we have end-to-end support for multiple required functions. |
Beta Was this translation helpful? Give feedback.
That support was only very recently added to OpenAI. ToolCallBehavior currently has a RequireFunction method that accepts a single function:
semantic-kernel/dotnet/src/Connectors/Connectors.OpenAI/ToolCallBehavior.cs
Line 81 in 2b96abf
It should be trivial to add an overload that accepts an enumerable of functions. There is also work underway to abstract all of this away in order to allow it all to be used in a service-agnostic way, and that abstraction already factors in this capability.