Skip to content

Conversation

@m-nash
Copy link
Collaborator

@m-nash m-nash commented Oct 28, 2025

Changes MRW calls to use the AOT safe version in custom code.

Copy link

Copilot AI left a 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)!;
Copy link
Collaborator

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

@m-nash m-nash merged commit a9c80c4 into openai:main Oct 28, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants