-
Notifications
You must be signed in to change notification settings - Fork 3.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
.Net: Bug: ResponseFormat using typeof()
yields invalid schema
#10485
Comments
typeof()
yields invalid schematypeof()
yields invalid schema
@brandonh-msft The reason why you are getting the error you mentioned is because type
So, if you want a collection as response, you can wrap it in class/struct, like we did in following example: semantic-kernel/dotnet/samples/Concepts/ChatCompletion/OpenAI_StructuredOutputs.cs Lines 332 to 336 in 3f22587
And then set it as response format: semantic-kernel/dotnet/samples/Concepts/ChatCompletion/OpenAI_StructuredOutputs.cs Lines 211 to 215 in 3f22587
Please let me know if that will work for you, thanks! |
yup that's what I ended up doing, thanks. am hopeful we can avoid creating bad names, though, even if user does provide wrong types? just a thought. |
I think we can fix it at some point, in case if collections will be supported by Azure/OpenAI API in the future. As for now, I will deprioritize this task, since the case is not supported. |
Describe the bug
I'm using
ReponseFormat
on aPromptExecutionSettings
object. In my scenario I am setting it totypeof(Model[])
whereModel
is a record type with a simple structure, and I want to return an array of them as the LLM's response.When the prompt executes, an error is thrown:
To Reproduce
Steps to reproduce the behavior:
ResponseFormat
to atypeof()
expression on anOpenAIPromptExecutionSettings
objectKernelArguments
to anInvokePromptAsync()
callExpected behavior
The type should be schematized and sent along validly to the Azure OpenAI resource
Screenshots
If applicable, add screenshots to help explain your problem.
Platform
The text was updated successfully, but these errors were encountered: