Skip to content

Commit 94c345e

Browse files
committed
Add Endpoint property
1 parent a15aaad commit 94c345e

File tree

18 files changed

+265
-4
lines changed

18 files changed

+265
-4
lines changed

src/Custom/Assistants/AssistantClient.cs

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,13 @@ public AssistantClient(AuthenticationPolicy authenticationPolicy, OpenAIClientOp
8383
_threadSubClient = new(Pipeline, options);
8484
}
8585

86+
/// <summary>
87+
/// Gets the endpoint URI for the service.
88+
/// </summary>
89+
[Experimental("OPENAI001")]
90+
public Uri Endpoint => _endpoint;
91+
92+
8693
// CUSTOM:
8794
// - Used a custom pipeline.
8895
// - Demoted the endpoint parameter to be a property in the options class.
@@ -114,7 +121,7 @@ public virtual async Task<ClientResult<Assistant>> CreateAssistantAsync(string m
114121
options ??= new();
115122
options.Model = model;
116123

117-
ClientResult protocolResult = await CreateAssistantAsync(options?.ToBinaryContent(), cancellationToken.ToRequestOptions()).ConfigureAwait(false);
124+
ClientResult protocolResult = await CreateAssistantAsync(options?.ToBinaryContent(), cancellationToken.ToRequestOptions()).ConfigureAwait(false);
118125
return ClientResult.FromValue((Assistant)protocolResult, protocolResult.GetRawResponse());
119126
}
120127

@@ -130,7 +137,7 @@ public virtual ClientResult<Assistant> CreateAssistant(string model, AssistantCr
130137
options.Model = model;
131138

132139
ClientResult protocolResult = CreateAssistant(options?.ToBinaryContent(), cancellationToken.ToRequestOptions());
133-
return ClientResult.FromValue((Assistant)protocolResult, protocolResult.GetRawResponse());
140+
return ClientResult.FromValue((Assistant)protocolResult, protocolResult.GetRawResponse());
134141
}
135142

136143
/// <summary>
@@ -319,7 +326,7 @@ public virtual ClientResult<AssistantDeletionResult> DeleteAssistant(string assi
319326
public virtual async Task<ClientResult<AssistantThread>> CreateThreadAsync(ThreadCreationOptions options = null, CancellationToken cancellationToken = default)
320327
{
321328
ClientResult protocolResult = await CreateThreadAsync(options?.ToBinaryContent(), cancellationToken.ToRequestOptions()).ConfigureAwait(false);
322-
return ClientResult.FromValue((AssistantThread)protocolResult, protocolResult.GetRawResponse());;
329+
return ClientResult.FromValue((AssistantThread)protocolResult, protocolResult.GetRawResponse()); ;
323330
}
324331

325332
/// <summary>
@@ -717,7 +724,7 @@ public virtual ClientResult<ThreadRun> CreateRun(string threadId, string assista
717724
options.Stream = null;
718725

719726
ClientResult protocolResult = CreateRun(threadId, options?.ToBinaryContent(), cancellationToken.ToRequestOptions());
720-
return ClientResult.FromValue((ThreadRun)protocolResult, protocolResult.GetRawResponse());
727+
return ClientResult.FromValue((ThreadRun)protocolResult, protocolResult.GetRawResponse());
721728
}
722729

723730
/// <summary>

src/Custom/Audio/AudioClient.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,12 @@ protected internal AudioClient(ClientPipeline pipeline, string model, OpenAIClie
116116
[Experimental("OPENAI001")]
117117
public string Model => _model;
118118

119+
/// <summary>
120+
/// Gets the endpoint URI for the service.
121+
/// </summary>
122+
[Experimental("OPENAI001")]
123+
public Uri Endpoint => _endpoint;
124+
119125
#region GenerateSpeech
120126

121127
/// <summary> Generates a life-like, spoken audio recording of the input text. </summary>

src/Custom/Batch/BatchClient.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,12 @@ protected internal BatchClient(ClientPipeline pipeline, OpenAIClientOptions opti
9595
_endpoint = OpenAIClient.GetEndpoint(options);
9696
}
9797

98+
/// <summary>
99+
/// Gets the endpoint URI for the service.
100+
/// </summary>
101+
[Experimental("OPENAI001")]
102+
public Uri Endpoint => _endpoint;
103+
98104
internal virtual CreateBatchOperation CreateCreateBatchOperation(string batchId, string status, PipelineResponse response)
99105
{
100106
return new CreateBatchOperation(this, _endpoint, batchId, status, response);

src/Custom/Chat/ChatClient.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,12 @@ protected internal ChatClient(ClientPipeline pipeline, string model, OpenAIClien
124124
[Experimental("OPENAI001")]
125125
public string Model => _model;
126126

127+
/// <summary>
128+
/// Gets the endpoint URI for the service.
129+
/// </summary>
130+
[Experimental("OPENAI001")]
131+
public Uri Endpoint => _endpoint;
132+
127133
/// <summary> Generates a completion for the given chat. </summary>
128134
/// <param name="messages"> The messages comprising the chat so far. </param>
129135
/// <param name="options"> The options to configure the chat completion. </param>

src/Custom/Containers/ContainerClient.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,4 +77,10 @@ protected internal ContainerClient(ClientPipeline pipeline, OpenAIClientOptions
7777
_endpoint = OpenAIClient.GetEndpoint(options);
7878
}
7979

80+
/// <summary>
81+
/// Gets the endpoint URI for the service.
82+
/// </summary>
83+
[Experimental("OPENAI001")]
84+
public Uri Endpoint => _endpoint;
85+
8086
}

src/Custom/Embeddings/EmbeddingClient.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,12 @@ protected internal EmbeddingClient(ClientPipeline pipeline, string model, OpenAI
119119
[Experimental("OPENAI001")]
120120
public string Model => _model;
121121

122+
/// <summary>
123+
/// Gets the endpoint URI for the service.
124+
/// </summary>
125+
[Experimental("OPENAI001")]
126+
public Uri Endpoint => _endpoint;
127+
122128
// CUSTOM: Added to simplify generating a single embedding from a string input.
123129
/// <summary> Generates an embedding representing the text input. </summary>
124130
/// <param name="input"> The text input to generate an embedding for. </param>

src/Custom/Evals/EvaluationClient.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
using System;
12
using System.ClientModel;
23
using System.ClientModel.Primitives;
34
using System.Diagnostics.CodeAnalysis;
@@ -97,4 +98,10 @@ protected internal EvaluationClient(ClientPipeline pipeline, OpenAIClientOptions
9798
Pipeline = pipeline;
9899
_endpoint = OpenAIClient.GetEndpoint(options);
99100
}
101+
102+
/// <summary>
103+
/// Gets the endpoint URI for the service.
104+
/// </summary>
105+
[Experimental("OPENAI001")]
106+
public Uri Endpoint => _endpoint;
100107
}

src/Custom/Files/OpenAIFileClient.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,12 @@ protected internal OpenAIFileClient(ClientPipeline pipeline, OpenAIClientOptions
9494
_internalUploadsClient = new(pipeline, options);
9595
}
9696

97+
/// <summary>
98+
/// Gets the endpoint URI for the service.
99+
/// </summary>
100+
[Experimental("OPENAI001")]
101+
public Uri Endpoint => _endpoint;
102+
97103
/// <summary> Uploads a file that can be used across various operations. </summary>
98104
/// <remarks> Individual files can be up to 512 MB, and the size of all files uploaded by one organization can be up to 100 GB. </remarks>
99105
/// <param name="file"> The file stream to upload. </param>

src/Custom/FineTuning/FineTuningClient.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,12 @@ protected internal FineTuningClient(ClientPipeline pipeline, Uri endpoint)
123123
_endpoint = endpoint;
124124
}
125125

126+
/// <summary>
127+
/// Gets the endpoint URI for the service.
128+
/// </summary>
129+
[Experimental("OPENAI001")]
130+
public Uri Endpoint => _endpoint;
131+
126132
/// <summary> Creates a job with a training file and base model. </summary>
127133
/// <param name="baseModel"> The original model to use as a starting base to fine-tune. String such as "gpt-3.5-turbo" </param>
128134
/// <param name="trainingFileId"> The training file Id that is already uploaded. String should match pattern '^file-[a-zA-Z0-9]{24}$'. </param>

src/Custom/Graders/GraderClient.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,4 +76,10 @@ protected internal GraderClient(ClientPipeline pipeline, OpenAIClientOptions opt
7676
Pipeline = pipeline;
7777
_endpoint = OpenAIClient.GetEndpoint(options);
7878
}
79+
80+
/// <summary>
81+
/// Gets the endpoint URI for the service.
82+
/// </summary>
83+
[Experimental("OPENAI001")]
84+
public Uri Endpoint => _endpoint;
7985
}

0 commit comments

Comments
 (0)