Class ToolChoice
This can be a String or an Object Specifies a tool the model should use. Use to force the model to call a specific tool.
public class ToolChoice
- Inheritance
-
objectToolChoice
- Derived
Fields
Type_AllowedTools
public const string Type_AllowedTools = "allowed_tools"
Field Value
- string
Type_Custom
public const string Type_Custom = "custom"
Field Value
- string
Type_Function
public const string Type_Function = "function"
Field Value
- string
Type_Mcp
public const string Type_Mcp = "mcp"
Field Value
- string
Properties
Mode
public ToolChoiceMode? Mode { get; set; }
Property Value
Type
public virtual string Type { get; }
Property Value
- string
Methods
AllowedTools(ToolChoiceMode, List<Tool>)
Constrains the tools available to the model to a pre-defined set.
public static ToolChoice AllowedTools(ToolChoiceMode mode, List<Tool> tools)
Parameters
modeToolChoiceModetoolsList<Tool>
Returns
Auto()
The model can pick between generating a message or calling one or more tools.
public static ToolChoice Auto()
Returns
Custom(string)
Specifies a tool the model should use. Use to force the model to call a specific custom tool.
public static ToolChoice Custom(string customToolName)
Parameters
customToolNamestring
Returns
Function(string)
Specifies a tool the model should use. Use to force the model to call a specific function.
public static ToolChoice Function(string functionName)
Parameters
functionNamestring
Returns
None()
The model will not call any tool and instead generates a message.
public static ToolChoice None()
Returns
Required()
The model must call one or more tools.
public static ToolChoice Required()