Skip to content

Commit 7d0b7ac

Browse files
committed
Add support for included properties in Responses
1 parent ba45b1f commit 7d0b7ac

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
@@ -5373,6 +5373,25 @@ public class ImageGenerationToolInputImageMask : IJsonModel<ImageGenerationToolI
53735373
public override readonly string ToString();
53745374
}
53755375
[Experimental("OPENAI001")]
5376+
public readonly partial struct IncludedResponseProperty : IEquatable<IncludedResponseProperty> {
5377+
public IncludedResponseProperty(string value);
5378+
public static IncludedResponseProperty CodeInterpreterCallOutputs { get; }
5379+
public static IncludedResponseProperty ComputerCallOutputImageUri { get; }
5380+
public static IncludedResponseProperty FileSearchCallResults { get; }
5381+
public static IncludedResponseProperty MessageInputImageUri { get; }
5382+
public static IncludedResponseProperty ReasoningEncryptedContent { get; }
5383+
public readonly bool Equals(IncludedResponseProperty other);
5384+
[EditorBrowsable(EditorBrowsableState.Never)]
5385+
public override readonly bool Equals(object obj);
5386+
[EditorBrowsable(EditorBrowsableState.Never)]
5387+
public override readonly int GetHashCode();
5388+
public static bool operator ==(IncludedResponseProperty left, IncludedResponseProperty right);
5389+
public static implicit operator IncludedResponseProperty(string value);
5390+
public static implicit operator IncludedResponseProperty?(string value);
5391+
public static bool operator !=(IncludedResponseProperty left, IncludedResponseProperty right);
5392+
public override readonly string ToString();
5393+
}
5394+
[Experimental("OPENAI001")]
53765395
public class McpTool : ResponseTool, IJsonModel<McpTool>, IPersistableModel<McpTool> {
53775396
public McpTool(string serverLabel, McpToolConnectorId connectorId);
53785397
public McpTool(string serverLabel, Uri serverUri);
@@ -5589,16 +5608,16 @@ public class OpenAIResponseClient {
55895608
public virtual ClientResult<ResponseDeletionResult> DeleteResponse(string responseId, CancellationToken cancellationToken = default);
55905609
public virtual Task<ClientResult> DeleteResponseAsync(string responseId, RequestOptions options);
55915610
public virtual Task<ClientResult<ResponseDeletionResult>> DeleteResponseAsync(string responseId, CancellationToken cancellationToken = default);
5592-
public virtual ClientResult GetResponse(string responseId, bool? stream, int? startingAfter, RequestOptions options);
5593-
public virtual ClientResult<OpenAIResponse> GetResponse(string responseId, CancellationToken cancellationToken = default);
5594-
public virtual Task<ClientResult> GetResponseAsync(string responseId, bool? stream, int? startingAfter, RequestOptions options);
5595-
public virtual Task<ClientResult<OpenAIResponse>> GetResponseAsync(string responseId, CancellationToken cancellationToken = default);
5611+
public virtual ClientResult GetResponse(string responseId, IEnumerable<IncludedResponseProperty> include, bool? stream, int? startingAfter, bool? includeObfuscation, RequestOptions options);
5612+
public virtual ClientResult<OpenAIResponse> GetResponse(string responseId, IEnumerable<IncludedResponseProperty> include = null, int? startingAfter = null, bool? includeObfuscation = null, CancellationToken cancellationToken = default);
5613+
public virtual Task<ClientResult> GetResponseAsync(string responseId, IEnumerable<IncludedResponseProperty> include, bool? stream, int? startingAfter, bool? includeObfuscation, RequestOptions options);
5614+
public virtual Task<ClientResult<OpenAIResponse>> GetResponseAsync(string responseId, IEnumerable<IncludedResponseProperty> include = null, int? startingAfter = null, bool? includeObfuscation = null, CancellationToken cancellationToken = default);
55965615
public virtual CollectionResult<ResponseItem> GetResponseInputItems(string responseId, ResponseItemCollectionOptions options = null, CancellationToken cancellationToken = default);
55975616
public virtual CollectionResult GetResponseInputItems(string responseId, int? limit, string order, string after, string before, RequestOptions options);
55985617
public virtual AsyncCollectionResult<ResponseItem> GetResponseInputItemsAsync(string responseId, ResponseItemCollectionOptions options = null, CancellationToken cancellationToken = default);
55995618
public virtual AsyncCollectionResult GetResponseInputItemsAsync(string responseId, int? limit, string order, string after, string before, RequestOptions options);
5600-
public virtual CollectionResult<StreamingResponseUpdate> GetResponseStreaming(string responseId, int? startingAfter = null, CancellationToken cancellationToken = default);
5601-
public virtual AsyncCollectionResult<StreamingResponseUpdate> GetResponseStreamingAsync(string responseId, int? startingAfter = null, CancellationToken cancellationToken = default);
5619+
public virtual CollectionResult<StreamingResponseUpdate> GetResponseStreaming(string responseId, IEnumerable<IncludedResponseProperty> include = null, int? startingAfter = null, bool? includeObfuscation = null, CancellationToken cancellationToken = default);
5620+
public virtual AsyncCollectionResult<StreamingResponseUpdate> GetResponseStreamingAsync(string responseId, IEnumerable<IncludedResponseProperty> include = null, int? startingAfter = null, bool? includeObfuscation = null, CancellationToken cancellationToken = default);
56025621
}
56035622
[Experimental("OPENAI001")]
56045623
public static class OpenAIResponsesModelFactory {
@@ -5696,6 +5715,7 @@ public enum ResponseContentPartKind {
56965715
public class ResponseCreationOptions : IJsonModel<ResponseCreationOptions>, IPersistableModel<ResponseCreationOptions> {
56975716
public bool? BackgroundModeEnabled { get; set; }
56985717
public string EndUserId { get; set; }
5718+
public IList<IncludedResponseProperty> IncludedProperties { get; }
56995719
public string Instructions { get; set; }
57005720
public int? MaxOutputTokenCount { get; set; }
57015721
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
@@ -4705,6 +4705,24 @@ public class ImageGenerationToolInputImageMask : IJsonModel<ImageGenerationToolI
47054705
public static bool operator !=(ImageGenerationToolSize left, ImageGenerationToolSize right);
47064706
public override readonly string ToString();
47074707
}
4708+
public readonly partial struct IncludedResponseProperty : IEquatable<IncludedResponseProperty> {
4709+
public IncludedResponseProperty(string value);
4710+
public static IncludedResponseProperty CodeInterpreterCallOutputs { get; }
4711+
public static IncludedResponseProperty ComputerCallOutputImageUri { get; }
4712+
public static IncludedResponseProperty FileSearchCallResults { get; }
4713+
public static IncludedResponseProperty MessageInputImageUri { get; }
4714+
public static IncludedResponseProperty ReasoningEncryptedContent { get; }
4715+
public readonly bool Equals(IncludedResponseProperty other);
4716+
[EditorBrowsable(EditorBrowsableState.Never)]
4717+
public override readonly bool Equals(object obj);
4718+
[EditorBrowsable(EditorBrowsableState.Never)]
4719+
public override readonly int GetHashCode();
4720+
public static bool operator ==(IncludedResponseProperty left, IncludedResponseProperty right);
4721+
public static implicit operator IncludedResponseProperty(string value);
4722+
public static implicit operator IncludedResponseProperty?(string value);
4723+
public static bool operator !=(IncludedResponseProperty left, IncludedResponseProperty right);
4724+
public override readonly string ToString();
4725+
}
47084726
public class McpTool : ResponseTool, IJsonModel<McpTool>, IPersistableModel<McpTool> {
47094727
public McpTool(string serverLabel, McpToolConnectorId connectorId);
47104728
public McpTool(string serverLabel, Uri serverUri);
@@ -4902,16 +4920,16 @@ public class OpenAIResponseClient {
49024920
public virtual ClientResult<ResponseDeletionResult> DeleteResponse(string responseId, CancellationToken cancellationToken = default);
49034921
public virtual Task<ClientResult> DeleteResponseAsync(string responseId, RequestOptions options);
49044922
public virtual Task<ClientResult<ResponseDeletionResult>> DeleteResponseAsync(string responseId, CancellationToken cancellationToken = default);
4905-
public virtual ClientResult GetResponse(string responseId, bool? stream, int? startingAfter, RequestOptions options);
4906-
public virtual ClientResult<OpenAIResponse> GetResponse(string responseId, CancellationToken cancellationToken = default);
4907-
public virtual Task<ClientResult> GetResponseAsync(string responseId, bool? stream, int? startingAfter, RequestOptions options);
4908-
public virtual Task<ClientResult<OpenAIResponse>> GetResponseAsync(string responseId, CancellationToken cancellationToken = default);
4923+
public virtual ClientResult GetResponse(string responseId, IEnumerable<IncludedResponseProperty> include, bool? stream, int? startingAfter, bool? includeObfuscation, RequestOptions options);
4924+
public virtual ClientResult<OpenAIResponse> GetResponse(string responseId, IEnumerable<IncludedResponseProperty> include = null, int? startingAfter = null, bool? includeObfuscation = null, CancellationToken cancellationToken = default);
4925+
public virtual Task<ClientResult> GetResponseAsync(string responseId, IEnumerable<IncludedResponseProperty> include, bool? stream, int? startingAfter, bool? includeObfuscation, RequestOptions options);
4926+
public virtual Task<ClientResult<OpenAIResponse>> GetResponseAsync(string responseId, IEnumerable<IncludedResponseProperty> include = null, int? startingAfter = null, bool? includeObfuscation = null, CancellationToken cancellationToken = default);
49094927
public virtual CollectionResult<ResponseItem> GetResponseInputItems(string responseId, ResponseItemCollectionOptions options = null, CancellationToken cancellationToken = default);
49104928
public virtual CollectionResult GetResponseInputItems(string responseId, int? limit, string order, string after, string before, RequestOptions options);
49114929
public virtual AsyncCollectionResult<ResponseItem> GetResponseInputItemsAsync(string responseId, ResponseItemCollectionOptions options = null, CancellationToken cancellationToken = default);
49124930
public virtual AsyncCollectionResult GetResponseInputItemsAsync(string responseId, int? limit, string order, string after, string before, RequestOptions options);
4913-
public virtual CollectionResult<StreamingResponseUpdate> GetResponseStreaming(string responseId, int? startingAfter = null, CancellationToken cancellationToken = default);
4914-
public virtual AsyncCollectionResult<StreamingResponseUpdate> GetResponseStreamingAsync(string responseId, int? startingAfter = null, CancellationToken cancellationToken = default);
4931+
public virtual CollectionResult<StreamingResponseUpdate> GetResponseStreaming(string responseId, IEnumerable<IncludedResponseProperty> include = null, int? startingAfter = null, bool? includeObfuscation = null, CancellationToken cancellationToken = default);
4932+
public virtual AsyncCollectionResult<StreamingResponseUpdate> GetResponseStreamingAsync(string responseId, IEnumerable<IncludedResponseProperty> include = null, int? startingAfter = null, bool? includeObfuscation = null, CancellationToken cancellationToken = default);
49154933
}
49164934
public static class OpenAIResponsesModelFactory {
49174935
public static MessageResponseItem MessageResponseItem(string id = null, MessageRole role = MessageRole.Assistant, MessageStatus? status = null);
@@ -4998,6 +5016,7 @@ public enum ResponseContentPartKind {
49985016
public class ResponseCreationOptions : IJsonModel<ResponseCreationOptions>, IPersistableModel<ResponseCreationOptions> {
49995017
public bool? BackgroundModeEnabled { get; set; }
50005018
public string EndUserId { get; set; }
5019+
public IList<IncludedResponseProperty> IncludedProperties { get; }
50015020
public string Instructions { get; set; }
50025021
public int? MaxOutputTokenCount { get; set; }
50035022
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)