Skip to content

Commit 12196d4

Browse files
committed
Add support for included properties in Responses
1 parent 87964c3 commit 12196d4

19 files changed

+2052
-1319
lines changed

api/OpenAI.net8.0.cs

Lines changed: 26 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5372,6 +5372,25 @@ public class ImageGenerationToolInputImageMask : IJsonModel<ImageGenerationToolI
53725372
public override readonly string ToString();
53735373
}
53745374
[Experimental("OPENAI001")]
5375+
public readonly partial struct IncludedResponseProperty : IEquatable<IncludedResponseProperty> {
5376+
public IncludedResponseProperty(string value);
5377+
public static IncludedResponseProperty CodeInterpreterCallOutputs { get; }
5378+
public static IncludedResponseProperty ComputerCallOutputImageUri { get; }
5379+
public static IncludedResponseProperty FileSearchCallResults { get; }
5380+
public static IncludedResponseProperty MessageInputImageUri { get; }
5381+
public static IncludedResponseProperty ReasoningEncryptedContent { get; }
5382+
public readonly bool Equals(IncludedResponseProperty other);
5383+
[EditorBrowsable(EditorBrowsableState.Never)]
5384+
public override readonly bool Equals(object obj);
5385+
[EditorBrowsable(EditorBrowsableState.Never)]
5386+
public override readonly int GetHashCode();
5387+
public static bool operator ==(IncludedResponseProperty left, IncludedResponseProperty right);
5388+
public static implicit operator IncludedResponseProperty(string value);
5389+
public static implicit operator IncludedResponseProperty?(string value);
5390+
public static bool operator !=(IncludedResponseProperty left, IncludedResponseProperty right);
5391+
public override readonly string ToString();
5392+
}
5393+
[Experimental("OPENAI001")]
53755394
public class McpTool : ResponseTool, IJsonModel<McpTool>, IPersistableModel<McpTool> {
53765395
public McpTool(string serverLabel, McpToolConnectorId connectorId);
53775396
public McpTool(string serverLabel, Uri serverUri);
@@ -5588,16 +5607,16 @@ public class OpenAIResponseClient {
55885607
public virtual ClientResult<ResponseDeletionResult> DeleteResponse(string responseId, CancellationToken cancellationToken = default);
55895608
public virtual Task<ClientResult> DeleteResponseAsync(string responseId, RequestOptions options);
55905609
public virtual Task<ClientResult<ResponseDeletionResult>> DeleteResponseAsync(string responseId, CancellationToken cancellationToken = default);
5591-
public virtual ClientResult GetResponse(string responseId, bool? stream, int? startingAfter, RequestOptions options);
5592-
public virtual ClientResult<OpenAIResponse> GetResponse(string responseId, CancellationToken cancellationToken = default);
5593-
public virtual Task<ClientResult> GetResponseAsync(string responseId, bool? stream, int? startingAfter, RequestOptions options);
5594-
public virtual Task<ClientResult<OpenAIResponse>> GetResponseAsync(string responseId, CancellationToken cancellationToken = default);
5610+
public virtual ClientResult GetResponse(string responseId, IEnumerable<IncludedResponseProperty> include, bool? stream, int? startingAfter, bool? includeObfuscation, RequestOptions options);
5611+
public virtual ClientResult<OpenAIResponse> GetResponse(string responseId, IEnumerable<IncludedResponseProperty> include = null, int? startingAfter = null, bool? includeObfuscation = null, CancellationToken cancellationToken = default);
5612+
public virtual Task<ClientResult> GetResponseAsync(string responseId, IEnumerable<IncludedResponseProperty> include, bool? stream, int? startingAfter, bool? includeObfuscation, RequestOptions options);
5613+
public virtual Task<ClientResult<OpenAIResponse>> GetResponseAsync(string responseId, IEnumerable<IncludedResponseProperty> include = null, int? startingAfter = null, bool? includeObfuscation = null, CancellationToken cancellationToken = default);
55955614
public virtual CollectionResult<ResponseItem> GetResponseInputItems(string responseId, ResponseItemCollectionOptions options = null, CancellationToken cancellationToken = default);
55965615
public virtual CollectionResult GetResponseInputItems(string responseId, int? limit, string order, string after, string before, RequestOptions options);
55975616
public virtual AsyncCollectionResult<ResponseItem> GetResponseInputItemsAsync(string responseId, ResponseItemCollectionOptions options = null, CancellationToken cancellationToken = default);
55985617
public virtual AsyncCollectionResult GetResponseInputItemsAsync(string responseId, int? limit, string order, string after, string before, RequestOptions options);
5599-
public virtual CollectionResult<StreamingResponseUpdate> GetResponseStreaming(string responseId, int? startingAfter = null, CancellationToken cancellationToken = default);
5600-
public virtual AsyncCollectionResult<StreamingResponseUpdate> GetResponseStreamingAsync(string responseId, int? startingAfter = null, CancellationToken cancellationToken = default);
5618+
public virtual CollectionResult<StreamingResponseUpdate> GetResponseStreaming(string responseId, IEnumerable<IncludedResponseProperty> include = null, int? startingAfter = null, bool? includeObfuscation = null, CancellationToken cancellationToken = default);
5619+
public virtual AsyncCollectionResult<StreamingResponseUpdate> GetResponseStreamingAsync(string responseId, IEnumerable<IncludedResponseProperty> include = null, int? startingAfter = null, bool? includeObfuscation = null, CancellationToken cancellationToken = default);
56015620
}
56025621
[Experimental("OPENAI001")]
56035622
public static class OpenAIResponsesModelFactory {
@@ -5695,6 +5714,7 @@ public enum ResponseContentPartKind {
56955714
public class ResponseCreationOptions : IJsonModel<ResponseCreationOptions>, IPersistableModel<ResponseCreationOptions> {
56965715
public bool? BackgroundModeEnabled { get; set; }
56975716
public string EndUserId { get; set; }
5717+
public IList<IncludedResponseProperty> IncludedProperties { get; }
56985718
public string Instructions { get; set; }
56995719
public int? MaxOutputTokenCount { get; set; }
57005720
public IDictionary<string, string> Metadata { get; }

api/OpenAI.netstandard2.0.cs

Lines changed: 25 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4704,6 +4704,24 @@ public class ImageGenerationToolInputImageMask : IJsonModel<ImageGenerationToolI
47044704
public static bool operator !=(ImageGenerationToolSize left, ImageGenerationToolSize right);
47054705
public override readonly string ToString();
47064706
}
4707+
public readonly partial struct IncludedResponseProperty : IEquatable<IncludedResponseProperty> {
4708+
public IncludedResponseProperty(string value);
4709+
public static IncludedResponseProperty CodeInterpreterCallOutputs { get; }
4710+
public static IncludedResponseProperty ComputerCallOutputImageUri { get; }
4711+
public static IncludedResponseProperty FileSearchCallResults { get; }
4712+
public static IncludedResponseProperty MessageInputImageUri { get; }
4713+
public static IncludedResponseProperty ReasoningEncryptedContent { get; }
4714+
public readonly bool Equals(IncludedResponseProperty other);
4715+
[EditorBrowsable(EditorBrowsableState.Never)]
4716+
public override readonly bool Equals(object obj);
4717+
[EditorBrowsable(EditorBrowsableState.Never)]
4718+
public override readonly int GetHashCode();
4719+
public static bool operator ==(IncludedResponseProperty left, IncludedResponseProperty right);
4720+
public static implicit operator IncludedResponseProperty(string value);
4721+
public static implicit operator IncludedResponseProperty?(string value);
4722+
public static bool operator !=(IncludedResponseProperty left, IncludedResponseProperty right);
4723+
public override readonly string ToString();
4724+
}
47074725
public class McpTool : ResponseTool, IJsonModel<McpTool>, IPersistableModel<McpTool> {
47084726
public McpTool(string serverLabel, McpToolConnectorId connectorId);
47094727
public McpTool(string serverLabel, Uri serverUri);
@@ -4901,16 +4919,16 @@ public class OpenAIResponseClient {
49014919
public virtual ClientResult<ResponseDeletionResult> DeleteResponse(string responseId, CancellationToken cancellationToken = default);
49024920
public virtual Task<ClientResult> DeleteResponseAsync(string responseId, RequestOptions options);
49034921
public virtual Task<ClientResult<ResponseDeletionResult>> DeleteResponseAsync(string responseId, CancellationToken cancellationToken = default);
4904-
public virtual ClientResult GetResponse(string responseId, bool? stream, int? startingAfter, RequestOptions options);
4905-
public virtual ClientResult<OpenAIResponse> GetResponse(string responseId, CancellationToken cancellationToken = default);
4906-
public virtual Task<ClientResult> GetResponseAsync(string responseId, bool? stream, int? startingAfter, RequestOptions options);
4907-
public virtual Task<ClientResult<OpenAIResponse>> GetResponseAsync(string responseId, CancellationToken cancellationToken = default);
4922+
public virtual ClientResult GetResponse(string responseId, IEnumerable<IncludedResponseProperty> include, bool? stream, int? startingAfter, bool? includeObfuscation, RequestOptions options);
4923+
public virtual ClientResult<OpenAIResponse> GetResponse(string responseId, IEnumerable<IncludedResponseProperty> include = null, int? startingAfter = null, bool? includeObfuscation = null, CancellationToken cancellationToken = default);
4924+
public virtual Task<ClientResult> GetResponseAsync(string responseId, IEnumerable<IncludedResponseProperty> include, bool? stream, int? startingAfter, bool? includeObfuscation, RequestOptions options);
4925+
public virtual Task<ClientResult<OpenAIResponse>> GetResponseAsync(string responseId, IEnumerable<IncludedResponseProperty> include = null, int? startingAfter = null, bool? includeObfuscation = null, CancellationToken cancellationToken = default);
49084926
public virtual CollectionResult<ResponseItem> GetResponseInputItems(string responseId, ResponseItemCollectionOptions options = null, CancellationToken cancellationToken = default);
49094927
public virtual CollectionResult GetResponseInputItems(string responseId, int? limit, string order, string after, string before, RequestOptions options);
49104928
public virtual AsyncCollectionResult<ResponseItem> GetResponseInputItemsAsync(string responseId, ResponseItemCollectionOptions options = null, CancellationToken cancellationToken = default);
49114929
public virtual AsyncCollectionResult GetResponseInputItemsAsync(string responseId, int? limit, string order, string after, string before, RequestOptions options);
4912-
public virtual CollectionResult<StreamingResponseUpdate> GetResponseStreaming(string responseId, int? startingAfter = null, CancellationToken cancellationToken = default);
4913-
public virtual AsyncCollectionResult<StreamingResponseUpdate> GetResponseStreamingAsync(string responseId, int? startingAfter = null, CancellationToken cancellationToken = default);
4930+
public virtual CollectionResult<StreamingResponseUpdate> GetResponseStreaming(string responseId, IEnumerable<IncludedResponseProperty> include = null, int? startingAfter = null, bool? includeObfuscation = null, CancellationToken cancellationToken = default);
4931+
public virtual AsyncCollectionResult<StreamingResponseUpdate> GetResponseStreamingAsync(string responseId, IEnumerable<IncludedResponseProperty> include = null, int? startingAfter = null, bool? includeObfuscation = null, CancellationToken cancellationToken = default);
49144932
}
49154933
public static class OpenAIResponsesModelFactory {
49164934
public static MessageResponseItem MessageResponseItem(string id = null, MessageRole role = MessageRole.Assistant, MessageStatus? status = null);
@@ -4997,6 +5015,7 @@ public enum ResponseContentPartKind {
49975015
public class ResponseCreationOptions : IJsonModel<ResponseCreationOptions>, IPersistableModel<ResponseCreationOptions> {
49985016
public bool? BackgroundModeEnabled { get; set; }
49995017
public string EndUserId { get; set; }
5018+
public IList<IncludedResponseProperty> IncludedProperties { get; }
50005019
public string Instructions { get; set; }
50015020
public int? MaxOutputTokenCount { get; set; }
50025021
public IDictionary<string, string> Metadata { get; }

specification/base/typespec/responses/operations.tsp

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,14 +36,19 @@ interface Responses {
3636
@route("{response_id}")
3737
getResponse(
3838
@path
39-
@example("resp_677efb5139a88190b512bc3fef8e535d")
4039
response_id: string,
4140

4241
@query(#{ name: "include[]", explode: true })
43-
includables?: Includable[] = #[],
42+
include?: Includable[],
43+
44+
@query(#{ explode: true })
45+
stream?: boolean,
46+
47+
@query(#{ explode: true })
48+
starting_after?: int32,
4449

45-
@query stream?: boolean = false,
46-
@query starting_after?: int32,
50+
@query(#{ explode: true })
51+
include_obfuscation?: boolean,
4752
): Response | SseResponseOf<ResponseStreamEvent> | ResponseErrorResponse;
4853

4954
@delete
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
namespace OpenAI.Responses;
2+
3+
[CodeGenType("Includable")]
4+
public readonly partial struct IncludedResponseProperty
5+
{
6+
[CodeGenMember("MessageInputImageImageUrl")]
7+
public static IncludedResponseProperty MessageInputImageUri { get; } = new IncludedResponseProperty(MessageInputImageImageUrlValue);
8+
9+
[CodeGenMember("ComputerCallOutputOutputImageUrl")]
10+
public static IncludedResponseProperty ComputerCallOutputImageUri { get; } = new IncludedResponseProperty(ComputerCallOutputOutputImageUrlValue);
11+
}

src/Custom/Responses/Internal/InternalIncludable.cs

Lines changed: 0 additions & 7 deletions
This file was deleted.

src/Custom/Responses/OpenAIResponseClient.Protocol.cs

Lines changed: 0 additions & 35 deletions
This file was deleted.

0 commit comments

Comments
 (0)