From 713e89e5839b691fc4b5108e2ff2ab27bacbea5c Mon Sep 17 00:00:00 2001 From: Krzysztof Cwalina Date: Fri, 25 Jul 2025 15:10:02 -0700 Subject: [PATCH 1/2] added .Model properties to clients that store it currently as a private filed --- src/Custom/Audio/AudioClient.cs | 5 +++++ src/Custom/Chat/ChatClient.cs | 5 +++++ src/Custom/Embeddings/EmbeddingClient.cs | 5 +++++ src/Custom/Images/ImageClient.cs | 5 +++++ src/Custom/Moderations/ModerationClient.cs | 5 +++++ src/Custom/Responses/OpenAIResponseClient.cs | 5 +++++ 6 files changed, 30 insertions(+) diff --git a/src/Custom/Audio/AudioClient.cs b/src/Custom/Audio/AudioClient.cs index 19dc6524c..7563d15a8 100644 --- a/src/Custom/Audio/AudioClient.cs +++ b/src/Custom/Audio/AudioClient.cs @@ -88,6 +88,11 @@ protected internal AudioClient(ClientPipeline pipeline, string model, OpenAIClie _endpoint = OpenAIClient.GetEndpoint(options); } + /// + /// Gets the name of the model used in requests sent to the service. + /// + public string Model => _model; + #region GenerateSpeech /// Generates a life-like, spoken audio recording of the input text. diff --git a/src/Custom/Chat/ChatClient.cs b/src/Custom/Chat/ChatClient.cs index f88d4bfe8..6f2a87378 100644 --- a/src/Custom/Chat/ChatClient.cs +++ b/src/Custom/Chat/ChatClient.cs @@ -102,6 +102,11 @@ protected internal ChatClient(ClientPipeline pipeline, string model, OpenAIClien _telemetry = new OpenTelemetrySource(model, _endpoint); } + /// + /// Gets the name of the model used in requests sent to the service. + /// + public string Model => _model; + /// Generates a completion for the given chat. /// The messages comprising the chat so far. /// The options to configure the chat completion. diff --git a/src/Custom/Embeddings/EmbeddingClient.cs b/src/Custom/Embeddings/EmbeddingClient.cs index cbcd05556..cf99c7405 100644 --- a/src/Custom/Embeddings/EmbeddingClient.cs +++ b/src/Custom/Embeddings/EmbeddingClient.cs @@ -89,6 +89,11 @@ protected internal EmbeddingClient(ClientPipeline pipeline, string model, OpenAI _endpoint = OpenAIClient.GetEndpoint(options); } + /// + /// Gets the name of the model used in requests sent to the service. + /// + public string Model => _model; + // CUSTOM: Added to simplify generating a single embedding from a string input. /// Generates an embedding representing the text input. /// The text input to generate an embedding for. diff --git a/src/Custom/Images/ImageClient.cs b/src/Custom/Images/ImageClient.cs index b66b3b86c..b18629061 100644 --- a/src/Custom/Images/ImageClient.cs +++ b/src/Custom/Images/ImageClient.cs @@ -86,6 +86,11 @@ protected internal ImageClient(ClientPipeline pipeline, string model, OpenAIClie Pipeline = pipeline; _endpoint = OpenAIClient.GetEndpoint(options); } + + /// + /// Gets the name of the model used in requests sent to the service. + /// + public string Model => _model; #region GenerateImages diff --git a/src/Custom/Moderations/ModerationClient.cs b/src/Custom/Moderations/ModerationClient.cs index adfe5eafa..e450ec874 100644 --- a/src/Custom/Moderations/ModerationClient.cs +++ b/src/Custom/Moderations/ModerationClient.cs @@ -89,6 +89,11 @@ protected internal ModerationClient(ClientPipeline pipeline, string model, OpenA _endpoint = OpenAIClient.GetEndpoint(options); } + /// + /// Gets the name of the model used in requests sent to the service. + /// + public string Model => _model; + /// Classifies if the text input is potentially harmful across several categories. /// The text input to classify. /// A token that can be used to cancel this method call. diff --git a/src/Custom/Responses/OpenAIResponseClient.cs b/src/Custom/Responses/OpenAIResponseClient.cs index 6c013eb2d..3877e6458 100644 --- a/src/Custom/Responses/OpenAIResponseClient.cs +++ b/src/Custom/Responses/OpenAIResponseClient.cs @@ -93,6 +93,11 @@ protected internal OpenAIResponseClient(ClientPipeline pipeline, string model, O _endpoint = OpenAIClient.GetEndpoint(options); } + /// + /// Gets the name of the model used in requests sent to the service. + /// + public string Model => _model; + public virtual async Task> CreateResponseAsync(IEnumerable inputItems, ResponseCreationOptions options = null, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(inputItems, nameof(inputItems)); From 14118663d7fbf09c0b610dad1f20fbb99904a709 Mon Sep 17 00:00:00 2001 From: Krzysztof Cwalina Date: Mon, 28 Jul 2025 16:06:50 -0700 Subject: [PATCH 2/2] for now removing model property from responses --- src/Custom/Responses/OpenAIResponseClient.cs | 5 ----- 1 file changed, 5 deletions(-) diff --git a/src/Custom/Responses/OpenAIResponseClient.cs b/src/Custom/Responses/OpenAIResponseClient.cs index 3877e6458..6c013eb2d 100644 --- a/src/Custom/Responses/OpenAIResponseClient.cs +++ b/src/Custom/Responses/OpenAIResponseClient.cs @@ -93,11 +93,6 @@ protected internal OpenAIResponseClient(ClientPipeline pipeline, string model, O _endpoint = OpenAIClient.GetEndpoint(options); } - /// - /// Gets the name of the model used in requests sent to the service. - /// - public string Model => _model; - public virtual async Task> CreateResponseAsync(IEnumerable inputItems, ResponseCreationOptions options = null, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(inputItems, nameof(inputItems));