Skip to content

Structured output in lieu of JSON Schema with gpt-4o-mini? #9508

Closed Answered by dmytrostruk
ManojG1978 asked this question in Q&A
Discussion options

You must be logged in to vote

@ManojG1978 Thanks for your question!

In order to use Structured Outputs, you will need to pass executionSettings in KernelArguments when you invoke a function, since it looks like passing it to CreateFunctionFromPrompt method impacts only AI service selection logic, but not the execution. Here is an updated code that should resolve an issue:

var executionSettings = new OpenAIPromptExecutionSettings
{
    ResponseFormat = typeof(Quiz),
    FunctionChoiceBehavior = FunctionChoiceBehavior.Auto()
};

var function = kernel.CreateFunctionFromPrompt(prompt, executionSettings);

var result = await kernel.InvokeAsync<string>(function,
-   new KernelArguments()    
+   new KernelArguments(executio…

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by sophialagerkranspandey
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
.NET Issue or Pull requests regarding .NET code
3 participants