Skip to content

Commit 2cbe28a

Browse files
committed
wip
1 parent cbb6509 commit 2cbe28a

33 files changed

+9475
-9529
lines changed

specification/base/typespec/responses/custom.tsp

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,24 @@ model ReasoningItemSummaryTextPart extends ReasoningItemSummaryPart {
2626
}
2727

2828
union CodeInterpreterToolOutputType {
29-
string,
30-
logs: "logs",
31-
image: "image"
29+
string,
30+
logs: "logs",
31+
image: "image",
3232
}
3333

3434
@discriminator("type")
3535
model CodeInterpreterToolOutput {
3636
@doc("The type of the output.")
3737
type: CodeInterpreterToolOutputType;
38+
}
39+
40+
union CodeInterpreterContainerConfigurationType {
41+
string,
42+
auto: "auto",
43+
}
44+
45+
@discriminator("type")
46+
model CodeInterpreterContainerConfiguration {
47+
@doc("The type of the output.")
48+
type: CodeInterpreterContainerConfigurationType;
3849
}

specification/base/typespec/responses/models.tsp

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1858,11 +1858,9 @@ model CodeInterpreterTool extends Tool {
18581858
* Configuration for a code interpreter container. Optionally specify the IDs
18591859
* of the files to run the code on.
18601860
*/
1861-
model CodeInterpreterToolAuto {
1862-
@doc("""
1863-
Always `auto`.
1864-
""")
1865-
type: "auto";
1861+
model CodeInterpreterToolAuto /* extends CodeInterpreterContainerConfiguration */ {
1862+
@doc("Always `auto`.")
1863+
//type: CodeInterpreterContainerConfigurationType.auto;
18661864

18671865
/** An optional list of uploaded files to make available to your code. */
18681866
file_ids?: string[];
@@ -2488,7 +2486,6 @@ alias CodeInterpreterToolCallItemBase = {
24882486
);
24892487
/** The output of a code interpreter tool. */
24902488

2491-
24922489
// Tool customization: Remove shared sequence_number property that was moved to the common parent
24932490
/** Emitted when there is a partial audio response. */
24942491
model ResponseAudioDeltaEvent {
@@ -2591,10 +2588,10 @@ model ResponseCodeInterpreterCallInProgressEvent extends ResponseStreamEvent {
25912588
type: ResponseStreamEventType.response_code_interpreter_call_in_progress;
25922589

25932590
/** The index of the output item that the code interpreter call is in progress. */
2594-
output_index: integer;
2591+
output_index: int32;
25952592

25962593
/** The unique identifier of the code interpreter tool call item. */
2597-
item_id: string,
2594+
item_id: string;
25982595
}
25992596

26002597
// Tool customization: Remove shared sequence_number property that was moved to the common parent
@@ -2609,7 +2606,7 @@ model ResponseCodeInterpreterCallInterpretingEvent extends ResponseStreamEvent {
26092606
output_index: int32;
26102607

26112608
/** The unique identifier of the code interpreter tool call item. */
2612-
item_id: string,
2609+
item_id: string;
26132610
}
26142611

26152612
/** The top log probability of a token. */

specification/client/responses.client.tsp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@ using Azure.ClientGenerator.Core;
1010
@@visibility(ItemResource.id, Lifecycle.Read);
1111
@@usage(ItemResource, Usage.input | Usage.output);
1212

13+
@@visibility(CodeInterpreterToolCallItemResource.status, Lifecycle.Read);
14+
@@clientName(CodeInterpreterToolImageOutput.url, "ImageUri");
15+
1316
@@visibility(ComputerToolCallItemResource.status, Lifecycle.Read);
1417

1518
@@visibility(ComputerToolCallOutputItemResource.status, Lifecycle.Read);

src/Custom/Responses/GeneratorStubs.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,5 @@ namespace OpenAI.Responses;
22

33
[CodeGenType("CodeInterpreterToolImageOutput")] public partial class CodeInterpreterToolImageOutput {}
44
[CodeGenType("CodeInterpreterToolLogsOutput")] public partial class CodeInterpreterToolLogsOutput {}
5-
[CodeGenType("UnknownCodeInterpreterToolOutput")] public partial class UnknownCodeInterpreterToolOutput {}
65
[CodeGenType("CodeInterpreterToolOutput")] public partial class CodeInterpreterToolOutput {}
7-
[CodeGenType("CodeInterpreterToolOutputType")] public readonly partial struct CodeInterpreterToolOutputType {}
6+
[CodeGenType("CodeInterpreterToolAuto")] public partial class CodeInterpreterToolAuto {}

src/Custom/Responses/Internal/GeneratorStubs.cs

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -90,20 +90,21 @@ namespace OpenAI.Responses;
9090
[CodeGenType("UnknownTool")] internal partial class InternalUnknownTool {}
9191
[CodeGenType("UnknownToolChoiceObject")] internal partial class InternalUnknownToolChoiceObject {}
9292
[CodeGenType("WebSearchToolCallItemParam")] internal partial class InternalWebSearchToolCallItemParam {}
93-
[CodeGenType("CodeInterpreterToolAutoType")] internal readonly partial struct InternalCodeInterpreterToolAutoType {}
9493
[CodeGenType("ImageGenToolModel")] internal readonly partial struct InternalImageGenToolModel {}
9594
[CodeGenType("ImageGenToolQuality")] internal readonly partial struct InternalImageGenToolQuality {}
9695
[CodeGenType("ImageGenToolSize")] internal readonly partial struct InternalImageGenToolSize {}
9796
[CodeGenType("ImageGenToolOutputFormat")] internal readonly partial struct InternalImageGenToolOutputFormat {}
9897
[CodeGenType("ImageGenToolModeration")] internal readonly partial struct InternalImageGenToolModeration {}
9998
[CodeGenType("ImageGenToolBackground")] internal readonly partial struct InternalImageGenToolBackground {}
100-
[CodeGenType("CodeInterpreterTextOutputType")] internal readonly partial struct InternalCodeInterpreterTextOutputType {}
99+
[CodeGenType("CodeInterpreterContainerConfigurationType")] internal readonly partial struct InternalCodeInterpreterContainerConfigurationType {}
100+
[CodeGenType("CodeInterpreterContainerConfiguration")] internal readonly partial struct InternalCodeInterpreterContainerConfiguration {}
101101
[CodeGenType("CodeInterpreterFileOutputType")] internal readonly partial struct InternalCodeInterpreterFileOutputType {}
102+
[CodeGenType("CodeInterpreterTextOutputType")] internal readonly partial struct InternalCodeInterpreterTextOutputType {}
103+
[CodeGenType("CodeInterpreterToolOutputType")] internal readonly partial struct InternalCodeInterpreterToolOutputType {}
102104
[CodeGenType("LocalShellExecActionType")] internal readonly partial struct InternalLocalShellExecActionType {}
103105
[CodeGenType("ImageGenToolCallItemResourceStatus")] internal readonly partial struct InternalImageGenToolCallItemResourceStatus {}
104106
[CodeGenType("LocalShellToolCallItemResourceStatus")] internal readonly partial struct InternalLocalShellToolCallItemResourceStatus {}
105107
[CodeGenType("LocalShellToolCallOutputItemResourceStatus")] internal readonly partial struct InternalLocalShellToolCallOutputItemResourceStatus {}
106-
[CodeGenType("CodeInterpreterToolAuto")] internal partial class InternalCodeInterpreterToolAuto {}
107108
[CodeGenType("ImageGenTool")] internal partial class InternalImageGenTool {}
108109
[CodeGenType("ImageGenToolInputImageMask")] internal partial class InternalImageGenToolInputImageMask {}
109110
[CodeGenType("LocalShellTool")] internal partial class InternalLocalShellTool {}
@@ -136,4 +137,6 @@ namespace OpenAI.Responses;
136137
[CodeGenType("ResponseReasoningSummaryDeltaEvent")] internal partial class InternalResponseReasoningSummaryDeltaEvent {}
137138
[CodeGenType("ResponseReasoningSummaryDoneEvent")] internal partial class InternalResponseReasoningSummaryDoneEvent {}
138139
[CodeGenType("DotNetCustomToolCallApprovalPolicyAlways")] internal partial class InternalDotNetCustomToolCallApprovalPolicyAlways { }
139-
[CodeGenType("DotNetCustomToolCallApprovalPolicyNever")] internal partial class InternalDotNetCustomToolCallApprovalPolicyNever { }
140+
[CodeGenType("DotNetCustomToolCallApprovalPolicyNever")] internal partial class InternalDotNetCustomToolCallApprovalPolicyNever { }
141+
[CodeGenType("UnknownCodeInterpreterToolOutput")] internal partial class InternalUnknownCodeInterpreterToolOutput {}
142+
[CodeGenType("UnknownCodeInterpreterContainerConfiguration")] internal partial class InternalUnknownCodeInterpreterContainerConfiguration {}
Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,10 @@
11
namespace OpenAI.Responses;
22

33
// CUSTOM: Renamed and made public.
4-
[CodeGenType("CodeInterpreterToolCallItemResource")] public partial class CodeInterpreterCallResponseItem {}
4+
[CodeGenType("CodeInterpreterToolCallItemResource")]
5+
public partial class CodeInterpreterCallResponseItem
6+
{
7+
// CUSTOM: Made nullable since this is a read-only property.
8+
[CodeGenMember("Status")]
9+
public CodeInterpreterCallStatus? Status { get; }
10+
}
Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,12 @@
11
namespace OpenAI.Responses;
22

3-
// CUSTOM: Renamed and made public.
4-
[CodeGenType("CodeInterpreterToolCallItemResourceStatus")] public readonly partial struct CodeInterpreterCallStatus {}
3+
// CUSTOM: Renamed and made public. Recreated as CLR enum.
4+
[CodeGenType("CodeInterpreterToolCallItemResourceStatus")]
5+
public enum CodeInterpreterCallStatus
6+
{
7+
InProgress,
8+
Interpreting,
9+
Completed,
10+
Incomplete,
11+
Failed
12+
}

src/Custom/Responses/Tools/AutomaticCodeInterpreterContainerConfiguration.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,14 @@ namespace OpenAI.Responses;
55
/// <summary>
66
/// Represents a configuration for an automatic Code Interpreter container.
77
/// </summary>
8-
public class AutomaticCodeInterpreterContainerConfiguration : CodeInterpreterContainerConfiguration
8+
public partial class CodeInterpreterToolAuto : CodeInterpreterContainerConfiguration
99
{
1010

1111
/// <summary>
1212
/// Initializes a new instance of the <see cref="AutomaticCodeInterpreterContainerConfiguration"/> class.
1313
/// </summary>
1414
/// <param name="fileIds"></param>
15-
public AutomaticCodeInterpreterContainerConfiguration(IEnumerable<string> fileIds = null)
15+
public CodeInterpreterToolAuto(IEnumerable<string> fileIds = null)
1616
{
1717
if (fileIds != null)
1818
{

src/Custom/Responses/Tools/CodeInterpreterContainer.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ internal BinaryData AsBinaryData()
4040
{
4141
return this.ContainerId != null
4242
? new BinaryData($"\"{ContainerId}\"")
43-
: ContainerConfiguration is AutomaticCodeInterpreterContainerConfiguration autoConfig && autoConfig.FileIds?.Any() == true ?
43+
: ContainerConfiguration is CodeInterpreterToolAuto autoConfig && autoConfig.FileIds?.Any() == true ?
4444
new BinaryData($"{{\"type\": \"auto\", \"file_ids\": [{string.Join(", ", autoConfig.FileIds.Select(id => $"\"{id}\""))}]}}") :
4545
new BinaryData("{\"type\": \"auto\"}");
4646
}

src/Custom/Responses/Tools/CodeInterpreterContainerConfiguration.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,6 @@ public class CodeInterpreterContainerConfiguration
1313
/// </summary>
1414
/// <param name="fileIds">The list of file IDs associated with the container.</param>
1515
/// <returns>A new instance of the <see cref="AutomaticCodeInterpreterContainerConfiguration"/> class.</returns>
16-
public static AutomaticCodeInterpreterContainerConfiguration CreateAutomaticConfiguration(IEnumerable<string> fileIds = null) =>
17-
new AutomaticCodeInterpreterContainerConfiguration(fileIds);
16+
public static CodeInterpreterToolAuto CreateAutomaticConfiguration(IEnumerable<string> fileIds = null) =>
17+
new CodeInterpreterToolAuto(fileIds);
1818
}

0 commit comments

Comments
 (0)