-
Notifications
You must be signed in to change notification settings - Fork 342
Fix custom code AOT compatibility #781
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR updates ModelReaderWriter method calls throughout the codebase to use AOT-compatible overloads by explicitly passing ModelReaderWriterOptions.Json and OpenAIContext.Default parameters, ensuring compatibility with Ahead-of-Time compilation scenarios.
Key changes:
- Updated all
ModelReaderWriter.Write()calls to include explicit options and context parameters - Updated all
ModelReaderWriter.Read<T>()calls to include explicit options and context parameters
Reviewed Changes
Copilot reviewed 17 out of 17 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| src/Utility/CustomSerializationHelpers.cs | Updated serialization helper to use AOT-safe ModelReaderWriter.Write overload |
| src/Custom/VectorStores/Internal/Pagination/VectorStoreCollectionResult.cs | Updated deserialization to use AOT-safe ModelReaderWriter.Read overload |
| src/Custom/VectorStores/Internal/Pagination/AsyncVectorStoreCollectionResult.cs | Updated async deserialization to use AOT-safe ModelReaderWriter.Read overload |
| src/Custom/Responses/Pagination/Internal/ResponseItemCollectionResult.cs | Updated response item deserialization to use AOT-safe ModelReaderWriter.Read overload |
| src/Custom/Responses/Pagination/Internal/AsyncResponseItemCollectionResult.cs | Updated async response item deserialization to use AOT-safe ModelReaderWriter.Read overload |
| src/Custom/Realtime/Streaming/RealtimeUpdate.cs | Updated raw content serialization to use AOT-safe ModelReaderWriter.Write overload |
| src/Custom/Realtime/RealtimeSession.cs | Updated multiple serialization and deserialization points to use AOT-safe ModelReaderWriter overloads |
| src/Custom/Realtime/Internal/InternalRealtimeResponseSession.cs | Updated property setter serialization to use AOT-safe ModelReaderWriter.Write overload |
| src/Custom/Realtime/ConversationSessionOptions.cs | Updated property setters to use AOT-safe ModelReaderWriter.Write overload |
| src/Custom/Realtime/ConversationResponseOptions.cs | Updated property setters to use AOT-safe ModelReaderWriter.Write overload |
| src/Custom/FineTuning/Internal/Pagination/FineTuningEventCollectionResult.cs | Updated event deserialization to use AOT-safe ModelReaderWriter.Read overload |
| src/Custom/FineTuning/Internal/Pagination/FineTuningCheckpointCollectionResult.cs | Updated checkpoint deserialization to use AOT-safe ModelReaderWriter.Read overload |
| src/Custom/FineTuning/Internal/Pagination/AsyncFineTuningEventCollectionResult.cs | Updated async event deserialization to use AOT-safe ModelReaderWriter.Read overload |
| src/Custom/FineTuning/Internal/Pagination/AsyncFineTuningCheckpointCollectionResult.cs | Updated async checkpoint deserialization to use AOT-safe ModelReaderWriter.Read overload |
| src/Custom/FineTuning/FineTuningTrainingMethod.cs | Updated hyperparameter serialization to use AOT-safe ModelReaderWriter.Write overload |
| src/Custom/FineTuning/FineTuningClient.cs | Updated job deserialization to use AOT-safe ModelReaderWriter.Read overload |
| src/Custom/Assistants/AssistantResponseFormat.cs | Updated ToString() serialization to use AOT-safe ModelReaderWriter.Write overload |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
|
||
| PipelineResponse response = page.GetRawResponse(); | ||
| InternalResponseItemList list = ModelReaderWriter.Read<InternalResponseItemList>(response.Content)!; | ||
| InternalResponseItemList list = ModelReaderWriter.Read<InternalResponseItemList>(response.Content, ModelReaderWriterOptions.Json, OpenAIContext.Default)!; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suspect that the following four internal classes edited in this PR are actually not used anymore, and that they are leftovers from a previous PR where they should have been deleted instead:
- ResponseItemCollectionResult
- AsyncResponseItemCollectionResult
- VectorStoreCollectionResult
- AsyncVectorStoreCollectionResult
Changes MRW calls to use the AOT safe version in custom code.