Skip to content

Conversation

ShivangiReja
Copy link
Collaborator

@ShivangiReja ShivangiReja commented Oct 2, 2025

This PR adds JsonPatch support to Chat, Responses, and Embeddings so callers can:

  • Pass additional properties on requests
  • Read unmodeled properties from responses via the Patch bag.

Motivation

  • OpenAI exposes fast-moving, model-specific knobs that aren’t on the typed surface.
  • Developers need a way to round-trip those fields without waiting on spec/SDK updates.

Examples:

Responses

// You can use the Patch property to set additional properties in the request
ResponseCreationOptions options = new();
options.Patch.Set("$.reasoning.effort"u8, "high");
options.Patch.Set("$.text.verbosity"u8, "medium");

OpenAIResponse response = client.CreateResponse("What is the answer to the ultimate question of life, the universe, and everything?", options);

// You can also read additional properties back from the response
var effort = response.Patch.GetString("$.reasoning.effort"u8);
var verbosity = response.Patch.GetString("$.text.verbosity"u8);
Console.WriteLine($"effort={effort}, verbosity={verbosity}");

Fixes: #259

@ShivangiReja ShivangiReja marked this pull request as ready for review October 3, 2025 21:42
@jsquire jsquire requested a review from m-nash October 3, 2025 21:46
Copy link
Collaborator

@m-nash m-nash left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The new visitor tests are a great start thanks for adding them

@ShivangiReja ShivangiReja merged commit fb7c8db into openai:main Oct 7, 2025
2 checks passed
@sheng-jie
Copy link

Great job

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.

Additional properties from OpenAI-compatible response are needed but not exposed

7 participants