Skip to content

Commit 809d0c3

Browse files
committed
remove explicit operators for streaming models
1 parent b370c6d commit 809d0c3

14 files changed

+590
-77
lines changed

src/Custom/Chat/Streaming/StreamingChatCompletionUpdate.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
using OpenAI.Internal;
22
using System;
3+
using System.ClientModel;
34
using System.Collections.Generic;
45
using System.Diagnostics.CodeAnalysis;
56

67
namespace OpenAI.Chat;
78

89
/// <summary> An incremental update corresponding to a streaming chat completion generated by the model. </summary>
910
[CodeGenType("CreateChatCompletionStreamResponse")]
11+
[CodeGenSuppress("StreamingChatCompletionUpdate", typeof(System.ClientModel.ClientResult))]
1012
public partial class StreamingChatCompletionUpdate
1113
{
1214
private ChatMessageContent _contentUpdate;
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
namespace OpenAI.Containers;
2+
3+
// CUSTOM: Use the correct namespace.
4+
[CodeGenType("ContainerCollectionOptions")] public partial class ContainerCollectionOptions { }
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
namespace OpenAI.Containers;
2+
3+
// CUSTOM: Use the correct namespace.
4+
[CodeGenType("ContainerCollectionOrder")] public partial struct ContainerCollectionOrder { }
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
namespace OpenAI.Containers;
2+
3+
// CUSTOM: Use the correct namespace.
4+
[CodeGenType("ContainerFileCollectionOptions")] public partial class ContainerFileCollectionOptions { }

src/Custom/Responses/Streaming/StreamingResponseUpdate.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ namespace OpenAI.Responses;
66
// - Added Experimental attribute.
77
// - Renamed.
88
[CodeGenType("ResponseStreamEvent")]
9+
[CodeGenSuppress("StreamingResponseUpdate", typeof(System.ClientModel.ClientResult))]
910
public partial class StreamingResponseUpdate
1011
{
1112
}

src/Generated/ContainerClient.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,15 +63,15 @@ public virtual ClientResult<ContainerResource> CreateContainer(CreateContainerBo
6363
{
6464
Argument.AssertNotNull(body, nameof(body));
6565

66-
ClientResult result = this.CreateContainer(body, cancellationToken.CanBeCanceled ? new RequestOptions { CancellationToken = cancellationToken } : null);
66+
ClientResult result = CreateContainer(body, cancellationToken.CanBeCanceled ? new RequestOptions { CancellationToken = cancellationToken } : null);
6767
return ClientResult.FromValue((ContainerResource)result, result.GetRawResponse());
6868
}
6969

7070
public virtual async Task<ClientResult<ContainerResource>> CreateContainerAsync(CreateContainerBody body, CancellationToken cancellationToken = default)
7171
{
7272
Argument.AssertNotNull(body, nameof(body));
7373

74-
ClientResult result = await this.CreateContainerAsync(body, cancellationToken.CanBeCanceled ? new RequestOptions { CancellationToken = cancellationToken } : null).ConfigureAwait(false);
74+
ClientResult result = await CreateContainerAsync(body, cancellationToken.CanBeCanceled ? new RequestOptions { CancellationToken = cancellationToken } : null).ConfigureAwait(false);
7575
return ClientResult.FromValue((ContainerResource)result, result.GetRawResponse());
7676
}
7777

src/Generated/Models/Chat/StreamingChatCompletionUpdate.Serialization.cs

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
#nullable disable
44

55
using System;
6-
using System.ClientModel;
76
using System.ClientModel.Primitives;
87
using System.Collections.Generic;
98
using System.Diagnostics.CodeAnalysis;
@@ -236,13 +235,5 @@ protected virtual StreamingChatCompletionUpdate PersistableModelCreateCore(Binar
236235
}
237236

238237
string IPersistableModel<StreamingChatCompletionUpdate>.GetFormatFromOptions(ModelReaderWriterOptions options) => "J";
239-
240-
[Experimental("OPENAI001")]
241-
public static explicit operator StreamingChatCompletionUpdate(ClientResult result)
242-
{
243-
using PipelineResponse response = result.GetRawResponse();
244-
using JsonDocument document = JsonDocument.Parse(response.Content);
245-
return DeserializeStreamingChatCompletionUpdate(document.RootElement, ModelSerializationExtensions.WireOptions);
246-
}
247238
}
248239
}

src/Generated/Models/ContainerCollectionOptions.Serialization.cs renamed to src/Generated/Models/Containers/ContainerCollectionOptions.Serialization.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,9 @@
66
using System.ClientModel.Primitives;
77
using System.Collections.Generic;
88
using System.Text.Json;
9+
using OpenAI;
910

10-
namespace OpenAI
11+
namespace OpenAI.Containers
1112
{
1213
public partial class ContainerCollectionOptions : IJsonModel<ContainerCollectionOptions>
1314
{

src/Generated/Models/ContainerCollectionOptions.cs renamed to src/Generated/Models/Containers/ContainerCollectionOptions.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
using System.Collections.Generic;
77
using System.Diagnostics.CodeAnalysis;
88

9-
namespace OpenAI
9+
namespace OpenAI.Containers
1010
{
1111
[Experimental("OPENAI001")]
1212
public partial class ContainerCollectionOptions

src/Generated/Models/ContainerCollectionOrder.cs renamed to src/Generated/Models/Containers/ContainerCollectionOrder.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,9 @@
55
using System;
66
using System.ComponentModel;
77
using System.Diagnostics.CodeAnalysis;
8+
using OpenAI;
89

9-
namespace OpenAI
10+
namespace OpenAI.Containers
1011
{
1112
[Experimental("OPENAI001")]
1213
public readonly partial struct ContainerCollectionOrder : IEquatable<ContainerCollectionOrder>

0 commit comments

Comments
 (0)