-
Notifications
You must be signed in to change notification settings - Fork 838
Closed
Labels
Description
Background and motivation
Allow developers to use structured output with function calling : https://platform.openai.com/docs/guides/function-calling#function-calling-with-structured-outputs
Open AI says:
"By default, when you use function calling, the API will offer best-effort matching for your parameters, which means that occasionally the model may miss parameters or get their types wrong when using complicated schemas.
Structured Outputs is a feature that ensures model outputs for function calls will exactly match your supplied schema.
Structured Outputs for function calling can be enabled with a single parameter, just by supplying strict: true"
API Proposal
public static AIFunction Create(
Delegate method,
bool isStrict,
string? name = null,
string? description = null,
JsonSerializerOptions? serializerOptions = null)
{
...
}
API Usage
AIFunctionFactory.Create(Tools.TimeTools.ConvertDateTime,strict:true), //set strict to true
Alternative Designs
No response
Risks
No response