Skip to content

Commit 7c91d8d

Browse files
authored
Fix pipeline in RealtimeClient (#619)
`RealtimeClient` has two HTTP operations: `CreateEphemeralToken` and `CreateEphemeralTranscriptionToken`, which are currently broken because the pipeline is not set up correctly. This change fixes that issue.
1 parent cc157bd commit 7c91d8d

30 files changed

+214
-89
lines changed

api/OpenAI.net8.0.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4298,7 +4298,12 @@ public class RealtimeClient {
42984298
protected RealtimeClient();
42994299
public RealtimeClient(ApiKeyCredential credential, OpenAIClientOptions options);
43004300
public RealtimeClient(ApiKeyCredential credential);
4301+
[Experimental("OPENAI001")]
4302+
public RealtimeClient(AuthenticationPolicy authenticationPolicy, OpenAIClientOptions options);
4303+
[Experimental("OPENAI001")]
4304+
public RealtimeClient(AuthenticationPolicy authenticationPolicy);
43014305
protected internal RealtimeClient(ClientPipeline pipeline, OpenAIClientOptions options);
4306+
public RealtimeClient(string apiKey);
43024307
public ClientPipeline Pipeline { get; }
43034308
public event EventHandler<BinaryData> OnReceivingCommand { add; remove; }
43044309
public event EventHandler<BinaryData> OnSendingCommand { add; remove; }

api/OpenAI.netstandard2.0.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3766,7 +3766,10 @@ public class RealtimeClient {
37663766
protected RealtimeClient();
37673767
public RealtimeClient(ApiKeyCredential credential, OpenAIClientOptions options);
37683768
public RealtimeClient(ApiKeyCredential credential);
3769+
public RealtimeClient(AuthenticationPolicy authenticationPolicy, OpenAIClientOptions options);
3770+
public RealtimeClient(AuthenticationPolicy authenticationPolicy);
37693771
protected internal RealtimeClient(ClientPipeline pipeline, OpenAIClientOptions options);
3772+
public RealtimeClient(string apiKey);
37703773
public ClientPipeline Pipeline { get; }
37713774
public event EventHandler<BinaryData> OnReceivingCommand { add; remove; }
37723775
public event EventHandler<BinaryData> OnSendingCommand { add; remove; }

src/Custom/Assistants/AssistantClient.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public partial class AssistantClient
4141
// - Used a custom pipeline.
4242
// - Demoted the endpoint parameter to be a property in the options class.
4343
/// <summary> Initializes a new instance of <see cref="AssistantClient"/>. </summary>
44-
/// <param name="credential"> The API key to authenticate with the service. </param>
44+
/// <param name="credential"> The <see cref="ApiKeyCredential"/> to authenticate with the service. </param>
4545
/// <exception cref="ArgumentNullException"> <paramref name="credential"/> is null. </exception>
4646
public AssistantClient(ApiKeyCredential credential) : this(credential, new OpenAIClientOptions())
4747
{
@@ -51,7 +51,7 @@ public partial class AssistantClient
5151
// - Used a custom pipeline.
5252
// - Demoted the endpoint parameter to be a property in the options class.
5353
/// <summary> Initializes a new instance of <see cref="AssistantClient"/>. </summary>
54-
/// <param name="credential"> The API key to authenticate with the service. </param>
54+
/// <param name="credential"> The <see cref="ApiKeyCredential"/> to authenticate with the service. </param>
5555
/// <param name="options"> The options to configure the client. </param>
5656
/// <exception cref="ArgumentNullException"> <paramref name="credential"/> is null. </exception>
5757
public AssistantClient(ApiKeyCredential credential, OpenAIClientOptions options) : this(OpenAIClient.CreateApiKeyAuthenticationPolicy(credential), options)

src/Custom/Assistants/Internal/InternalAssistantMessageClient.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ internal partial class InternalAssistantMessageClient
2323
// - Used a custom pipeline.
2424
// - Demoted the endpoint parameter to be a property in the options class.
2525
/// <summary> Initializes a new instance of <see cref="InternalAssistantMessageClient"/>. </summary>
26-
/// <param name="credential"> The API key to authenticate with the service. </param>
26+
/// <param name="credential"> The <see cref="ApiKeyCredential"/> to authenticate with the service. </param>
2727
/// <exception cref="ArgumentNullException"> <paramref name="credential"/> is null. </exception>
2828
public InternalAssistantMessageClient(ApiKeyCredential credential) : this(credential, new OpenAIClientOptions())
2929
{
@@ -33,7 +33,7 @@ internal partial class InternalAssistantMessageClient
3333
// - Used a custom pipeline.
3434
// - Demoted the endpoint parameter to be a property in the options class.
3535
/// <summary> Initializes a new instance of <see cref="InternalAssistantMessageClient"/>. </summary>
36-
/// <param name="credential"> The API key to authenticate with the service. </param>
36+
/// <param name="credential"> The <see cref="ApiKeyCredential"/> to authenticate with the service. </param>
3737
/// <param name="options"> The options to configure the client. </param>
3838
/// <exception cref="ArgumentNullException"> <paramref name="credential"/> is null. </exception>
3939
public InternalAssistantMessageClient(ApiKeyCredential credential, OpenAIClientOptions options) : this(OpenAIClient.CreateApiKeyAuthenticationPolicy(credential), options)

src/Custom/Assistants/Internal/InternalAssistantRunClient.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ internal partial class InternalAssistantRunClient
3232
// - Used a custom pipeline.
3333
// - Demoted the endpoint parameter to be a property in the options class.
3434
/// <summary> Initializes a new instance of <see cref="InternalAssistantRunClient"/>. </summary>
35-
/// <param name="credential"> The API key to authenticate with the service. </param>
35+
/// <param name="credential"> The <see cref="ApiKeyCredential"/> to authenticate with the service. </param>
3636
/// <exception cref="ArgumentNullException"> <paramref name="credential"/> is null. </exception>
3737
public InternalAssistantRunClient(ApiKeyCredential credential) : this(credential, new OpenAIClientOptions())
3838
{
@@ -42,7 +42,7 @@ internal partial class InternalAssistantRunClient
4242
// - Used a custom pipeline.
4343
// - Demoted the endpoint parameter to be a property in the options class.
4444
/// <summary> Initializes a new instance of <see cref="InternalAssistantRunClient"/>. </summary>
45-
/// <param name="credential"> The API key to authenticate with the service. </param>
45+
/// <param name="credential"> The <see cref="ApiKeyCredential"/> to authenticate with the service. </param>
4646
/// <param name="options"> The options to configure the client. </param>
4747
/// <exception cref="ArgumentNullException"> <paramref name="credential"/> is null. </exception>
4848
public InternalAssistantRunClient(ApiKeyCredential credential, OpenAIClientOptions options) : this(OpenAIClient.CreateApiKeyAuthenticationPolicy(credential), options)

src/Custom/Assistants/Internal/InternalAssistantThreadClient.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ internal partial class InternalAssistantThreadClient
2121
// - Used a custom pipeline.
2222
// - Demoted the endpoint parameter to be a property in the options class.
2323
/// <summary> Initializes a new instance of <see cref="InternalAssistantThreadClient"/>. </summary>
24-
/// <param name="credential"> The API key to authenticate with the service. </param>
24+
/// <param name="credential"> The <see cref="ApiKeyCredential"/> to authenticate with the service. </param>
2525
/// <exception cref="ArgumentNullException"> <paramref name="credential"/> is null. </exception>
2626
public InternalAssistantThreadClient(ApiKeyCredential credential) : this(credential, new OpenAIClientOptions())
2727
{
@@ -31,7 +31,7 @@ internal partial class InternalAssistantThreadClient
3131
// - Used a custom pipeline.
3232
// - Demoted the endpoint parameter to be a property in the options class.
3333
/// <summary> Initializes a new instance of <see cref="InternalAssistantThreadClient"/>. </summary>
34-
/// <param name="credential"> The API key to authenticate with the service. </param>
34+
/// <param name="credential"> The <see cref="ApiKeyCredential"/> to authenticate with the service. </param>
3535
/// <param name="options"> The options to configure the client. </param>
3636
/// <exception cref="ArgumentNullException"> <paramref name="credential"/> is null. </exception>
3737
public InternalAssistantThreadClient(ApiKeyCredential credential, OpenAIClientOptions options) : this(OpenAIClient.CreateApiKeyAuthenticationPolicy(credential), options)

src/Custom/Audio/AudioClient.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ public partial class AudioClient
3737
// - Demoted the endpoint parameter to be a property in the options class.
3838
/// <summary> Initializes a new instance of <see cref="AudioClient"/>. </summary>
3939
/// <param name="model"> The name of the model to use in requests sent to the service. To learn more about the available models, see <see href="https://platform.openai.com/docs/models"/>. </param>
40-
/// <param name="credential"> The API key to authenticate with the service. </param>
40+
/// <param name="credential"> The <see cref="ApiKeyCredential"/> to authenticate with the service. </param>
4141
/// <exception cref="ArgumentNullException"> <paramref name="model"/> or <paramref name="credential"/> is null. </exception>
4242
/// <exception cref="ArgumentException"> <paramref name="model"/> is an empty string, and was expected to be non-empty. </exception>
4343
public AudioClient(string model, ApiKeyCredential credential) : this(model, credential, new OpenAIClientOptions())
@@ -50,7 +50,7 @@ public partial class AudioClient
5050
// - Demoted the endpoint parameter to be a property in the options class.
5151
/// <summary> Initializes a new instance of <see cref="AudioClient"/>. </summary>
5252
/// <param name="model"> The name of the model to use in requests sent to the service. To learn more about the available models, see <see href="https://platform.openai.com/docs/models"/>. </param>
53-
/// <param name="credential"> The API key to authenticate with the service. </param>
53+
/// <param name="credential"> The <see cref="ApiKeyCredential"/> to authenticate with the service. </param>
5454
/// <param name="options"> The options to configure the client. </param>
5555
/// <exception cref="ArgumentNullException"> <paramref name="model"/> or <paramref name="credential"/> is null. </exception>
5656
/// <exception cref="ArgumentException"> <paramref name="model"/> is an empty string, and was expected to be non-empty. </exception>

src/Custom/Batch/BatchClient.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ public partial class BatchClient
4040
// - Used a custom pipeline.
4141
// - Demoted the endpoint parameter to be a property in the options class.
4242
/// <summary> Initializes a new instance of <see cref="BatchClient"/>. </summary>
43-
/// <param name="credential"> The API key to authenticate with the service. </param>
43+
/// <param name="credential"> The <see cref="ApiKeyCredential"/> to authenticate with the service. </param>
4444
/// <exception cref="ArgumentNullException"> <paramref name="credential"/> is null. </exception>
4545
public BatchClient(ApiKeyCredential credential) : this(credential, new OpenAIClientOptions())
4646
{
@@ -49,7 +49,7 @@ public partial class BatchClient
4949
/// <summary>
5050
/// Initializes a new instance of <see cref="BatchClient"/> that will use an API key when authenticating.
5151
/// </summary>
52-
/// <param name="credential"> The API key used to authenticate with the service endpoint. </param>
52+
/// <param name="credential"> The <see cref="ApiKeyCredential"/> to authenticate with the service. </param>
5353
/// <param name="options"> Additional options to customize the client. </param>
5454
/// <exception cref="ArgumentNullException"> The provided <paramref name="credential"/> was null. </exception>
5555
public BatchClient(ApiKeyCredential credential, OpenAIClientOptions options) : this(OpenAIClient.CreateApiKeyAuthenticationPolicy(credential), options)

src/Custom/Chat/ChatClient.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public partial class ChatClient
4141
// - Demoted the endpoint parameter to be a property in the options class.
4242
/// <summary> Initializes a new instance of <see cref="ChatClient"/>. </summary>
4343
/// <param name="model"> The name of the model to use in requests sent to the service. To learn more about the available models, see <see href="https://platform.openai.com/docs/models"/>. </param>
44-
/// <param name="credential"> The API key to authenticate with the service. </param>
44+
/// <param name="credential"> The <see cref="ApiKeyCredential"/> to authenticate with the service. </param>
4545
/// <exception cref="ArgumentNullException"> <paramref name="model"/> or <paramref name="credential"/> is null. </exception>
4646
/// <exception cref="ArgumentException"> <paramref name="model"/> is an empty string, and was expected to be non-empty. </exception>
4747
public ChatClient(string model, ApiKeyCredential credential) : this(model, credential, new OpenAIClientOptions())
@@ -55,7 +55,7 @@ public partial class ChatClient
5555
// - Added telemetry support.
5656
/// <summary> Initializes a new instance of <see cref="ChatClient"/>. </summary>
5757
/// <param name="model"> The name of the model to use in requests sent to the service. To learn more about the available models, see <see href="https://platform.openai.com/docs/models"/>. </param>
58-
/// <param name="credential"> The API key to authenticate with the service. </param>
58+
/// <param name="credential"> The <see cref="ApiKeyCredential"/> to authenticate with the service. </param>
5959
/// <param name="options"> The options to configure the client. </param>
6060
/// <exception cref="ArgumentNullException"> <paramref name="model"/> or <paramref name="credential"/> is null. </exception>
6161
/// <exception cref="ArgumentException"> <paramref name="model"/> is an empty string, and was expected to be non-empty. </exception>

src/Custom/Containers/ContainerClient.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ public partial class ContainerClient
2121
// - Used a custom pipeline.
2222
// - Demoted the endpoint parameter to be a property in the options class.
2323
/// <summary> Initializes a new instance of <see cref="ContainerClient"/>. </summary>
24-
/// <param name="credential"> The API key to authenticate with the service. </param>
24+
/// <param name="credential"> The <see cref="ApiKeyCredential"/> to authenticate with the service. </param>
2525
/// <exception cref="ArgumentNullException"> <paramref name="credential"/> is null. </exception>
2626
public ContainerClient(ApiKeyCredential credential) : this(credential, new OpenAIClientOptions())
2727
{
@@ -31,7 +31,7 @@ public partial class ContainerClient
3131
// - Used a custom pipeline.
3232
// - Demoted the endpoint parameter to be a property in the options class.
3333
/// <summary> Initializes a new instance of <see cref="ContainerClient"/>. </summary>
34-
/// <param name="credential"> The API key to authenticate with the service. </param>
34+
/// <param name="credential"> The <see cref="ApiKeyCredential"/> to authenticate with the service. </param>
3535
/// <param name="options"> The options to configure the client. </param>
3636
/// <exception cref="ArgumentNullException"> <paramref name="credential"/> is null. </exception>
3737
public ContainerClient(ApiKeyCredential credential, OpenAIClientOptions options) : this(OpenAIClient.CreateApiKeyAuthenticationPolicy(credential), options)

0 commit comments

Comments
 (0)