-
Notifications
You must be signed in to change notification settings - Fork 3.3k
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: Fixed JSON schema name in Structured Outputs for generic types #9490
.Net: Fixed JSON schema name in Structured Outputs for generic types #9490
Conversation
dotnet/src/Connectors/Connectors.OpenAI/Core/ClientCore.ChatCompletion.cs
Show resolved
Hide resolved
dotnet/src/Connectors/Connectors.OpenAI.UnitTests/Services/OpenAIChatCompletionServiceTests.cs
Outdated
Show resolved
Hide resolved
Wouldn't it better to use fully qualified type names, as they are truly unique, and because OpenAI doesn't support symbols, use for example hash of string? |
@asvishnyakov Thanks for your feedback! I don't see a requirement for this property to be unique in OpenAI docs or usage of hash in their examples. It would be also nice to be consistent with Python implementation, which uses just a name. |
Motivation and Context
Resolves: #9416
When C# type is passed as a response format to OpenAI chat completion service, we use the type name as JSON schema name. When the type is generic, its name will contain characters that are not allowed in JSON schema name according to OpenAI API. This PR fixes the issue by replacing invalid characters with empty string.
Contribution Checklist