Skip to content

Commit 713e89e

Browse files
added .Model properties to clients that store it currently as a private filed
1 parent 5b5f6f6 commit 713e89e

File tree

6 files changed

+30
-0
lines changed

6 files changed

+30
-0
lines changed

src/Custom/Audio/AudioClient.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,11 @@ protected internal AudioClient(ClientPipeline pipeline, string model, OpenAIClie
8888
_endpoint = OpenAIClient.GetEndpoint(options);
8989
}
9090

91+
/// <summary>
92+
/// Gets the name of the model used in requests sent to the service.
93+
/// </summary>
94+
public string Model => _model;
95+
9196
#region GenerateSpeech
9297

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

src/Custom/Chat/ChatClient.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,11 @@ protected internal ChatClient(ClientPipeline pipeline, string model, OpenAIClien
102102
_telemetry = new OpenTelemetrySource(model, _endpoint);
103103
}
104104

105+
/// <summary>
106+
/// Gets the name of the model used in requests sent to the service.
107+
/// </summary>
108+
public string Model => _model;
109+
105110
/// <summary> Generates a completion for the given chat. </summary>
106111
/// <param name="messages"> The messages comprising the chat so far. </param>
107112
/// <param name="options"> The options to configure the chat completion. </param>

src/Custom/Embeddings/EmbeddingClient.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,11 @@ protected internal EmbeddingClient(ClientPipeline pipeline, string model, OpenAI
8989
_endpoint = OpenAIClient.GetEndpoint(options);
9090
}
9191

92+
/// <summary>
93+
/// Gets the name of the model used in requests sent to the service.
94+
/// </summary>
95+
public string Model => _model;
96+
9297
// CUSTOM: Added to simplify generating a single embedding from a string input.
9398
/// <summary> Generates an embedding representing the text input. </summary>
9499
/// <param name="input"> The text input to generate an embedding for. </param>

src/Custom/Images/ImageClient.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,11 @@ protected internal ImageClient(ClientPipeline pipeline, string model, OpenAIClie
8686
Pipeline = pipeline;
8787
_endpoint = OpenAIClient.GetEndpoint(options);
8888
}
89+
90+
/// <summary>
91+
/// Gets the name of the model used in requests sent to the service.
92+
/// </summary>
93+
public string Model => _model;
8994

9095
#region GenerateImages
9196

src/Custom/Moderations/ModerationClient.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,11 @@ protected internal ModerationClient(ClientPipeline pipeline, string model, OpenA
8989
_endpoint = OpenAIClient.GetEndpoint(options);
9090
}
9191

92+
/// <summary>
93+
/// Gets the name of the model used in requests sent to the service.
94+
/// </summary>
95+
public string Model => _model;
96+
9297
/// <summary> Classifies if the text input is potentially harmful across several categories. </summary>
9398
/// <param name="input"> The text input to classify. </param>
9499
/// <param name="cancellationToken"> A token that can be used to cancel this method call. </param>

src/Custom/Responses/OpenAIResponseClient.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,11 @@ protected internal OpenAIResponseClient(ClientPipeline pipeline, string model, O
9393
_endpoint = OpenAIClient.GetEndpoint(options);
9494
}
9595

96+
/// <summary>
97+
/// Gets the name of the model used in requests sent to the service.
98+
/// </summary>
99+
public string Model => _model;
100+
96101
public virtual async Task<ClientResult<OpenAIResponse>> CreateResponseAsync(IEnumerable<ResponseItem> inputItems, ResponseCreationOptions options = null, CancellationToken cancellationToken = default)
97102
{
98103
Argument.AssertNotNullOrEmpty(inputItems, nameof(inputItems));

0 commit comments

Comments
 (0)