From e023763288a1909373f16fff917466cfe876586b Mon Sep 17 00:00:00 2001 From: Lezune Date: Tue, 28 May 2024 21:06:41 -0700 Subject: [PATCH 001/283] Updated AudioTranscriptionServiceException class by removing constructors in which the error message was hard coded in. Updated all relevant service files to include message. --- .../Exceptions/AudioTranscriptionServiceException.cs | 6 ------ .../AudioTranscriptionService.Exceptions.cs | 4 +++- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/Standard.AI.OpenAI/Models/Services/Foundations/AudioTranscriptions/Exceptions/AudioTranscriptionServiceException.cs b/Standard.AI.OpenAI/Models/Services/Foundations/AudioTranscriptions/Exceptions/AudioTranscriptionServiceException.cs index 01b40e4d..75782ddb 100644 --- a/Standard.AI.OpenAI/Models/Services/Foundations/AudioTranscriptions/Exceptions/AudioTranscriptionServiceException.cs +++ b/Standard.AI.OpenAI/Models/Services/Foundations/AudioTranscriptions/Exceptions/AudioTranscriptionServiceException.cs @@ -10,12 +10,6 @@ namespace Standard.AI.OpenAI.Models.Services.Foundations.AudioTranscriptions.Exc #pragma warning disable RCS1194 // Implement exception constructors. public class AudioTranscriptionServiceException : Xeption { - public AudioTranscriptionServiceException(Exception innerException) - : base( - message: "Audio transcription service error occurred, contact support.", - innerException: innerException) - { } - public AudioTranscriptionServiceException(string message, Exception innerException) : base(message, innerException) { } diff --git a/Standard.AI.OpenAI/Services/Foundations/AudioTranscriptions/AudioTranscriptionService.Exceptions.cs b/Standard.AI.OpenAI/Services/Foundations/AudioTranscriptions/AudioTranscriptionService.Exceptions.cs index 0a729e95..02c08012 100644 --- a/Standard.AI.OpenAI/Services/Foundations/AudioTranscriptions/AudioTranscriptionService.Exceptions.cs +++ b/Standard.AI.OpenAI/Services/Foundations/AudioTranscriptions/AudioTranscriptionService.Exceptions.cs @@ -69,7 +69,9 @@ private static async ValueTask TryCatch( var failedAudioTranscriptionServiceException = new FailedAudioTranscriptionServiceException(exception); - throw new AudioTranscriptionServiceException(failedAudioTranscriptionServiceException); + throw new AudioTranscriptionServiceException( + message: "Audio transcription service error occurred, contact support.", + failedAudioTranscriptionServiceException); } } } From 56673820764428a8312de6196d791fec2d76fd24 Mon Sep 17 00:00:00 2001 From: Lezune Date: Tue, 28 May 2024 21:20:10 -0700 Subject: [PATCH 002/283] Updated AudioTranscriptionValidationException class by removing constructors in which the error message was hard coded in. Updated all relevant service files to include message. --- .../Exceptions/AudioTranscriptionValidationException.cs | 6 ------ .../AudioTranscriptionService.Exceptions.cs | 8 ++++++-- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/Standard.AI.OpenAI/Models/Services/Foundations/AudioTranscriptions/Exceptions/AudioTranscriptionValidationException.cs b/Standard.AI.OpenAI/Models/Services/Foundations/AudioTranscriptions/Exceptions/AudioTranscriptionValidationException.cs index 3f4d19f4..4f43aa1b 100644 --- a/Standard.AI.OpenAI/Models/Services/Foundations/AudioTranscriptions/Exceptions/AudioTranscriptionValidationException.cs +++ b/Standard.AI.OpenAI/Models/Services/Foundations/AudioTranscriptions/Exceptions/AudioTranscriptionValidationException.cs @@ -9,12 +9,6 @@ namespace Standard.AI.OpenAI.Models.Services.Foundations.AudioTranscriptions.Exc #pragma warning disable RCS1194 // Implement exception constructors. public class AudioTranscriptionValidationException : Xeption { - public AudioTranscriptionValidationException(Xeption innerException) - : base( - message: "Audio transcription validation error occurred, fix errors and try again.", - innerException: innerException) - { } - public AudioTranscriptionValidationException(string message, Xeption innerException) : base(message, innerException) { } diff --git a/Standard.AI.OpenAI/Services/Foundations/AudioTranscriptions/AudioTranscriptionService.Exceptions.cs b/Standard.AI.OpenAI/Services/Foundations/AudioTranscriptions/AudioTranscriptionService.Exceptions.cs index 0a729e95..f0a65e9e 100644 --- a/Standard.AI.OpenAI/Services/Foundations/AudioTranscriptions/AudioTranscriptionService.Exceptions.cs +++ b/Standard.AI.OpenAI/Services/Foundations/AudioTranscriptions/AudioTranscriptionService.Exceptions.cs @@ -23,11 +23,15 @@ private static async ValueTask TryCatch( } catch (NullAudioTranscriptionException nullAudioTranscriptionException) { - throw new AudioTranscriptionValidationException(nullAudioTranscriptionException); + throw new AudioTranscriptionValidationException( + message: "Audio transcription validation error occurred, fix errors and try again.", + nullAudioTranscriptionException); } catch (InvalidAudioTranscriptionException invalidAudioTranscriptionException) { - throw new AudioTranscriptionValidationException(invalidAudioTranscriptionException); + throw new AudioTranscriptionValidationException( + message: "Audio transcription validation error occurred, fix errors and try again.", + invalidAudioTranscriptionException); } catch (HttpResponseUrlNotFoundException httpResponseUrlNotFoundException) { From 0d13c07effa9091907664efc4c707655f7cda1c0 Mon Sep 17 00:00:00 2001 From: Lezune Date: Tue, 28 May 2024 21:36:47 -0700 Subject: [PATCH 003/283] Updated FailedAudioTranscriptionServiceException class by removing constructors in which the error message was hard coded in. Updated all relevant service files to include message. --- .../Exceptions/FailedAudioTranscriptionServiceException.cs | 6 ------ .../AudioTranscriptionService.Exceptions.cs | 4 +++- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/Standard.AI.OpenAI/Models/Services/Foundations/AudioTranscriptions/Exceptions/FailedAudioTranscriptionServiceException.cs b/Standard.AI.OpenAI/Models/Services/Foundations/AudioTranscriptions/Exceptions/FailedAudioTranscriptionServiceException.cs index f84284b7..e3f90e47 100644 --- a/Standard.AI.OpenAI/Models/Services/Foundations/AudioTranscriptions/Exceptions/FailedAudioTranscriptionServiceException.cs +++ b/Standard.AI.OpenAI/Models/Services/Foundations/AudioTranscriptions/Exceptions/FailedAudioTranscriptionServiceException.cs @@ -10,12 +10,6 @@ namespace Standard.AI.OpenAI.Models.Services.Foundations.AudioTranscriptions.Exc #pragma warning disable RCS1194 // Implement exception constructors. public class FailedAudioTranscriptionServiceException : Xeption { - public FailedAudioTranscriptionServiceException(Exception innerException) - : base( - message: "Failed Audio Transcription Service Exception occurred, please contact support for assistance.", - innerException: innerException) - { } - public FailedAudioTranscriptionServiceException(string message, Exception innerException) : base(message, innerException) { } diff --git a/Standard.AI.OpenAI/Services/Foundations/AudioTranscriptions/AudioTranscriptionService.Exceptions.cs b/Standard.AI.OpenAI/Services/Foundations/AudioTranscriptions/AudioTranscriptionService.Exceptions.cs index 0a729e95..14f7f286 100644 --- a/Standard.AI.OpenAI/Services/Foundations/AudioTranscriptions/AudioTranscriptionService.Exceptions.cs +++ b/Standard.AI.OpenAI/Services/Foundations/AudioTranscriptions/AudioTranscriptionService.Exceptions.cs @@ -67,7 +67,9 @@ private static async ValueTask TryCatch( catch (Exception exception) { var failedAudioTranscriptionServiceException = - new FailedAudioTranscriptionServiceException(exception); + new FailedAudioTranscriptionServiceException( + message: "Failed Audio Transcription Service Exception occurred, please contact support for assistance.", + exception); throw new AudioTranscriptionServiceException(failedAudioTranscriptionServiceException); } From cdd7bf4d8cf8f7572e12f81e21b8214f51542ab5 Mon Sep 17 00:00:00 2001 From: Lezune Date: Tue, 28 May 2024 21:51:55 -0700 Subject: [PATCH 004/283] Updated InvalidAudioTranscriptionException class by removing constructors in which the error message was hard coded in. Updated all relevant service files to include message. --- ...AudioTranscriptionServiceTests.Validations.Send.cs | 6 ++++-- .../Exceptions/InvalidAudioTranscriptionException.cs | 11 ++--------- .../AudioTranscriptionService.Exceptions.cs | 4 +++- .../AudioTranscriptionService.Validations.cs | 3 ++- 4 files changed, 11 insertions(+), 13 deletions(-) diff --git a/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/AudioTranscriptions/AudioTranscriptionServiceTests.Validations.Send.cs b/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/AudioTranscriptions/AudioTranscriptionServiceTests.Validations.Send.cs index 3f58eccf..3c0613ab 100644 --- a/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/AudioTranscriptions/AudioTranscriptionServiceTests.Validations.Send.cs +++ b/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/AudioTranscriptions/AudioTranscriptionServiceTests.Validations.Send.cs @@ -56,7 +56,8 @@ private async Task ShouldThrowValidationExceptionOnSendIfAudioTranscriptionReque Request = null }; - var invalidAudioTranscriptionException = new InvalidAudioTranscriptionException(); + var invalidAudioTranscriptionException = new InvalidAudioTranscriptionException( + message: "Audio transcription is invalid."); invalidAudioTranscriptionException.AddData( key: nameof(AudioTranscription.Request), @@ -103,7 +104,8 @@ private async Task ShouldThrowValidationExceptionOnSendIfAudioTranscriptionReque } }; - var invalidAudioTranscriptionException = new InvalidAudioTranscriptionException(); + var invalidAudioTranscriptionException = new InvalidAudioTranscriptionException( + message: "Audio transcription is invalid."); invalidAudioTranscriptionException.AddData( key: nameof(AudioTranscriptionRequest.FileName), diff --git a/Standard.AI.OpenAI/Models/Services/Foundations/AudioTranscriptions/Exceptions/InvalidAudioTranscriptionException.cs b/Standard.AI.OpenAI/Models/Services/Foundations/AudioTranscriptions/Exceptions/InvalidAudioTranscriptionException.cs index 9646124a..4d65e0b3 100644 --- a/Standard.AI.OpenAI/Models/Services/Foundations/AudioTranscriptions/Exceptions/InvalidAudioTranscriptionException.cs +++ b/Standard.AI.OpenAI/Models/Services/Foundations/AudioTranscriptions/Exceptions/InvalidAudioTranscriptionException.cs @@ -10,15 +10,8 @@ namespace Standard.AI.OpenAI.Models.Services.Foundations.AudioTranscriptions.Exc #pragma warning disable RCS1194 // Implement exception constructors. public class InvalidAudioTranscriptionException : Xeption { - public InvalidAudioTranscriptionException() - : base( - message: "Audio transcription is invalid.") - { } - - public InvalidAudioTranscriptionException(Exception innerException) - : base( - message: "Audio transcription is invalid.", - innerException: innerException) + public InvalidAudioTranscriptionException(string message) + : base(message) { } public InvalidAudioTranscriptionException(string message, Exception innerException) diff --git a/Standard.AI.OpenAI/Services/Foundations/AudioTranscriptions/AudioTranscriptionService.Exceptions.cs b/Standard.AI.OpenAI/Services/Foundations/AudioTranscriptions/AudioTranscriptionService.Exceptions.cs index 0a729e95..98b0f54c 100644 --- a/Standard.AI.OpenAI/Services/Foundations/AudioTranscriptions/AudioTranscriptionService.Exceptions.cs +++ b/Standard.AI.OpenAI/Services/Foundations/AudioTranscriptions/AudioTranscriptionService.Exceptions.cs @@ -53,7 +53,9 @@ private static async ValueTask TryCatch( catch (HttpResponseBadRequestException httpResponseBadRequestException) { var invalidAudioTranscriptionException = - new InvalidAudioTranscriptionException(httpResponseBadRequestException); + new InvalidAudioTranscriptionException( + message: "Audio transcription is invalid.", + httpResponseBadRequestException); throw new AudioTranscriptionDependencyValidationException(invalidAudioTranscriptionException); } diff --git a/Standard.AI.OpenAI/Services/Foundations/AudioTranscriptions/AudioTranscriptionService.Validations.cs b/Standard.AI.OpenAI/Services/Foundations/AudioTranscriptions/AudioTranscriptionService.Validations.cs index 988408ff..8d8c0db0 100644 --- a/Standard.AI.OpenAI/Services/Foundations/AudioTranscriptions/AudioTranscriptionService.Validations.cs +++ b/Standard.AI.OpenAI/Services/Foundations/AudioTranscriptions/AudioTranscriptionService.Validations.cs @@ -48,7 +48,8 @@ private static void ValidateAudioTranscriptionIsNotNull(AudioTranscription audio private static void Validate(params (dynamic Rule, string Parameter)[] validations) { - InvalidAudioTranscriptionException invalidAudioTranscriptionException = new InvalidAudioTranscriptionException(); + InvalidAudioTranscriptionException invalidAudioTranscriptionException = new InvalidAudioTranscriptionException( + message: "Audio transcription is invalid."); foreach ((dynamic rule, string parameter) in validations) { From 4fc50aa639ee8f1f3977ee99e80521f1ae0b4733 Mon Sep 17 00:00:00 2001 From: Lezune Date: Tue, 28 May 2024 21:58:34 -0700 Subject: [PATCH 005/283] Updated InvalidConfigurationAudioTranscriptionException class by removing constructors in which the error message was hard coded in. Updated all relevant service files to include message. --- .../InvalidConfigurationAudioTranscriptionException.cs | 6 ------ .../AudioTranscriptionService.Exceptions.cs | 4 +++- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/Standard.AI.OpenAI/Models/Services/Foundations/AudioTranscriptions/Exceptions/InvalidConfigurationAudioTranscriptionException.cs b/Standard.AI.OpenAI/Models/Services/Foundations/AudioTranscriptions/Exceptions/InvalidConfigurationAudioTranscriptionException.cs index 080b8c12..e16854c6 100644 --- a/Standard.AI.OpenAI/Models/Services/Foundations/AudioTranscriptions/Exceptions/InvalidConfigurationAudioTranscriptionException.cs +++ b/Standard.AI.OpenAI/Models/Services/Foundations/AudioTranscriptions/Exceptions/InvalidConfigurationAudioTranscriptionException.cs @@ -10,12 +10,6 @@ namespace Standard.AI.OpenAI.Models.Services.Foundations.AudioTranscriptions.Exc #pragma warning disable RCS1194 // Implement exception constructors. public class InvalidConfigurationAudioTranscriptionException : Xeption { - public InvalidConfigurationAudioTranscriptionException(Exception innerException) - : base( - message: "Invalid audio transcription configuration error occurred, contact support.", - innerException: innerException) - { } - public InvalidConfigurationAudioTranscriptionException(string message, Exception innerException) : base(message, innerException) { } diff --git a/Standard.AI.OpenAI/Services/Foundations/AudioTranscriptions/AudioTranscriptionService.Exceptions.cs b/Standard.AI.OpenAI/Services/Foundations/AudioTranscriptions/AudioTranscriptionService.Exceptions.cs index 0a729e95..63444490 100644 --- a/Standard.AI.OpenAI/Services/Foundations/AudioTranscriptions/AudioTranscriptionService.Exceptions.cs +++ b/Standard.AI.OpenAI/Services/Foundations/AudioTranscriptions/AudioTranscriptionService.Exceptions.cs @@ -32,7 +32,9 @@ private static async ValueTask TryCatch( catch (HttpResponseUrlNotFoundException httpResponseUrlNotFoundException) { var invalidConfigurationAudioTranscriptionException = - new InvalidConfigurationAudioTranscriptionException(httpResponseUrlNotFoundException); + new InvalidConfigurationAudioTranscriptionException( + message: "Invalid audio transcription configuration error occurred, contact support.", + httpResponseUrlNotFoundException); throw new AudioTranscriptionDependencyException(invalidConfigurationAudioTranscriptionException); } From 5cf9dd503b075f3f04e6db3cdefdcecf5e3dd1f2 Mon Sep 17 00:00:00 2001 From: Lezune Date: Tue, 28 May 2024 22:09:27 -0700 Subject: [PATCH 006/283] Updated NullAudioTranscriptionException class by removing constructors in which the error message was hard coded in. Updated all relevant service files to include message. --- .../AudioTranscriptionServiceTests.Validations.Send.cs | 3 ++- .../Exceptions/NullAudioTranscriptionException.cs | 5 ++--- .../AudioTranscriptionService.Validations.cs | 3 ++- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/AudioTranscriptions/AudioTranscriptionServiceTests.Validations.Send.cs b/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/AudioTranscriptions/AudioTranscriptionServiceTests.Validations.Send.cs index 3f58eccf..839e46c2 100644 --- a/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/AudioTranscriptions/AudioTranscriptionServiceTests.Validations.Send.cs +++ b/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/AudioTranscriptions/AudioTranscriptionServiceTests.Validations.Send.cs @@ -20,7 +20,8 @@ private async Task ShouldThrowValidationExceptionOnSendIfAudioTranscriptionIsNul // given AudioTranscription audioTranscription = null; - var nullAudioTranscriptionException = new NullAudioTranscriptionException(); + var nullAudioTranscriptionException = new NullAudioTranscriptionException( + message: "Audio transcription is null."); var exceptedAudioTranscriptionValidationException = new AudioTranscriptionValidationException( diff --git a/Standard.AI.OpenAI/Models/Services/Foundations/AudioTranscriptions/Exceptions/NullAudioTranscriptionException.cs b/Standard.AI.OpenAI/Models/Services/Foundations/AudioTranscriptions/Exceptions/NullAudioTranscriptionException.cs index 244fb1a0..c6a7d0cb 100644 --- a/Standard.AI.OpenAI/Models/Services/Foundations/AudioTranscriptions/Exceptions/NullAudioTranscriptionException.cs +++ b/Standard.AI.OpenAI/Models/Services/Foundations/AudioTranscriptions/Exceptions/NullAudioTranscriptionException.cs @@ -9,9 +9,8 @@ namespace Standard.AI.OpenAI.Models.Services.Foundations.AudioTranscriptions.Exc #pragma warning disable RCS1194 // Implement exception constructors. public class NullAudioTranscriptionException : Xeption { - public NullAudioTranscriptionException() - : base( - message: "Audio transcription is null.") + public NullAudioTranscriptionException(string message) + : base(message) { } public NullAudioTranscriptionException(string message, Xeption innerException) diff --git a/Standard.AI.OpenAI/Services/Foundations/AudioTranscriptions/AudioTranscriptionService.Validations.cs b/Standard.AI.OpenAI/Services/Foundations/AudioTranscriptions/AudioTranscriptionService.Validations.cs index 988408ff..6ae3ea5e 100644 --- a/Standard.AI.OpenAI/Services/Foundations/AudioTranscriptions/AudioTranscriptionService.Validations.cs +++ b/Standard.AI.OpenAI/Services/Foundations/AudioTranscriptions/AudioTranscriptionService.Validations.cs @@ -30,7 +30,8 @@ private static void ValidateAudioTranscriptionIsNotNull(AudioTranscription audio { if (audioTranscription is null) { - throw new NullAudioTranscriptionException(); + throw new NullAudioTranscriptionException( + message: "Audio transcription is null."); } } From fd7bcb94e4c12f98f20cd1e5997dca59385d5808 Mon Sep 17 00:00:00 2001 From: Lezune Date: Tue, 28 May 2024 22:14:53 -0700 Subject: [PATCH 007/283] Updated UnauthorizedAudioTranscriptionException class by removing constructors in which the error message was hard coded in. Updated all relevant service files to include message. --- .../UnauthorizedAudioTranscriptionException.cs | 6 ------ .../AudioTranscriptionService.Exceptions.cs | 9 ++++++--- 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/Standard.AI.OpenAI/Models/Services/Foundations/AudioTranscriptions/Exceptions/UnauthorizedAudioTranscriptionException.cs b/Standard.AI.OpenAI/Models/Services/Foundations/AudioTranscriptions/Exceptions/UnauthorizedAudioTranscriptionException.cs index e976adb7..a6c5d041 100644 --- a/Standard.AI.OpenAI/Models/Services/Foundations/AudioTranscriptions/Exceptions/UnauthorizedAudioTranscriptionException.cs +++ b/Standard.AI.OpenAI/Models/Services/Foundations/AudioTranscriptions/Exceptions/UnauthorizedAudioTranscriptionException.cs @@ -10,12 +10,6 @@ namespace Standard.AI.OpenAI.Models.Services.Foundations.AudioTranscriptions.Exc #pragma warning disable RCS1194 // Implement exception constructors. public class UnauthorizedAudioTranscriptionException : Xeption { - public UnauthorizedAudioTranscriptionException(Exception innerException) - : base( - message: "Unauthorized audio transcription request, fix errors and try again.", - innerException: innerException) - { } - public UnauthorizedAudioTranscriptionException(string message, Exception innerException) : base(message, innerException) { } diff --git a/Standard.AI.OpenAI/Services/Foundations/AudioTranscriptions/AudioTranscriptionService.Exceptions.cs b/Standard.AI.OpenAI/Services/Foundations/AudioTranscriptions/AudioTranscriptionService.Exceptions.cs index 0a729e95..77c757df 100644 --- a/Standard.AI.OpenAI/Services/Foundations/AudioTranscriptions/AudioTranscriptionService.Exceptions.cs +++ b/Standard.AI.OpenAI/Services/Foundations/AudioTranscriptions/AudioTranscriptionService.Exceptions.cs @@ -39,14 +39,17 @@ private static async ValueTask TryCatch( catch (HttpResponseUnauthorizedException httpResponseUnauthorizedException) { var unauthorizedAudioTranscriptionException = - new UnauthorizedAudioTranscriptionException(httpResponseUnauthorizedException); + new UnauthorizedAudioTranscriptionException( + message: "Unauthorized audio transcription request, fix errors and try again.", + httpResponseUnauthorizedException); throw new AudioTranscriptionDependencyException(unauthorizedAudioTranscriptionException); } catch (HttpResponseForbiddenException httpResponseForbiddenException) { - var unauthorizedAudioTranscriptionException = - new UnauthorizedAudioTranscriptionException(httpResponseForbiddenException); + var unauthorizedAudioTranscriptionException = new UnauthorizedAudioTranscriptionException( + message: "Unauthorized audio transcription request, fix errors and try again.", + httpResponseForbiddenException); throw new AudioTranscriptionDependencyException(unauthorizedAudioTranscriptionException); } From bed3dd330927df2ffb2891adad2d9d27d3e34b97 Mon Sep 17 00:00:00 2001 From: Lezune Date: Wed, 29 May 2024 19:49:46 -0700 Subject: [PATCH 008/283] Updated ChatCompletionDependencyException class by removing constructors in which the error message was hard coded in. Updated all relevant service files to include message. --- .../ChatCompletionDependencyException.cs | 6 ------ .../ChatCompletionService.Exceptions.cs | 16 ++++++++++++---- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/Standard.AI.OpenAI/Models/Services/Foundations/ChatCompletions/Exceptions/ChatCompletionDependencyException.cs b/Standard.AI.OpenAI/Models/Services/Foundations/ChatCompletions/Exceptions/ChatCompletionDependencyException.cs index dbe8db33..339c5dd2 100644 --- a/Standard.AI.OpenAI/Models/Services/Foundations/ChatCompletions/Exceptions/ChatCompletionDependencyException.cs +++ b/Standard.AI.OpenAI/Models/Services/Foundations/ChatCompletions/Exceptions/ChatCompletionDependencyException.cs @@ -8,12 +8,6 @@ namespace Standard.AI.OpenAI.Models.Services.Foundations.ChatCompletions.Excepti { public class ChatCompletionDependencyException : Xeption { - public ChatCompletionDependencyException(Xeption innerException) - : base( - message: "Chat completion dependency error occurred, contact support.", - innerException: innerException) - { } - public ChatCompletionDependencyException(string message, Xeption innerException) : base(message, innerException) { } diff --git a/Standard.AI.OpenAI/Services/Foundations/ChatCompletions/ChatCompletionService.Exceptions.cs b/Standard.AI.OpenAI/Services/Foundations/ChatCompletions/ChatCompletionService.Exceptions.cs index e753f46e..bed4e541 100644 --- a/Standard.AI.OpenAI/Services/Foundations/ChatCompletions/ChatCompletionService.Exceptions.cs +++ b/Standard.AI.OpenAI/Services/Foundations/ChatCompletions/ChatCompletionService.Exceptions.cs @@ -33,21 +33,27 @@ private async ValueTask TryCatch(ReturningChatCompletionFunction var invalidConfigurationChatCompletionException = new InvalidConfigurationChatCompletionException(httpResponseUrlNotFoundException); - throw new ChatCompletionDependencyException(invalidConfigurationChatCompletionException); + throw new ChatCompletionDependencyException( + message: "Chat completion dependency error occurred, contact support.", + invalidConfigurationChatCompletionException); } catch (HttpResponseUnauthorizedException httpResponseUnauthorizedException) { var unauthorizedChatCompletionException = new UnauthorizedChatCompletionException(httpResponseUnauthorizedException); - throw new ChatCompletionDependencyException(unauthorizedChatCompletionException); + throw new ChatCompletionDependencyException( + message: "Chat completion dependency error occurred, contact support.", + unauthorizedChatCompletionException); } catch (HttpResponseForbiddenException httpResponseForbiddenException) { var unauthorizedChatCompletionException = new UnauthorizedChatCompletionException(httpResponseForbiddenException); - throw new ChatCompletionDependencyException(unauthorizedChatCompletionException); + throw new ChatCompletionDependencyException( + message: "Chat completion dependency error occurred, contact support.", + unauthorizedChatCompletionException); } catch (HttpResponseNotFoundException httpResponseNotFoundException) { @@ -75,7 +81,9 @@ private async ValueTask TryCatch(ReturningChatCompletionFunction var failedServerChatCompletionException = new FailedServerChatCompletionException(httpResponseException); - throw new ChatCompletionDependencyException(failedServerChatCompletionException); + throw new ChatCompletionDependencyException( + message: "Chat completion dependency error occurred, contact support.", + failedServerChatCompletionException); } catch (Exception exception) { From 19a68096515d9146acb45f6d5639cb65e059fae7 Mon Sep 17 00:00:00 2001 From: Lezune Date: Wed, 29 May 2024 19:55:06 -0700 Subject: [PATCH 009/283] Updated ChatCompletionDependencyValidationException class by removing constructors in which the error message was hard coded in. Updated all relevant service files to include message. --- .../ChatCompletionDependencyValidationException.cs | 6 ------ .../ChatCompletionService.Exceptions.cs | 12 +++++++++--- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/Standard.AI.OpenAI/Models/Services/Foundations/ChatCompletions/Exceptions/ChatCompletionDependencyValidationException.cs b/Standard.AI.OpenAI/Models/Services/Foundations/ChatCompletions/Exceptions/ChatCompletionDependencyValidationException.cs index 3e8d550c..7b23d6d5 100644 --- a/Standard.AI.OpenAI/Models/Services/Foundations/ChatCompletions/Exceptions/ChatCompletionDependencyValidationException.cs +++ b/Standard.AI.OpenAI/Models/Services/Foundations/ChatCompletions/Exceptions/ChatCompletionDependencyValidationException.cs @@ -8,12 +8,6 @@ namespace Standard.AI.OpenAI.Models.Services.Foundations.ChatCompletions.Excepti { public class ChatCompletionDependencyValidationException : Xeption { - public ChatCompletionDependencyValidationException(Xeption innerException) - : base( - message: "Chat completion dependency validation error occurred, fix errors and try again.", - innerException: innerException) - { } - public ChatCompletionDependencyValidationException(string message, Xeption innerException) : base(message, innerException) { } diff --git a/Standard.AI.OpenAI/Services/Foundations/ChatCompletions/ChatCompletionService.Exceptions.cs b/Standard.AI.OpenAI/Services/Foundations/ChatCompletions/ChatCompletionService.Exceptions.cs index e753f46e..e7a25e5c 100644 --- a/Standard.AI.OpenAI/Services/Foundations/ChatCompletions/ChatCompletionService.Exceptions.cs +++ b/Standard.AI.OpenAI/Services/Foundations/ChatCompletions/ChatCompletionService.Exceptions.cs @@ -54,21 +54,27 @@ private async ValueTask TryCatch(ReturningChatCompletionFunction var notFoundChatCompletionException = new NotFoundChatCompletionException(httpResponseNotFoundException); - throw new ChatCompletionDependencyValidationException(notFoundChatCompletionException); + throw new ChatCompletionDependencyValidationException( + message: "Chat completion dependency validation error occurred, fix errors and try again.", + notFoundChatCompletionException); } catch (HttpResponseBadRequestException httpResponseBadRequestException) { var invalidChatCompletionException = new InvalidChatCompletionException(httpResponseBadRequestException); - throw new ChatCompletionDependencyValidationException(invalidChatCompletionException); + throw new ChatCompletionDependencyValidationException( + message: "Chat completion dependency validation error occurred, fix errors and try again.", + invalidChatCompletionException); } catch (HttpResponseTooManyRequestsException httpResponseTooManyRequestsException) { var excessiveCallChatCompletionException = new ExcessiveCallChatCompletionException(httpResponseTooManyRequestsException); - throw new ChatCompletionDependencyValidationException(excessiveCallChatCompletionException); + throw new ChatCompletionDependencyValidationException( + message: "Chat completion dependency validation error occurred, fix errors and try again.", + excessiveCallChatCompletionException); } catch (HttpResponseException httpResponseException) { From d77e497ef8c1e945e276e87c21d6250e1246ae02 Mon Sep 17 00:00:00 2001 From: Lezune Date: Wed, 29 May 2024 19:59:05 -0700 Subject: [PATCH 010/283] Updated ChatCompletionServiceException class by removing constructors in which the error message was hard coded in. Updated all relevant service files to include message. --- .../Exceptions/ChatCompletionServiceException.cs | 6 ------ .../ChatCompletions/ChatCompletionService.Exceptions.cs | 1 + 2 files changed, 1 insertion(+), 6 deletions(-) diff --git a/Standard.AI.OpenAI/Models/Services/Foundations/ChatCompletions/Exceptions/ChatCompletionServiceException.cs b/Standard.AI.OpenAI/Models/Services/Foundations/ChatCompletions/Exceptions/ChatCompletionServiceException.cs index 4a306a4a..7b724626 100644 --- a/Standard.AI.OpenAI/Models/Services/Foundations/ChatCompletions/Exceptions/ChatCompletionServiceException.cs +++ b/Standard.AI.OpenAI/Models/Services/Foundations/ChatCompletions/Exceptions/ChatCompletionServiceException.cs @@ -9,12 +9,6 @@ namespace Standard.AI.OpenAI.Models.Services.Foundations.ChatCompletions.Excepti { public class ChatCompletionServiceException : Xeption { - public ChatCompletionServiceException(Exception innerException) - : base( - message: "Chat completion service error occurred, contact support.", - innerException: innerException) - { } - public ChatCompletionServiceException(string message, Exception innerException) : base(message, innerException) { } diff --git a/Standard.AI.OpenAI/Services/Foundations/ChatCompletions/ChatCompletionService.Exceptions.cs b/Standard.AI.OpenAI/Services/Foundations/ChatCompletions/ChatCompletionService.Exceptions.cs index e753f46e..6024d7d3 100644 --- a/Standard.AI.OpenAI/Services/Foundations/ChatCompletions/ChatCompletionService.Exceptions.cs +++ b/Standard.AI.OpenAI/Services/Foundations/ChatCompletions/ChatCompletionService.Exceptions.cs @@ -83,6 +83,7 @@ private async ValueTask TryCatch(ReturningChatCompletionFunction new FailedChatCompletionServiceException(exception); throw new ChatCompletionServiceException( + message: "Chat completion service error occurred, contact support.", failedChatCompletionServiceException); } } From 17260c1db83e0262137cc9d57b4fad9d43710054 Mon Sep 17 00:00:00 2001 From: Lezune Date: Wed, 29 May 2024 20:04:32 -0700 Subject: [PATCH 011/283] Updated ChatCompletionValidationException class by removing constructors in which the error message was hard coded in. Updated all relevant service files to include message. --- .../Exceptions/ChatCompletionValidationException.cs | 6 ------ .../ChatCompletions/ChatCompletionService.Exceptions.cs | 8 ++++++-- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/Standard.AI.OpenAI/Models/Services/Foundations/ChatCompletions/Exceptions/ChatCompletionValidationException.cs b/Standard.AI.OpenAI/Models/Services/Foundations/ChatCompletions/Exceptions/ChatCompletionValidationException.cs index 868b1a1a..ee30f61d 100644 --- a/Standard.AI.OpenAI/Models/Services/Foundations/ChatCompletions/Exceptions/ChatCompletionValidationException.cs +++ b/Standard.AI.OpenAI/Models/Services/Foundations/ChatCompletions/Exceptions/ChatCompletionValidationException.cs @@ -8,12 +8,6 @@ namespace Standard.AI.OpenAI.Models.Services.Foundations.ChatCompletions.Excepti { public class ChatCompletionValidationException : Xeption { - public ChatCompletionValidationException(Xeption innerException) - : base( - message: "Chat completion validation error occurred, fix errors and try again.", - innerException: innerException) - { } - public ChatCompletionValidationException(string message, Xeption innerException) : base(message, innerException) { } diff --git a/Standard.AI.OpenAI/Services/Foundations/ChatCompletions/ChatCompletionService.Exceptions.cs b/Standard.AI.OpenAI/Services/Foundations/ChatCompletions/ChatCompletionService.Exceptions.cs index e753f46e..00b3b3a1 100644 --- a/Standard.AI.OpenAI/Services/Foundations/ChatCompletions/ChatCompletionService.Exceptions.cs +++ b/Standard.AI.OpenAI/Services/Foundations/ChatCompletions/ChatCompletionService.Exceptions.cs @@ -22,11 +22,15 @@ private async ValueTask TryCatch(ReturningChatCompletionFunction } catch (NullChatCompletionException nullChatCompletionException) { - throw new ChatCompletionValidationException(nullChatCompletionException); + throw new ChatCompletionValidationException( + message: "Chat completion validation error occurred, fix errors and try again.", + nullChatCompletionException); } catch (InvalidChatCompletionException invalidChatCompletionException) { - throw new ChatCompletionValidationException(invalidChatCompletionException); + throw new ChatCompletionValidationException( + message: "Chat completion validation error occurred, fix errors and try again.", + invalidChatCompletionException); } catch (HttpResponseUrlNotFoundException httpResponseUrlNotFoundException) { From d240c9d483ca8bcd165bd0cba6b85d3354fee1b8 Mon Sep 17 00:00:00 2001 From: Lezune Date: Wed, 29 May 2024 20:09:17 -0700 Subject: [PATCH 012/283] Updated ExcessiveCallChatCompletionException class by removing constructors in which the error message was hard coded in. Updated all relevant service files to include message. --- .../Exceptions/ExcessiveCallChatCompletionException.cs | 6 ------ .../ChatCompletions/ChatCompletionService.Exceptions.cs | 4 +++- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/Standard.AI.OpenAI/Models/Services/Foundations/ChatCompletions/Exceptions/ExcessiveCallChatCompletionException.cs b/Standard.AI.OpenAI/Models/Services/Foundations/ChatCompletions/Exceptions/ExcessiveCallChatCompletionException.cs index a38dbafa..402fbf81 100644 --- a/Standard.AI.OpenAI/Models/Services/Foundations/ChatCompletions/Exceptions/ExcessiveCallChatCompletionException.cs +++ b/Standard.AI.OpenAI/Models/Services/Foundations/ChatCompletions/Exceptions/ExcessiveCallChatCompletionException.cs @@ -9,12 +9,6 @@ namespace Standard.AI.OpenAI.Models.Services.Foundations.ChatCompletions.Excepti { public class ExcessiveCallChatCompletionException : Xeption { - public ExcessiveCallChatCompletionException(Exception innerException) - : base( - message: "Excessive call error occurred, limit your calls.", - innerException: innerException) - { } - public ExcessiveCallChatCompletionException(string message, Exception innerException) : base(message, innerException) { } diff --git a/Standard.AI.OpenAI/Services/Foundations/ChatCompletions/ChatCompletionService.Exceptions.cs b/Standard.AI.OpenAI/Services/Foundations/ChatCompletions/ChatCompletionService.Exceptions.cs index e753f46e..b15c7975 100644 --- a/Standard.AI.OpenAI/Services/Foundations/ChatCompletions/ChatCompletionService.Exceptions.cs +++ b/Standard.AI.OpenAI/Services/Foundations/ChatCompletions/ChatCompletionService.Exceptions.cs @@ -66,7 +66,9 @@ private async ValueTask TryCatch(ReturningChatCompletionFunction catch (HttpResponseTooManyRequestsException httpResponseTooManyRequestsException) { var excessiveCallChatCompletionException = - new ExcessiveCallChatCompletionException(httpResponseTooManyRequestsException); + new ExcessiveCallChatCompletionException( + message: "Excessive call error occurred, limit your calls.", + httpResponseTooManyRequestsException); throw new ChatCompletionDependencyValidationException(excessiveCallChatCompletionException); } From 51f8c94169f0ed5e2367be1e18dc7fa5a41df8ad Mon Sep 17 00:00:00 2001 From: Lezune Date: Wed, 29 May 2024 20:12:58 -0700 Subject: [PATCH 013/283] Updated FailedChatCompletionServiceException class by removing constructors in which the error message was hard coded in. Updated all relevant service files to include message. --- .../Exceptions/FailedChatCompletionServiceException.cs | 6 ------ .../ChatCompletions/ChatCompletionService.Exceptions.cs | 4 +++- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/Standard.AI.OpenAI/Models/Services/Foundations/ChatCompletions/Exceptions/FailedChatCompletionServiceException.cs b/Standard.AI.OpenAI/Models/Services/Foundations/ChatCompletions/Exceptions/FailedChatCompletionServiceException.cs index cd1e4a8b..dab5bfdb 100644 --- a/Standard.AI.OpenAI/Models/Services/Foundations/ChatCompletions/Exceptions/FailedChatCompletionServiceException.cs +++ b/Standard.AI.OpenAI/Models/Services/Foundations/ChatCompletions/Exceptions/FailedChatCompletionServiceException.cs @@ -9,12 +9,6 @@ namespace Standard.AI.OpenAI.Models.Services.Foundations.ChatCompletions.Excepti { public class FailedChatCompletionServiceException : Xeption { - public FailedChatCompletionServiceException(Exception innerException) - : base( - message: "Failed Chat Completion Service Exception occurred, please contact support for assistance.", - innerException: innerException) - { } - public FailedChatCompletionServiceException(string message, Exception innerException) : base(message, innerException) { } diff --git a/Standard.AI.OpenAI/Services/Foundations/ChatCompletions/ChatCompletionService.Exceptions.cs b/Standard.AI.OpenAI/Services/Foundations/ChatCompletions/ChatCompletionService.Exceptions.cs index e753f46e..9ab7dc98 100644 --- a/Standard.AI.OpenAI/Services/Foundations/ChatCompletions/ChatCompletionService.Exceptions.cs +++ b/Standard.AI.OpenAI/Services/Foundations/ChatCompletions/ChatCompletionService.Exceptions.cs @@ -80,7 +80,9 @@ private async ValueTask TryCatch(ReturningChatCompletionFunction catch (Exception exception) { var failedChatCompletionServiceException = - new FailedChatCompletionServiceException(exception); + new FailedChatCompletionServiceException( + message: "Failed Chat Completion Service Exception occurred, please contact support for assistance.", + exception); throw new ChatCompletionServiceException( failedChatCompletionServiceException); From 32a91b54fa0069122e379844b28c9e5e504df9a1 Mon Sep 17 00:00:00 2001 From: Lezune Date: Wed, 29 May 2024 20:18:15 -0700 Subject: [PATCH 014/283] Updated FailedServerChatCompletionException class by removing constructors in which the error message was hard coded in. Updated all relevant service files to include message. --- .../Exceptions/FailedServerChatCompletionException.cs | 6 ------ .../ChatCompletions/ChatCompletionService.Exceptions.cs | 4 +++- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/Standard.AI.OpenAI/Models/Services/Foundations/ChatCompletions/Exceptions/FailedServerChatCompletionException.cs b/Standard.AI.OpenAI/Models/Services/Foundations/ChatCompletions/Exceptions/FailedServerChatCompletionException.cs index f4c17e4d..ff49a035 100644 --- a/Standard.AI.OpenAI/Models/Services/Foundations/ChatCompletions/Exceptions/FailedServerChatCompletionException.cs +++ b/Standard.AI.OpenAI/Models/Services/Foundations/ChatCompletions/Exceptions/FailedServerChatCompletionException.cs @@ -9,12 +9,6 @@ namespace Standard.AI.OpenAI.Models.Services.Foundations.ChatCompletions.Excepti { public class FailedServerChatCompletionException : Xeption { - public FailedServerChatCompletionException(Exception innerException) - : base( - message: "Failed chat completion server error occurred, contact support.", - innerException: innerException) - { } - public FailedServerChatCompletionException(string message, Exception innerException) : base(message, innerException) { } diff --git a/Standard.AI.OpenAI/Services/Foundations/ChatCompletions/ChatCompletionService.Exceptions.cs b/Standard.AI.OpenAI/Services/Foundations/ChatCompletions/ChatCompletionService.Exceptions.cs index e753f46e..0b2bcdc1 100644 --- a/Standard.AI.OpenAI/Services/Foundations/ChatCompletions/ChatCompletionService.Exceptions.cs +++ b/Standard.AI.OpenAI/Services/Foundations/ChatCompletions/ChatCompletionService.Exceptions.cs @@ -73,7 +73,9 @@ private async ValueTask TryCatch(ReturningChatCompletionFunction catch (HttpResponseException httpResponseException) { var failedServerChatCompletionException = - new FailedServerChatCompletionException(httpResponseException); + new FailedServerChatCompletionException( + message: "Failed chat completion server error occurred, contact support.", + httpResponseException); throw new ChatCompletionDependencyException(failedServerChatCompletionException); } From fa0f8c109d5ddd59eb64e3152e32535ca645e14c Mon Sep 17 00:00:00 2001 From: Lezune Date: Wed, 29 May 2024 20:26:05 -0700 Subject: [PATCH 015/283] Updated InvalidChatCompletionException class by removing constructors in which the error message was hard coded in. Updated all relevant service files to include message. --- .../ChatCompletionServiceTests.Validations.Send.cs | 6 ++++-- .../Exceptions/InvalidChatCompletionException.cs | 9 +-------- .../ChatCompletions/ChatCompletionService.Exceptions.cs | 4 +++- .../ChatCompletions/ChatCompletionService.Validations.cs | 4 +++- 4 files changed, 11 insertions(+), 12 deletions(-) diff --git a/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/ChatCompletions/ChatCompletionServiceTests.Validations.Send.cs b/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/ChatCompletions/ChatCompletionServiceTests.Validations.Send.cs index 8557d1e4..a74bb45e 100644 --- a/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/ChatCompletions/ChatCompletionServiceTests.Validations.Send.cs +++ b/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/ChatCompletions/ChatCompletionServiceTests.Validations.Send.cs @@ -58,7 +58,8 @@ private async Task ShouldThrowValidationExceptionOnSendIfRequestIsNullAsync() invalidChatCompletion.Request = null; var invalidChatCompletionException = - new InvalidChatCompletionException(); + new InvalidChatCompletionException( + message: "Chat completion is invalid."); invalidChatCompletionException.AddData( key: nameof(ChatCompletion.Request), @@ -106,7 +107,8 @@ private async Task ShouldThrowValidationExceptionOnSendIfRequestIsInvalidAsync(s }; var invalidChatCompletionException = - new InvalidChatCompletionException(); + new InvalidChatCompletionException( + message: "Chat completion is invalid."); invalidChatCompletionException.AddData( key: nameof(ChatCompletion.Request.Model), diff --git a/Standard.AI.OpenAI/Models/Services/Foundations/ChatCompletions/Exceptions/InvalidChatCompletionException.cs b/Standard.AI.OpenAI/Models/Services/Foundations/ChatCompletions/Exceptions/InvalidChatCompletionException.cs index a9d9f0a7..57f8d84d 100644 --- a/Standard.AI.OpenAI/Models/Services/Foundations/ChatCompletions/Exceptions/InvalidChatCompletionException.cs +++ b/Standard.AI.OpenAI/Models/Services/Foundations/ChatCompletions/Exceptions/InvalidChatCompletionException.cs @@ -9,17 +9,10 @@ namespace Standard.AI.OpenAI.Models.Services.Foundations.ChatCompletions.Excepti { public class InvalidChatCompletionException : Xeption { - public InvalidChatCompletionException() + public InvalidChatCompletionException(string message) : base( message: "Chat completion is invalid.") { } - - public InvalidChatCompletionException(Exception innerException) - : base( - message: "Chat completion is invalid.", - innerException: innerException) - { } - public InvalidChatCompletionException(string message, Xeption innerException) : base(message, innerException) { } diff --git a/Standard.AI.OpenAI/Services/Foundations/ChatCompletions/ChatCompletionService.Exceptions.cs b/Standard.AI.OpenAI/Services/Foundations/ChatCompletions/ChatCompletionService.Exceptions.cs index e753f46e..9a15c1d9 100644 --- a/Standard.AI.OpenAI/Services/Foundations/ChatCompletions/ChatCompletionService.Exceptions.cs +++ b/Standard.AI.OpenAI/Services/Foundations/ChatCompletions/ChatCompletionService.Exceptions.cs @@ -59,7 +59,9 @@ private async ValueTask TryCatch(ReturningChatCompletionFunction catch (HttpResponseBadRequestException httpResponseBadRequestException) { var invalidChatCompletionException = - new InvalidChatCompletionException(httpResponseBadRequestException); + new InvalidChatCompletionException( + message: "Chat completion is invalid.", + httpResponseBadRequestException); throw new ChatCompletionDependencyValidationException(invalidChatCompletionException); } diff --git a/Standard.AI.OpenAI/Services/Foundations/ChatCompletions/ChatCompletionService.Validations.cs b/Standard.AI.OpenAI/Services/Foundations/ChatCompletions/ChatCompletionService.Validations.cs index d23e5168..0d5e7ec1 100644 --- a/Standard.AI.OpenAI/Services/Foundations/ChatCompletions/ChatCompletionService.Validations.cs +++ b/Standard.AI.OpenAI/Services/Foundations/ChatCompletions/ChatCompletionService.Validations.cs @@ -48,7 +48,9 @@ private void ValidateChatCompletionIsNotNull(ChatCompletion chatCompletion) private static void Validate(params (dynamic Rule, string Parameter)[] validations) { - var invalidChatCompletionException = new InvalidChatCompletionException(); + var invalidChatCompletionException = + new InvalidChatCompletionException( + message: "Chat completion is invalid."); foreach ((dynamic rule, string parameter) in validations) { From 8c3e56dc97b8b0f768fe8f6fddcf5394c6a81309 Mon Sep 17 00:00:00 2001 From: Lezune Date: Wed, 29 May 2024 20:30:26 -0700 Subject: [PATCH 016/283] Updated InvalidConfigurationChatCompletionException class by removing constructors in which the error message was hard coded in. Updated all relevant service files to include message. --- .../InvalidConfigurationChatCompletionException.cs | 6 ------ .../ChatCompletions/ChatCompletionService.Exceptions.cs | 4 +++- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/Standard.AI.OpenAI/Models/Services/Foundations/ChatCompletions/Exceptions/InvalidConfigurationChatCompletionException.cs b/Standard.AI.OpenAI/Models/Services/Foundations/ChatCompletions/Exceptions/InvalidConfigurationChatCompletionException.cs index 47d5e40f..821eec6d 100644 --- a/Standard.AI.OpenAI/Models/Services/Foundations/ChatCompletions/Exceptions/InvalidConfigurationChatCompletionException.cs +++ b/Standard.AI.OpenAI/Models/Services/Foundations/ChatCompletions/Exceptions/InvalidConfigurationChatCompletionException.cs @@ -9,12 +9,6 @@ namespace Standard.AI.OpenAI.Models.Services.Foundations.ChatCompletions.Excepti { public class InvalidConfigurationChatCompletionException : Xeption { - public InvalidConfigurationChatCompletionException(Exception innerException) - : base( - message: "Invalid chat completion configuration error occurred, contact support.", - innerException: innerException) - { } - public InvalidConfigurationChatCompletionException(string message, Exception innerException) : base(message, innerException) { } diff --git a/Standard.AI.OpenAI/Services/Foundations/ChatCompletions/ChatCompletionService.Exceptions.cs b/Standard.AI.OpenAI/Services/Foundations/ChatCompletions/ChatCompletionService.Exceptions.cs index e753f46e..8465a3ca 100644 --- a/Standard.AI.OpenAI/Services/Foundations/ChatCompletions/ChatCompletionService.Exceptions.cs +++ b/Standard.AI.OpenAI/Services/Foundations/ChatCompletions/ChatCompletionService.Exceptions.cs @@ -31,7 +31,9 @@ private async ValueTask TryCatch(ReturningChatCompletionFunction catch (HttpResponseUrlNotFoundException httpResponseUrlNotFoundException) { var invalidConfigurationChatCompletionException = - new InvalidConfigurationChatCompletionException(httpResponseUrlNotFoundException); + new InvalidConfigurationChatCompletionException( + message: "Invalid chat completion configuration error occurred, contact support.", + httpResponseUrlNotFoundException); throw new ChatCompletionDependencyException(invalidConfigurationChatCompletionException); } From 2e0426ca464691044826d74e1a1745f5b9fc9880 Mon Sep 17 00:00:00 2001 From: Lezune Date: Wed, 29 May 2024 20:37:42 -0700 Subject: [PATCH 017/283] Updated NotFoundChatCompletionException class by removing constructors in which the error message was hard coded in. Updated all relevant service files to include message. --- .../Exceptions/NotFoundChatCompletionException.cs | 6 ------ .../ChatCompletions/ChatCompletionService.Exceptions.cs | 4 +++- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/Standard.AI.OpenAI/Models/Services/Foundations/ChatCompletions/Exceptions/NotFoundChatCompletionException.cs b/Standard.AI.OpenAI/Models/Services/Foundations/ChatCompletions/Exceptions/NotFoundChatCompletionException.cs index 11d5118b..46f1b734 100644 --- a/Standard.AI.OpenAI/Models/Services/Foundations/ChatCompletions/Exceptions/NotFoundChatCompletionException.cs +++ b/Standard.AI.OpenAI/Models/Services/Foundations/ChatCompletions/Exceptions/NotFoundChatCompletionException.cs @@ -9,12 +9,6 @@ namespace Standard.AI.OpenAI.Models.Services.Foundations.ChatCompletions.Excepti { public class NotFoundChatCompletionException : Xeption { - public NotFoundChatCompletionException(Exception innerException) - : base( - message: "Chat completion not found.", - innerException: innerException) - { } - public NotFoundChatCompletionException(string message, Exception innerException) : base(message, innerException) { } diff --git a/Standard.AI.OpenAI/Services/Foundations/ChatCompletions/ChatCompletionService.Exceptions.cs b/Standard.AI.OpenAI/Services/Foundations/ChatCompletions/ChatCompletionService.Exceptions.cs index e753f46e..115010d5 100644 --- a/Standard.AI.OpenAI/Services/Foundations/ChatCompletions/ChatCompletionService.Exceptions.cs +++ b/Standard.AI.OpenAI/Services/Foundations/ChatCompletions/ChatCompletionService.Exceptions.cs @@ -52,7 +52,9 @@ private async ValueTask TryCatch(ReturningChatCompletionFunction catch (HttpResponseNotFoundException httpResponseNotFoundException) { var notFoundChatCompletionException = - new NotFoundChatCompletionException(httpResponseNotFoundException); + new NotFoundChatCompletionException( + message: "Chat completion not found.", + httpResponseNotFoundException); throw new ChatCompletionDependencyValidationException(notFoundChatCompletionException); } From f3a24302c05f370da7dc706b890d98801275a5cd Mon Sep 17 00:00:00 2001 From: Lezune Date: Wed, 29 May 2024 20:47:49 -0700 Subject: [PATCH 018/283] Updated UnauthorizedChatCompletionException class by removing constructors in which the error message was hard coded in. Updated all relevant service files to include message. --- .../Exceptions/UnauthorizedChatCompletionException.cs | 6 ------ .../ChatCompletions/ChatCompletionService.Exceptions.cs | 8 ++++++-- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/Standard.AI.OpenAI/Models/Services/Foundations/ChatCompletions/Exceptions/UnauthorizedChatCompletionException.cs b/Standard.AI.OpenAI/Models/Services/Foundations/ChatCompletions/Exceptions/UnauthorizedChatCompletionException.cs index a6a2d54d..5a4185ac 100644 --- a/Standard.AI.OpenAI/Models/Services/Foundations/ChatCompletions/Exceptions/UnauthorizedChatCompletionException.cs +++ b/Standard.AI.OpenAI/Models/Services/Foundations/ChatCompletions/Exceptions/UnauthorizedChatCompletionException.cs @@ -9,12 +9,6 @@ namespace Standard.AI.OpenAI.Models.Services.Foundations.ChatCompletions.Excepti { public class UnauthorizedChatCompletionException : Xeption { - public UnauthorizedChatCompletionException(Exception innerException) - : base( - message: "Unauthorized chat completion request, fix errors and try again.", - innerException: innerException) - { } - public UnauthorizedChatCompletionException(string message, Exception innerException) : base(message, innerException) { } diff --git a/Standard.AI.OpenAI/Services/Foundations/ChatCompletions/ChatCompletionService.Exceptions.cs b/Standard.AI.OpenAI/Services/Foundations/ChatCompletions/ChatCompletionService.Exceptions.cs index e753f46e..09b1a050 100644 --- a/Standard.AI.OpenAI/Services/Foundations/ChatCompletions/ChatCompletionService.Exceptions.cs +++ b/Standard.AI.OpenAI/Services/Foundations/ChatCompletions/ChatCompletionService.Exceptions.cs @@ -38,14 +38,18 @@ private async ValueTask TryCatch(ReturningChatCompletionFunction catch (HttpResponseUnauthorizedException httpResponseUnauthorizedException) { var unauthorizedChatCompletionException = - new UnauthorizedChatCompletionException(httpResponseUnauthorizedException); + new UnauthorizedChatCompletionException( + message: "Unauthorized chat completion request, fix errors and try again.", + httpResponseUnauthorizedException); throw new ChatCompletionDependencyException(unauthorizedChatCompletionException); } catch (HttpResponseForbiddenException httpResponseForbiddenException) { var unauthorizedChatCompletionException = - new UnauthorizedChatCompletionException(httpResponseForbiddenException); + new UnauthorizedChatCompletionException( + message: "Unauthorized chat completion request, fix errors and try again.", + httpResponseForbiddenException); throw new ChatCompletionDependencyException(unauthorizedChatCompletionException); } From b7001df7b219f8187a97ab5e01b0903cda82df25 Mon Sep 17 00:00:00 2001 From: Lezune Date: Wed, 29 May 2024 20:53:17 -0700 Subject: [PATCH 019/283] Updated CompletionDependencyException class by removing constructors in which the error message was hard coded in. Updated all relevant service files to include message. --- .../Exceptions/CompletionDependencyException.cs | 6 ------ .../Completions/CompletionService.Exceptions.cs | 16 ++++++++++++---- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/Standard.AI.OpenAI/Models/Services/Foundations/Completions/Exceptions/CompletionDependencyException.cs b/Standard.AI.OpenAI/Models/Services/Foundations/Completions/Exceptions/CompletionDependencyException.cs index cc8b4c8d..b32017a0 100644 --- a/Standard.AI.OpenAI/Models/Services/Foundations/Completions/Exceptions/CompletionDependencyException.cs +++ b/Standard.AI.OpenAI/Models/Services/Foundations/Completions/Exceptions/CompletionDependencyException.cs @@ -8,12 +8,6 @@ namespace Standard.AI.OpenAI.Models.Services.Foundations.Completions.Exceptions { public class CompletionDependencyException : Xeption { - public CompletionDependencyException(Xeption innerException) - : base( - message: "Completion dependency error occurred, contact support.", - innerException: innerException) - { } - public CompletionDependencyException(string message, Xeption innerException) : base(message, innerException) { } diff --git a/Standard.AI.OpenAI/Services/Foundations/Completions/CompletionService.Exceptions.cs b/Standard.AI.OpenAI/Services/Foundations/Completions/CompletionService.Exceptions.cs index 5b2e9871..5ceb2894 100644 --- a/Standard.AI.OpenAI/Services/Foundations/Completions/CompletionService.Exceptions.cs +++ b/Standard.AI.OpenAI/Services/Foundations/Completions/CompletionService.Exceptions.cs @@ -34,21 +34,27 @@ private static async ValueTask TryCatch(ReturningCompletionFunction var invalidConfigurationCompletionException = new InvalidConfigurationCompletionException(httpResponseUrlNotFoundException); - throw new CompletionDependencyException(invalidConfigurationCompletionException); + throw new CompletionDependencyException( + message: "Completion dependency error occurred, contact support.", + invalidConfigurationCompletionException); } catch (HttpResponseUnauthorizedException httpResponseUnauthorizedException) { var unauthorizedCompletionException = new UnauthorizedCompletionException(httpResponseUnauthorizedException); - throw new CompletionDependencyException(unauthorizedCompletionException); + throw new CompletionDependencyException( + message: "Completion dependency error occurred, contact support.", + unauthorizedCompletionException); } catch (HttpResponseForbiddenException httpResponseForbiddenException) { var unauthorizedCompletionException = new UnauthorizedCompletionException(httpResponseForbiddenException); - throw new CompletionDependencyException(unauthorizedCompletionException); + throw new CompletionDependencyException( + message: "Completion dependency error occurred, contact support.", + unauthorizedCompletionException); } catch (HttpResponseNotFoundException httpResponseNotFoundException) { @@ -77,7 +83,9 @@ private static async ValueTask TryCatch(ReturningCompletionFunction var failedServerCompletionException = new FailedServerCompletionException(httpResponseException); - throw new CompletionDependencyException(failedServerCompletionException); + throw new CompletionDependencyException( + message: "Completion dependency error occurred, contact support.", + failedServerCompletionException); } catch (Exception exception) { From af3e7559763db76b281cb08d0df6c005a3de66e7 Mon Sep 17 00:00:00 2001 From: Lezune Date: Wed, 29 May 2024 21:06:49 -0700 Subject: [PATCH 020/283] Updated CompletionServiceException class by removing constructors in which the error message was hard coded in. Updated all relevant service files to include message. --- .../Completions/Exceptions/CompletionServiceException.cs | 6 ------ .../Foundations/Completions/CompletionService.Exceptions.cs | 4 +++- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/Standard.AI.OpenAI/Models/Services/Foundations/Completions/Exceptions/CompletionServiceException.cs b/Standard.AI.OpenAI/Models/Services/Foundations/Completions/Exceptions/CompletionServiceException.cs index ec34da9d..f0c58713 100644 --- a/Standard.AI.OpenAI/Models/Services/Foundations/Completions/Exceptions/CompletionServiceException.cs +++ b/Standard.AI.OpenAI/Models/Services/Foundations/Completions/Exceptions/CompletionServiceException.cs @@ -8,12 +8,6 @@ namespace Standard.AI.OpenAI.Models.Services.Foundations.Completions.Exceptions { public class CompletionServiceException : Xeption { - public CompletionServiceException(Xeption innerException) - : base( - message: "Completion service error occurred, contact support.", - innerException: innerException) - { } - public CompletionServiceException(string message, Xeption innerException) : base(message, innerException) { } diff --git a/Standard.AI.OpenAI/Services/Foundations/Completions/CompletionService.Exceptions.cs b/Standard.AI.OpenAI/Services/Foundations/Completions/CompletionService.Exceptions.cs index 5b2e9871..8cd9a613 100644 --- a/Standard.AI.OpenAI/Services/Foundations/Completions/CompletionService.Exceptions.cs +++ b/Standard.AI.OpenAI/Services/Foundations/Completions/CompletionService.Exceptions.cs @@ -84,7 +84,9 @@ private static async ValueTask TryCatch(ReturningCompletionFunction var failedCompletionServiceException = new FailedCompletionServiceException(exception); - throw new CompletionServiceException(failedCompletionServiceException); + throw new CompletionServiceException( + message: "Completion service error occurred, contact support.", + failedCompletionServiceException); } } } From c706b5ae645141a0871ad4173ad5a78eee070dd3 Mon Sep 17 00:00:00 2001 From: Lezune Date: Wed, 29 May 2024 21:12:22 -0700 Subject: [PATCH 021/283] Updated CompletionValidationException class by removing constructors in which the error message was hard coded in. Updated all relevant service files to include message. --- .../Completions/Exceptions/CompletionValidationException.cs | 6 ------ .../Foundations/Completions/CompletionService.Exceptions.cs | 5 ++++- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/Standard.AI.OpenAI/Models/Services/Foundations/Completions/Exceptions/CompletionValidationException.cs b/Standard.AI.OpenAI/Models/Services/Foundations/Completions/Exceptions/CompletionValidationException.cs index dd60a470..de32b385 100644 --- a/Standard.AI.OpenAI/Models/Services/Foundations/Completions/Exceptions/CompletionValidationException.cs +++ b/Standard.AI.OpenAI/Models/Services/Foundations/Completions/Exceptions/CompletionValidationException.cs @@ -8,12 +8,6 @@ namespace Standard.AI.OpenAI.Models.Services.Foundations.Completions.Exceptions { public class CompletionValidationException : Xeption { - public CompletionValidationException(Xeption innerException) - : base( - message: "Completion validation error occurred, fix errors and try again.", - innerException: innerException) - { } - public CompletionValidationException(string message, Xeption innerException) : base(message, innerException) { } diff --git a/Standard.AI.OpenAI/Services/Foundations/Completions/CompletionService.Exceptions.cs b/Standard.AI.OpenAI/Services/Foundations/Completions/CompletionService.Exceptions.cs index 5b2e9871..193ad4f5 100644 --- a/Standard.AI.OpenAI/Services/Foundations/Completions/CompletionService.Exceptions.cs +++ b/Standard.AI.OpenAI/Services/Foundations/Completions/CompletionService.Exceptions.cs @@ -22,11 +22,14 @@ private static async ValueTask TryCatch(ReturningCompletionFunction } catch (NullCompletionException nullCompletionException) { - throw new CompletionValidationException(nullCompletionException); + throw new CompletionValidationException( + message: "Completion validation error occurred, fix errors and try again.", + nullCompletionException); } catch (InvalidCompletionException invalidCompletionException) { throw new CompletionValidationException( + message: "Completion validation error occurred, fix errors and try again.", invalidCompletionException); } catch (HttpResponseUrlNotFoundException httpResponseUrlNotFoundException) From 6098e1fea3a5c385a17c9dcdfb3944169961bb53 Mon Sep 17 00:00:00 2001 From: Lezune Date: Wed, 29 May 2024 21:17:31 -0700 Subject: [PATCH 022/283] Updated ExcessiveCallCompletionException class by removing constructors in which the error message was hard coded in. Updated all relevant service files to include message. --- .../Exceptions/ExcessiveCallCompletionException.cs | 6 ------ .../Foundations/Completions/CompletionService.Exceptions.cs | 4 +++- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/Standard.AI.OpenAI/Models/Services/Foundations/Completions/Exceptions/ExcessiveCallCompletionException.cs b/Standard.AI.OpenAI/Models/Services/Foundations/Completions/Exceptions/ExcessiveCallCompletionException.cs index aebd7f23..711c9989 100644 --- a/Standard.AI.OpenAI/Models/Services/Foundations/Completions/Exceptions/ExcessiveCallCompletionException.cs +++ b/Standard.AI.OpenAI/Models/Services/Foundations/Completions/Exceptions/ExcessiveCallCompletionException.cs @@ -9,12 +9,6 @@ namespace Standard.AI.OpenAI.Models.Services.Foundations.Completions.Exceptions { public class ExcessiveCallCompletionException : Xeption { - public ExcessiveCallCompletionException(Exception innerException) - : base( - message: "Excessive call error occurred, limit your calls.", - innerException: innerException) - { } - public ExcessiveCallCompletionException(string message, Exception innerException) : base(message, innerException) { } diff --git a/Standard.AI.OpenAI/Services/Foundations/Completions/CompletionService.Exceptions.cs b/Standard.AI.OpenAI/Services/Foundations/Completions/CompletionService.Exceptions.cs index 5b2e9871..9c342632 100644 --- a/Standard.AI.OpenAI/Services/Foundations/Completions/CompletionService.Exceptions.cs +++ b/Standard.AI.OpenAI/Services/Foundations/Completions/CompletionService.Exceptions.cs @@ -68,7 +68,9 @@ private static async ValueTask TryCatch(ReturningCompletionFunction catch (HttpResponseTooManyRequestsException httpResponseTooManyRequestsException) { var excessiveCallCompletionException = - new ExcessiveCallCompletionException(httpResponseTooManyRequestsException); + new ExcessiveCallCompletionException( + message: "Excessive call error occurred, limit your calls.", + httpResponseTooManyRequestsException); throw new CompletionDependencyValidationException(excessiveCallCompletionException); } From e257fa25233aaddac3481406c99ae8bdb5e88b44 Mon Sep 17 00:00:00 2001 From: Lezune Date: Wed, 29 May 2024 21:20:43 -0700 Subject: [PATCH 023/283] Updated FailedCompletionServiceException class by removing constructors in which the error message was hard coded in. Updated all relevant service files to include message. --- .../Exceptions/FailedCompletionServiceException.cs | 6 ------ .../Foundations/Completions/CompletionService.Exceptions.cs | 4 +++- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/Standard.AI.OpenAI/Models/Services/Foundations/Completions/Exceptions/FailedCompletionServiceException.cs b/Standard.AI.OpenAI/Models/Services/Foundations/Completions/Exceptions/FailedCompletionServiceException.cs index e1ad8c5f..3a529095 100644 --- a/Standard.AI.OpenAI/Models/Services/Foundations/Completions/Exceptions/FailedCompletionServiceException.cs +++ b/Standard.AI.OpenAI/Models/Services/Foundations/Completions/Exceptions/FailedCompletionServiceException.cs @@ -9,12 +9,6 @@ namespace Standard.AI.OpenAI.Models.Services.Foundations.Completions.Exceptions { public class FailedCompletionServiceException : Xeption { - public FailedCompletionServiceException(Exception innerException) - : base( - message: "Failed completion error occurred, contact support.", - innerException: innerException) - { } - public FailedCompletionServiceException(string message, Exception innerException) : base(message, innerException) { } diff --git a/Standard.AI.OpenAI/Services/Foundations/Completions/CompletionService.Exceptions.cs b/Standard.AI.OpenAI/Services/Foundations/Completions/CompletionService.Exceptions.cs index 5b2e9871..374383c1 100644 --- a/Standard.AI.OpenAI/Services/Foundations/Completions/CompletionService.Exceptions.cs +++ b/Standard.AI.OpenAI/Services/Foundations/Completions/CompletionService.Exceptions.cs @@ -82,7 +82,9 @@ private static async ValueTask TryCatch(ReturningCompletionFunction catch (Exception exception) { var failedCompletionServiceException = - new FailedCompletionServiceException(exception); + new FailedCompletionServiceException( + message: "Failed completion error occurred, contact support.", + exception); throw new CompletionServiceException(failedCompletionServiceException); } From 06d11db9538e9aa6fc56ff61193b776a47546e1f Mon Sep 17 00:00:00 2001 From: Lezune Date: Wed, 29 May 2024 21:23:56 -0700 Subject: [PATCH 024/283] Updated FailedServerCompletionException class by removing constructors in which the error message was hard coded in. Updated all relevant service files to include message. --- .../Exceptions/FailedServerCompletionException.cs | 6 ------ .../Foundations/Completions/CompletionService.Exceptions.cs | 4 +++- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/Standard.AI.OpenAI/Models/Services/Foundations/Completions/Exceptions/FailedServerCompletionException.cs b/Standard.AI.OpenAI/Models/Services/Foundations/Completions/Exceptions/FailedServerCompletionException.cs index 755073b2..02a03516 100644 --- a/Standard.AI.OpenAI/Models/Services/Foundations/Completions/Exceptions/FailedServerCompletionException.cs +++ b/Standard.AI.OpenAI/Models/Services/Foundations/Completions/Exceptions/FailedServerCompletionException.cs @@ -9,12 +9,6 @@ namespace Standard.AI.OpenAI.Models.Services.Foundations.Completions.Exceptions { public class FailedServerCompletionException : Xeption { - public FailedServerCompletionException(Exception innerException) - : base( - message: "Failed server completion error occurred, contact support.", - innerException: innerException) - { } - public FailedServerCompletionException(string message, Exception innerException) : base(message, innerException) { } diff --git a/Standard.AI.OpenAI/Services/Foundations/Completions/CompletionService.Exceptions.cs b/Standard.AI.OpenAI/Services/Foundations/Completions/CompletionService.Exceptions.cs index 5b2e9871..30228c77 100644 --- a/Standard.AI.OpenAI/Services/Foundations/Completions/CompletionService.Exceptions.cs +++ b/Standard.AI.OpenAI/Services/Foundations/Completions/CompletionService.Exceptions.cs @@ -75,7 +75,9 @@ private static async ValueTask TryCatch(ReturningCompletionFunction catch (HttpResponseException httpResponseException) { var failedServerCompletionException = - new FailedServerCompletionException(httpResponseException); + new FailedServerCompletionException( + message: "Failed server completion error occurred, contact support.", + httpResponseException); throw new CompletionDependencyException(failedServerCompletionException); } From 18b7e419bdbebbb21f38aefad67bbbb6b73850a5 Mon Sep 17 00:00:00 2001 From: Lezune Date: Wed, 29 May 2024 21:30:13 -0700 Subject: [PATCH 025/283] Updated InvalidCompletionException class by removing constructors in which the error message was hard coded in. Updated all relevant service files to include message. --- .../CompletionServiceTests.Validations.Prompt.cs | 11 ++++++++--- .../Exceptions/InvalidCompletionException.cs | 12 ++---------- .../Completions/CompletionService.Exceptions.cs | 4 +++- .../Completions/CompletionService.Validations.cs | 4 +++- 4 files changed, 16 insertions(+), 15 deletions(-) diff --git a/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/Completions/CompletionServiceTests.Validations.Prompt.cs b/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/Completions/CompletionServiceTests.Validations.Prompt.cs index e6b84b3c..cd1e6be8 100644 --- a/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/Completions/CompletionServiceTests.Validations.Prompt.cs +++ b/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/Completions/CompletionServiceTests.Validations.Prompt.cs @@ -56,7 +56,8 @@ private async Task ShouldThrowValidationExceptionOnPromptIfRequestIsNullAsync() invalidCompletion.Request = null; var invalidCompletionException = - new InvalidCompletionException(); + new InvalidCompletionException( + message: "Invalid completion error occurred, fix errors and try again."); invalidCompletionException.AddData( key: nameof(Completion.Request), @@ -103,7 +104,9 @@ private async Task ShouldThrowValidationExceptionOnPromptIfCompletionIsInvalidAs } }; - var invalidCompletionException = new InvalidCompletionException(); + var invalidCompletionException = + new InvalidCompletionException( + message: "Invalid completion error occurred, fix errors and try again."); invalidCompletionException.AddData( key: nameof(CompletionRequest.Model), @@ -146,7 +149,9 @@ private async Task ShouldThrowValidationExceptionOnPromptIfPromptIsEmptyAsync() } }; - var invalidCompletionException = new InvalidCompletionException(); + var invalidCompletionException = + new InvalidCompletionException( + message: "Invalid completion error occurred, fix errors and try again."); invalidCompletionException.AddData( key: nameof(CompletionRequest.Prompts), diff --git a/Standard.AI.OpenAI/Models/Services/Foundations/Completions/Exceptions/InvalidCompletionException.cs b/Standard.AI.OpenAI/Models/Services/Foundations/Completions/Exceptions/InvalidCompletionException.cs index 5935f2d4..afeca8db 100644 --- a/Standard.AI.OpenAI/Models/Services/Foundations/Completions/Exceptions/InvalidCompletionException.cs +++ b/Standard.AI.OpenAI/Models/Services/Foundations/Completions/Exceptions/InvalidCompletionException.cs @@ -9,17 +9,9 @@ namespace Standard.AI.OpenAI.Models.Services.Foundations.Completions.Exceptions { public class InvalidCompletionException : Xeption { - public InvalidCompletionException() - : base( - message: "Invalid completion error occurred, fix errors and try again.") + public InvalidCompletionException(string message) + : base(message) { } - - public InvalidCompletionException(Exception innerException) - : base( - message: "Invalid completion error occurred, fix errors and try again.", - innerException: innerException) - { } - public InvalidCompletionException(string message, Exception innerException) : base(message, innerException) { } diff --git a/Standard.AI.OpenAI/Services/Foundations/Completions/CompletionService.Exceptions.cs b/Standard.AI.OpenAI/Services/Foundations/Completions/CompletionService.Exceptions.cs index 5b2e9871..fb601eb9 100644 --- a/Standard.AI.OpenAI/Services/Foundations/Completions/CompletionService.Exceptions.cs +++ b/Standard.AI.OpenAI/Services/Foundations/Completions/CompletionService.Exceptions.cs @@ -60,7 +60,9 @@ private static async ValueTask TryCatch(ReturningCompletionFunction catch (HttpResponseBadRequestException httpResponseBadRequestException) { var invalidCompletionException = - new InvalidCompletionException(httpResponseBadRequestException); + new InvalidCompletionException( + message: "Invalid completion error occurred, fix errors and try again.", + httpResponseBadRequestException); throw new CompletionDependencyValidationException(invalidCompletionException); } diff --git a/Standard.AI.OpenAI/Services/Foundations/Completions/CompletionService.Validations.cs b/Standard.AI.OpenAI/Services/Foundations/Completions/CompletionService.Validations.cs index e366662f..81a92f79 100644 --- a/Standard.AI.OpenAI/Services/Foundations/Completions/CompletionService.Validations.cs +++ b/Standard.AI.OpenAI/Services/Foundations/Completions/CompletionService.Validations.cs @@ -55,7 +55,9 @@ private static void ValidateCompletionRequestNotNull(CompletionRequest request) private static void Validate(params (dynamic Rule, string Parameter)[] validations) { - var invalidCompletionException = new InvalidCompletionException(); + var invalidCompletionException = + new InvalidCompletionException( + message: "Invalid completion error occurred, fix errors and try again."); foreach ((dynamic rule, string parameter) in validations) { From 54fe715b864b4cea136bfb260fee52b1183c1c40 Mon Sep 17 00:00:00 2001 From: Lezune Date: Wed, 29 May 2024 21:37:24 -0700 Subject: [PATCH 026/283] Updated InvalidConfigurationCompletionException class by removing constructors in which the error message was hard coded in. Updated all relevant service files to include message. --- .../Exceptions/InvalidConfigurationCompletionException.cs | 6 ------ .../Foundations/Completions/CompletionService.Exceptions.cs | 4 +++- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/Standard.AI.OpenAI/Models/Services/Foundations/Completions/Exceptions/InvalidConfigurationCompletionException.cs b/Standard.AI.OpenAI/Models/Services/Foundations/Completions/Exceptions/InvalidConfigurationCompletionException.cs index 2435b5ed..55f0b7e6 100644 --- a/Standard.AI.OpenAI/Models/Services/Foundations/Completions/Exceptions/InvalidConfigurationCompletionException.cs +++ b/Standard.AI.OpenAI/Models/Services/Foundations/Completions/Exceptions/InvalidConfigurationCompletionException.cs @@ -9,12 +9,6 @@ namespace Standard.AI.OpenAI.Models.Services.Foundations.Completions.Exceptions { public class InvalidConfigurationCompletionException : Xeption { - public InvalidConfigurationCompletionException(Exception innerException) - : base( - message: "Invalid configuration error occurred, fix errors and try again.", - innerException: innerException) - { } - public InvalidConfigurationCompletionException(string message, Exception innerException) : base(message, innerException) { } diff --git a/Standard.AI.OpenAI/Services/Foundations/Completions/CompletionService.Exceptions.cs b/Standard.AI.OpenAI/Services/Foundations/Completions/CompletionService.Exceptions.cs index 5b2e9871..1387a8dd 100644 --- a/Standard.AI.OpenAI/Services/Foundations/Completions/CompletionService.Exceptions.cs +++ b/Standard.AI.OpenAI/Services/Foundations/Completions/CompletionService.Exceptions.cs @@ -32,7 +32,9 @@ private static async ValueTask TryCatch(ReturningCompletionFunction catch (HttpResponseUrlNotFoundException httpResponseUrlNotFoundException) { var invalidConfigurationCompletionException = - new InvalidConfigurationCompletionException(httpResponseUrlNotFoundException); + new InvalidConfigurationCompletionException( + message: "Invalid configuration error occurred, fix errors and try again.", + httpResponseUrlNotFoundException); throw new CompletionDependencyException(invalidConfigurationCompletionException); } From 873bc25385613c68177b1f70e412815e439a48aa Mon Sep 17 00:00:00 2001 From: Lezune Date: Wed, 29 May 2024 21:42:10 -0700 Subject: [PATCH 027/283] Updated NotFoundCompletionException class by removing constructors in which the error message was hard coded in. Updated all relevant service files to include message. --- .../Completions/Exceptions/NotFoundCompletionException.cs | 6 ------ .../Foundations/Completions/CompletionService.Exceptions.cs | 4 +++- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/Standard.AI.OpenAI/Models/Services/Foundations/Completions/Exceptions/NotFoundCompletionException.cs b/Standard.AI.OpenAI/Models/Services/Foundations/Completions/Exceptions/NotFoundCompletionException.cs index 51d8a890..e33e1f76 100644 --- a/Standard.AI.OpenAI/Models/Services/Foundations/Completions/Exceptions/NotFoundCompletionException.cs +++ b/Standard.AI.OpenAI/Models/Services/Foundations/Completions/Exceptions/NotFoundCompletionException.cs @@ -9,12 +9,6 @@ namespace Standard.AI.OpenAI.Models.Services.Foundations.Completions.Exceptions { public class NotFoundCompletionException : Xeption { - public NotFoundCompletionException(Exception innerException) - : base( - message: "Not found completion error occurred, fix errors and try again.", - innerException: innerException) - { } - public NotFoundCompletionException(string message, Exception innerException) : base(message, innerException) { } diff --git a/Standard.AI.OpenAI/Services/Foundations/Completions/CompletionService.Exceptions.cs b/Standard.AI.OpenAI/Services/Foundations/Completions/CompletionService.Exceptions.cs index 5b2e9871..9b3f669c 100644 --- a/Standard.AI.OpenAI/Services/Foundations/Completions/CompletionService.Exceptions.cs +++ b/Standard.AI.OpenAI/Services/Foundations/Completions/CompletionService.Exceptions.cs @@ -53,7 +53,9 @@ private static async ValueTask TryCatch(ReturningCompletionFunction catch (HttpResponseNotFoundException httpResponseNotFoundException) { var notFoundCompletionException = - new NotFoundCompletionException(httpResponseNotFoundException); + new NotFoundCompletionException( + message: "Not found completion error occurred, fix errors and try again.", + httpResponseNotFoundException); throw new CompletionDependencyValidationException(notFoundCompletionException); } From 153b168c396a430463110fd1506fe1190306dc6f Mon Sep 17 00:00:00 2001 From: Lezune Date: Wed, 29 May 2024 21:48:26 -0700 Subject: [PATCH 028/283] Updated NullCompletionException class by removing constructors in which the error message was hard coded in. Updated all relevant service files to include message. --- .../Completions/CompletionServiceTests.Validations.Prompt.cs | 4 +++- .../Completions/Exceptions/NullCompletionException.cs | 5 ++--- .../Foundations/Completions/CompletionService.Validations.cs | 3 ++- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/Completions/CompletionServiceTests.Validations.Prompt.cs b/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/Completions/CompletionServiceTests.Validations.Prompt.cs index e6b84b3c..7fd42d0c 100644 --- a/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/Completions/CompletionServiceTests.Validations.Prompt.cs +++ b/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/Completions/CompletionServiceTests.Validations.Prompt.cs @@ -20,7 +20,9 @@ private async Task ShouldThrowValidationExceptionOnPromptIfCompletionIsNullAsync { // given Completion nullCompletion = null; - var nullCompletionException = new NullCompletionException(); + var nullCompletionException = + new NullCompletionException( + message: "Completion is null."); var exceptedCompletionValidationException = new CompletionValidationException( diff --git a/Standard.AI.OpenAI/Models/Services/Foundations/Completions/Exceptions/NullCompletionException.cs b/Standard.AI.OpenAI/Models/Services/Foundations/Completions/Exceptions/NullCompletionException.cs index b4ef379e..ff734311 100644 --- a/Standard.AI.OpenAI/Models/Services/Foundations/Completions/Exceptions/NullCompletionException.cs +++ b/Standard.AI.OpenAI/Models/Services/Foundations/Completions/Exceptions/NullCompletionException.cs @@ -8,9 +8,8 @@ namespace Standard.AI.OpenAI.Models.Services.Foundations.Completions.Exceptions { public class NullCompletionException : Xeption { - public NullCompletionException() - : base( - message: "Completion is null.") + public NullCompletionException(string message) + : base(message) { } public NullCompletionException(string message, Xeption innerException) diff --git a/Standard.AI.OpenAI/Services/Foundations/Completions/CompletionService.Validations.cs b/Standard.AI.OpenAI/Services/Foundations/Completions/CompletionService.Validations.cs index e366662f..ed364ce4 100644 --- a/Standard.AI.OpenAI/Services/Foundations/Completions/CompletionService.Validations.cs +++ b/Standard.AI.OpenAI/Services/Foundations/Completions/CompletionService.Validations.cs @@ -25,7 +25,8 @@ private static void ValidateCompletionNotNull(Completion completion) { if (completion is null) { - throw new NullCompletionException(); + throw new NullCompletionException( + message: "Completion is null."); } } From a9ab86ec7b4f996e3d786362616c3a73717558c2 Mon Sep 17 00:00:00 2001 From: Lezune Date: Wed, 29 May 2024 21:52:22 -0700 Subject: [PATCH 029/283] Updated UnauthorizedCompletionException class by removing constructors in which the error message was hard coded in. Updated all relevant service files to include message. --- .../Exceptions/UnauthorizedCompletionException.cs | 6 ------ .../Completions/CompletionService.Exceptions.cs | 8 ++++++-- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/Standard.AI.OpenAI/Models/Services/Foundations/Completions/Exceptions/UnauthorizedCompletionException.cs b/Standard.AI.OpenAI/Models/Services/Foundations/Completions/Exceptions/UnauthorizedCompletionException.cs index 54dac63e..ce2db16a 100644 --- a/Standard.AI.OpenAI/Models/Services/Foundations/Completions/Exceptions/UnauthorizedCompletionException.cs +++ b/Standard.AI.OpenAI/Models/Services/Foundations/Completions/Exceptions/UnauthorizedCompletionException.cs @@ -9,12 +9,6 @@ namespace Standard.AI.OpenAI.Models.Services.Foundations.Completions.Exceptions { public class UnauthorizedCompletionException : Xeption { - public UnauthorizedCompletionException(Exception innerException) - : base( - message: "Unauthorized completion request, fix errors and try again.", - innerException: innerException) - { } - public UnauthorizedCompletionException(string message, Exception innerException) : base(message, innerException) { } diff --git a/Standard.AI.OpenAI/Services/Foundations/Completions/CompletionService.Exceptions.cs b/Standard.AI.OpenAI/Services/Foundations/Completions/CompletionService.Exceptions.cs index 5b2e9871..4d4657a5 100644 --- a/Standard.AI.OpenAI/Services/Foundations/Completions/CompletionService.Exceptions.cs +++ b/Standard.AI.OpenAI/Services/Foundations/Completions/CompletionService.Exceptions.cs @@ -39,14 +39,18 @@ private static async ValueTask TryCatch(ReturningCompletionFunction catch (HttpResponseUnauthorizedException httpResponseUnauthorizedException) { var unauthorizedCompletionException = - new UnauthorizedCompletionException(httpResponseUnauthorizedException); + new UnauthorizedCompletionException( + message: "Unauthorized completion request, fix errors and try again.", + httpResponseUnauthorizedException); throw new CompletionDependencyException(unauthorizedCompletionException); } catch (HttpResponseForbiddenException httpResponseForbiddenException) { var unauthorizedCompletionException = - new UnauthorizedCompletionException(httpResponseForbiddenException); + new UnauthorizedCompletionException( + message: "Unauthorized completion request, fix errors and try again.", + httpResponseForbiddenException); throw new CompletionDependencyException(unauthorizedCompletionException); } From 3101401d9476a3736bc7e64fae7e4480732a83f2 Mon Sep 17 00:00:00 2001 From: Lezune Date: Thu, 30 May 2024 01:50:57 -0700 Subject: [PATCH 030/283] Updated ExcessiveCallFineTuneException class by removing constructors in which the error message was hard coded in. Updated all relevant service files to include message. --- .../FineTunes/Exceptions/ExcessiveCallFineTuneException.cs | 6 ------ .../Foundations/FineTunes/FineTuneService.Exceptions.cs | 4 +++- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/Standard.AI.OpenAI/Models/Services/Foundations/FineTunes/Exceptions/ExcessiveCallFineTuneException.cs b/Standard.AI.OpenAI/Models/Services/Foundations/FineTunes/Exceptions/ExcessiveCallFineTuneException.cs index 7b094b3b..3180c1b6 100644 --- a/Standard.AI.OpenAI/Models/Services/Foundations/FineTunes/Exceptions/ExcessiveCallFineTuneException.cs +++ b/Standard.AI.OpenAI/Models/Services/Foundations/FineTunes/Exceptions/ExcessiveCallFineTuneException.cs @@ -9,12 +9,6 @@ namespace Standard.AI.OpenAI.Models.Services.Foundations.FineTunes.Exceptions { public class ExcessiveCallFineTuneException : Xeption { - public ExcessiveCallFineTuneException(Exception innerException) - : base( - message: "Excessive call error occurred, limit your calls.", - innerException: innerException) - { } - public ExcessiveCallFineTuneException(string message, Exception innerException) : base(message, innerException) { } diff --git a/Standard.AI.OpenAI/Services/Foundations/FineTunes/FineTuneService.Exceptions.cs b/Standard.AI.OpenAI/Services/Foundations/FineTunes/FineTuneService.Exceptions.cs index eca7071b..b9d150f0 100644 --- a/Standard.AI.OpenAI/Services/Foundations/FineTunes/FineTuneService.Exceptions.cs +++ b/Standard.AI.OpenAI/Services/Foundations/FineTunes/FineTuneService.Exceptions.cs @@ -62,7 +62,9 @@ private static async ValueTask TryCatch(ReturningFineTuneFunction retu catch (HttpResponseTooManyRequestsException httpResponseTooManyRequestsException) { var excessiveCallFineTuneException = - new ExcessiveCallFineTuneException(httpResponseTooManyRequestsException); + new ExcessiveCallFineTuneException( + message: "Excessive call error occurred, limit your calls.", + httpResponseTooManyRequestsException); throw new FineTuneDependencyValidationException(excessiveCallFineTuneException); } From 0b16c39f8e1fa066d2073bf47e4aea30c85a4f58 Mon Sep 17 00:00:00 2001 From: Lezune Date: Thu, 30 May 2024 01:54:30 -0700 Subject: [PATCH 031/283] Updated FailedFineTuneServiceException class by removing constructors in which the error message was hard coded in. Updated all relevant service files to include message. --- .../FineTunes/Exceptions/FailedFineTuneServiceException.cs | 6 ------ .../Foundations/FineTunes/FineTuneService.Exceptions.cs | 4 +++- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/Standard.AI.OpenAI/Models/Services/Foundations/FineTunes/Exceptions/FailedFineTuneServiceException.cs b/Standard.AI.OpenAI/Models/Services/Foundations/FineTunes/Exceptions/FailedFineTuneServiceException.cs index b37e1cf6..60e13f78 100644 --- a/Standard.AI.OpenAI/Models/Services/Foundations/FineTunes/Exceptions/FailedFineTuneServiceException.cs +++ b/Standard.AI.OpenAI/Models/Services/Foundations/FineTunes/Exceptions/FailedFineTuneServiceException.cs @@ -9,12 +9,6 @@ namespace Standard.AI.OpenAI.Models.Services.Foundations.FineTunes.Exceptions { public class FailedFineTuneServiceException : Xeption { - public FailedFineTuneServiceException(Exception innerException) - : base( - message: "Failed fine tune error occurred, contact support.", - innerException: innerException) - { } - public FailedFineTuneServiceException(string message, Exception innerException) : base(message, innerException) { } diff --git a/Standard.AI.OpenAI/Services/Foundations/FineTunes/FineTuneService.Exceptions.cs b/Standard.AI.OpenAI/Services/Foundations/FineTunes/FineTuneService.Exceptions.cs index eca7071b..1303d6aa 100644 --- a/Standard.AI.OpenAI/Services/Foundations/FineTunes/FineTuneService.Exceptions.cs +++ b/Standard.AI.OpenAI/Services/Foundations/FineTunes/FineTuneService.Exceptions.cs @@ -76,7 +76,9 @@ private static async ValueTask TryCatch(ReturningFineTuneFunction retu catch (Exception exception) { var failedFineTuneServiceException = - new FailedFineTuneServiceException(exception); + new FailedFineTuneServiceException( + message: "Failed fine tune error occurred, contact support.", + exception); throw new FineTuneServiceException(failedFineTuneServiceException); } From ccdf9c2231977cf7523f4a524657ac2eb0f1d74f Mon Sep 17 00:00:00 2001 From: Lezune Date: Thu, 30 May 2024 01:59:43 -0700 Subject: [PATCH 032/283] Updated FailedServerFineTuneException class by removing constructors in which the error message was hard coded in. Updated all relevant service files to include message. --- .../FineTunes/Exceptions/FailedServerFineTuneException.cs | 6 ------ .../Foundations/FineTunes/FineTuneService.Exceptions.cs | 4 +++- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/Standard.AI.OpenAI/Models/Services/Foundations/FineTunes/Exceptions/FailedServerFineTuneException.cs b/Standard.AI.OpenAI/Models/Services/Foundations/FineTunes/Exceptions/FailedServerFineTuneException.cs index 3497d12a..c8697ce4 100644 --- a/Standard.AI.OpenAI/Models/Services/Foundations/FineTunes/Exceptions/FailedServerFineTuneException.cs +++ b/Standard.AI.OpenAI/Models/Services/Foundations/FineTunes/Exceptions/FailedServerFineTuneException.cs @@ -9,12 +9,6 @@ namespace Standard.AI.OpenAI.Models.Services.Foundations.FineTunes.Exceptions { public class FailedServerFineTuneException : Xeption { - public FailedServerFineTuneException(Exception innerException) - : base( - message: "Failed fine tune server error occurred, contact support.", - innerException: innerException) - { } - public FailedServerFineTuneException(string message, Exception innerException) : base(message: message, innerException) { } diff --git a/Standard.AI.OpenAI/Services/Foundations/FineTunes/FineTuneService.Exceptions.cs b/Standard.AI.OpenAI/Services/Foundations/FineTunes/FineTuneService.Exceptions.cs index eca7071b..1a98d813 100644 --- a/Standard.AI.OpenAI/Services/Foundations/FineTunes/FineTuneService.Exceptions.cs +++ b/Standard.AI.OpenAI/Services/Foundations/FineTunes/FineTuneService.Exceptions.cs @@ -69,7 +69,9 @@ private static async ValueTask TryCatch(ReturningFineTuneFunction retu catch (HttpResponseException httpResponseException) { var failedServerFineTuneException = - new FailedServerFineTuneException(httpResponseException); + new FailedServerFineTuneException( + message: "Failed fine tune server error occurred, contact support.", + httpResponseException); throw new FineTuneDependencyException(failedServerFineTuneException); } From 33bee5cf4bedb929ad7ebc061a362c695d502284 Mon Sep 17 00:00:00 2001 From: Lezune Date: Thu, 30 May 2024 02:05:03 -0700 Subject: [PATCH 033/283] Updated FineTuneDependencyException class by removing constructors in which the error message was hard coded in. Updated all relevant service files to include message. --- .../Exceptions/FineTuneDependencyException.cs | 6 ------ .../FineTunes/FineTuneService.Exceptions.cs | 16 ++++++++++++---- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/Standard.AI.OpenAI/Models/Services/Foundations/FineTunes/Exceptions/FineTuneDependencyException.cs b/Standard.AI.OpenAI/Models/Services/Foundations/FineTunes/Exceptions/FineTuneDependencyException.cs index c1d965db..5b7ae340 100644 --- a/Standard.AI.OpenAI/Models/Services/Foundations/FineTunes/Exceptions/FineTuneDependencyException.cs +++ b/Standard.AI.OpenAI/Models/Services/Foundations/FineTunes/Exceptions/FineTuneDependencyException.cs @@ -8,12 +8,6 @@ namespace Standard.AI.OpenAI.Models.Services.Foundations.FineTunes.Exceptions { public class FineTuneDependencyException : Xeption { - public FineTuneDependencyException(Xeption innerException) - : base( - message: "Fine tune dependency error ocurred, contact support.", - innerException: innerException) - { } - public FineTuneDependencyException(string message, Xeption innerException) : base(message, innerException) { } diff --git a/Standard.AI.OpenAI/Services/Foundations/FineTunes/FineTuneService.Exceptions.cs b/Standard.AI.OpenAI/Services/Foundations/FineTunes/FineTuneService.Exceptions.cs index eca7071b..e4bcf518 100644 --- a/Standard.AI.OpenAI/Services/Foundations/FineTunes/FineTuneService.Exceptions.cs +++ b/Standard.AI.OpenAI/Services/Foundations/FineTunes/FineTuneService.Exceptions.cs @@ -33,7 +33,9 @@ private static async ValueTask TryCatch(ReturningFineTuneFunction retu var invalidFineTuneConfigurationException = new InvalidFineTuneConfigurationException(httpResponseUrlNotFoundException); - throw new FineTuneDependencyException(invalidFineTuneConfigurationException); + throw new FineTuneDependencyException( + message: "Fine tune dependency error ocurred, contact support.", + invalidFineTuneConfigurationException); } catch (HttpResponseUnauthorizedException httpResponseUnauthorizedException) { @@ -41,7 +43,9 @@ private static async ValueTask TryCatch(ReturningFineTuneFunction retu new UnauthorizedFineTuneException( httpResponseUnauthorizedException); - throw new FineTuneDependencyException(unauthorizedFineTuneException); + throw new FineTuneDependencyException( + message: "Fine tune dependency error ocurred, contact support.", + unauthorizedFineTuneException); } catch (HttpResponseForbiddenException httpResponseForbiddenException) { @@ -49,7 +53,9 @@ private static async ValueTask TryCatch(ReturningFineTuneFunction retu new UnauthorizedFineTuneException( httpResponseForbiddenException); - throw new FineTuneDependencyException(unauthorizedFineTuneException); + throw new FineTuneDependencyException( + message: "Fine tune dependency error ocurred, contact support.", + unauthorizedFineTuneException); } catch (HttpResponseBadRequestException httpResponseBadRequestException) { @@ -71,7 +77,9 @@ private static async ValueTask TryCatch(ReturningFineTuneFunction retu var failedServerFineTuneException = new FailedServerFineTuneException(httpResponseException); - throw new FineTuneDependencyException(failedServerFineTuneException); + throw new FineTuneDependencyException( + message: "Fine tune dependency error ocurred, contact support.", + failedServerFineTuneException); } catch (Exception exception) { From c35253c470d899c04fa1da67963b287ab3c21f53 Mon Sep 17 00:00:00 2001 From: Lezune Date: Thu, 30 May 2024 02:09:17 -0700 Subject: [PATCH 034/283] Updated FineTuneDependencyValidationException class by removing constructors in which the error message was hard coded in. Updated all relevant service files to include message. --- .../Exceptions/FineTuneDependencyValidationException.cs | 6 ------ .../Foundations/FineTunes/FineTuneService.Exceptions.cs | 8 ++++++-- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/Standard.AI.OpenAI/Models/Services/Foundations/FineTunes/Exceptions/FineTuneDependencyValidationException.cs b/Standard.AI.OpenAI/Models/Services/Foundations/FineTunes/Exceptions/FineTuneDependencyValidationException.cs index 271876ad..88bff9e7 100644 --- a/Standard.AI.OpenAI/Models/Services/Foundations/FineTunes/Exceptions/FineTuneDependencyValidationException.cs +++ b/Standard.AI.OpenAI/Models/Services/Foundations/FineTunes/Exceptions/FineTuneDependencyValidationException.cs @@ -8,12 +8,6 @@ namespace Standard.AI.OpenAI.Models.Services.Foundations.FineTunes.Exceptions { public class FineTuneDependencyValidationException : Xeption { - public FineTuneDependencyValidationException(Xeption innerException) - : base( - message: "Fine tune dependency validation error occurred, fix errors and try again", - innerException: innerException) - { } - public FineTuneDependencyValidationException(string message, Xeption innerException) : base(message, innerException) { } diff --git a/Standard.AI.OpenAI/Services/Foundations/FineTunes/FineTuneService.Exceptions.cs b/Standard.AI.OpenAI/Services/Foundations/FineTunes/FineTuneService.Exceptions.cs index eca7071b..bb69d9d0 100644 --- a/Standard.AI.OpenAI/Services/Foundations/FineTunes/FineTuneService.Exceptions.cs +++ b/Standard.AI.OpenAI/Services/Foundations/FineTunes/FineTuneService.Exceptions.cs @@ -57,14 +57,18 @@ private static async ValueTask TryCatch(ReturningFineTuneFunction retu new InvalidFineTuneException( httpResponseBadRequestException); - throw new FineTuneDependencyValidationException(invalidFineTuneException); + throw new FineTuneDependencyValidationException( + message: "Fine tune dependency validation error occurred, fix errors and try again", + invalidFineTuneException); } catch (HttpResponseTooManyRequestsException httpResponseTooManyRequestsException) { var excessiveCallFineTuneException = new ExcessiveCallFineTuneException(httpResponseTooManyRequestsException); - throw new FineTuneDependencyValidationException(excessiveCallFineTuneException); + throw new FineTuneDependencyValidationException( + message: "Fine tune dependency validation error occurred, fix errors and try again", + excessiveCallFineTuneException); } catch (HttpResponseException httpResponseException) { From 65ab8e9dc0a1b8fe531fa96d4b99c8969c1d2033 Mon Sep 17 00:00:00 2001 From: Lezune Date: Thu, 30 May 2024 02:14:29 -0700 Subject: [PATCH 035/283] Updated FineTuneServiceException class by removing constructors in which the error message was hard coded in. Updated all relevant service files to include message. --- .../FineTunes/Exceptions/FineTuneServiceException.cs | 6 ------ .../Foundations/FineTunes/FineTuneService.Exceptions.cs | 4 +++- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/Standard.AI.OpenAI/Models/Services/Foundations/FineTunes/Exceptions/FineTuneServiceException.cs b/Standard.AI.OpenAI/Models/Services/Foundations/FineTunes/Exceptions/FineTuneServiceException.cs index 5c0303e6..9d1a2d11 100644 --- a/Standard.AI.OpenAI/Models/Services/Foundations/FineTunes/Exceptions/FineTuneServiceException.cs +++ b/Standard.AI.OpenAI/Models/Services/Foundations/FineTunes/Exceptions/FineTuneServiceException.cs @@ -8,12 +8,6 @@ namespace Standard.AI.OpenAI.Models.Services.Foundations.FineTunes.Exceptions { public class FineTuneServiceException : Xeption { - public FineTuneServiceException(Xeption innerException) - : base( - message: "Fine tune error ocurred, contact support.", - innerException: innerException) - { } - public FineTuneServiceException(string message, Xeption innerException) : base(message, innerException) { } } diff --git a/Standard.AI.OpenAI/Services/Foundations/FineTunes/FineTuneService.Exceptions.cs b/Standard.AI.OpenAI/Services/Foundations/FineTunes/FineTuneService.Exceptions.cs index eca7071b..41027491 100644 --- a/Standard.AI.OpenAI/Services/Foundations/FineTunes/FineTuneService.Exceptions.cs +++ b/Standard.AI.OpenAI/Services/Foundations/FineTunes/FineTuneService.Exceptions.cs @@ -78,7 +78,9 @@ private static async ValueTask TryCatch(ReturningFineTuneFunction retu var failedFineTuneServiceException = new FailedFineTuneServiceException(exception); - throw new FineTuneServiceException(failedFineTuneServiceException); + throw new FineTuneServiceException( + message: "Fine tune error ocurred, contact support.", + failedFineTuneServiceException); } } } From 1eee46e2d0c2d55de43d0110ee38d151c9c8c71e Mon Sep 17 00:00:00 2001 From: Lezune Date: Thu, 30 May 2024 02:18:32 -0700 Subject: [PATCH 036/283] Updated FineTuneValidationException class by removing constructors in which the error message was hard coded in. Updated all relevant service files to include message. --- .../FineTunes/Exceptions/FineTuneValidationException.cs | 6 ------ .../Foundations/FineTunes/FineTuneService.Exceptions.cs | 8 ++++++-- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/Standard.AI.OpenAI/Models/Services/Foundations/FineTunes/Exceptions/FineTuneValidationException.cs b/Standard.AI.OpenAI/Models/Services/Foundations/FineTunes/Exceptions/FineTuneValidationException.cs index a35754db..0be017e1 100644 --- a/Standard.AI.OpenAI/Models/Services/Foundations/FineTunes/Exceptions/FineTuneValidationException.cs +++ b/Standard.AI.OpenAI/Models/Services/Foundations/FineTunes/Exceptions/FineTuneValidationException.cs @@ -8,12 +8,6 @@ namespace Standard.AI.OpenAI.Models.Services.Foundations.FineTunes.Exceptions { public class FineTuneValidationException : Xeption { - public FineTuneValidationException(Xeption innerException) - : base( - message: "Fine tune validation error occurred, fix errors and try again.", - innerException: innerException) - { } - public FineTuneValidationException(string message, Xeption innerException) : base(message, innerException) { } diff --git a/Standard.AI.OpenAI/Services/Foundations/FineTunes/FineTuneService.Exceptions.cs b/Standard.AI.OpenAI/Services/Foundations/FineTunes/FineTuneService.Exceptions.cs index eca7071b..5317331a 100644 --- a/Standard.AI.OpenAI/Services/Foundations/FineTunes/FineTuneService.Exceptions.cs +++ b/Standard.AI.OpenAI/Services/Foundations/FineTunes/FineTuneService.Exceptions.cs @@ -22,11 +22,15 @@ private static async ValueTask TryCatch(ReturningFineTuneFunction retu } catch (NullFineTuneException nullFineTuneException) { - throw new FineTuneValidationException(nullFineTuneException); + throw new FineTuneValidationException( + message: "Fine tune validation error occurred, fix errors and try again.", + nullFineTuneException); } catch (InvalidFineTuneException invalidFineTuneException) { - throw new FineTuneValidationException(invalidFineTuneException); + throw new FineTuneValidationException( + message: "Fine tune validation error occurred, fix errors and try again.", + invalidFineTuneException); } catch (HttpResponseUrlNotFoundException httpResponseUrlNotFoundException) { From 095df5af591989f0fa87f42b6a66aecf64f7331f Mon Sep 17 00:00:00 2001 From: Lezune Date: Thu, 30 May 2024 02:23:30 -0700 Subject: [PATCH 037/283] Updated InvalidFineTuneConfigurationException class by removing constructors in which the error message was hard coded in. Updated all relevant service files to include message. --- .../Exceptions/InvalidFineTuneConfigurationException.cs | 6 ------ .../Foundations/FineTunes/FineTuneService.Exceptions.cs | 4 +++- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/Standard.AI.OpenAI/Models/Services/Foundations/FineTunes/Exceptions/InvalidFineTuneConfigurationException.cs b/Standard.AI.OpenAI/Models/Services/Foundations/FineTunes/Exceptions/InvalidFineTuneConfigurationException.cs index a7aaf366..c19d4ccc 100644 --- a/Standard.AI.OpenAI/Models/Services/Foundations/FineTunes/Exceptions/InvalidFineTuneConfigurationException.cs +++ b/Standard.AI.OpenAI/Models/Services/Foundations/FineTunes/Exceptions/InvalidFineTuneConfigurationException.cs @@ -9,12 +9,6 @@ namespace Standard.AI.OpenAI.Models.Services.Foundations.FineTunes.Exceptions { public class InvalidFineTuneConfigurationException : Xeption { - public InvalidFineTuneConfigurationException(Exception innerException) - : base( - message: "Invalid fine tune configuration error ocurred, contact support.", - innerException: innerException) - { } - public InvalidFineTuneConfigurationException(string message, Exception innerException) : base(message, innerException) { } diff --git a/Standard.AI.OpenAI/Services/Foundations/FineTunes/FineTuneService.Exceptions.cs b/Standard.AI.OpenAI/Services/Foundations/FineTunes/FineTuneService.Exceptions.cs index eca7071b..3aec80f0 100644 --- a/Standard.AI.OpenAI/Services/Foundations/FineTunes/FineTuneService.Exceptions.cs +++ b/Standard.AI.OpenAI/Services/Foundations/FineTunes/FineTuneService.Exceptions.cs @@ -31,7 +31,9 @@ private static async ValueTask TryCatch(ReturningFineTuneFunction retu catch (HttpResponseUrlNotFoundException httpResponseUrlNotFoundException) { var invalidFineTuneConfigurationException = - new InvalidFineTuneConfigurationException(httpResponseUrlNotFoundException); + new InvalidFineTuneConfigurationException( + message: "Invalid fine tune configuration error ocurred, contact support.", + httpResponseUrlNotFoundException); throw new FineTuneDependencyException(invalidFineTuneConfigurationException); } From 0d3c9654710c73a3b371cac2c134518066b934a6 Mon Sep 17 00:00:00 2001 From: Lezune Date: Thu, 30 May 2024 02:30:48 -0700 Subject: [PATCH 038/283] Updated InvalidFineTuneException class by removing constructors in which the error message was hard coded in. Updated all relevant service files to include message. --- .../FineTuneServiceTests.Validations.Submit.cs | 7 +++++-- .../FineTunes/Exceptions/InvalidFineTuneException.cs | 10 ++-------- .../FineTunes/FineTuneService.Exceptions.cs | 1 + .../FineTunes/FineTuneService.Validations.cs | 4 +++- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/FineTunes/FineTuneServiceTests.Validations.Submit.cs b/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/FineTunes/FineTuneServiceTests.Validations.Submit.cs index e0bcf7b1..56ed0842 100644 --- a/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/FineTunes/FineTuneServiceTests.Validations.Submit.cs +++ b/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/FineTunes/FineTuneServiceTests.Validations.Submit.cs @@ -60,7 +60,8 @@ private async Task ShouldThrowValidationExceptionOnSubmitIfFineTuneRequestIsNull fineTune.Request = nullFineTuneRequest; var invalidFineTuneException = - new InvalidFineTuneException(); + new InvalidFineTuneException( + message: "Fine tune is invalid."); invalidFineTuneException.AddData( key: nameof(FineTune.Request), @@ -104,7 +105,9 @@ private async Task ShouldThrowValidationExceptionOnSubmitIfFineTuneRequestIsInva var invalidFineTune = new FineTune(); invalidFineTune.Request = new FineTuneRequest(); invalidFineTune.Request.FileId = invalidText; - var invalidFineTuneException = new InvalidFineTuneException(); + var invalidFineTuneException = + new InvalidFineTuneException( + message: "Fine tune is invalid."); invalidFineTuneException.AddData( key: nameof(FineTuneRequest.FileId), diff --git a/Standard.AI.OpenAI/Models/Services/Foundations/FineTunes/Exceptions/InvalidFineTuneException.cs b/Standard.AI.OpenAI/Models/Services/Foundations/FineTunes/Exceptions/InvalidFineTuneException.cs index 4f5c6c4b..bdfbd056 100644 --- a/Standard.AI.OpenAI/Models/Services/Foundations/FineTunes/Exceptions/InvalidFineTuneException.cs +++ b/Standard.AI.OpenAI/Models/Services/Foundations/FineTunes/Exceptions/InvalidFineTuneException.cs @@ -9,14 +9,8 @@ namespace Standard.AI.OpenAI.Models.Services.Foundations.FineTunes.Exceptions { public class InvalidFineTuneException : Xeption { - public InvalidFineTuneException() - : base(message: "Fine tune is invalid.") - { } - - public InvalidFineTuneException(Exception innerException) - : base( - message: "Fine tune is invalid.", - innerException: innerException) + public InvalidFineTuneException(string message) + : base(message) { } public InvalidFineTuneException(string message, Exception innerException) diff --git a/Standard.AI.OpenAI/Services/Foundations/FineTunes/FineTuneService.Exceptions.cs b/Standard.AI.OpenAI/Services/Foundations/FineTunes/FineTuneService.Exceptions.cs index eca7071b..1619ee34 100644 --- a/Standard.AI.OpenAI/Services/Foundations/FineTunes/FineTuneService.Exceptions.cs +++ b/Standard.AI.OpenAI/Services/Foundations/FineTunes/FineTuneService.Exceptions.cs @@ -55,6 +55,7 @@ private static async ValueTask TryCatch(ReturningFineTuneFunction retu { var invalidFineTuneException = new InvalidFineTuneException( + message: "Fine tune is invalid.", httpResponseBadRequestException); throw new FineTuneDependencyValidationException(invalidFineTuneException); diff --git a/Standard.AI.OpenAI/Services/Foundations/FineTunes/FineTuneService.Validations.cs b/Standard.AI.OpenAI/Services/Foundations/FineTunes/FineTuneService.Validations.cs index 6d96c33d..81ac0b0f 100644 --- a/Standard.AI.OpenAI/Services/Foundations/FineTunes/FineTuneService.Validations.cs +++ b/Standard.AI.OpenAI/Services/Foundations/FineTunes/FineTuneService.Validations.cs @@ -33,7 +33,9 @@ private static void ValidateFineTuneNotNull(FineTune fineTune) private static void Validate(params (dynamic Rule, string Parameter)[] validations) { - var invalidFineTuneException = new InvalidFineTuneException(); + var invalidFineTuneException = + new InvalidFineTuneException( + message: "Fine tune is invalid."); foreach ((dynamic rule, string parameter) in validations) { From bda268751a3c8d885c76b9026dbbb4f8171cc98e Mon Sep 17 00:00:00 2001 From: Lezune Date: Thu, 30 May 2024 02:36:46 -0700 Subject: [PATCH 039/283] Updated NullFineTuneException class by removing constructors in which the error message was hard coded in. Updated all relevant service files to include message. --- .../FineTunes/FineTuneServiceTests.Validations.Submit.cs | 3 ++- .../FineTunes/Exceptions/NullFineTuneException.cs | 5 ++--- .../Foundations/FineTunes/FineTuneService.Validations.cs | 3 ++- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/FineTunes/FineTuneServiceTests.Validations.Submit.cs b/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/FineTunes/FineTuneServiceTests.Validations.Submit.cs index e0bcf7b1..efbef060 100644 --- a/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/FineTunes/FineTuneServiceTests.Validations.Submit.cs +++ b/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/FineTunes/FineTuneServiceTests.Validations.Submit.cs @@ -21,7 +21,8 @@ private async Task ShouldThrowValidationExceptionOnSubmitIfFineTuneIsNullAsync() FineTune nullFineTune = null; var nullFineTuneException = - new NullFineTuneException(); + new NullFineTuneException( + message: "Fine tune is null."); var expectedFineTuneValidationException = new FineTuneValidationException( diff --git a/Standard.AI.OpenAI/Models/Services/Foundations/FineTunes/Exceptions/NullFineTuneException.cs b/Standard.AI.OpenAI/Models/Services/Foundations/FineTunes/Exceptions/NullFineTuneException.cs index 5588ae0d..c904f6da 100644 --- a/Standard.AI.OpenAI/Models/Services/Foundations/FineTunes/Exceptions/NullFineTuneException.cs +++ b/Standard.AI.OpenAI/Models/Services/Foundations/FineTunes/Exceptions/NullFineTuneException.cs @@ -8,9 +8,8 @@ namespace Standard.AI.OpenAI.Models.Services.Foundations.FineTunes.Exceptions { public class NullFineTuneException : Xeption { - public NullFineTuneException() - : base( - message: "Fine tune is null.") + public NullFineTuneException(string message) + : base(message) { } public NullFineTuneException(string message, Xeption innerException) diff --git a/Standard.AI.OpenAI/Services/Foundations/FineTunes/FineTuneService.Validations.cs b/Standard.AI.OpenAI/Services/Foundations/FineTunes/FineTuneService.Validations.cs index 6d96c33d..a6886c93 100644 --- a/Standard.AI.OpenAI/Services/Foundations/FineTunes/FineTuneService.Validations.cs +++ b/Standard.AI.OpenAI/Services/Foundations/FineTunes/FineTuneService.Validations.cs @@ -27,7 +27,8 @@ private static void ValidateFineTuneNotNull(FineTune fineTune) { if (fineTune is null) { - throw new NullFineTuneException(); + throw new NullFineTuneException( + message: "Fine tune is null."); } } From bc9f112fb98b41658bdc3bf51d52dab8615a2312 Mon Sep 17 00:00:00 2001 From: Lezune Date: Thu, 30 May 2024 02:40:34 -0700 Subject: [PATCH 040/283] Updated UnauthorizedFineTuneException class by removing constructors in which the error message was hard coded in. Updated all relevant service files to include message. --- .../FineTunes/Exceptions/UnauthorizedFineTuneException.cs | 6 ------ .../Foundations/FineTunes/FineTuneService.Exceptions.cs | 2 ++ 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/Standard.AI.OpenAI/Models/Services/Foundations/FineTunes/Exceptions/UnauthorizedFineTuneException.cs b/Standard.AI.OpenAI/Models/Services/Foundations/FineTunes/Exceptions/UnauthorizedFineTuneException.cs index 27d6c1a3..113ad343 100644 --- a/Standard.AI.OpenAI/Models/Services/Foundations/FineTunes/Exceptions/UnauthorizedFineTuneException.cs +++ b/Standard.AI.OpenAI/Models/Services/Foundations/FineTunes/Exceptions/UnauthorizedFineTuneException.cs @@ -9,12 +9,6 @@ namespace Standard.AI.OpenAI.Models.Services.Foundations.FineTunes.Exceptions { public class UnauthorizedFineTuneException : Xeption { - public UnauthorizedFineTuneException(Exception innerException) - : base( - message: "Unauthorized fine tune request, fix errors and try again.", - innerException: innerException) - { } - public UnauthorizedFineTuneException(string message, Exception innerException) : base(message, innerException) { } diff --git a/Standard.AI.OpenAI/Services/Foundations/FineTunes/FineTuneService.Exceptions.cs b/Standard.AI.OpenAI/Services/Foundations/FineTunes/FineTuneService.Exceptions.cs index eca7071b..4e853010 100644 --- a/Standard.AI.OpenAI/Services/Foundations/FineTunes/FineTuneService.Exceptions.cs +++ b/Standard.AI.OpenAI/Services/Foundations/FineTunes/FineTuneService.Exceptions.cs @@ -39,6 +39,7 @@ private static async ValueTask TryCatch(ReturningFineTuneFunction retu { var unauthorizedFineTuneException = new UnauthorizedFineTuneException( + message: "Unauthorized fine tune request, fix errors and try again.", httpResponseUnauthorizedException); throw new FineTuneDependencyException(unauthorizedFineTuneException); @@ -47,6 +48,7 @@ private static async ValueTask TryCatch(ReturningFineTuneFunction retu { var unauthorizedFineTuneException = new UnauthorizedFineTuneException( + message: "Unauthorized fine tune request, fix errors and try again.", httpResponseForbiddenException); throw new FineTuneDependencyException(unauthorizedFineTuneException); From dc51a5072672c92cd57f871bed666548db2c2be5 Mon Sep 17 00:00:00 2001 From: Lezune Date: Thu, 30 May 2024 02:48:08 -0700 Subject: [PATCH 041/283] Updated ExcessiveCallImageGenerationException class by removing constructors in which the error message was hard coded in. Updated all relevant service files to include message. --- .../Exceptions/ExcessiveCallImageGenerationException.cs | 6 ------ .../ImageGenerations/ImageGenerationService.Exceptions.cs | 4 +++- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/Standard.AI.OpenAI/Models/Services/Foundations/ImageGenerations/Exceptions/ExcessiveCallImageGenerationException.cs b/Standard.AI.OpenAI/Models/Services/Foundations/ImageGenerations/Exceptions/ExcessiveCallImageGenerationException.cs index e037587b..7888a00e 100644 --- a/Standard.AI.OpenAI/Models/Services/Foundations/ImageGenerations/Exceptions/ExcessiveCallImageGenerationException.cs +++ b/Standard.AI.OpenAI/Models/Services/Foundations/ImageGenerations/Exceptions/ExcessiveCallImageGenerationException.cs @@ -9,12 +9,6 @@ namespace Standard.AI.OpenAI.Models.Services.Foundations.ImageGenerations.Except { public class ExcessiveCallImageGenerationException : Xeption { - public ExcessiveCallImageGenerationException(Exception innerException) - : base( - message: "Excessive call error occurred, limit your calls.", - innerException: innerException) - { } - public ExcessiveCallImageGenerationException(string message, Exception innerException) : base(message, innerException) { } diff --git a/Standard.AI.OpenAI/Services/Foundations/ImageGenerations/ImageGenerationService.Exceptions.cs b/Standard.AI.OpenAI/Services/Foundations/ImageGenerations/ImageGenerationService.Exceptions.cs index ab06432d..9c2b5d2c 100644 --- a/Standard.AI.OpenAI/Services/Foundations/ImageGenerations/ImageGenerationService.Exceptions.cs +++ b/Standard.AI.OpenAI/Services/Foundations/ImageGenerations/ImageGenerationService.Exceptions.cs @@ -66,7 +66,9 @@ private async ValueTask TryCatch(ReturningImageGenerationFuncti catch (HttpResponseTooManyRequestsException httpResponseTooManyRequestsException) { var excessiveCallImageGenerationException = - new ExcessiveCallImageGenerationException(httpResponseTooManyRequestsException); + new ExcessiveCallImageGenerationException( + message: "Excessive call error occurred, limit your calls.", + httpResponseTooManyRequestsException); throw new ImageGenerationDependencyValidationException(excessiveCallImageGenerationException); } From a5202c69847e894b7a05187b936cd222228a5fbe Mon Sep 17 00:00:00 2001 From: Lezune Date: Thu, 30 May 2024 02:53:15 -0700 Subject: [PATCH 042/283] Updated FailedImageGenerationServiceException class by removing constructors in which the error message was hard coded in. Updated all relevant service files to include message. --- .../Exceptions/FailedImageGenerationServiceException.cs | 6 ------ .../ImageGenerations/ImageGenerationService.Exceptions.cs | 4 +++- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/Standard.AI.OpenAI/Models/Services/Foundations/ImageGenerations/Exceptions/FailedImageGenerationServiceException.cs b/Standard.AI.OpenAI/Models/Services/Foundations/ImageGenerations/Exceptions/FailedImageGenerationServiceException.cs index 5fbacb1b..ffd643ee 100644 --- a/Standard.AI.OpenAI/Models/Services/Foundations/ImageGenerations/Exceptions/FailedImageGenerationServiceException.cs +++ b/Standard.AI.OpenAI/Models/Services/Foundations/ImageGenerations/Exceptions/FailedImageGenerationServiceException.cs @@ -9,12 +9,6 @@ namespace Standard.AI.OpenAI.Models.Services.Foundations.ImageGenerations.Except { public class FailedImageGenerationServiceException : Xeption { - public FailedImageGenerationServiceException(Exception innerException) - : base( - message: "Failed image generation service error occurred, contact support.", - innerException: innerException) - { } - public FailedImageGenerationServiceException(string message, Exception innerException) : base(message, innerException) { } diff --git a/Standard.AI.OpenAI/Services/Foundations/ImageGenerations/ImageGenerationService.Exceptions.cs b/Standard.AI.OpenAI/Services/Foundations/ImageGenerations/ImageGenerationService.Exceptions.cs index ab06432d..2db3623a 100644 --- a/Standard.AI.OpenAI/Services/Foundations/ImageGenerations/ImageGenerationService.Exceptions.cs +++ b/Standard.AI.OpenAI/Services/Foundations/ImageGenerations/ImageGenerationService.Exceptions.cs @@ -80,7 +80,9 @@ private async ValueTask TryCatch(ReturningImageGenerationFuncti catch (Exception exception) { var failedImageGenerationServiceException = - new FailedImageGenerationServiceException(exception); + new FailedImageGenerationServiceException( + message: "Failed image generation service error occurred, contact support.", + exception); throw new ImageGenerationServiceException(failedImageGenerationServiceException); } From 09c962af64b99b1e63c575a87cdbe016ca55ff3c Mon Sep 17 00:00:00 2001 From: Lezune Date: Thu, 30 May 2024 02:58:12 -0700 Subject: [PATCH 043/283] Updated FailedServerImageGenerationException class by removing constructors in which the error message was hard coded in. Updated all relevant service files to include message. --- .../Exceptions/FailedServerImageGenerationException.cs | 6 ------ .../ImageGenerations/ImageGenerationService.Exceptions.cs | 4 +++- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/Standard.AI.OpenAI/Models/Services/Foundations/ImageGenerations/Exceptions/FailedServerImageGenerationException.cs b/Standard.AI.OpenAI/Models/Services/Foundations/ImageGenerations/Exceptions/FailedServerImageGenerationException.cs index 358ad603..488ad22a 100644 --- a/Standard.AI.OpenAI/Models/Services/Foundations/ImageGenerations/Exceptions/FailedServerImageGenerationException.cs +++ b/Standard.AI.OpenAI/Models/Services/Foundations/ImageGenerations/Exceptions/FailedServerImageGenerationException.cs @@ -9,12 +9,6 @@ namespace Standard.AI.OpenAI.Models.Services.Foundations.ImageGenerations.Except { public class FailedServerImageGenerationException : Xeption { - public FailedServerImageGenerationException(Exception innerException) - : base( - message: "Failed image generation server error occurred, contact support.", - innerException: innerException) - { } - public FailedServerImageGenerationException(string message, Exception innerException) : base(message, innerException) { } diff --git a/Standard.AI.OpenAI/Services/Foundations/ImageGenerations/ImageGenerationService.Exceptions.cs b/Standard.AI.OpenAI/Services/Foundations/ImageGenerations/ImageGenerationService.Exceptions.cs index ab06432d..4197909e 100644 --- a/Standard.AI.OpenAI/Services/Foundations/ImageGenerations/ImageGenerationService.Exceptions.cs +++ b/Standard.AI.OpenAI/Services/Foundations/ImageGenerations/ImageGenerationService.Exceptions.cs @@ -73,7 +73,9 @@ private async ValueTask TryCatch(ReturningImageGenerationFuncti catch (HttpResponseException httpResponseException) { var failedServerImageGenerationException = - new FailedServerImageGenerationException(httpResponseException); + new FailedServerImageGenerationException( + message: "Failed image generation server error occurred, contact support.", + httpResponseException); throw new ImageGenerationDependencyException(failedServerImageGenerationException); } From 10e28f7e1cc6a012577564530b82be474cf327ff Mon Sep 17 00:00:00 2001 From: Lezune Date: Thu, 30 May 2024 03:01:57 -0700 Subject: [PATCH 044/283] Updated ImageGenerationDependencyException class by removing constructors in which the error message was hard coded in. Updated all relevant service files to include message. --- .../ImageGenerationDependencyException.cs | 6 ------ .../ImageGenerationService.Exceptions.cs | 16 ++++++++++++---- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/Standard.AI.OpenAI/Models/Services/Foundations/ImageGenerations/Exceptions/ImageGenerationDependencyException.cs b/Standard.AI.OpenAI/Models/Services/Foundations/ImageGenerations/Exceptions/ImageGenerationDependencyException.cs index 9849da89..00b4328f 100644 --- a/Standard.AI.OpenAI/Models/Services/Foundations/ImageGenerations/Exceptions/ImageGenerationDependencyException.cs +++ b/Standard.AI.OpenAI/Models/Services/Foundations/ImageGenerations/Exceptions/ImageGenerationDependencyException.cs @@ -8,12 +8,6 @@ namespace Standard.AI.OpenAI.Models.Services.Foundations.ImageGenerations.Except { public class ImageGenerationDependencyException : Xeption { - public ImageGenerationDependencyException(Xeption innerException) - : base( - message: "Image generation dependency error occurred, contact support.", - innerException: innerException) - { } - public ImageGenerationDependencyException(string message, Xeption innerException) : base(message, innerException) { } diff --git a/Standard.AI.OpenAI/Services/Foundations/ImageGenerations/ImageGenerationService.Exceptions.cs b/Standard.AI.OpenAI/Services/Foundations/ImageGenerations/ImageGenerationService.Exceptions.cs index ab06432d..61aab367 100644 --- a/Standard.AI.OpenAI/Services/Foundations/ImageGenerations/ImageGenerationService.Exceptions.cs +++ b/Standard.AI.OpenAI/Services/Foundations/ImageGenerations/ImageGenerationService.Exceptions.cs @@ -33,21 +33,27 @@ private async ValueTask TryCatch(ReturningImageGenerationFuncti var invalidConfigurationImageGenerationException = new InvalidConfigurationImageGenerationException(httpResponseUrlNotFoundException); - throw new ImageGenerationDependencyException(invalidConfigurationImageGenerationException); + throw new ImageGenerationDependencyException( + message: "Image generation dependency error occurred, contact support.", + invalidConfigurationImageGenerationException); } catch (HttpResponseUnauthorizedException httpResponseUnauthorizedException) { var unauthorizedImageGenerationException = new UnauthorizedImageGenerationException(httpResponseUnauthorizedException); - throw new ImageGenerationDependencyException(unauthorizedImageGenerationException); + throw new ImageGenerationDependencyException( + message: "Image generation dependency error occurred, contact support.", + unauthorizedImageGenerationException); } catch (HttpResponseForbiddenException httpResponseForbiddenException) { var unauthorizedImageGenerationException = new UnauthorizedImageGenerationException(httpResponseForbiddenException); - throw new ImageGenerationDependencyException(unauthorizedImageGenerationException); + throw new ImageGenerationDependencyException( + message: "Image generation dependency error occurred, contact support.", + unauthorizedImageGenerationException); } catch (HttpResponseNotFoundException httpResponseNotFoundException) { @@ -75,7 +81,9 @@ private async ValueTask TryCatch(ReturningImageGenerationFuncti var failedServerImageGenerationException = new FailedServerImageGenerationException(httpResponseException); - throw new ImageGenerationDependencyException(failedServerImageGenerationException); + throw new ImageGenerationDependencyException( + message: "Image generation dependency error occurred, contact support.", + failedServerImageGenerationException); } catch (Exception exception) { From 092a0edc09a3ff4e8f01f4f9c244d6f8e6f49947 Mon Sep 17 00:00:00 2001 From: Lezune Date: Thu, 30 May 2024 03:05:38 -0700 Subject: [PATCH 045/283] Updated ImageGenerationDependencyValidationException class by removing constructors in which the error message was hard coded in. Updated all relevant service files to include message. --- .../ImageGenerationDependencyValidationException.cs | 6 ------ .../ImageGenerationService.Exceptions.cs | 12 +++++++++--- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/Standard.AI.OpenAI/Models/Services/Foundations/ImageGenerations/Exceptions/ImageGenerationDependencyValidationException.cs b/Standard.AI.OpenAI/Models/Services/Foundations/ImageGenerations/Exceptions/ImageGenerationDependencyValidationException.cs index 39955e84..b79d757c 100644 --- a/Standard.AI.OpenAI/Models/Services/Foundations/ImageGenerations/Exceptions/ImageGenerationDependencyValidationException.cs +++ b/Standard.AI.OpenAI/Models/Services/Foundations/ImageGenerations/Exceptions/ImageGenerationDependencyValidationException.cs @@ -8,12 +8,6 @@ namespace Standard.AI.OpenAI.Models.Services.Foundations.ImageGenerations.Except { public class ImageGenerationDependencyValidationException : Xeption { - public ImageGenerationDependencyValidationException(Xeption innerException) - : base( - message: "Image generation dependency validation error occurred, fix errors and try again.", - innerException: innerException) - { } - public ImageGenerationDependencyValidationException(string message, Xeption innerException) : base(message, innerException) { } diff --git a/Standard.AI.OpenAI/Services/Foundations/ImageGenerations/ImageGenerationService.Exceptions.cs b/Standard.AI.OpenAI/Services/Foundations/ImageGenerations/ImageGenerationService.Exceptions.cs index ab06432d..51f790c3 100644 --- a/Standard.AI.OpenAI/Services/Foundations/ImageGenerations/ImageGenerationService.Exceptions.cs +++ b/Standard.AI.OpenAI/Services/Foundations/ImageGenerations/ImageGenerationService.Exceptions.cs @@ -54,21 +54,27 @@ private async ValueTask TryCatch(ReturningImageGenerationFuncti var notFoundImageGenerationException = new NotFoundImageGenerationException(httpResponseNotFoundException); - throw new ImageGenerationDependencyValidationException(notFoundImageGenerationException); + throw new ImageGenerationDependencyValidationException( + message: "Image generation dependency validation error occurred, fix errors and try again.", + notFoundImageGenerationException); } catch (HttpResponseBadRequestException httpResponseBadRequestException) { var invalidImageGenerationException = new InvalidImageGenerationException(httpResponseBadRequestException); - throw new ImageGenerationDependencyValidationException(invalidImageGenerationException); + throw new ImageGenerationDependencyValidationException( + message: "Image generation dependency validation error occurred, fix errors and try again.", + invalidImageGenerationException); } catch (HttpResponseTooManyRequestsException httpResponseTooManyRequestsException) { var excessiveCallImageGenerationException = new ExcessiveCallImageGenerationException(httpResponseTooManyRequestsException); - throw new ImageGenerationDependencyValidationException(excessiveCallImageGenerationException); + throw new ImageGenerationDependencyValidationException( + message: "Image generation dependency validation error occurred, fix errors and try again.", + excessiveCallImageGenerationException); } catch (HttpResponseException httpResponseException) { From f322a7824281dbf6870d8b6ee1b07600e666ef85 Mon Sep 17 00:00:00 2001 From: Lezune Date: Thu, 30 May 2024 03:09:08 -0700 Subject: [PATCH 046/283] Updated ImageGenerationServiceException class by removing constructors in which the error message was hard coded in. Updated all relevant service files to include message. --- .../Exceptions/ImageGenerationServiceException.cs | 6 ------ .../ImageGenerations/ImageGenerationService.Exceptions.cs | 4 +++- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/Standard.AI.OpenAI/Models/Services/Foundations/ImageGenerations/Exceptions/ImageGenerationServiceException.cs b/Standard.AI.OpenAI/Models/Services/Foundations/ImageGenerations/Exceptions/ImageGenerationServiceException.cs index 69822ee7..742828a6 100644 --- a/Standard.AI.OpenAI/Models/Services/Foundations/ImageGenerations/Exceptions/ImageGenerationServiceException.cs +++ b/Standard.AI.OpenAI/Models/Services/Foundations/ImageGenerations/Exceptions/ImageGenerationServiceException.cs @@ -9,12 +9,6 @@ namespace Standard.AI.OpenAI.Models.Services.Foundations.ImageGenerations.Except { public class ImageGenerationServiceException : Xeption { - public ImageGenerationServiceException(Exception innerException) - : base( - message: "Image generation service error occurred, contact support.", - innerException: innerException) - { } - public ImageGenerationServiceException(string message, Exception innerException) : base(message, innerException) { } diff --git a/Standard.AI.OpenAI/Services/Foundations/ImageGenerations/ImageGenerationService.Exceptions.cs b/Standard.AI.OpenAI/Services/Foundations/ImageGenerations/ImageGenerationService.Exceptions.cs index ab06432d..cc98e09c 100644 --- a/Standard.AI.OpenAI/Services/Foundations/ImageGenerations/ImageGenerationService.Exceptions.cs +++ b/Standard.AI.OpenAI/Services/Foundations/ImageGenerations/ImageGenerationService.Exceptions.cs @@ -82,7 +82,9 @@ private async ValueTask TryCatch(ReturningImageGenerationFuncti var failedImageGenerationServiceException = new FailedImageGenerationServiceException(exception); - throw new ImageGenerationServiceException(failedImageGenerationServiceException); + throw new ImageGenerationServiceException( + message: "Image generation service error occurred, contact support.", + failedImageGenerationServiceException); } } } From 34d65908bc6494874f2f93bce18144c9167a671b Mon Sep 17 00:00:00 2001 From: Lezune Date: Thu, 30 May 2024 03:13:17 -0700 Subject: [PATCH 047/283] Updated ImageGenerationValidationException class by removing constructors in which the error message was hard coded in. Updated all relevant service files to include message. --- .../Exceptions/ImageGenerationValidationException.cs | 6 ------ .../ImageGenerations/ImageGenerationService.Exceptions.cs | 8 ++++++-- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/Standard.AI.OpenAI/Models/Services/Foundations/ImageGenerations/Exceptions/ImageGenerationValidationException.cs b/Standard.AI.OpenAI/Models/Services/Foundations/ImageGenerations/Exceptions/ImageGenerationValidationException.cs index e7fe4028..0ea23539 100644 --- a/Standard.AI.OpenAI/Models/Services/Foundations/ImageGenerations/Exceptions/ImageGenerationValidationException.cs +++ b/Standard.AI.OpenAI/Models/Services/Foundations/ImageGenerations/Exceptions/ImageGenerationValidationException.cs @@ -8,12 +8,6 @@ namespace Standard.AI.OpenAI.Models.Services.Foundations.ImageGenerations.Except { public class ImageGenerationValidationException : Xeption { - public ImageGenerationValidationException(Xeption innerException) - : base( - message: "Image generation validation error occurred, fix errors and try again.", - innerException: innerException) - { } - public ImageGenerationValidationException(string message, Xeption innerException) : base(message, innerException) { } diff --git a/Standard.AI.OpenAI/Services/Foundations/ImageGenerations/ImageGenerationService.Exceptions.cs b/Standard.AI.OpenAI/Services/Foundations/ImageGenerations/ImageGenerationService.Exceptions.cs index ab06432d..4e83c98a 100644 --- a/Standard.AI.OpenAI/Services/Foundations/ImageGenerations/ImageGenerationService.Exceptions.cs +++ b/Standard.AI.OpenAI/Services/Foundations/ImageGenerations/ImageGenerationService.Exceptions.cs @@ -22,11 +22,15 @@ private async ValueTask TryCatch(ReturningImageGenerationFuncti } catch (NullImageGenerationException nullImageGenerationException) { - throw new ImageGenerationValidationException(nullImageGenerationException); + throw new ImageGenerationValidationException( + message: "Image generation validation error occurred, fix errors and try again.", + nullImageGenerationException); } catch (InvalidImageGenerationException invalidImageGenerationException) { - throw new ImageGenerationValidationException(invalidImageGenerationException); + throw new ImageGenerationValidationException( + message: "Image generation validation error occurred, fix errors and try again.", + invalidImageGenerationException); } catch (HttpResponseUrlNotFoundException httpResponseUrlNotFoundException) { From 29bffa289c453b0c10687d2ea6fb91bdfeed0bbb Mon Sep 17 00:00:00 2001 From: Lezune Date: Thu, 30 May 2024 03:21:24 -0700 Subject: [PATCH 048/283] Updated InvalidConfigurationImageGenerationException class by removing constructors in which the error message was hard coded in. Updated all relevant service files to include message. --- .../InvalidConfigurationImageGenerationException.cs | 6 ------ .../ImageGenerations/ImageGenerationService.Exceptions.cs | 4 +++- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/Standard.AI.OpenAI/Models/Services/Foundations/ImageGenerations/Exceptions/InvalidConfigurationImageGenerationException.cs b/Standard.AI.OpenAI/Models/Services/Foundations/ImageGenerations/Exceptions/InvalidConfigurationImageGenerationException.cs index 68649641..2048b0fe 100644 --- a/Standard.AI.OpenAI/Models/Services/Foundations/ImageGenerations/Exceptions/InvalidConfigurationImageGenerationException.cs +++ b/Standard.AI.OpenAI/Models/Services/Foundations/ImageGenerations/Exceptions/InvalidConfigurationImageGenerationException.cs @@ -9,12 +9,6 @@ namespace Standard.AI.OpenAI.Models.Services.Foundations.ImageGenerations.Except { public class InvalidConfigurationImageGenerationException : Xeption { - public InvalidConfigurationImageGenerationException(Exception innerException) - : base( - message: "Invalid image generation configuration error occurred, contact support.", - innerException: innerException) - { } - public InvalidConfigurationImageGenerationException(string message, Exception innerException) : base(message, innerException) { } diff --git a/Standard.AI.OpenAI/Services/Foundations/ImageGenerations/ImageGenerationService.Exceptions.cs b/Standard.AI.OpenAI/Services/Foundations/ImageGenerations/ImageGenerationService.Exceptions.cs index ab06432d..14353965 100644 --- a/Standard.AI.OpenAI/Services/Foundations/ImageGenerations/ImageGenerationService.Exceptions.cs +++ b/Standard.AI.OpenAI/Services/Foundations/ImageGenerations/ImageGenerationService.Exceptions.cs @@ -31,7 +31,9 @@ private async ValueTask TryCatch(ReturningImageGenerationFuncti catch (HttpResponseUrlNotFoundException httpResponseUrlNotFoundException) { var invalidConfigurationImageGenerationException = - new InvalidConfigurationImageGenerationException(httpResponseUrlNotFoundException); + new InvalidConfigurationImageGenerationException( + message: "Invalid image generation configuration error occurred, contact support.", + httpResponseUrlNotFoundException); throw new ImageGenerationDependencyException(invalidConfigurationImageGenerationException); } From ba6f05e7b3c577de7226d1772217b93be7a3ba48 Mon Sep 17 00:00:00 2001 From: Lezune Date: Thu, 30 May 2024 03:26:31 -0700 Subject: [PATCH 049/283] Updated InvalidImageGenerationException class by removing constructors in which the error message was hard coded in. Updated all relevant service files to include message. --- ...mageGenerationServiceTests.Validations.Generate.cs | 6 ++++-- .../Exceptions/InvalidImageGenerationException.cs | 11 ++--------- .../ImageGenerationService.Exceptions.cs | 4 +++- .../ImageGenerationService.Validations.cs | 4 +++- 4 files changed, 12 insertions(+), 13 deletions(-) diff --git a/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/ImageGenerations/ImageGenerationServiceTests.Validations.Generate.cs b/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/ImageGenerations/ImageGenerationServiceTests.Validations.Generate.cs index e1cb5395..4418a738 100644 --- a/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/ImageGenerations/ImageGenerationServiceTests.Validations.Generate.cs +++ b/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/ImageGenerations/ImageGenerationServiceTests.Validations.Generate.cs @@ -58,7 +58,8 @@ private async Task ShouldThrowValidationExceptionOnGenerateIfRequestIsNullAsync( invalidImageGeneration.Request = null; var invalidImageGenerationException = - new InvalidImageGenerationException(); + new InvalidImageGenerationException( + message: "Invalid image generation error occurred, fix errors and try again."); invalidImageGenerationException.AddData( key: nameof(ImageGeneration.Request), @@ -106,7 +107,8 @@ private async Task ShouldThrowValidationExceptionOnGenerateIfRequestIsInvalidAsy }; var invalidImageGenerationException = - new InvalidImageGenerationException(); + new InvalidImageGenerationException( + message: "Invalid image generation error occurred, fix errors and try again."); invalidImageGenerationException.AddData( key: nameof(ImageGeneration.Request.Prompt), diff --git a/Standard.AI.OpenAI/Models/Services/Foundations/ImageGenerations/Exceptions/InvalidImageGenerationException.cs b/Standard.AI.OpenAI/Models/Services/Foundations/ImageGenerations/Exceptions/InvalidImageGenerationException.cs index f2b751dd..52bfe881 100644 --- a/Standard.AI.OpenAI/Models/Services/Foundations/ImageGenerations/Exceptions/InvalidImageGenerationException.cs +++ b/Standard.AI.OpenAI/Models/Services/Foundations/ImageGenerations/Exceptions/InvalidImageGenerationException.cs @@ -9,15 +9,8 @@ namespace Standard.AI.OpenAI.Models.Services.Foundations.ImageGenerations.Except { public class InvalidImageGenerationException : Xeption { - public InvalidImageGenerationException() - : base( - message: "Invalid image generation error occurred, fix errors and try again.") - { } - - public InvalidImageGenerationException(Exception innerException) - : base( - message: "Invalid image generation error occurred, fix errors and try again.", - innerException: innerException) + public InvalidImageGenerationException(string message) + : base(message) { } public InvalidImageGenerationException(string message, Exception innerException) diff --git a/Standard.AI.OpenAI/Services/Foundations/ImageGenerations/ImageGenerationService.Exceptions.cs b/Standard.AI.OpenAI/Services/Foundations/ImageGenerations/ImageGenerationService.Exceptions.cs index ab06432d..fb0d009a 100644 --- a/Standard.AI.OpenAI/Services/Foundations/ImageGenerations/ImageGenerationService.Exceptions.cs +++ b/Standard.AI.OpenAI/Services/Foundations/ImageGenerations/ImageGenerationService.Exceptions.cs @@ -59,7 +59,9 @@ private async ValueTask TryCatch(ReturningImageGenerationFuncti catch (HttpResponseBadRequestException httpResponseBadRequestException) { var invalidImageGenerationException = - new InvalidImageGenerationException(httpResponseBadRequestException); + new InvalidImageGenerationException( + message: "Invalid image generation error occurred, fix errors and try again.", + httpResponseBadRequestException); throw new ImageGenerationDependencyValidationException(invalidImageGenerationException); } diff --git a/Standard.AI.OpenAI/Services/Foundations/ImageGenerations/ImageGenerationService.Validations.cs b/Standard.AI.OpenAI/Services/Foundations/ImageGenerations/ImageGenerationService.Validations.cs index b72804f1..009ddf65 100644 --- a/Standard.AI.OpenAI/Services/Foundations/ImageGenerations/ImageGenerationService.Validations.cs +++ b/Standard.AI.OpenAI/Services/Foundations/ImageGenerations/ImageGenerationService.Validations.cs @@ -45,7 +45,9 @@ private static void ValidateImageGenerationIsNotNull(ImageGeneration imageGenera private static void Validate(params (dynamic Rule, string Parameter)[] validations) { - var invalidImageGenerationException = new InvalidImageGenerationException(); + var invalidImageGenerationException = + new InvalidImageGenerationException( + message: "Invalid image generation error occurred, fix errors and try again."); foreach ((dynamic rule, string parameter) in validations) { From c5fcb5f319b45be2ecb768910c82ba893a3176a7 Mon Sep 17 00:00:00 2001 From: Lezune Date: Thu, 30 May 2024 03:30:09 -0700 Subject: [PATCH 050/283] Updated NotFoundImageGenerationException class by removing constructors in which the error message was hard coded in. Updated all relevant service files to include message. --- .../Exceptions/NotFoundImageGenerationException.cs | 6 ------ .../ImageGenerations/ImageGenerationService.Exceptions.cs | 4 +++- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/Standard.AI.OpenAI/Models/Services/Foundations/ImageGenerations/Exceptions/NotFoundImageGenerationException.cs b/Standard.AI.OpenAI/Models/Services/Foundations/ImageGenerations/Exceptions/NotFoundImageGenerationException.cs index 14b4b345..40c68aff 100644 --- a/Standard.AI.OpenAI/Models/Services/Foundations/ImageGenerations/Exceptions/NotFoundImageGenerationException.cs +++ b/Standard.AI.OpenAI/Models/Services/Foundations/ImageGenerations/Exceptions/NotFoundImageGenerationException.cs @@ -9,12 +9,6 @@ namespace Standard.AI.OpenAI.Models.Services.Foundations.ImageGenerations.Except { public class NotFoundImageGenerationException : Xeption { - public NotFoundImageGenerationException(Exception innerException) - : base( - message: "Not found image generation error occurred, fix errors and try again.", - innerException: innerException) - { } - public NotFoundImageGenerationException(string message, Exception innerException) : base(message, innerException) { } diff --git a/Standard.AI.OpenAI/Services/Foundations/ImageGenerations/ImageGenerationService.Exceptions.cs b/Standard.AI.OpenAI/Services/Foundations/ImageGenerations/ImageGenerationService.Exceptions.cs index ab06432d..4df8ae0d 100644 --- a/Standard.AI.OpenAI/Services/Foundations/ImageGenerations/ImageGenerationService.Exceptions.cs +++ b/Standard.AI.OpenAI/Services/Foundations/ImageGenerations/ImageGenerationService.Exceptions.cs @@ -52,7 +52,9 @@ private async ValueTask TryCatch(ReturningImageGenerationFuncti catch (HttpResponseNotFoundException httpResponseNotFoundException) { var notFoundImageGenerationException = - new NotFoundImageGenerationException(httpResponseNotFoundException); + new NotFoundImageGenerationException( + message: "Not found image generation error occurred, fix errors and try again.", + httpResponseNotFoundException); throw new ImageGenerationDependencyValidationException(notFoundImageGenerationException); } From 4dbb98c6d7967d7552e96a645380026d5b0d783a Mon Sep 17 00:00:00 2001 From: Lezune Date: Thu, 30 May 2024 03:33:35 -0700 Subject: [PATCH 051/283] Updated NullImageGenerationException class by removing constructors in which the error message was hard coded in. Updated all relevant service files to include message. --- .../ImageGenerationServiceTests.Validations.Generate.cs | 3 ++- .../Exceptions/NullImageGenerationException.cs | 5 ++--- .../ImageGenerations/ImageGenerationService.Validations.cs | 3 ++- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/ImageGenerations/ImageGenerationServiceTests.Validations.Generate.cs b/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/ImageGenerations/ImageGenerationServiceTests.Validations.Generate.cs index e1cb5395..500d5813 100644 --- a/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/ImageGenerations/ImageGenerationServiceTests.Validations.Generate.cs +++ b/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/ImageGenerations/ImageGenerationServiceTests.Validations.Generate.cs @@ -21,7 +21,8 @@ private async Task ShouldThrowValidationExceptionOnGenerateIfImageGenerationIsNu ImageGeneration nullImageGeneration = null; var nullImageGenerationException = - new NullImageGenerationException(); + new NullImageGenerationException( + message: "Image generation is null."); var expectedImageGenerationValidationException = new ImageGenerationValidationException( diff --git a/Standard.AI.OpenAI/Models/Services/Foundations/ImageGenerations/Exceptions/NullImageGenerationException.cs b/Standard.AI.OpenAI/Models/Services/Foundations/ImageGenerations/Exceptions/NullImageGenerationException.cs index e57104ad..fefd419c 100644 --- a/Standard.AI.OpenAI/Models/Services/Foundations/ImageGenerations/Exceptions/NullImageGenerationException.cs +++ b/Standard.AI.OpenAI/Models/Services/Foundations/ImageGenerations/Exceptions/NullImageGenerationException.cs @@ -8,9 +8,8 @@ namespace Standard.AI.OpenAI.Models.Services.Foundations.ImageGenerations.Except { public class NullImageGenerationException : Xeption { - public NullImageGenerationException() - : base( - message: "Image generation is null.") + public NullImageGenerationException(string message) + : base(message) { } public NullImageGenerationException(string message, Xeption innerException) diff --git a/Standard.AI.OpenAI/Services/Foundations/ImageGenerations/ImageGenerationService.Validations.cs b/Standard.AI.OpenAI/Services/Foundations/ImageGenerations/ImageGenerationService.Validations.cs index b72804f1..af334785 100644 --- a/Standard.AI.OpenAI/Services/Foundations/ImageGenerations/ImageGenerationService.Validations.cs +++ b/Standard.AI.OpenAI/Services/Foundations/ImageGenerations/ImageGenerationService.Validations.cs @@ -27,7 +27,8 @@ private static void ValidateImageGenerationIsNotNull(ImageGeneration imageGenera { if (imageGeneration is null) { - throw new NullImageGenerationException(); + throw new NullImageGenerationException( + message: "Image generation is null."); } } From 83af75411aef1d4542c7fdf6e5ec1ec0f7dc53be Mon Sep 17 00:00:00 2001 From: Lezune Date: Thu, 30 May 2024 03:37:54 -0700 Subject: [PATCH 052/283] Updated UnauthorizedImageGenerationException class by removing constructors in which the error message was hard coded in. Updated all relevant service files to include message. --- .../Exceptions/UnauthorizedImageGenerationException.cs | 6 ------ .../ImageGenerations/ImageGenerationService.Exceptions.cs | 8 ++++++-- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/Standard.AI.OpenAI/Models/Services/Foundations/ImageGenerations/Exceptions/UnauthorizedImageGenerationException.cs b/Standard.AI.OpenAI/Models/Services/Foundations/ImageGenerations/Exceptions/UnauthorizedImageGenerationException.cs index 500c83b4..83229366 100644 --- a/Standard.AI.OpenAI/Models/Services/Foundations/ImageGenerations/Exceptions/UnauthorizedImageGenerationException.cs +++ b/Standard.AI.OpenAI/Models/Services/Foundations/ImageGenerations/Exceptions/UnauthorizedImageGenerationException.cs @@ -9,12 +9,6 @@ namespace Standard.AI.OpenAI.Models.Services.Foundations.ImageGenerations.Except { public class UnauthorizedImageGenerationException : Xeption { - public UnauthorizedImageGenerationException(Exception innerException) - : base( - message: "Unauthorized image generation request, fix errors and try again.", - innerException: innerException) - { } - public UnauthorizedImageGenerationException(string message, Exception innerException) : base(message, innerException) { } diff --git a/Standard.AI.OpenAI/Services/Foundations/ImageGenerations/ImageGenerationService.Exceptions.cs b/Standard.AI.OpenAI/Services/Foundations/ImageGenerations/ImageGenerationService.Exceptions.cs index ab06432d..3333dc49 100644 --- a/Standard.AI.OpenAI/Services/Foundations/ImageGenerations/ImageGenerationService.Exceptions.cs +++ b/Standard.AI.OpenAI/Services/Foundations/ImageGenerations/ImageGenerationService.Exceptions.cs @@ -38,14 +38,18 @@ private async ValueTask TryCatch(ReturningImageGenerationFuncti catch (HttpResponseUnauthorizedException httpResponseUnauthorizedException) { var unauthorizedImageGenerationException = - new UnauthorizedImageGenerationException(httpResponseUnauthorizedException); + new UnauthorizedImageGenerationException( + message: "Unauthorized image generation request, fix errors and try again.", + httpResponseUnauthorizedException); throw new ImageGenerationDependencyException(unauthorizedImageGenerationException); } catch (HttpResponseForbiddenException httpResponseForbiddenException) { var unauthorizedImageGenerationException = - new UnauthorizedImageGenerationException(httpResponseForbiddenException); + new UnauthorizedImageGenerationException( + message: "Unauthorized image generation request, fix errors and try again.", + httpResponseForbiddenException); throw new ImageGenerationDependencyException(unauthorizedImageGenerationException); } From 39d3d394e771cae570adaa99065aad5b591b197f Mon Sep 17 00:00:00 2001 From: Lezune Date: Thu, 30 May 2024 03:42:15 -0700 Subject: [PATCH 053/283] Updated FailedLocalFileDependencyException class by removing constructors in which the error message was hard coded in. Updated all relevant service files to include message. --- .../Exceptions/FailedLocalFileDependencyException.cs | 6 ------ .../Foundations/LocalFiles/LocalFileService.Exceptions.cs | 8 ++++++-- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/Standard.AI.OpenAI/Models/Services/Foundations/LocalFiles/Exceptions/FailedLocalFileDependencyException.cs b/Standard.AI.OpenAI/Models/Services/Foundations/LocalFiles/Exceptions/FailedLocalFileDependencyException.cs index 46ad9095..5609ef50 100644 --- a/Standard.AI.OpenAI/Models/Services/Foundations/LocalFiles/Exceptions/FailedLocalFileDependencyException.cs +++ b/Standard.AI.OpenAI/Models/Services/Foundations/LocalFiles/Exceptions/FailedLocalFileDependencyException.cs @@ -9,12 +9,6 @@ namespace Standard.AI.OpenAI.Models.Services.Foundations.LocalFiles.Exceptions { internal class FailedLocalFileDependencyException : Xeption { - public FailedLocalFileDependencyException(Exception innerException) - : base( - message: "Failed local file error occurred, contact support.", - innerException: innerException) - { } - public FailedLocalFileDependencyException(string message, Exception innerException) : base(message, innerException) { } diff --git a/Standard.AI.OpenAI/Services/Foundations/LocalFiles/LocalFileService.Exceptions.cs b/Standard.AI.OpenAI/Services/Foundations/LocalFiles/LocalFileService.Exceptions.cs index 13d9bfb6..7f618785 100644 --- a/Standard.AI.OpenAI/Services/Foundations/LocalFiles/LocalFileService.Exceptions.cs +++ b/Standard.AI.OpenAI/Services/Foundations/LocalFiles/LocalFileService.Exceptions.cs @@ -51,14 +51,18 @@ private Stream TryCatch(ReturningStreamFunction returningStreamFunction) catch (IOException ioException) { var failedFileException = - new FailedLocalFileDependencyException(ioException); + new FailedLocalFileDependencyException( + message: "Failed local file error occurred, contact support.", + ioException); throw new LocalFileDependencyException(failedFileException); } catch (NotSupportedException notSupportedException) { var failedFileException = - new FailedLocalFileDependencyException(notSupportedException); + new FailedLocalFileDependencyException( + message: "Failed local file error occurred, contact support.", + notSupportedException); throw new LocalFileDependencyException(failedFileException); } From ece164d8314269d6b5427e5787e0ddfd640a90a0 Mon Sep 17 00:00:00 2001 From: Lezune Date: Thu, 30 May 2024 03:48:12 -0700 Subject: [PATCH 054/283] Updated FailedLocalFileServiceException class by removing constructors in which the error message was hard coded in. Updated all relevant service files to include message. --- .../Exceptions/FailedLocalFileServiceException.cs | 6 ------ .../Foundations/LocalFiles/LocalFileService.Exceptions.cs | 4 +++- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/Standard.AI.OpenAI/Models/Services/Foundations/LocalFiles/Exceptions/FailedLocalFileServiceException.cs b/Standard.AI.OpenAI/Models/Services/Foundations/LocalFiles/Exceptions/FailedLocalFileServiceException.cs index 40df4090..dea32343 100644 --- a/Standard.AI.OpenAI/Models/Services/Foundations/LocalFiles/Exceptions/FailedLocalFileServiceException.cs +++ b/Standard.AI.OpenAI/Models/Services/Foundations/LocalFiles/Exceptions/FailedLocalFileServiceException.cs @@ -9,12 +9,6 @@ namespace Standard.AI.OpenAI.Models.Services.Foundations.LocalFiles.Exceptions { public class FailedLocalFileServiceException : Xeption { - public FailedLocalFileServiceException(Exception innerException) - : base( - message: "Failed local file service error occurred, contact support.", - innerException: innerException) - { } - public FailedLocalFileServiceException(string message, Exception innerException) : base(message, innerException) { } diff --git a/Standard.AI.OpenAI/Services/Foundations/LocalFiles/LocalFileService.Exceptions.cs b/Standard.AI.OpenAI/Services/Foundations/LocalFiles/LocalFileService.Exceptions.cs index 13d9bfb6..8af2ce75 100644 --- a/Standard.AI.OpenAI/Services/Foundations/LocalFiles/LocalFileService.Exceptions.cs +++ b/Standard.AI.OpenAI/Services/Foundations/LocalFiles/LocalFileService.Exceptions.cs @@ -65,7 +65,9 @@ private Stream TryCatch(ReturningStreamFunction returningStreamFunction) catch (Exception exception) { var failedLocalFileServiceException = - new FailedLocalFileServiceException(exception); + new FailedLocalFileServiceException( + message: "Failed local file service error occurred, contact support.", + exception); throw new LocalFileServiceException(failedLocalFileServiceException); } From 9a31232a11a16fc54c622f5687aa61500c579f07 Mon Sep 17 00:00:00 2001 From: Lezune Date: Thu, 30 May 2024 03:53:26 -0700 Subject: [PATCH 055/283] Updated InvalidLocalFileException class by removing constructors in which the error message was hard coded in. Updated all relevant service files to include message. --- .../LocalFileServiceTests.Validations.Read.cs | 3 ++- .../Exceptions/InvalidLocalFileException.cs | 11 ++--------- .../LocalFiles/LocalFileService.Exceptions.cs | 10 ++++++++-- .../LocalFiles/LocalFileService.Validations.cs | 4 +++- 4 files changed, 15 insertions(+), 13 deletions(-) diff --git a/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/LocalFiles/LocalFileServiceTests.Validations.Read.cs b/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/LocalFiles/LocalFileServiceTests.Validations.Read.cs index e0dd2024..24bbe8d5 100644 --- a/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/LocalFiles/LocalFileServiceTests.Validations.Read.cs +++ b/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/LocalFiles/LocalFileServiceTests.Validations.Read.cs @@ -21,7 +21,8 @@ private void ShouldThrowValidationExceptionOnReadIfFilePathIsInvalid( { // given var invalidFileException = - new InvalidLocalFileException(); + new InvalidLocalFileException( + message: "Invalid local file error occurred, fix error and try again."); invalidFileException.AddData( key: "FilePath", diff --git a/Standard.AI.OpenAI/Models/Services/Foundations/LocalFiles/Exceptions/InvalidLocalFileException.cs b/Standard.AI.OpenAI/Models/Services/Foundations/LocalFiles/Exceptions/InvalidLocalFileException.cs index ebdeb833..d5420fbc 100644 --- a/Standard.AI.OpenAI/Models/Services/Foundations/LocalFiles/Exceptions/InvalidLocalFileException.cs +++ b/Standard.AI.OpenAI/Models/Services/Foundations/LocalFiles/Exceptions/InvalidLocalFileException.cs @@ -9,15 +9,8 @@ namespace Standard.AI.OpenAI.Models.Services.Foundations.LocalFiles.Exceptions { public class InvalidLocalFileException : Xeption { - public InvalidLocalFileException() - : base( - message: "Invalid local file error occurred, fix error and try again.") - { } - - public InvalidLocalFileException(Exception innerException) - : base( - message: "Invalid local file error occurred, fix error and try again.", - innerException: innerException) + public InvalidLocalFileException(string message) + : base(message) { } public InvalidLocalFileException(string message, Exception innerException) diff --git a/Standard.AI.OpenAI/Services/Foundations/LocalFiles/LocalFileService.Exceptions.cs b/Standard.AI.OpenAI/Services/Foundations/LocalFiles/LocalFileService.Exceptions.cs index 13d9bfb6..fe76bb6c 100644 --- a/Standard.AI.OpenAI/Services/Foundations/LocalFiles/LocalFileService.Exceptions.cs +++ b/Standard.AI.OpenAI/Services/Foundations/LocalFiles/LocalFileService.Exceptions.cs @@ -24,13 +24,19 @@ private Stream TryCatch(ReturningStreamFunction returningStreamFunction) } catch (ArgumentException argumentException) { - var invalidFileException = new InvalidLocalFileException(argumentException); + var invalidFileException = + new InvalidLocalFileException( + message: "Invalid local file error occurred, fix error and try again.", + argumentException); throw new LocalFileDependencyValidationException(invalidFileException); } catch (PathTooLongException pathTooLongException) { - var invalidFileException = new InvalidLocalFileException(pathTooLongException); + var invalidFileException = + new InvalidLocalFileException( + message: "Invalid local file error occurred, fix error and try again.", + pathTooLongException); throw new LocalFileDependencyValidationException(invalidFileException); } diff --git a/Standard.AI.OpenAI/Services/Foundations/LocalFiles/LocalFileService.Validations.cs b/Standard.AI.OpenAI/Services/Foundations/LocalFiles/LocalFileService.Validations.cs index 22a803ca..d980afcf 100644 --- a/Standard.AI.OpenAI/Services/Foundations/LocalFiles/LocalFileService.Validations.cs +++ b/Standard.AI.OpenAI/Services/Foundations/LocalFiles/LocalFileService.Validations.cs @@ -23,7 +23,9 @@ private void ValidatePath(string path) private void Validate(params (dynamic Rule, string Parameter)[] validations) { - var invalidFileException = new InvalidLocalFileException(); + var invalidFileException = + new InvalidLocalFileException( + message: "Invalid local file error occurred, fix error and try again."); foreach ((dynamic rule, string parameter) in validations) { From 71104b60a80f68a55aca95d07f34dbd11548563b Mon Sep 17 00:00:00 2001 From: Lezune Date: Thu, 30 May 2024 03:58:32 -0700 Subject: [PATCH 056/283] Updated LocalFileDependencyException class by removing constructors in which the error message was hard coded in. Updated all relevant service files to include message. --- .../AIFiles/AIFileOrchestrationServiceTests.cs | 4 +++- .../LocalFiles/Exceptions/LocalFileDependencyException.cs | 6 ------ .../Foundations/LocalFiles/LocalFileService.Exceptions.cs | 8 ++++++-- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/Standard.AI.OpenAI.Tests.Unit/Services/Orchestrations/AIFiles/AIFileOrchestrationServiceTests.cs b/Standard.AI.OpenAI.Tests.Unit/Services/Orchestrations/AIFiles/AIFileOrchestrationServiceTests.cs index cebfc9b8..71b6f1b4 100644 --- a/Standard.AI.OpenAI.Tests.Unit/Services/Orchestrations/AIFiles/AIFileOrchestrationServiceTests.cs +++ b/Standard.AI.OpenAI.Tests.Unit/Services/Orchestrations/AIFiles/AIFileOrchestrationServiceTests.cs @@ -57,7 +57,9 @@ public static TheoryData DependencyExceptions() return new TheoryData { - new LocalFileDependencyException(someInnerException), + new LocalFileDependencyException( + message: "Local file dependency error occurred, contact support.", + someInnerException), new LocalFileServiceException(someInnerException), new AIFileDependencyException(someInnerException), new AIFileServiceException(someInnerException), diff --git a/Standard.AI.OpenAI/Models/Services/Foundations/LocalFiles/Exceptions/LocalFileDependencyException.cs b/Standard.AI.OpenAI/Models/Services/Foundations/LocalFiles/Exceptions/LocalFileDependencyException.cs index 5b89c390..13a893dc 100644 --- a/Standard.AI.OpenAI/Models/Services/Foundations/LocalFiles/Exceptions/LocalFileDependencyException.cs +++ b/Standard.AI.OpenAI/Models/Services/Foundations/LocalFiles/Exceptions/LocalFileDependencyException.cs @@ -8,12 +8,6 @@ namespace Standard.AI.OpenAI.Models.Services.Foundations.LocalFiles.Exceptions { public class LocalFileDependencyException : Xeption { - public LocalFileDependencyException(Xeption innerException) - : base( - message: "Local file dependency error occurred, contact support.", - innerException: innerException) - { } - public LocalFileDependencyException(string message, Xeption innerException) : base(message, innerException) { } diff --git a/Standard.AI.OpenAI/Services/Foundations/LocalFiles/LocalFileService.Exceptions.cs b/Standard.AI.OpenAI/Services/Foundations/LocalFiles/LocalFileService.Exceptions.cs index 13d9bfb6..0968992d 100644 --- a/Standard.AI.OpenAI/Services/Foundations/LocalFiles/LocalFileService.Exceptions.cs +++ b/Standard.AI.OpenAI/Services/Foundations/LocalFiles/LocalFileService.Exceptions.cs @@ -53,14 +53,18 @@ private Stream TryCatch(ReturningStreamFunction returningStreamFunction) var failedFileException = new FailedLocalFileDependencyException(ioException); - throw new LocalFileDependencyException(failedFileException); + throw new LocalFileDependencyException( + message: "Local file dependency error occurred, contact support.", + failedFileException); } catch (NotSupportedException notSupportedException) { var failedFileException = new FailedLocalFileDependencyException(notSupportedException); - throw new LocalFileDependencyException(failedFileException); + throw new LocalFileDependencyException( + message: "Local file dependency error occurred, contact support.", + failedFileException); } catch (Exception exception) { From cdafda6b984a7f01b6ff428fa7deb7a6b2dc493d Mon Sep 17 00:00:00 2001 From: Lezune Date: Thu, 30 May 2024 04:03:25 -0700 Subject: [PATCH 057/283] Updated LocalFileDependencyValidationException class by removing constructors in which the error message was hard coded in. Updated all relevant service files to include message. --- .../AIFiles/AIFileOrchestrationServiceTests.cs | 4 +++- .../LocalFileDependencyValidationException.cs | 6 ------ .../LocalFiles/LocalFileService.Exceptions.cs | 16 ++++++++++++---- 3 files changed, 15 insertions(+), 11 deletions(-) diff --git a/Standard.AI.OpenAI.Tests.Unit/Services/Orchestrations/AIFiles/AIFileOrchestrationServiceTests.cs b/Standard.AI.OpenAI.Tests.Unit/Services/Orchestrations/AIFiles/AIFileOrchestrationServiceTests.cs index cebfc9b8..205e0466 100644 --- a/Standard.AI.OpenAI.Tests.Unit/Services/Orchestrations/AIFiles/AIFileOrchestrationServiceTests.cs +++ b/Standard.AI.OpenAI.Tests.Unit/Services/Orchestrations/AIFiles/AIFileOrchestrationServiceTests.cs @@ -45,7 +45,9 @@ public static TheoryData DependencyValidationExceptions() return new TheoryData { new LocalFileValidationException(someInnerException), - new LocalFileDependencyValidationException(someInnerException), + new LocalFileDependencyValidationException( + message: "Local file dependency validation error occurred, fix the errors and try again.", + someInnerException), new AIFileValidationException(someInnerException), new AIFileDependencyValidationException(someInnerException) }; diff --git a/Standard.AI.OpenAI/Models/Services/Foundations/LocalFiles/Exceptions/LocalFileDependencyValidationException.cs b/Standard.AI.OpenAI/Models/Services/Foundations/LocalFiles/Exceptions/LocalFileDependencyValidationException.cs index 957b602a..51d9bc45 100644 --- a/Standard.AI.OpenAI/Models/Services/Foundations/LocalFiles/Exceptions/LocalFileDependencyValidationException.cs +++ b/Standard.AI.OpenAI/Models/Services/Foundations/LocalFiles/Exceptions/LocalFileDependencyValidationException.cs @@ -8,12 +8,6 @@ namespace Standard.AI.OpenAI.Models.Services.Foundations.LocalFiles.Exceptions { internal class LocalFileDependencyValidationException : Xeption { - public LocalFileDependencyValidationException(Xeption innerException) - : base( - message: "Local file dependency validation error occurred, fix the errors and try again.", - innerException: innerException) - { } - public LocalFileDependencyValidationException(string message, Xeption innerException) : base(message, innerException) { } diff --git a/Standard.AI.OpenAI/Services/Foundations/LocalFiles/LocalFileService.Exceptions.cs b/Standard.AI.OpenAI/Services/Foundations/LocalFiles/LocalFileService.Exceptions.cs index 13d9bfb6..c0b4fdae 100644 --- a/Standard.AI.OpenAI/Services/Foundations/LocalFiles/LocalFileService.Exceptions.cs +++ b/Standard.AI.OpenAI/Services/Foundations/LocalFiles/LocalFileService.Exceptions.cs @@ -26,27 +26,35 @@ private Stream TryCatch(ReturningStreamFunction returningStreamFunction) { var invalidFileException = new InvalidLocalFileException(argumentException); - throw new LocalFileDependencyValidationException(invalidFileException); + throw new LocalFileDependencyValidationException( + message: "Local file dependency validation error occurred, fix the errors and try again.", + invalidFileException); } catch (PathTooLongException pathTooLongException) { var invalidFileException = new InvalidLocalFileException(pathTooLongException); - throw new LocalFileDependencyValidationException(invalidFileException); + throw new LocalFileDependencyValidationException( + message: "Local file dependency validation error occurred, fix the errors and try again.", + invalidFileException); } catch (FileNotFoundException fileNotFoundException) { var notFoundFileException = new NotFoundLocalFileException(fileNotFoundException); - throw new LocalFileDependencyValidationException(notFoundFileException); + throw new LocalFileDependencyValidationException( + message: "Local file dependency validation error occurred, fix the errors and try again.", + notFoundFileException); } catch (DirectoryNotFoundException directoryNotFoundException) { var notFoundFileException = new NotFoundLocalFileException(directoryNotFoundException); - throw new LocalFileDependencyValidationException(notFoundFileException); + throw new LocalFileDependencyValidationException( + message: "Local file dependency validation error occurred, fix the errors and try again.", + notFoundFileException); } catch (IOException ioException) { From 9c31a5944e1a5ddc54a4f462155dffc2edb0a07a Mon Sep 17 00:00:00 2001 From: Lezune Date: Thu, 30 May 2024 04:07:59 -0700 Subject: [PATCH 058/283] Updated LocalFileServiceException class by removing constructors in which the error message was hard coded in. Updated all relevant service files to include message. --- .../AIFiles/AIFileOrchestrationServiceTests.cs | 4 +++- .../LocalFiles/Exceptions/LocalFileServiceException.cs | 6 ------ .../Foundations/LocalFiles/LocalFileService.Exceptions.cs | 4 +++- 3 files changed, 6 insertions(+), 8 deletions(-) diff --git a/Standard.AI.OpenAI.Tests.Unit/Services/Orchestrations/AIFiles/AIFileOrchestrationServiceTests.cs b/Standard.AI.OpenAI.Tests.Unit/Services/Orchestrations/AIFiles/AIFileOrchestrationServiceTests.cs index cebfc9b8..07fd8627 100644 --- a/Standard.AI.OpenAI.Tests.Unit/Services/Orchestrations/AIFiles/AIFileOrchestrationServiceTests.cs +++ b/Standard.AI.OpenAI.Tests.Unit/Services/Orchestrations/AIFiles/AIFileOrchestrationServiceTests.cs @@ -58,7 +58,9 @@ public static TheoryData DependencyExceptions() return new TheoryData { new LocalFileDependencyException(someInnerException), - new LocalFileServiceException(someInnerException), + new LocalFileServiceException( + message: "Local file service error occurred, contact support.", + someInnerException), new AIFileDependencyException(someInnerException), new AIFileServiceException(someInnerException), }; diff --git a/Standard.AI.OpenAI/Models/Services/Foundations/LocalFiles/Exceptions/LocalFileServiceException.cs b/Standard.AI.OpenAI/Models/Services/Foundations/LocalFiles/Exceptions/LocalFileServiceException.cs index 2fed802c..0a8f7671 100644 --- a/Standard.AI.OpenAI/Models/Services/Foundations/LocalFiles/Exceptions/LocalFileServiceException.cs +++ b/Standard.AI.OpenAI/Models/Services/Foundations/LocalFiles/Exceptions/LocalFileServiceException.cs @@ -8,12 +8,6 @@ namespace Standard.AI.OpenAI.Models.Services.Foundations.LocalFiles.Exceptions { public class LocalFileServiceException : Xeption { - public LocalFileServiceException(Xeption innerException) - : base( - message: "Local file service error occurred, contact support.", - innerException: innerException) - { } - public LocalFileServiceException(string message, Xeption innerException) : base(message, innerException) { } diff --git a/Standard.AI.OpenAI/Services/Foundations/LocalFiles/LocalFileService.Exceptions.cs b/Standard.AI.OpenAI/Services/Foundations/LocalFiles/LocalFileService.Exceptions.cs index 13d9bfb6..ff1d19f6 100644 --- a/Standard.AI.OpenAI/Services/Foundations/LocalFiles/LocalFileService.Exceptions.cs +++ b/Standard.AI.OpenAI/Services/Foundations/LocalFiles/LocalFileService.Exceptions.cs @@ -67,7 +67,9 @@ private Stream TryCatch(ReturningStreamFunction returningStreamFunction) var failedLocalFileServiceException = new FailedLocalFileServiceException(exception); - throw new LocalFileServiceException(failedLocalFileServiceException); + throw new LocalFileServiceException( + message: "Local file service error occurred, contact support.", + failedLocalFileServiceException); } } } From ed3fbd97210c598282ae91f3ad13c3bd0825da80 Mon Sep 17 00:00:00 2001 From: Lezune Date: Thu, 30 May 2024 04:14:16 -0700 Subject: [PATCH 059/283] Updated LocalFileValidationException class by removing constructors in which the error message was hard coded in. Updated all relevant service files to include message. --- .../AIFiles/AIFileOrchestrationServiceTests.cs | 4 +++- .../LocalFiles/Exceptions/LocalFileValidationException.cs | 6 ------ .../Foundations/LocalFiles/LocalFileService.Exceptions.cs | 4 +++- 3 files changed, 6 insertions(+), 8 deletions(-) diff --git a/Standard.AI.OpenAI.Tests.Unit/Services/Orchestrations/AIFiles/AIFileOrchestrationServiceTests.cs b/Standard.AI.OpenAI.Tests.Unit/Services/Orchestrations/AIFiles/AIFileOrchestrationServiceTests.cs index cebfc9b8..d1296bbe 100644 --- a/Standard.AI.OpenAI.Tests.Unit/Services/Orchestrations/AIFiles/AIFileOrchestrationServiceTests.cs +++ b/Standard.AI.OpenAI.Tests.Unit/Services/Orchestrations/AIFiles/AIFileOrchestrationServiceTests.cs @@ -44,7 +44,9 @@ public static TheoryData DependencyValidationExceptions() return new TheoryData { - new LocalFileValidationException(someInnerException), + new LocalFileValidationException( + message: "Local file validation error occurred, fix error and try again.", + someInnerException), new LocalFileDependencyValidationException(someInnerException), new AIFileValidationException(someInnerException), new AIFileDependencyValidationException(someInnerException) diff --git a/Standard.AI.OpenAI/Models/Services/Foundations/LocalFiles/Exceptions/LocalFileValidationException.cs b/Standard.AI.OpenAI/Models/Services/Foundations/LocalFiles/Exceptions/LocalFileValidationException.cs index 6ea2d175..2fe08546 100644 --- a/Standard.AI.OpenAI/Models/Services/Foundations/LocalFiles/Exceptions/LocalFileValidationException.cs +++ b/Standard.AI.OpenAI/Models/Services/Foundations/LocalFiles/Exceptions/LocalFileValidationException.cs @@ -8,12 +8,6 @@ namespace Standard.AI.OpenAI.Models.Services.Foundations.LocalFiles.Exceptions { internal class LocalFileValidationException : Xeption { - public LocalFileValidationException(Xeption innerException) - : base( - message: "Local file validation error occurred, fix error and try again.", - innerException: innerException) - { } - public LocalFileValidationException(string message, Xeption innerException) : base(message, innerException) { } diff --git a/Standard.AI.OpenAI/Services/Foundations/LocalFiles/LocalFileService.Exceptions.cs b/Standard.AI.OpenAI/Services/Foundations/LocalFiles/LocalFileService.Exceptions.cs index 13d9bfb6..f38b0893 100644 --- a/Standard.AI.OpenAI/Services/Foundations/LocalFiles/LocalFileService.Exceptions.cs +++ b/Standard.AI.OpenAI/Services/Foundations/LocalFiles/LocalFileService.Exceptions.cs @@ -20,7 +20,9 @@ private Stream TryCatch(ReturningStreamFunction returningStreamFunction) } catch (InvalidLocalFileException invalidFileException) { - throw new LocalFileValidationException(invalidFileException); + throw new LocalFileValidationException( + message: "Local file validation error occurred, fix error and try again.", + invalidFileException); } catch (ArgumentException argumentException) { From ed9002a12fed2b0684886f2f20291295b2f2bca1 Mon Sep 17 00:00:00 2001 From: Lezune Date: Thu, 30 May 2024 04:17:35 -0700 Subject: [PATCH 060/283] Updated NotFoundLocalFileException class by removing constructors in which the error message was hard coded in. Updated all relevant service files to include message. --- .../LocalFiles/Exceptions/NotFoundLocalFileException.cs | 6 ------ .../Foundations/LocalFiles/LocalFileService.Exceptions.cs | 8 ++++++-- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/Standard.AI.OpenAI/Models/Services/Foundations/LocalFiles/Exceptions/NotFoundLocalFileException.cs b/Standard.AI.OpenAI/Models/Services/Foundations/LocalFiles/Exceptions/NotFoundLocalFileException.cs index 38c367fa..21cedd4c 100644 --- a/Standard.AI.OpenAI/Models/Services/Foundations/LocalFiles/Exceptions/NotFoundLocalFileException.cs +++ b/Standard.AI.OpenAI/Models/Services/Foundations/LocalFiles/Exceptions/NotFoundLocalFileException.cs @@ -9,12 +9,6 @@ namespace Standard.AI.OpenAI.Models.Services.Foundations.LocalFiles.Exceptions { internal class NotFoundLocalFileException : Xeption { - public NotFoundLocalFileException(Exception innerException) - : base( - message: "Not found local file error occurred, fix error and try again.", - innerException: innerException) - { } - public NotFoundLocalFileException(string message, Exception innerException) : base(message, innerException) { } diff --git a/Standard.AI.OpenAI/Services/Foundations/LocalFiles/LocalFileService.Exceptions.cs b/Standard.AI.OpenAI/Services/Foundations/LocalFiles/LocalFileService.Exceptions.cs index 13d9bfb6..d9d5350b 100644 --- a/Standard.AI.OpenAI/Services/Foundations/LocalFiles/LocalFileService.Exceptions.cs +++ b/Standard.AI.OpenAI/Services/Foundations/LocalFiles/LocalFileService.Exceptions.cs @@ -37,14 +37,18 @@ private Stream TryCatch(ReturningStreamFunction returningStreamFunction) catch (FileNotFoundException fileNotFoundException) { var notFoundFileException = - new NotFoundLocalFileException(fileNotFoundException); + new NotFoundLocalFileException( + message: "Not found local file error occurred, fix error and try again.", + fileNotFoundException); throw new LocalFileDependencyValidationException(notFoundFileException); } catch (DirectoryNotFoundException directoryNotFoundException) { var notFoundFileException = - new NotFoundLocalFileException(directoryNotFoundException); + new NotFoundLocalFileException( + message: "Not found local file error occurred, fix error and try again.", + directoryNotFoundException); throw new LocalFileDependencyValidationException(notFoundFileException); } From a3a948736d8fc72692b87ab77b3249557df41606 Mon Sep 17 00:00:00 2001 From: Lezune Date: Thu, 30 May 2024 04:29:32 -0700 Subject: [PATCH 061/283] Updated AudioTranscriptionDependencyException class by removing constructors in which the error message was hard coded in. Updated all relevant service files to include message. --- .../AudioTranscriptionDependencyException.cs | 6 ------ .../AudioTranscriptionService.Exceptions.cs | 12 +++++++++--- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/Standard.AI.OpenAI/Models/Services/Foundations/AudioTranscriptions/Exceptions/AudioTranscriptionDependencyException.cs b/Standard.AI.OpenAI/Models/Services/Foundations/AudioTranscriptions/Exceptions/AudioTranscriptionDependencyException.cs index 2b57740d..75aa82f5 100644 --- a/Standard.AI.OpenAI/Models/Services/Foundations/AudioTranscriptions/Exceptions/AudioTranscriptionDependencyException.cs +++ b/Standard.AI.OpenAI/Models/Services/Foundations/AudioTranscriptions/Exceptions/AudioTranscriptionDependencyException.cs @@ -9,12 +9,6 @@ namespace Standard.AI.OpenAI.Models.Services.Foundations.AudioTranscriptions.Exc #pragma warning disable RCS1194 // Implement exception constructors. public class AudioTranscriptionDependencyException : Xeption { - public AudioTranscriptionDependencyException(Xeption innerException) - : base( - message: "Audio transcription dependency error occurred, contact support.", - innerException: innerException) - { } - public AudioTranscriptionDependencyException(string message, Xeption innerException) : base(message, innerException) { } diff --git a/Standard.AI.OpenAI/Services/Foundations/AudioTranscriptions/AudioTranscriptionService.Exceptions.cs b/Standard.AI.OpenAI/Services/Foundations/AudioTranscriptions/AudioTranscriptionService.Exceptions.cs index 0a729e95..d77f4082 100644 --- a/Standard.AI.OpenAI/Services/Foundations/AudioTranscriptions/AudioTranscriptionService.Exceptions.cs +++ b/Standard.AI.OpenAI/Services/Foundations/AudioTranscriptions/AudioTranscriptionService.Exceptions.cs @@ -34,21 +34,27 @@ private static async ValueTask TryCatch( var invalidConfigurationAudioTranscriptionException = new InvalidConfigurationAudioTranscriptionException(httpResponseUrlNotFoundException); - throw new AudioTranscriptionDependencyException(invalidConfigurationAudioTranscriptionException); + throw new AudioTranscriptionDependencyException( + message: "Audio transcription dependency error occurred, contact support.", + invalidConfigurationAudioTranscriptionException); } catch (HttpResponseUnauthorizedException httpResponseUnauthorizedException) { var unauthorizedAudioTranscriptionException = new UnauthorizedAudioTranscriptionException(httpResponseUnauthorizedException); - throw new AudioTranscriptionDependencyException(unauthorizedAudioTranscriptionException); + throw new AudioTranscriptionDependencyException( + message: "Audio transcription dependency error occurred, contact support.", + unauthorizedAudioTranscriptionException); } catch (HttpResponseForbiddenException httpResponseForbiddenException) { var unauthorizedAudioTranscriptionException = new UnauthorizedAudioTranscriptionException(httpResponseForbiddenException); - throw new AudioTranscriptionDependencyException(unauthorizedAudioTranscriptionException); + throw new AudioTranscriptionDependencyException( + message: "Audio transcription dependency error occurred, contact support.", + unauthorizedAudioTranscriptionException); } catch (HttpResponseBadRequestException httpResponseBadRequestException) { From 6f04789c3cfd7056f0d16cbe0b72b6784fe873c6 Mon Sep 17 00:00:00 2001 From: Lezune Date: Thu, 30 May 2024 04:41:33 -0700 Subject: [PATCH 062/283] Updated AudioTranscriptionDependencyValidationException class by removing constructors in which the error message was hard coded in. Updated all relevant service files to include message. --- .../AudioTranscriptionDependencyValidationException.cs | 6 ------ .../AudioTranscriptionService.Exceptions.cs | 8 ++++++-- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/Standard.AI.OpenAI/Models/Services/Foundations/AudioTranscriptions/Exceptions/AudioTranscriptionDependencyValidationException.cs b/Standard.AI.OpenAI/Models/Services/Foundations/AudioTranscriptions/Exceptions/AudioTranscriptionDependencyValidationException.cs index 009b17f8..a2ffb90b 100644 --- a/Standard.AI.OpenAI/Models/Services/Foundations/AudioTranscriptions/Exceptions/AudioTranscriptionDependencyValidationException.cs +++ b/Standard.AI.OpenAI/Models/Services/Foundations/AudioTranscriptions/Exceptions/AudioTranscriptionDependencyValidationException.cs @@ -9,12 +9,6 @@ namespace Standard.AI.OpenAI.Models.Services.Foundations.AudioTranscriptions.Exc #pragma warning disable RCS1194 // Implement exception constructors. public class AudioTranscriptionDependencyValidationException : Xeption { - public AudioTranscriptionDependencyValidationException(Xeption innerException) - : base( - message: "Chat completion dependency validation error occurred, fix errors and try again.", - innerException: innerException) - { } - public AudioTranscriptionDependencyValidationException(string message, Xeption innerException) : base(message, innerException) { } diff --git a/Standard.AI.OpenAI/Services/Foundations/AudioTranscriptions/AudioTranscriptionService.Exceptions.cs b/Standard.AI.OpenAI/Services/Foundations/AudioTranscriptions/AudioTranscriptionService.Exceptions.cs index 0a729e95..6e2bd544 100644 --- a/Standard.AI.OpenAI/Services/Foundations/AudioTranscriptions/AudioTranscriptionService.Exceptions.cs +++ b/Standard.AI.OpenAI/Services/Foundations/AudioTranscriptions/AudioTranscriptionService.Exceptions.cs @@ -55,14 +55,18 @@ private static async ValueTask TryCatch( var invalidAudioTranscriptionException = new InvalidAudioTranscriptionException(httpResponseBadRequestException); - throw new AudioTranscriptionDependencyValidationException(invalidAudioTranscriptionException); + throw new AudioTranscriptionDependencyValidationException( + message: "Chat completion dependency validation error occurred, fix errors and try again.", + invalidAudioTranscriptionException); } catch (HttpResponseTooManyRequestsException httpResponseTooManyRequestsException) { var excessiveCallAudioTranscriptionException = new ExcessiveCallAudioTranscriptionException(httpResponseTooManyRequestsException); - throw new AudioTranscriptionDependencyValidationException(excessiveCallAudioTranscriptionException); + throw new AudioTranscriptionDependencyValidationException( + message: "Chat completion dependency validation error occurred, fix errors and try again.", + excessiveCallAudioTranscriptionException); } catch (Exception exception) { From 40463a9c23058668d271981cb85250ac3a2d24f5 Mon Sep 17 00:00:00 2001 From: Lezune Date: Thu, 30 May 2024 04:51:43 -0700 Subject: [PATCH 063/283] Updated AIModelDependencyException class by removing constructors in which the error message was hard coded in. Updated all relevant service files to include message. --- .../Exceptions/AIModelDependencyException.cs | 6 ---- .../AIModels/AIModelService.Exceptions.cs | 32 ++++++++++++++----- 2 files changed, 24 insertions(+), 14 deletions(-) diff --git a/Standard.AI.OpenAI/Models/Services/Foundations/AIModels/Exceptions/AIModelDependencyException.cs b/Standard.AI.OpenAI/Models/Services/Foundations/AIModels/Exceptions/AIModelDependencyException.cs index d46f6ca2..91e66083 100644 --- a/Standard.AI.OpenAI/Models/Services/Foundations/AIModels/Exceptions/AIModelDependencyException.cs +++ b/Standard.AI.OpenAI/Models/Services/Foundations/AIModels/Exceptions/AIModelDependencyException.cs @@ -8,12 +8,6 @@ namespace Standard.AI.OpenAI.Models.Services.Foundations.AIModels.Exceptions { internal class AIModelDependencyException : Xeption { - public AIModelDependencyException(Xeption innerException) - : base( - message: "AI Model dependency error occurred, contact support.", - innerException: innerException) - { } - public AIModelDependencyException(string message, Xeption innerException) : base(message, innerException) { } diff --git a/Standard.AI.OpenAI/Services/Foundations/AIModels/AIModelService.Exceptions.cs b/Standard.AI.OpenAI/Services/Foundations/AIModels/AIModelService.Exceptions.cs index f16afaf0..f3a933bd 100644 --- a/Standard.AI.OpenAI/Services/Foundations/AIModels/AIModelService.Exceptions.cs +++ b/Standard.AI.OpenAI/Services/Foundations/AIModels/AIModelService.Exceptions.cs @@ -31,21 +31,27 @@ private async ValueTask TryCatch(ReturningAIModelFunction returningAIMo var invalidConfigurationAIModelException = new InvalidConfigurationAIModelException(httpResponseUrlNotFoundException); - throw new AIModelDependencyException(invalidConfigurationAIModelException); + throw new AIModelDependencyException( + message: "AI Model dependency error occurred, contact support.", + invalidConfigurationAIModelException); } catch (HttpResponseUnauthorizedException httpResponseUnauthorizedException) { var unauthorizedAIModelException = new UnauthorizedAIModelException(httpResponseUnauthorizedException); - throw new AIModelDependencyException(unauthorizedAIModelException); + throw new AIModelDependencyException( + message: "AI Model dependency error occurred, contact support.", + unauthorizedAIModelException); } catch (HttpResponseForbiddenException httpResponseForbiddenException) { var unauthorizedAIModelException = new UnauthorizedAIModelException(httpResponseForbiddenException); - throw new AIModelDependencyException(unauthorizedAIModelException); + throw new AIModelDependencyException( + message: "AI Model dependency error occurred, contact support.", + unauthorizedAIModelException); } catch (HttpResponseNotFoundException httpResponseNotFoundException) { @@ -73,7 +79,9 @@ private async ValueTask TryCatch(ReturningAIModelFunction returningAIMo var failedServerAIModelException = new FailedServerAIModelException(httpResponseException); - throw new AIModelDependencyException(failedServerAIModelException); + throw new AIModelDependencyException( + message: "AI Model dependency error occurred, contact support.", + failedServerAIModelException); } catch (Exception exception) { @@ -96,21 +104,27 @@ private async ValueTask> TryCatch(ReturningAIModelsFunction var invalidConfigurationAIModelException = new InvalidConfigurationAIModelException(httpResponseUrlNotFoundException); - throw new AIModelDependencyException(invalidConfigurationAIModelException); + throw new AIModelDependencyException( + message: "AI Model dependency error occurred, contact support.", + invalidConfigurationAIModelException); } catch (HttpResponseUnauthorizedException httpResponseUnauthorizedException) { var unauthorizedAIModelException = new UnauthorizedAIModelException(httpResponseUnauthorizedException); - throw new AIModelDependencyException(unauthorizedAIModelException); + throw new AIModelDependencyException( + message: "AI Model dependency error occurred, contact support.", + unauthorizedAIModelException); } catch (HttpResponseForbiddenException httpResponseForbiddenException) { var unauthorizedAIModelException = new UnauthorizedAIModelException(httpResponseForbiddenException); - throw new AIModelDependencyException(unauthorizedAIModelException); + throw new AIModelDependencyException( + message: "AI Model dependency error occurred, contact support.", + unauthorizedAIModelException); } catch (HttpResponseTooManyRequestsException httpResponseTooManyRequestsException) { @@ -124,7 +138,9 @@ private async ValueTask> TryCatch(ReturningAIModelsFunction var failedServerAIModelException = new FailedServerAIModelException(httpResponseException); - throw new AIModelDependencyException(failedServerAIModelException); + throw new AIModelDependencyException( + message: "AI Model dependency error occurred, contact support.", + failedServerAIModelException); } catch (Exception exception) { From f0f389dff54abd38a90b3a7849c7fad9a17d173a Mon Sep 17 00:00:00 2001 From: Lezune Date: Thu, 30 May 2024 04:56:33 -0700 Subject: [PATCH 064/283] Updated AIModelDependencyValidationException class by removing constructors in which the error message was hard coded in. Updated all relevant service files to include message. --- .../AIModelDependencyValidationException.cs | 6 ------ .../AIModels/AIModelService.Exceptions.cs | 16 ++++++++++++---- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/Standard.AI.OpenAI/Models/Services/Foundations/AIModels/Exceptions/AIModelDependencyValidationException.cs b/Standard.AI.OpenAI/Models/Services/Foundations/AIModels/Exceptions/AIModelDependencyValidationException.cs index c1c9e541..fc8e31bf 100644 --- a/Standard.AI.OpenAI/Models/Services/Foundations/AIModels/Exceptions/AIModelDependencyValidationException.cs +++ b/Standard.AI.OpenAI/Models/Services/Foundations/AIModels/Exceptions/AIModelDependencyValidationException.cs @@ -8,12 +8,6 @@ namespace Standard.AI.OpenAI.Models.Services.Foundations.AIModels.Exceptions { internal class AIModelDependencyValidationException : Xeption { - public AIModelDependencyValidationException(Xeption innerException) - : base( - message: "AI Model dependency validation error occurred, fix errors and try again.", - innerException: innerException) - { } - public AIModelDependencyValidationException(string message, Xeption innerException) : base(message: message, innerException) { } diff --git a/Standard.AI.OpenAI/Services/Foundations/AIModels/AIModelService.Exceptions.cs b/Standard.AI.OpenAI/Services/Foundations/AIModels/AIModelService.Exceptions.cs index f16afaf0..f6940559 100644 --- a/Standard.AI.OpenAI/Services/Foundations/AIModels/AIModelService.Exceptions.cs +++ b/Standard.AI.OpenAI/Services/Foundations/AIModels/AIModelService.Exceptions.cs @@ -52,21 +52,27 @@ private async ValueTask TryCatch(ReturningAIModelFunction returningAIMo var notFoundAIModelException = new NotFoundAIModelException(httpResponseNotFoundException); - throw new AIModelDependencyValidationException(notFoundAIModelException); + throw new AIModelDependencyValidationException( + message: "AI Model dependency validation error occurred, fix errors and try again.", + notFoundAIModelException); } catch (HttpResponseBadRequestException httpResponseBadRequestException) { var invalidAIModelException = new InvalidAIModelException(httpResponseBadRequestException); - throw new AIModelDependencyValidationException(invalidAIModelException); + throw new AIModelDependencyValidationException( + message: "AI Model dependency validation error occurred, fix errors and try again.", + invalidAIModelException); } catch (HttpResponseTooManyRequestsException httpResponseTooManyRequestsException) { var excessiveCallAIModelException = new ExcessiveCallAIModelException(httpResponseTooManyRequestsException); - throw new AIModelDependencyValidationException(excessiveCallAIModelException); + throw new AIModelDependencyValidationException( + message: "AI Model dependency validation error occurred, fix errors and try again.", + excessiveCallAIModelException); } catch (HttpResponseException httpResponseException) { @@ -117,7 +123,9 @@ private async ValueTask> TryCatch(ReturningAIModelsFunction var excessiveCallAIModelException = new ExcessiveCallAIModelException(httpResponseTooManyRequestsException); - throw new AIModelDependencyValidationException(excessiveCallAIModelException); + throw new AIModelDependencyValidationException( + message: "AI Model dependency validation error occurred, fix errors and try again.", + excessiveCallAIModelException); } catch (HttpResponseException httpResponseException) { From ea0beef0817645f0f7b66fcbc12365de9e4ccc83 Mon Sep 17 00:00:00 2001 From: Lezune Date: Thu, 30 May 2024 05:01:28 -0700 Subject: [PATCH 065/283] Updated AIModelServiceException class by removing constructors in which the error message was hard coded in. Updated all relevant service files to include message. --- .../AIModels/Exceptions/AIModelServiceException.cs | 6 ------ .../Foundations/AIModels/AIModelService.Exceptions.cs | 2 ++ 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/Standard.AI.OpenAI/Models/Services/Foundations/AIModels/Exceptions/AIModelServiceException.cs b/Standard.AI.OpenAI/Models/Services/Foundations/AIModels/Exceptions/AIModelServiceException.cs index 26e26273..d9e22db0 100644 --- a/Standard.AI.OpenAI/Models/Services/Foundations/AIModels/Exceptions/AIModelServiceException.cs +++ b/Standard.AI.OpenAI/Models/Services/Foundations/AIModels/Exceptions/AIModelServiceException.cs @@ -8,12 +8,6 @@ namespace Standard.AI.OpenAI.Models.Services.Foundations.AIModels.Exceptions { public class AIModelServiceException : Xeption { - public AIModelServiceException(Xeption innerException) - : base( - message: "AI Model service error occurred, contact support.", - innerException: innerException) - { } - public AIModelServiceException(string message, Xeption innerException) : base(message, innerException) { } diff --git a/Standard.AI.OpenAI/Services/Foundations/AIModels/AIModelService.Exceptions.cs b/Standard.AI.OpenAI/Services/Foundations/AIModels/AIModelService.Exceptions.cs index f16afaf0..e659d6e7 100644 --- a/Standard.AI.OpenAI/Services/Foundations/AIModels/AIModelService.Exceptions.cs +++ b/Standard.AI.OpenAI/Services/Foundations/AIModels/AIModelService.Exceptions.cs @@ -81,6 +81,7 @@ private async ValueTask TryCatch(ReturningAIModelFunction returningAIMo new FailedAIModelServiceException(exception); throw new AIModelServiceException( + message: "AI Model service error occurred, contact support.", failedAIModelServiceException); } } @@ -132,6 +133,7 @@ private async ValueTask> TryCatch(ReturningAIModelsFunction new FailedAIModelServiceException(exception); throw new AIModelServiceException( + message: "AI Model service error occurred, contact support.", failedAIModelServiceException); } } From 2eacc680c21b84a371a664824237586b41832606 Mon Sep 17 00:00:00 2001 From: Lezune Date: Thu, 30 May 2024 05:06:29 -0700 Subject: [PATCH 066/283] Updated AIModelValidationException class by removing constructors in which the error message was hard coded in. Updated all relevant service files to include message. --- .../AIModels/Exceptions/AIModelValidationException.cs | 6 ------ .../Foundations/AIModels/AIModelService.Exceptions.cs | 4 +++- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/Standard.AI.OpenAI/Models/Services/Foundations/AIModels/Exceptions/AIModelValidationException.cs b/Standard.AI.OpenAI/Models/Services/Foundations/AIModels/Exceptions/AIModelValidationException.cs index a2eba438..6a25bd4b 100644 --- a/Standard.AI.OpenAI/Models/Services/Foundations/AIModels/Exceptions/AIModelValidationException.cs +++ b/Standard.AI.OpenAI/Models/Services/Foundations/AIModels/Exceptions/AIModelValidationException.cs @@ -8,12 +8,6 @@ namespace Standard.AI.OpenAI.Models.Services.Foundations.AIModels.Exceptions { public class AIModelValidationException : Xeption { - public AIModelValidationException(Xeption innerException) - : base( - message: "AI Model validation error occurred, fix errors and try again.", - innerException: innerException) - { } - public AIModelValidationException(string message, Xeption innerException) : base(message, innerException) { } diff --git a/Standard.AI.OpenAI/Services/Foundations/AIModels/AIModelService.Exceptions.cs b/Standard.AI.OpenAI/Services/Foundations/AIModels/AIModelService.Exceptions.cs index f16afaf0..6307321d 100644 --- a/Standard.AI.OpenAI/Services/Foundations/AIModels/AIModelService.Exceptions.cs +++ b/Standard.AI.OpenAI/Services/Foundations/AIModels/AIModelService.Exceptions.cs @@ -24,7 +24,9 @@ private async ValueTask TryCatch(ReturningAIModelFunction returningAIMo } catch (InvalidAIModelException invalidAIModelException) { - throw new AIModelValidationException(invalidAIModelException); + throw new AIModelValidationException( + message: "AI Model validation error occurred, fix errors and try again.", + invalidAIModelException); } catch (HttpResponseUrlNotFoundException httpResponseUrlNotFoundException) { From 637eb37cf817896bf94cf6e266134684efd8fcca Mon Sep 17 00:00:00 2001 From: Lezune Date: Thu, 30 May 2024 05:10:13 -0700 Subject: [PATCH 067/283] Updated ExcessiveCallAIModelException class by removing constructors in which the error message was hard coded in. Updated all relevant service files to include message. --- .../AIModels/Exceptions/ExcessiveCallAIModelException.cs | 6 ------ .../Foundations/AIModels/AIModelService.Exceptions.cs | 8 ++++++-- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/Standard.AI.OpenAI/Models/Services/Foundations/AIModels/Exceptions/ExcessiveCallAIModelException.cs b/Standard.AI.OpenAI/Models/Services/Foundations/AIModels/Exceptions/ExcessiveCallAIModelException.cs index ab551e35..ddc0f967 100644 --- a/Standard.AI.OpenAI/Models/Services/Foundations/AIModels/Exceptions/ExcessiveCallAIModelException.cs +++ b/Standard.AI.OpenAI/Models/Services/Foundations/AIModels/Exceptions/ExcessiveCallAIModelException.cs @@ -9,12 +9,6 @@ namespace Standard.AI.OpenAI.Models.Services.Foundations.AIModels.Exceptions { internal class ExcessiveCallAIModelException : Xeption { - public ExcessiveCallAIModelException(Exception innerException) - : base( - message: "Excessive call error occurred, limit your calls.", - innerException: innerException) - { } - public ExcessiveCallAIModelException(string message, Exception innerException) : base(message, innerException) { } diff --git a/Standard.AI.OpenAI/Services/Foundations/AIModels/AIModelService.Exceptions.cs b/Standard.AI.OpenAI/Services/Foundations/AIModels/AIModelService.Exceptions.cs index f16afaf0..9594aca3 100644 --- a/Standard.AI.OpenAI/Services/Foundations/AIModels/AIModelService.Exceptions.cs +++ b/Standard.AI.OpenAI/Services/Foundations/AIModels/AIModelService.Exceptions.cs @@ -64,7 +64,9 @@ private async ValueTask TryCatch(ReturningAIModelFunction returningAIMo catch (HttpResponseTooManyRequestsException httpResponseTooManyRequestsException) { var excessiveCallAIModelException = - new ExcessiveCallAIModelException(httpResponseTooManyRequestsException); + new ExcessiveCallAIModelException( + message: "Excessive call error occurred, limit your calls.", + httpResponseTooManyRequestsException); throw new AIModelDependencyValidationException(excessiveCallAIModelException); } @@ -115,7 +117,9 @@ private async ValueTask> TryCatch(ReturningAIModelsFunction catch (HttpResponseTooManyRequestsException httpResponseTooManyRequestsException) { var excessiveCallAIModelException = - new ExcessiveCallAIModelException(httpResponseTooManyRequestsException); + new ExcessiveCallAIModelException( + message: "Excessive call error occurred, limit your calls.", + httpResponseTooManyRequestsException); throw new AIModelDependencyValidationException(excessiveCallAIModelException); } From 0976b7d6f205286104f80fa860bd8b6d9010c27b Mon Sep 17 00:00:00 2001 From: Lezune Date: Thu, 30 May 2024 05:14:15 -0700 Subject: [PATCH 068/283] Updated FailedAIModelServiceException class by removing constructors in which the error message was hard coded in. Updated all relevant service files to include message. --- .../AIModels/Exceptions/FailedAIModelServiceException.cs | 6 ------ .../Foundations/AIModels/AIModelService.Exceptions.cs | 8 ++++++-- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/Standard.AI.OpenAI/Models/Services/Foundations/AIModels/Exceptions/FailedAIModelServiceException.cs b/Standard.AI.OpenAI/Models/Services/Foundations/AIModels/Exceptions/FailedAIModelServiceException.cs index 28f50dd1..37bcca2f 100644 --- a/Standard.AI.OpenAI/Models/Services/Foundations/AIModels/Exceptions/FailedAIModelServiceException.cs +++ b/Standard.AI.OpenAI/Models/Services/Foundations/AIModels/Exceptions/FailedAIModelServiceException.cs @@ -9,12 +9,6 @@ namespace Standard.AI.OpenAI.Models.Services.Foundations.AIModels.Exceptions { public class FailedAIModelServiceException : Xeption { - public FailedAIModelServiceException(Exception innerException) - : base( - message: "Failed AI Model Service Exception occurred, please contact support for assistance.", - innerException: innerException) - { } - public FailedAIModelServiceException(string message, Exception innerException) : base(message, innerException) { } diff --git a/Standard.AI.OpenAI/Services/Foundations/AIModels/AIModelService.Exceptions.cs b/Standard.AI.OpenAI/Services/Foundations/AIModels/AIModelService.Exceptions.cs index f16afaf0..a87a9c34 100644 --- a/Standard.AI.OpenAI/Services/Foundations/AIModels/AIModelService.Exceptions.cs +++ b/Standard.AI.OpenAI/Services/Foundations/AIModels/AIModelService.Exceptions.cs @@ -78,7 +78,9 @@ private async ValueTask TryCatch(ReturningAIModelFunction returningAIMo catch (Exception exception) { var failedAIModelServiceException = - new FailedAIModelServiceException(exception); + new FailedAIModelServiceException( + message: "Failed AI Model Service Exception occurred, please contact support for assistance.", + exception); throw new AIModelServiceException( failedAIModelServiceException); @@ -129,7 +131,9 @@ private async ValueTask> TryCatch(ReturningAIModelsFunction catch (Exception exception) { var failedAIModelServiceException = - new FailedAIModelServiceException(exception); + new FailedAIModelServiceException( + message: "Failed AI Model Service Exception occurred, please contact support for assistance.", + exception); throw new AIModelServiceException( failedAIModelServiceException); From bb88b3694e6398e32a4a4b8e045af2f821292a22 Mon Sep 17 00:00:00 2001 From: Lezune Date: Thu, 30 May 2024 05:17:49 -0700 Subject: [PATCH 069/283] Updated FailedServerAIModelException class by removing constructors in which the error message was hard coded in. Updated all relevant service files to include message. --- .../AIModels/Exceptions/FailedServerAIModelException.cs | 6 ------ .../Foundations/AIModels/AIModelService.Exceptions.cs | 8 ++++++-- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/Standard.AI.OpenAI/Models/Services/Foundations/AIModels/Exceptions/FailedServerAIModelException.cs b/Standard.AI.OpenAI/Models/Services/Foundations/AIModels/Exceptions/FailedServerAIModelException.cs index d0056af7..03dc7abc 100644 --- a/Standard.AI.OpenAI/Models/Services/Foundations/AIModels/Exceptions/FailedServerAIModelException.cs +++ b/Standard.AI.OpenAI/Models/Services/Foundations/AIModels/Exceptions/FailedServerAIModelException.cs @@ -9,12 +9,6 @@ namespace Standard.AI.OpenAI.Models.Services.Foundations.AIModels.Exceptions { public class FailedServerAIModelException : Xeption { - public FailedServerAIModelException(Exception innerException) - : base( - message: "Failed AI Model server error occurred, contact support", - innerException: innerException) - { } - public FailedServerAIModelException(string message, Exception innerException) : base(message, innerException) { } diff --git a/Standard.AI.OpenAI/Services/Foundations/AIModels/AIModelService.Exceptions.cs b/Standard.AI.OpenAI/Services/Foundations/AIModels/AIModelService.Exceptions.cs index f16afaf0..ee4e10d4 100644 --- a/Standard.AI.OpenAI/Services/Foundations/AIModels/AIModelService.Exceptions.cs +++ b/Standard.AI.OpenAI/Services/Foundations/AIModels/AIModelService.Exceptions.cs @@ -71,7 +71,9 @@ private async ValueTask TryCatch(ReturningAIModelFunction returningAIMo catch (HttpResponseException httpResponseException) { var failedServerAIModelException = - new FailedServerAIModelException(httpResponseException); + new FailedServerAIModelException( + message: "Failed AI Model server error occurred, contact support", + httpResponseException); throw new AIModelDependencyException(failedServerAIModelException); } @@ -122,7 +124,9 @@ private async ValueTask> TryCatch(ReturningAIModelsFunction catch (HttpResponseException httpResponseException) { var failedServerAIModelException = - new FailedServerAIModelException(httpResponseException); + new FailedServerAIModelException( + message: "Failed AI Model server error occurred, contact support", + httpResponseException); throw new AIModelDependencyException(failedServerAIModelException); } From 87848a9aa9b0ded95e45360cfbbfe466ee8318af Mon Sep 17 00:00:00 2001 From: Lezune Date: Thu, 30 May 2024 05:23:16 -0700 Subject: [PATCH 070/283] Updated InvalidAIModelException class by removing constructors in which the error message was hard coded in. Updated all relevant service files to include message. --- .../AIModelServiceTests.Validations.RetrieveByName.cs | 3 ++- .../AIModels/Exceptions/InvalidAIModelException.cs | 11 ++--------- .../Foundations/AIModels/AIModelService.Exceptions.cs | 4 +++- .../AIModels/AIModelService.Validations.cs | 4 +++- 4 files changed, 10 insertions(+), 12 deletions(-) diff --git a/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/AIModels/AIModelServiceTests.Validations.RetrieveByName.cs b/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/AIModels/AIModelServiceTests.Validations.RetrieveByName.cs index 2232ec3e..eee8bb76 100644 --- a/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/AIModels/AIModelServiceTests.Validations.RetrieveByName.cs +++ b/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/AIModels/AIModelServiceTests.Validations.RetrieveByName.cs @@ -22,7 +22,8 @@ private async Task ShouldThrowValidationExceptionOnRetrieveModelByNameIfModelNam { // given var invalidAIModelException = - new InvalidAIModelException(); + new InvalidAIModelException( + message: "AI Model is invalid."); invalidAIModelException.AddData( key: nameof(AIModel.Name), diff --git a/Standard.AI.OpenAI/Models/Services/Foundations/AIModels/Exceptions/InvalidAIModelException.cs b/Standard.AI.OpenAI/Models/Services/Foundations/AIModels/Exceptions/InvalidAIModelException.cs index 25eafc57..f7d09fc0 100644 --- a/Standard.AI.OpenAI/Models/Services/Foundations/AIModels/Exceptions/InvalidAIModelException.cs +++ b/Standard.AI.OpenAI/Models/Services/Foundations/AIModels/Exceptions/InvalidAIModelException.cs @@ -9,15 +9,8 @@ namespace Standard.AI.OpenAI.Models.Services.Foundations.AIModels.Exceptions { public class InvalidAIModelException : Xeption { - public InvalidAIModelException() - : base( - message: "AI Model is invalid.") - { } - - public InvalidAIModelException(Exception innerException) - : base( - message: "AI Model is invalid.", - innerException: innerException) + public InvalidAIModelException(string message) + : base(message) { } public InvalidAIModelException(string message, Exception innerException) diff --git a/Standard.AI.OpenAI/Services/Foundations/AIModels/AIModelService.Exceptions.cs b/Standard.AI.OpenAI/Services/Foundations/AIModels/AIModelService.Exceptions.cs index f16afaf0..2a645dc5 100644 --- a/Standard.AI.OpenAI/Services/Foundations/AIModels/AIModelService.Exceptions.cs +++ b/Standard.AI.OpenAI/Services/Foundations/AIModels/AIModelService.Exceptions.cs @@ -57,7 +57,9 @@ private async ValueTask TryCatch(ReturningAIModelFunction returningAIMo catch (HttpResponseBadRequestException httpResponseBadRequestException) { var invalidAIModelException = - new InvalidAIModelException(httpResponseBadRequestException); + new InvalidAIModelException( + message: "AI Model is invalid.", + httpResponseBadRequestException); throw new AIModelDependencyValidationException(invalidAIModelException); } diff --git a/Standard.AI.OpenAI/Services/Foundations/AIModels/AIModelService.Validations.cs b/Standard.AI.OpenAI/Services/Foundations/AIModels/AIModelService.Validations.cs index 5c8e67b5..24b5bef5 100644 --- a/Standard.AI.OpenAI/Services/Foundations/AIModels/AIModelService.Validations.cs +++ b/Standard.AI.OpenAI/Services/Foundations/AIModels/AIModelService.Validations.cs @@ -21,7 +21,9 @@ private static void ValidateAIModelName(string aiModelName) => private static void Validate(params (dynamic Rule, string Parameter)[] validations) { - var invalidAIModelException = new InvalidAIModelException(); + var invalidAIModelException = + new InvalidAIModelException( + message: "AI Model is invalid."); foreach ((dynamic rule, string parameter) in validations) { From fdaf3141a954377f818dd1e57b3084189ad97cd9 Mon Sep 17 00:00:00 2001 From: Lezune Date: Thu, 30 May 2024 05:28:46 -0700 Subject: [PATCH 071/283] Updated InvalidConfigurationAIModelException class by removing constructors in which the error message was hard coded in. Updated all relevant service files to include message. --- .../Exceptions/InvalidConfigurationAIModelException.cs | 6 ------ .../Foundations/AIModels/AIModelService.Exceptions.cs | 8 ++++++-- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/Standard.AI.OpenAI/Models/Services/Foundations/AIModels/Exceptions/InvalidConfigurationAIModelException.cs b/Standard.AI.OpenAI/Models/Services/Foundations/AIModels/Exceptions/InvalidConfigurationAIModelException.cs index d0b86c1d..45fc3985 100644 --- a/Standard.AI.OpenAI/Models/Services/Foundations/AIModels/Exceptions/InvalidConfigurationAIModelException.cs +++ b/Standard.AI.OpenAI/Models/Services/Foundations/AIModels/Exceptions/InvalidConfigurationAIModelException.cs @@ -9,12 +9,6 @@ namespace Standard.AI.OpenAI.Models.Services.Foundations.AIModels.Exceptions { public class InvalidConfigurationAIModelException : Xeption { - public InvalidConfigurationAIModelException(Exception innerException) - : base( - message: "Invalid AI Model configuration error occurred, contact support.", - innerException: innerException) - { } - public InvalidConfigurationAIModelException(string message, Exception innerException) : base(message, innerException) { } } diff --git a/Standard.AI.OpenAI/Services/Foundations/AIModels/AIModelService.Exceptions.cs b/Standard.AI.OpenAI/Services/Foundations/AIModels/AIModelService.Exceptions.cs index f16afaf0..e37eeb63 100644 --- a/Standard.AI.OpenAI/Services/Foundations/AIModels/AIModelService.Exceptions.cs +++ b/Standard.AI.OpenAI/Services/Foundations/AIModels/AIModelService.Exceptions.cs @@ -29,7 +29,9 @@ private async ValueTask TryCatch(ReturningAIModelFunction returningAIMo catch (HttpResponseUrlNotFoundException httpResponseUrlNotFoundException) { var invalidConfigurationAIModelException = - new InvalidConfigurationAIModelException(httpResponseUrlNotFoundException); + new InvalidConfigurationAIModelException( + message: "Invalid AI Model configuration error occurred, contact support.", + httpResponseUrlNotFoundException); throw new AIModelDependencyException(invalidConfigurationAIModelException); } @@ -94,7 +96,9 @@ private async ValueTask> TryCatch(ReturningAIModelsFunction catch (HttpResponseUrlNotFoundException httpResponseUrlNotFoundException) { var invalidConfigurationAIModelException = - new InvalidConfigurationAIModelException(httpResponseUrlNotFoundException); + new InvalidConfigurationAIModelException( + message: "Invalid AI Model configuration error occurred, contact support.", + httpResponseUrlNotFoundException); throw new AIModelDependencyException(invalidConfigurationAIModelException); } From 3f67637049f384a5b34b75870b11ad28bac93862 Mon Sep 17 00:00:00 2001 From: Lezune Date: Thu, 30 May 2024 05:36:03 -0700 Subject: [PATCH 072/283] Updated NotFoundAIModelException class by removing constructors in which the error message was hard coded in. Updated all relevant service files to include message. --- .../AIModels/Exceptions/NotFoundAIModelException.cs | 6 ------ .../Foundations/AIModels/AIModelService.Exceptions.cs | 4 +++- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/Standard.AI.OpenAI/Models/Services/Foundations/AIModels/Exceptions/NotFoundAIModelException.cs b/Standard.AI.OpenAI/Models/Services/Foundations/AIModels/Exceptions/NotFoundAIModelException.cs index e60b4fbd..1ee98e83 100644 --- a/Standard.AI.OpenAI/Models/Services/Foundations/AIModels/Exceptions/NotFoundAIModelException.cs +++ b/Standard.AI.OpenAI/Models/Services/Foundations/AIModels/Exceptions/NotFoundAIModelException.cs @@ -9,12 +9,6 @@ namespace Standard.AI.OpenAI.Models.Services.Foundations.AIModels.Exceptions { public class NotFoundAIModelException : Xeption { - public NotFoundAIModelException(Exception innerException) - : base( - message: "AI Model not found.", - innerException: innerException) - { } - public NotFoundAIModelException(string message, Exception innerException) : base(message, innerException) { } diff --git a/Standard.AI.OpenAI/Services/Foundations/AIModels/AIModelService.Exceptions.cs b/Standard.AI.OpenAI/Services/Foundations/AIModels/AIModelService.Exceptions.cs index f16afaf0..638f460f 100644 --- a/Standard.AI.OpenAI/Services/Foundations/AIModels/AIModelService.Exceptions.cs +++ b/Standard.AI.OpenAI/Services/Foundations/AIModels/AIModelService.Exceptions.cs @@ -50,7 +50,9 @@ private async ValueTask TryCatch(ReturningAIModelFunction returningAIMo catch (HttpResponseNotFoundException httpResponseNotFoundException) { var notFoundAIModelException = - new NotFoundAIModelException(httpResponseNotFoundException); + new NotFoundAIModelException( + message: "AI Model not found.", + httpResponseNotFoundException); throw new AIModelDependencyValidationException(notFoundAIModelException); } From 0ae4082698aef1f09a62a37d710f9a254a135897 Mon Sep 17 00:00:00 2001 From: Lezune Date: Thu, 30 May 2024 05:40:12 -0700 Subject: [PATCH 073/283] Updated UnauthorizedAIModelException class by removing constructors in which the error message was hard coded in. Updated all relevant service files to include message. --- .../Exceptions/UnauthorizedAIModelException.cs | 8 +------- .../AIModels/AIModelService.Exceptions.cs | 16 ++++++++++++---- 2 files changed, 13 insertions(+), 11 deletions(-) diff --git a/Standard.AI.OpenAI/Models/Services/Foundations/AIModels/Exceptions/UnauthorizedAIModelException.cs b/Standard.AI.OpenAI/Models/Services/Foundations/AIModels/Exceptions/UnauthorizedAIModelException.cs index 7547e067..5dbed051 100644 --- a/Standard.AI.OpenAI/Models/Services/Foundations/AIModels/Exceptions/UnauthorizedAIModelException.cs +++ b/Standard.AI.OpenAI/Models/Services/Foundations/AIModels/Exceptions/UnauthorizedAIModelException.cs @@ -8,13 +8,7 @@ namespace Standard.AI.OpenAI.Models.Services.Foundations.AIModels.Exceptions { public class UnauthorizedAIModelException : Xeption - { - public UnauthorizedAIModelException(Exception innerException) - : base( - message: "Unauthorized AI Model error occurred, fix errors and try again.", - innerException: innerException) - { } - + { public UnauthorizedAIModelException(string message, Exception innerException) : base(message, innerException) { } diff --git a/Standard.AI.OpenAI/Services/Foundations/AIModels/AIModelService.Exceptions.cs b/Standard.AI.OpenAI/Services/Foundations/AIModels/AIModelService.Exceptions.cs index f16afaf0..54562f7d 100644 --- a/Standard.AI.OpenAI/Services/Foundations/AIModels/AIModelService.Exceptions.cs +++ b/Standard.AI.OpenAI/Services/Foundations/AIModels/AIModelService.Exceptions.cs @@ -36,14 +36,18 @@ private async ValueTask TryCatch(ReturningAIModelFunction returningAIMo catch (HttpResponseUnauthorizedException httpResponseUnauthorizedException) { var unauthorizedAIModelException = - new UnauthorizedAIModelException(httpResponseUnauthorizedException); + new UnauthorizedAIModelException( + message: "Unauthorized AI Model error occurred, fix errors and try again.", + httpResponseUnauthorizedException); throw new AIModelDependencyException(unauthorizedAIModelException); } catch (HttpResponseForbiddenException httpResponseForbiddenException) { var unauthorizedAIModelException = - new UnauthorizedAIModelException(httpResponseForbiddenException); + new UnauthorizedAIModelException( + message: "Unauthorized AI Model error occurred, fix errors and try again.", + httpResponseForbiddenException); throw new AIModelDependencyException(unauthorizedAIModelException); } @@ -101,14 +105,18 @@ private async ValueTask> TryCatch(ReturningAIModelsFunction catch (HttpResponseUnauthorizedException httpResponseUnauthorizedException) { var unauthorizedAIModelException = - new UnauthorizedAIModelException(httpResponseUnauthorizedException); + new UnauthorizedAIModelException( + message: "Unauthorized AI Model error occurred, fix errors and try again.", + httpResponseUnauthorizedException); throw new AIModelDependencyException(unauthorizedAIModelException); } catch (HttpResponseForbiddenException httpResponseForbiddenException) { var unauthorizedAIModelException = - new UnauthorizedAIModelException(httpResponseForbiddenException); + new UnauthorizedAIModelException( + message: "Unauthorized AI Model error occurred, fix errors and try again.", + httpResponseForbiddenException); throw new AIModelDependencyException(unauthorizedAIModelException); } From 9d432932481d24cf04f2d68a735f3447cdea4708 Mon Sep 17 00:00:00 2001 From: Lezune Date: Thu, 30 May 2024 05:46:09 -0700 Subject: [PATCH 074/283] Updated AIFileOrchestrationDependencyException class by removing constructors in which the error message was hard coded in. Updated all relevant service files to include message. --- .../Exceptions/AIFileOrchestrationDependencyException.cs | 6 ------ .../AIFiles/AIFileOrchestrationService.Exceptions.cs | 6 ++++++ 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Standard.AI.OpenAI/Models/Services/Orchestrations/AIFiles/Exceptions/AIFileOrchestrationDependencyException.cs b/Standard.AI.OpenAI/Models/Services/Orchestrations/AIFiles/Exceptions/AIFileOrchestrationDependencyException.cs index 740e1137..1ebf824a 100644 --- a/Standard.AI.OpenAI/Models/Services/Orchestrations/AIFiles/Exceptions/AIFileOrchestrationDependencyException.cs +++ b/Standard.AI.OpenAI/Models/Services/Orchestrations/AIFiles/Exceptions/AIFileOrchestrationDependencyException.cs @@ -8,12 +8,6 @@ namespace Standard.AI.OpenAI.Models.Services.Orchestrations.AIFiles.Exceptions { public class AIFileOrchestrationDependencyException : Xeption { - public AIFileOrchestrationDependencyException(Xeption innerException) - : base( - message: "AI File dependency error occurred, contact support.", - innerException: innerException) - { } - public AIFileOrchestrationDependencyException(string message, Xeption innerException) : base(message, innerException) { } diff --git a/Standard.AI.OpenAI/Services/Orchestrations/AIFiles/AIFileOrchestrationService.Exceptions.cs b/Standard.AI.OpenAI/Services/Orchestrations/AIFiles/AIFileOrchestrationService.Exceptions.cs index 7f3a20b1..46bd6f41 100644 --- a/Standard.AI.OpenAI/Services/Orchestrations/AIFiles/AIFileOrchestrationService.Exceptions.cs +++ b/Standard.AI.OpenAI/Services/Orchestrations/AIFiles/AIFileOrchestrationService.Exceptions.cs @@ -46,11 +46,13 @@ private async ValueTask TryCatch(ReturningAIFileFunction returningAIFile catch (LocalFileDependencyException localFileDependencyException) { throw new AIFileOrchestrationDependencyException( + message: "AI File dependency error occurred, contact support.", localFileDependencyException.InnerException as Xeption); } catch (LocalFileServiceException localFileServiceException) { throw new AIFileOrchestrationDependencyException( + message: "AI File dependency error occurred, contact support.", localFileServiceException.InnerException as Xeption); } catch (AIFileValidationException aIFileValidationException) @@ -66,11 +68,13 @@ private async ValueTask TryCatch(ReturningAIFileFunction returningAIFile catch (AIFileDependencyException aIFileDependencyException) { throw new AIFileOrchestrationDependencyException( + message: "AI File dependency error occurred, contact support.", aIFileDependencyException.InnerException as Xeption); } catch (AIFileServiceException aIFileServiceException) { throw new AIFileOrchestrationDependencyException( + message: "AI File dependency error occurred, contact support.", aIFileServiceException.InnerException as Xeption); } catch (Exception exception) @@ -93,6 +97,7 @@ private async ValueTask> TryCatch(ReturningAIFilesFu catch (AIFileDependencyException aIFileDependencyException) { throw new AIFileOrchestrationDependencyException( + message: "AI File dependency error occurred, contact support.", aIFileDependencyException.InnerException as Xeption); } catch (AIFileDependencyValidationException aIFileDependencyValidationException) @@ -103,6 +108,7 @@ private async ValueTask> TryCatch(ReturningAIFilesFu catch (AIFileServiceException aIFileServiceException) { throw new AIFileOrchestrationDependencyException( + message: "AI File dependency error occurred, contact support.", aIFileServiceException.InnerException as Xeption); } catch (Exception exception) From 9a4e98b82ef2f21c584843ebd633c975ea91f808 Mon Sep 17 00:00:00 2001 From: Lezune Date: Thu, 30 May 2024 05:53:19 -0700 Subject: [PATCH 075/283] Updated AIFileOrchestrationDependencyValidationException class by removing constructors in which the error message was hard coded in. Updated all relevant service files to include message. --- .../AIFileOrchestrationDependencyValidationException.cs | 6 ------ .../AIFiles/AIFileOrchestrationService.Exceptions.cs | 5 +++++ 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/Standard.AI.OpenAI/Models/Services/Orchestrations/AIFiles/Exceptions/AIFileOrchestrationDependencyValidationException.cs b/Standard.AI.OpenAI/Models/Services/Orchestrations/AIFiles/Exceptions/AIFileOrchestrationDependencyValidationException.cs index 5fa414ed..69f3eb2e 100644 --- a/Standard.AI.OpenAI/Models/Services/Orchestrations/AIFiles/Exceptions/AIFileOrchestrationDependencyValidationException.cs +++ b/Standard.AI.OpenAI/Models/Services/Orchestrations/AIFiles/Exceptions/AIFileOrchestrationDependencyValidationException.cs @@ -8,12 +8,6 @@ namespace Standard.AI.OpenAI.Models.Services.Orchestrations.AIFiles.Exceptions { public class AIFileOrchestrationDependencyValidationException : Xeption { - public AIFileOrchestrationDependencyValidationException(Xeption innerException) - : base( - message: "AI file dependency validation error occurred, fix errors and try again.", - innerException: innerException) - { } - public AIFileOrchestrationDependencyValidationException(string message, Xeption innerException) : base(message, innerException) { } diff --git a/Standard.AI.OpenAI/Services/Orchestrations/AIFiles/AIFileOrchestrationService.Exceptions.cs b/Standard.AI.OpenAI/Services/Orchestrations/AIFiles/AIFileOrchestrationService.Exceptions.cs index 7f3a20b1..8741ebac 100644 --- a/Standard.AI.OpenAI/Services/Orchestrations/AIFiles/AIFileOrchestrationService.Exceptions.cs +++ b/Standard.AI.OpenAI/Services/Orchestrations/AIFiles/AIFileOrchestrationService.Exceptions.cs @@ -36,11 +36,13 @@ private async ValueTask TryCatch(ReturningAIFileFunction returningAIFile catch (LocalFileValidationException localFileValidationException) { throw new AIFileOrchestrationDependencyValidationException( + message: "AI file dependency validation error occurred, fix errors and try again.", localFileValidationException.InnerException as Xeption); } catch (LocalFileDependencyValidationException localFileDependencyValidationException) { throw new AIFileOrchestrationDependencyValidationException( + message: "AI file dependency validation error occurred, fix errors and try again.", localFileDependencyValidationException.InnerException as Xeption); } catch (LocalFileDependencyException localFileDependencyException) @@ -56,11 +58,13 @@ private async ValueTask TryCatch(ReturningAIFileFunction returningAIFile catch (AIFileValidationException aIFileValidationException) { throw new AIFileOrchestrationDependencyValidationException( + message: "AI file dependency validation error occurred, fix errors and try again.", aIFileValidationException.InnerException as Xeption); } catch (AIFileDependencyValidationException aIFileDependencyValidationException) { throw new AIFileOrchestrationDependencyValidationException( + message: "AI file dependency validation error occurred, fix errors and try again.", aIFileDependencyValidationException.InnerException as Xeption); } catch (AIFileDependencyException aIFileDependencyException) @@ -98,6 +102,7 @@ private async ValueTask> TryCatch(ReturningAIFilesFu catch (AIFileDependencyValidationException aIFileDependencyValidationException) { throw new AIFileOrchestrationDependencyValidationException( + message: "AI file dependency validation error occurred, fix errors and try again.", aIFileDependencyValidationException.InnerException as Xeption); } catch (AIFileServiceException aIFileServiceException) From 3ae60d2f91393763da921b286666cacd1585806b Mon Sep 17 00:00:00 2001 From: Lezune Date: Thu, 30 May 2024 05:57:51 -0700 Subject: [PATCH 076/283] Updated AIFileOrchestrationServiceException class by removing constructors in which the error message was hard coded in. Updated all relevant service files to include message. --- .../Exceptions/AIFileOrchestrationServiceException.cs | 6 ------ .../AIFiles/AIFileOrchestrationService.Exceptions.cs | 2 ++ 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/Standard.AI.OpenAI/Models/Services/Orchestrations/AIFiles/Exceptions/AIFileOrchestrationServiceException.cs b/Standard.AI.OpenAI/Models/Services/Orchestrations/AIFiles/Exceptions/AIFileOrchestrationServiceException.cs index 7693a11c..360906b9 100644 --- a/Standard.AI.OpenAI/Models/Services/Orchestrations/AIFiles/Exceptions/AIFileOrchestrationServiceException.cs +++ b/Standard.AI.OpenAI/Models/Services/Orchestrations/AIFiles/Exceptions/AIFileOrchestrationServiceException.cs @@ -8,12 +8,6 @@ namespace Standard.AI.OpenAI.Models.Services.Orchestrations.AIFiles.Exceptions { public class AIFileOrchestrationServiceException : Xeption { - public AIFileOrchestrationServiceException(Xeption innerException) - : base( - message: "AI File error occurred, contact support.", - innerException: innerException) - { } - public AIFileOrchestrationServiceException(string message, Xeption innerException) : base(message, innerException) { } diff --git a/Standard.AI.OpenAI/Services/Orchestrations/AIFiles/AIFileOrchestrationService.Exceptions.cs b/Standard.AI.OpenAI/Services/Orchestrations/AIFiles/AIFileOrchestrationService.Exceptions.cs index 7f3a20b1..7f00f192 100644 --- a/Standard.AI.OpenAI/Services/Orchestrations/AIFiles/AIFileOrchestrationService.Exceptions.cs +++ b/Standard.AI.OpenAI/Services/Orchestrations/AIFiles/AIFileOrchestrationService.Exceptions.cs @@ -80,6 +80,7 @@ private async ValueTask TryCatch(ReturningAIFileFunction returningAIFile exception); throw new AIFileOrchestrationServiceException( + message: "AI File error occurred, contact support.", failedAIFileOrchestrationServiceException); } } @@ -112,6 +113,7 @@ private async ValueTask> TryCatch(ReturningAIFilesFu exception); throw new AIFileOrchestrationServiceException( + message: "AI File error occurred, contact support.", failedAIFileOrchestrationServiceException); } } From dcc2e34b106fcef5e7fb018e85bf0d9214ba0ea8 Mon Sep 17 00:00:00 2001 From: Lezune Date: Thu, 30 May 2024 06:02:03 -0700 Subject: [PATCH 077/283] Updated AIFileOrchestrationValidationException class by removing constructors in which the error message was hard coded in. Updated all relevant service files to include message. --- .../Exceptions/AIFileOrchestrationValidationException.cs | 6 ------ .../AIFiles/AIFileOrchestrationService.Exceptions.cs | 5 ++++- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/Standard.AI.OpenAI/Models/Services/Orchestrations/AIFiles/Exceptions/AIFileOrchestrationValidationException.cs b/Standard.AI.OpenAI/Models/Services/Orchestrations/AIFiles/Exceptions/AIFileOrchestrationValidationException.cs index ba96f3c5..08870893 100644 --- a/Standard.AI.OpenAI/Models/Services/Orchestrations/AIFiles/Exceptions/AIFileOrchestrationValidationException.cs +++ b/Standard.AI.OpenAI/Models/Services/Orchestrations/AIFiles/Exceptions/AIFileOrchestrationValidationException.cs @@ -8,12 +8,6 @@ namespace Standard.AI.OpenAI.Models.Services.Orchestrations.AIFiles.Exceptions { public class AIFileOrchestrationValidationException : Xeption { - public AIFileOrchestrationValidationException(Xeption innerException) - : base( - message: "AI file validation error occurred, fix errors and try again.", - innerException: innerException) - { } - public AIFileOrchestrationValidationException(string message, Xeption innerException) : base(message, innerException) { } diff --git a/Standard.AI.OpenAI/Services/Orchestrations/AIFiles/AIFileOrchestrationService.Exceptions.cs b/Standard.AI.OpenAI/Services/Orchestrations/AIFiles/AIFileOrchestrationService.Exceptions.cs index 7f3a20b1..ce435eb2 100644 --- a/Standard.AI.OpenAI/Services/Orchestrations/AIFiles/AIFileOrchestrationService.Exceptions.cs +++ b/Standard.AI.OpenAI/Services/Orchestrations/AIFiles/AIFileOrchestrationService.Exceptions.cs @@ -27,11 +27,14 @@ private async ValueTask TryCatch(ReturningAIFileFunction returningAIFile catch (NullAIFileOrchestrationException nullAIFileOrchestrationException) { throw new AIFileOrchestrationValidationException( + message: "AI file validation error occurred, fix errors and try again.", nullAIFileOrchestrationException); } catch (InvalidAIFileOrchestrationException invalidAIFileOrchestrationException) { - throw new AIFileOrchestrationValidationException(invalidAIFileOrchestrationException); + throw new AIFileOrchestrationValidationException( + message: "AI file validation error occurred, fix errors and try again.", + invalidAIFileOrchestrationException); } catch (LocalFileValidationException localFileValidationException) { From d93dde78ed1b3c5dce9145e4fd19c95d0f96e9af Mon Sep 17 00:00:00 2001 From: Lezune Date: Thu, 30 May 2024 06:06:26 -0700 Subject: [PATCH 078/283] Updated FailedAIFileOrchestrationServiceException class by removing constructors in which the error message was hard coded in. Updated all relevant service files to include message. --- .../Exceptions/FailedAIFileOrchestrationServiceException.cs | 6 ------ .../AIFiles/AIFileOrchestrationService.Exceptions.cs | 2 ++ 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/Standard.AI.OpenAI/Models/Services/Orchestrations/AIFiles/Exceptions/FailedAIFileOrchestrationServiceException.cs b/Standard.AI.OpenAI/Models/Services/Orchestrations/AIFiles/Exceptions/FailedAIFileOrchestrationServiceException.cs index 12b74918..6b0f607a 100644 --- a/Standard.AI.OpenAI/Models/Services/Orchestrations/AIFiles/Exceptions/FailedAIFileOrchestrationServiceException.cs +++ b/Standard.AI.OpenAI/Models/Services/Orchestrations/AIFiles/Exceptions/FailedAIFileOrchestrationServiceException.cs @@ -9,12 +9,6 @@ namespace Standard.AI.OpenAI.Models.Services.Orchestrations.AIFiles.Exceptions { public class FailedAIFileOrchestrationServiceException : Xeption { - public FailedAIFileOrchestrationServiceException(Exception innerException) - : base( - message: "Failed AI file service error occurred, contact support.", - innerException: innerException) - { } - public FailedAIFileOrchestrationServiceException(string message, Exception innerException) : base(message, innerException) { } diff --git a/Standard.AI.OpenAI/Services/Orchestrations/AIFiles/AIFileOrchestrationService.Exceptions.cs b/Standard.AI.OpenAI/Services/Orchestrations/AIFiles/AIFileOrchestrationService.Exceptions.cs index 7f3a20b1..ef6d3ffd 100644 --- a/Standard.AI.OpenAI/Services/Orchestrations/AIFiles/AIFileOrchestrationService.Exceptions.cs +++ b/Standard.AI.OpenAI/Services/Orchestrations/AIFiles/AIFileOrchestrationService.Exceptions.cs @@ -77,6 +77,7 @@ private async ValueTask TryCatch(ReturningAIFileFunction returningAIFile { var failedAIFileOrchestrationServiceException = new FailedAIFileOrchestrationServiceException( + message: "Failed AI file service error occurred, contact support.", exception); throw new AIFileOrchestrationServiceException( @@ -109,6 +110,7 @@ private async ValueTask> TryCatch(ReturningAIFilesFu { var failedAIFileOrchestrationServiceException = new FailedAIFileOrchestrationServiceException( + message: "Failed AI file service error occurred, contact support.", exception); throw new AIFileOrchestrationServiceException( From 860e7ed08e1295f9a67c6c9b1cc59be76e3b033e Mon Sep 17 00:00:00 2001 From: Lezune Date: Thu, 30 May 2024 06:14:11 -0700 Subject: [PATCH 079/283] Updated InvalidAIFileOrchestrationException class by removing constructors in which the error message was hard coded in. Updated all relevant service files to include message. --- ...hestrationServiceTests.Validation.RemoveFileByIdAsync.cs | 3 ++- .../AIFileOrchestrationServiceTests.Validations.Upload.cs | 6 ++++-- .../Exceptions/InvalidAIFileOrchestrationException.cs | 5 ++--- .../AIFiles/AIFileOrchestrationService.Validations.cs | 4 +++- 4 files changed, 11 insertions(+), 7 deletions(-) diff --git a/Standard.AI.OpenAI.Tests.Unit/Services/Orchestrations/AIFiles/AIFileOrchestrationServiceTests.Validation.RemoveFileByIdAsync.cs b/Standard.AI.OpenAI.Tests.Unit/Services/Orchestrations/AIFiles/AIFileOrchestrationServiceTests.Validation.RemoveFileByIdAsync.cs index a41a6379..5ae64533 100644 --- a/Standard.AI.OpenAI.Tests.Unit/Services/Orchestrations/AIFiles/AIFileOrchestrationServiceTests.Validation.RemoveFileByIdAsync.cs +++ b/Standard.AI.OpenAI.Tests.Unit/Services/Orchestrations/AIFiles/AIFileOrchestrationServiceTests.Validation.RemoveFileByIdAsync.cs @@ -18,7 +18,8 @@ private async Task ShouldThrowValidationExceptionOnRemoveFileIfFileIdIsInvalid(s { // given var invalidAiFileOrchestrationException = - new InvalidAIFileOrchestrationException(); + new InvalidAIFileOrchestrationException( + message: "AI file is invalid."); invalidAiFileOrchestrationException.AddData( key: nameof(AIFile.Response.Id), diff --git a/Standard.AI.OpenAI.Tests.Unit/Services/Orchestrations/AIFiles/AIFileOrchestrationServiceTests.Validations.Upload.cs b/Standard.AI.OpenAI.Tests.Unit/Services/Orchestrations/AIFiles/AIFileOrchestrationServiceTests.Validations.Upload.cs index ea6f96fa..a4e8276b 100644 --- a/Standard.AI.OpenAI.Tests.Unit/Services/Orchestrations/AIFiles/AIFileOrchestrationServiceTests.Validations.Upload.cs +++ b/Standard.AI.OpenAI.Tests.Unit/Services/Orchestrations/AIFiles/AIFileOrchestrationServiceTests.Validations.Upload.cs @@ -60,7 +60,8 @@ private async Task ShouldThrowValidationExceptionOnUploadIfRequestIsNullAsync() var invalidAIFile = new AIFile(); var invalidAIFileOrchestrationException = - new InvalidAIFileOrchestrationException(); + new InvalidAIFileOrchestrationException( + message: "AI file is invalid."); invalidAIFileOrchestrationException.AddData( key: nameof(AIFileRequest), @@ -110,7 +111,8 @@ private async Task ShouldThrowValidationExceptionIfRequestIsInvalidAsync( invalidAIFile.Request.Name = invalidName; var invalidAIFileOrchestrationException = - new InvalidAIFileOrchestrationException(); + new InvalidAIFileOrchestrationException( + message: "AI file is invalid."); invalidAIFileOrchestrationException.AddData( key: nameof(AIFileRequest.Name), diff --git a/Standard.AI.OpenAI/Models/Services/Orchestrations/AIFiles/Exceptions/InvalidAIFileOrchestrationException.cs b/Standard.AI.OpenAI/Models/Services/Orchestrations/AIFiles/Exceptions/InvalidAIFileOrchestrationException.cs index 2d5ae099..78f72f50 100644 --- a/Standard.AI.OpenAI/Models/Services/Orchestrations/AIFiles/Exceptions/InvalidAIFileOrchestrationException.cs +++ b/Standard.AI.OpenAI/Models/Services/Orchestrations/AIFiles/Exceptions/InvalidAIFileOrchestrationException.cs @@ -8,9 +8,8 @@ namespace Standard.AI.OpenAI.Models.Services.Orchestrations.AIFiles.Exceptions { public class InvalidAIFileOrchestrationException : Xeption { - public InvalidAIFileOrchestrationException() - : base( - message: "AI file is invalid.") + public InvalidAIFileOrchestrationException(string message) + : base(message) { } public InvalidAIFileOrchestrationException( diff --git a/Standard.AI.OpenAI/Services/Orchestrations/AIFiles/AIFileOrchestrationService.Validations.cs b/Standard.AI.OpenAI/Services/Orchestrations/AIFiles/AIFileOrchestrationService.Validations.cs index 3ba810a6..e66cc0fe 100644 --- a/Standard.AI.OpenAI/Services/Orchestrations/AIFiles/AIFileOrchestrationService.Validations.cs +++ b/Standard.AI.OpenAI/Services/Orchestrations/AIFiles/AIFileOrchestrationService.Validations.cs @@ -53,7 +53,9 @@ private static void ValidateAIFileIdNotNull(string fileId) private static void Validate(params (dynamic Rule, string Parameter)[] validations) { - var invalidAIFileException = new InvalidAIFileOrchestrationException(); + var invalidAIFileException = + new InvalidAIFileOrchestrationException( + message: "AI file is invalid."); foreach ((dynamic rule, string parameter) in validations) { From 64899d922fb294309bfcb932c7905f395b0cfc38 Mon Sep 17 00:00:00 2001 From: Lezune Date: Thu, 30 May 2024 06:19:41 -0700 Subject: [PATCH 080/283] Updated NullAIFileOrchestrationException class by removing constructors in which the error message was hard coded in. Updated all relevant service files to include message. --- .../AIFileOrchestrationServiceTests.Validations.Upload.cs | 3 ++- .../AIFiles/Exceptions/NullAIFileOrchestrationException.cs | 5 ++--- .../AIFiles/AIFileOrchestrationService.Validations.cs | 3 ++- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/Standard.AI.OpenAI.Tests.Unit/Services/Orchestrations/AIFiles/AIFileOrchestrationServiceTests.Validations.Upload.cs b/Standard.AI.OpenAI.Tests.Unit/Services/Orchestrations/AIFiles/AIFileOrchestrationServiceTests.Validations.Upload.cs index ea6f96fa..cd68d2eb 100644 --- a/Standard.AI.OpenAI.Tests.Unit/Services/Orchestrations/AIFiles/AIFileOrchestrationServiceTests.Validations.Upload.cs +++ b/Standard.AI.OpenAI.Tests.Unit/Services/Orchestrations/AIFiles/AIFileOrchestrationServiceTests.Validations.Upload.cs @@ -20,7 +20,8 @@ private async Task ShouldThrowValidationExceptionOnUploadIfFileIsNullAsync() AIFile nullAIFile = null; var nullAIFileOrchestrationException = - new NullAIFileOrchestrationException(); + new NullAIFileOrchestrationException( + message: "AI file is null."); var expectedAIFileOrchestrationValidationException = new AIFileOrchestrationValidationException( diff --git a/Standard.AI.OpenAI/Models/Services/Orchestrations/AIFiles/Exceptions/NullAIFileOrchestrationException.cs b/Standard.AI.OpenAI/Models/Services/Orchestrations/AIFiles/Exceptions/NullAIFileOrchestrationException.cs index d1b277ab..3b8ac00a 100644 --- a/Standard.AI.OpenAI/Models/Services/Orchestrations/AIFiles/Exceptions/NullAIFileOrchestrationException.cs +++ b/Standard.AI.OpenAI/Models/Services/Orchestrations/AIFiles/Exceptions/NullAIFileOrchestrationException.cs @@ -8,9 +8,8 @@ namespace Standard.AI.OpenAI.Models.Services.Orchestrations.AIFiles.Exceptions { internal class NullAIFileOrchestrationException : Xeption { - public NullAIFileOrchestrationException() - : base( - message: "AI file is null.") + public NullAIFileOrchestrationException(string message) + : base(message) { } public NullAIFileOrchestrationException(string message, Xeption innerException) diff --git a/Standard.AI.OpenAI/Services/Orchestrations/AIFiles/AIFileOrchestrationService.Validations.cs b/Standard.AI.OpenAI/Services/Orchestrations/AIFiles/AIFileOrchestrationService.Validations.cs index 3ba810a6..a2d5f115 100644 --- a/Standard.AI.OpenAI/Services/Orchestrations/AIFiles/AIFileOrchestrationService.Validations.cs +++ b/Standard.AI.OpenAI/Services/Orchestrations/AIFiles/AIFileOrchestrationService.Validations.cs @@ -23,7 +23,8 @@ private static void ValidateAIFileNotNull(AIFile aiFile) { if (aiFile is null) { - throw new NullAIFileOrchestrationException(); + throw new NullAIFileOrchestrationException( + message: "AI file is null."); } } From 6087da4d87f1d6245edc5795825f322936658775 Mon Sep 17 00:00:00 2001 From: Lezune Date: Thu, 30 May 2024 06:35:09 -0700 Subject: [PATCH 081/283] Updated AIFileClientDependencyException class by removing constructors in which the error message was hard coded in. Updated all relevant service files to include message. --- Standard.AI.OpenAI/Clients/AIFiles/AIFilesClient.cs | 3 +++ .../AIFiles/Exceptions/AIFileClientDependencyException.cs | 6 ------ 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/Standard.AI.OpenAI/Clients/AIFiles/AIFilesClient.cs b/Standard.AI.OpenAI/Clients/AIFiles/AIFilesClient.cs index ea3ea306..2835d723 100644 --- a/Standard.AI.OpenAI/Clients/AIFiles/AIFilesClient.cs +++ b/Standard.AI.OpenAI/Clients/AIFiles/AIFilesClient.cs @@ -38,6 +38,7 @@ public async ValueTask UploadFileAsync(AIFile aiFile) catch (AIFileOrchestrationDependencyException aiFileOrchestrationDependencyException) { throw new AIFileClientDependencyException( + message: "AI file client dependency error occurred, contact support.", aiFileOrchestrationDependencyException.InnerException as Xeption); } catch (AIFileOrchestrationServiceException aiFileOrchestrationServiceException) @@ -61,6 +62,7 @@ public async ValueTask> RetrieveAllFilesAsync() catch (AIFileOrchestrationDependencyException aiFileOrchestrationDependencyException) { throw new AIFileClientDependencyException( + message: "AI file client dependency error occurred, contact support.", aiFileOrchestrationDependencyException.InnerException as Xeption); } catch (AIFileOrchestrationServiceException aiFileOrchestrationServiceException) @@ -89,6 +91,7 @@ public async ValueTask RemoveFileByIdAsync(string fileId) catch (AIFileOrchestrationDependencyException aiFileOrchestrationDependencyException) { throw new AIFileClientDependencyException( + message: "AI file client dependency error occurred, contact support.", aiFileOrchestrationDependencyException.InnerException as Xeption); } catch (AIFileOrchestrationServiceException aiFileOrchestrationServiceException) diff --git a/Standard.AI.OpenAI/Models/Clients/AIFiles/Exceptions/AIFileClientDependencyException.cs b/Standard.AI.OpenAI/Models/Clients/AIFiles/Exceptions/AIFileClientDependencyException.cs index 5a20206d..c4367bd1 100644 --- a/Standard.AI.OpenAI/Models/Clients/AIFiles/Exceptions/AIFileClientDependencyException.cs +++ b/Standard.AI.OpenAI/Models/Clients/AIFiles/Exceptions/AIFileClientDependencyException.cs @@ -12,12 +12,6 @@ namespace Standard.AI.OpenAI.Models.Clients.AIFiles.Exceptions /// public class AIFileClientDependencyException : Xeption { - public AIFileClientDependencyException(Xeption innerException) - : base( - message: "AI file client dependency error occurred, contact support.", - innerException: innerException) - { } - public AIFileClientDependencyException(string message, Xeption innerException) : base(message, innerException) { } From 7d28ee628004cb55fab1a9a886c4eab963d840c0 Mon Sep 17 00:00:00 2001 From: Lezune Date: Thu, 30 May 2024 06:42:07 -0700 Subject: [PATCH 082/283] Updated AIFileClientServiceException class by removing constructors in which the error message was hard coded in. Updated all relevant service files to include message. --- Standard.AI.OpenAI/Clients/AIFiles/AIFilesClient.cs | 3 +++ .../AIFiles/Exceptions/AIFileClientServiceException.cs | 6 ------ 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/Standard.AI.OpenAI/Clients/AIFiles/AIFilesClient.cs b/Standard.AI.OpenAI/Clients/AIFiles/AIFilesClient.cs index ea3ea306..cf763f42 100644 --- a/Standard.AI.OpenAI/Clients/AIFiles/AIFilesClient.cs +++ b/Standard.AI.OpenAI/Clients/AIFiles/AIFilesClient.cs @@ -43,6 +43,7 @@ public async ValueTask UploadFileAsync(AIFile aiFile) catch (AIFileOrchestrationServiceException aiFileOrchestrationServiceException) { throw new AIFileClientServiceException( + message: "AI file client service error occurred, contact support.", aiFileOrchestrationServiceException.InnerException as Xeption); } } @@ -66,6 +67,7 @@ public async ValueTask> RetrieveAllFilesAsync() catch (AIFileOrchestrationServiceException aiFileOrchestrationServiceException) { throw new AIFileClientServiceException( + message: "AI file client service error occurred, contact support.", aiFileOrchestrationServiceException.InnerException as Xeption); } } @@ -94,6 +96,7 @@ public async ValueTask RemoveFileByIdAsync(string fileId) catch (AIFileOrchestrationServiceException aiFileOrchestrationServiceException) { throw new AIFileClientServiceException( + message: "AI file client service error occurred, contact support.", aiFileOrchestrationServiceException.InnerException as Xeption); } } diff --git a/Standard.AI.OpenAI/Models/Clients/AIFiles/Exceptions/AIFileClientServiceException.cs b/Standard.AI.OpenAI/Models/Clients/AIFiles/Exceptions/AIFileClientServiceException.cs index 1902f6cb..5aadacd5 100644 --- a/Standard.AI.OpenAI/Models/Clients/AIFiles/Exceptions/AIFileClientServiceException.cs +++ b/Standard.AI.OpenAI/Models/Clients/AIFiles/Exceptions/AIFileClientServiceException.cs @@ -12,12 +12,6 @@ namespace Standard.AI.OpenAI.Models.Clients.AIFiles.Exceptions /// public class AIFileClientServiceException : Xeption { - public AIFileClientServiceException(Xeption innerException) - : base( - message: "AI file client service error occurred, contact support.", - innerException: innerException) - { } - public AIFileClientServiceException(string message, Xeption innerException) : base(message, innerException) { } From 920c7645fa87300711ae8878ad2598d20d628838 Mon Sep 17 00:00:00 2001 From: Lezune Date: Thu, 30 May 2024 06:47:28 -0700 Subject: [PATCH 083/283] Updated AIFileClientValidationException class by removing constructors in which the error message was hard coded in. Updated all relevant service files to include message. --- Standard.AI.OpenAI/Clients/AIFiles/AIFilesClient.cs | 5 +++++ .../AIFiles/Exceptions/AIFileClientValidationException.cs | 6 ------ 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/Standard.AI.OpenAI/Clients/AIFiles/AIFilesClient.cs b/Standard.AI.OpenAI/Clients/AIFiles/AIFilesClient.cs index ea3ea306..8a400f0f 100644 --- a/Standard.AI.OpenAI/Clients/AIFiles/AIFilesClient.cs +++ b/Standard.AI.OpenAI/Clients/AIFiles/AIFilesClient.cs @@ -28,11 +28,13 @@ public async ValueTask UploadFileAsync(AIFile aiFile) catch (AIFileOrchestrationValidationException aiFileOrchestrationValidationException) { throw new AIFileClientValidationException( + message: "AI file client validation error occurred, fix errors and try again.", aiFileOrchestrationValidationException.InnerException as Xeption); } catch (AIFileOrchestrationDependencyValidationException aiFileOrchestrationDependencyValidationException) { throw new AIFileClientValidationException( + message: "AI file client validation error occurred, fix errors and try again.", aiFileOrchestrationDependencyValidationException.InnerException as Xeption); } catch (AIFileOrchestrationDependencyException aiFileOrchestrationDependencyException) @@ -56,6 +58,7 @@ public async ValueTask> RetrieveAllFilesAsync() catch (AIFileOrchestrationDependencyValidationException aiFileOrchestrationDependencyValidationException) { throw new AIFileClientValidationException( + message: "AI file client validation error occurred, fix errors and try again.", aiFileOrchestrationDependencyValidationException.InnerException as Xeption); } catch (AIFileOrchestrationDependencyException aiFileOrchestrationDependencyException) @@ -79,11 +82,13 @@ public async ValueTask RemoveFileByIdAsync(string fileId) catch (AIFileOrchestrationValidationException aiFileOrchestrationValidationException) { throw new AIFileClientValidationException( + message: "AI file client validation error occurred, fix errors and try again.", aiFileOrchestrationValidationException.InnerException as Xeption); } catch (AIFileOrchestrationDependencyValidationException aiFileOrchestrationDependencyValidationException) { throw new AIFileClientValidationException( + message: "AI file client validation error occurred, fix errors and try again.", aiFileOrchestrationDependencyValidationException.InnerException as Xeption); } catch (AIFileOrchestrationDependencyException aiFileOrchestrationDependencyException) diff --git a/Standard.AI.OpenAI/Models/Clients/AIFiles/Exceptions/AIFileClientValidationException.cs b/Standard.AI.OpenAI/Models/Clients/AIFiles/Exceptions/AIFileClientValidationException.cs index 0be1d163..9ffe1cb4 100644 --- a/Standard.AI.OpenAI/Models/Clients/AIFiles/Exceptions/AIFileClientValidationException.cs +++ b/Standard.AI.OpenAI/Models/Clients/AIFiles/Exceptions/AIFileClientValidationException.cs @@ -12,12 +12,6 @@ namespace Standard.AI.OpenAI.Models.Clients.AIFiles.Exceptions /// public class AIFileClientValidationException : Xeption { - public AIFileClientValidationException(Xeption innerException) - : base( - message: "AI file client validation error occurred, fix errors and try again.", - innerException: innerException) - { } - public AIFileClientValidationException(string message, Xeption innerException) : base(message, innerException) { } From df40d743644e9deb67c3e4293649816d78d60ca1 Mon Sep 17 00:00:00 2001 From: Lezune Date: Thu, 30 May 2024 06:51:54 -0700 Subject: [PATCH 084/283] Updated AIModelClientDependencyException class by removing constructors in which the error message was hard coded in. Updated all relevant service files to include message. --- Standard.AI.OpenAI/Clients/AIModels/AIModelsClient.cs | 2 ++ .../AIModels/Exceptions/AIModelClientDependencyException.cs | 6 ------ 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/Standard.AI.OpenAI/Clients/AIModels/AIModelsClient.cs b/Standard.AI.OpenAI/Clients/AIModels/AIModelsClient.cs index 34dece77..6cd499d9 100644 --- a/Standard.AI.OpenAI/Clients/AIModels/AIModelsClient.cs +++ b/Standard.AI.OpenAI/Clients/AIModels/AIModelsClient.cs @@ -34,6 +34,7 @@ public async ValueTask> RetrieveAIModelsAsync() catch (AIModelDependencyException aiModelDependencyException) { throw new AIModelClientDependencyException( + message: "AI model client dependency error occurred, contact support.", aiModelDependencyException.InnerException as Xeption); } catch (AIModelServiceException aiModelServiceException) @@ -62,6 +63,7 @@ public async ValueTask RetrieveAIModelByNameAsync(string aiModelName) catch (AIModelDependencyException aiModelDependencyException) { throw new AIModelClientDependencyException( + message: "AI model client dependency error occurred, contact support.", aiModelDependencyException.InnerException as Xeption); } catch (AIModelServiceException aiModelServiceException) diff --git a/Standard.AI.OpenAI/Models/Clients/AIModels/Exceptions/AIModelClientDependencyException.cs b/Standard.AI.OpenAI/Models/Clients/AIModels/Exceptions/AIModelClientDependencyException.cs index 724992c5..a3579507 100644 --- a/Standard.AI.OpenAI/Models/Clients/AIModels/Exceptions/AIModelClientDependencyException.cs +++ b/Standard.AI.OpenAI/Models/Clients/AIModels/Exceptions/AIModelClientDependencyException.cs @@ -13,12 +13,6 @@ namespace Standard.AI.OpenAI.Models.Clients.AIModels.Exceptions /// public class AIModelClientDependencyException : Xeption { - public AIModelClientDependencyException(Xeption innerException) - : base( - message: "AI model client dependency error occurred, contact support.", - innerException: innerException) - { } - public AIModelClientDependencyException(string message, Xeption innerException) : base(message, innerException) { } From c4dbbfdd9e498e3de86c5ff0454638cd46e6cebd Mon Sep 17 00:00:00 2001 From: Lezune Date: Thu, 30 May 2024 06:56:36 -0700 Subject: [PATCH 085/283] Updated AIModelClientServiceException class by removing constructors in which the error message was hard coded in. Updated all relevant service files to include message. --- Standard.AI.OpenAI/Clients/AIModels/AIModelsClient.cs | 2 ++ .../AIModels/Exceptions/AIModelClientServiceException.cs | 6 ------ 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/Standard.AI.OpenAI/Clients/AIModels/AIModelsClient.cs b/Standard.AI.OpenAI/Clients/AIModels/AIModelsClient.cs index 34dece77..2f00ac47 100644 --- a/Standard.AI.OpenAI/Clients/AIModels/AIModelsClient.cs +++ b/Standard.AI.OpenAI/Clients/AIModels/AIModelsClient.cs @@ -39,6 +39,7 @@ public async ValueTask> RetrieveAIModelsAsync() catch (AIModelServiceException aiModelServiceException) { throw new AIModelClientServiceException( + message: "AI Model client service error occurred, contact support.", aiModelServiceException.InnerException as Xeption); } } @@ -67,6 +68,7 @@ public async ValueTask RetrieveAIModelByNameAsync(string aiModelName) catch (AIModelServiceException aiModelServiceException) { throw new AIModelClientServiceException( + message: "AI Model client service error occurred, contact support.", aiModelServiceException.InnerException as Xeption); } } diff --git a/Standard.AI.OpenAI/Models/Clients/AIModels/Exceptions/AIModelClientServiceException.cs b/Standard.AI.OpenAI/Models/Clients/AIModels/Exceptions/AIModelClientServiceException.cs index 3a9a846b..d76feeba 100644 --- a/Standard.AI.OpenAI/Models/Clients/AIModels/Exceptions/AIModelClientServiceException.cs +++ b/Standard.AI.OpenAI/Models/Clients/AIModels/Exceptions/AIModelClientServiceException.cs @@ -13,12 +13,6 @@ namespace Standard.AI.OpenAI.Models.Clients.AIModels.Exceptions /// public class AIModelClientServiceException : Xeption { - public AIModelClientServiceException(Xeption innerException) - : base( - message: "AI Model client service error occurred, contact support.", - innerException: innerException) - { } - public AIModelClientServiceException(string message, Xeption innerException) : base(message, innerException) { } From dec018635ca15448eb8a61f8dbf8922caa407390 Mon Sep 17 00:00:00 2001 From: Lezune Date: Thu, 30 May 2024 07:02:52 -0700 Subject: [PATCH 086/283] Updated AIModelClientValidationException class by removing constructors in which the error message was hard coded in. Updated all relevant service files to include message. --- Standard.AI.OpenAI/Clients/AIModels/AIModelsClient.cs | 3 +++ .../AIModels/Exceptions/AIModelClientValidationException.cs | 6 ------ 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/Standard.AI.OpenAI/Clients/AIModels/AIModelsClient.cs b/Standard.AI.OpenAI/Clients/AIModels/AIModelsClient.cs index 34dece77..66a0437b 100644 --- a/Standard.AI.OpenAI/Clients/AIModels/AIModelsClient.cs +++ b/Standard.AI.OpenAI/Clients/AIModels/AIModelsClient.cs @@ -29,6 +29,7 @@ public async ValueTask> RetrieveAIModelsAsync() catch (AIModelDependencyValidationException aiModelDependencyValidationException) { throw new AIModelClientValidationException( + message: "AI model client validation error occurred, fix errors and try again.", aiModelDependencyValidationException.InnerException as Xeption); } catch (AIModelDependencyException aiModelDependencyException) @@ -52,11 +53,13 @@ public async ValueTask RetrieveAIModelByNameAsync(string aiModelName) catch (AIModelValidationException aIModelValidationException) { throw new AIModelClientValidationException( + message: "AI model client validation error occurred, fix errors and try again.", aIModelValidationException.InnerException as Xeption); } catch (AIModelDependencyValidationException aiModelDependencyValidationException) { throw new AIModelClientValidationException( + message: "AI model client validation error occurred, fix errors and try again.", aiModelDependencyValidationException.InnerException as Xeption); } catch (AIModelDependencyException aiModelDependencyException) diff --git a/Standard.AI.OpenAI/Models/Clients/AIModels/Exceptions/AIModelClientValidationException.cs b/Standard.AI.OpenAI/Models/Clients/AIModels/Exceptions/AIModelClientValidationException.cs index 2db79486..1e76e543 100644 --- a/Standard.AI.OpenAI/Models/Clients/AIModels/Exceptions/AIModelClientValidationException.cs +++ b/Standard.AI.OpenAI/Models/Clients/AIModels/Exceptions/AIModelClientValidationException.cs @@ -12,12 +12,6 @@ namespace Standard.AI.OpenAI.Models.Clients.AIModels.Exceptions /// public class AIModelClientValidationException : Xeption { - public AIModelClientValidationException(Xeption innerException) - : base( - message: "AI model client validation error occurred, fix errors and try again.", - innerException: innerException) - { } - public AIModelClientValidationException(string message, Xeption innerException) : base(message: message, innerException) { } From 66297cc5a36b597aad554bb94e39df9731ff21dc Mon Sep 17 00:00:00 2001 From: Lezune Date: Thu, 30 May 2024 07:11:02 -0700 Subject: [PATCH 087/283] Updated ChatCompletionClientDependencyException class by removing constructors in which the error message was hard coded in. Updated all relevant service files to include message. --- .../Clients/ChatCompletions/ChatCompletionsClient.cs | 1 + .../Exceptions/ChatCompletionClientDependencyException.cs | 6 ------ 2 files changed, 1 insertion(+), 6 deletions(-) diff --git a/Standard.AI.OpenAI/Clients/ChatCompletions/ChatCompletionsClient.cs b/Standard.AI.OpenAI/Clients/ChatCompletions/ChatCompletionsClient.cs index 492c0777..9dd7f779 100644 --- a/Standard.AI.OpenAI/Clients/ChatCompletions/ChatCompletionsClient.cs +++ b/Standard.AI.OpenAI/Clients/ChatCompletions/ChatCompletionsClient.cs @@ -37,6 +37,7 @@ public async ValueTask SendChatCompletionAsync(ChatCompletion ch catch (ChatCompletionDependencyException completionDependencyException) { throw new ChatCompletionClientDependencyException( + message: "Chat completion dependency error occurred, contact support.", completionDependencyException.InnerException as Xeption); } catch (ChatCompletionServiceException completionServiceException) diff --git a/Standard.AI.OpenAI/Models/Clients/ChatCompletions/Exceptions/ChatCompletionClientDependencyException.cs b/Standard.AI.OpenAI/Models/Clients/ChatCompletions/Exceptions/ChatCompletionClientDependencyException.cs index e9f91747..702fe16d 100644 --- a/Standard.AI.OpenAI/Models/Clients/ChatCompletions/Exceptions/ChatCompletionClientDependencyException.cs +++ b/Standard.AI.OpenAI/Models/Clients/ChatCompletions/Exceptions/ChatCompletionClientDependencyException.cs @@ -12,12 +12,6 @@ namespace Standard.AI.OpenAI.Models.Clients.ChatCompletions.Exceptions /// public class ChatCompletionClientDependencyException : Xeption { - public ChatCompletionClientDependencyException(Xeption innerException) - : base( - message: "Chat completion dependency error occurred, contact support.", - innerException: innerException) - { } - public ChatCompletionClientDependencyException(string message, Xeption innerException) : base(message, innerException) { } From daabc5c9538bbfb13cae7c933eee751dd5d923f5 Mon Sep 17 00:00:00 2001 From: Lezune Date: Thu, 30 May 2024 07:15:12 -0700 Subject: [PATCH 088/283] Updated ChatCompletionClientServiceException class by removing constructors in which the error message was hard coded in. Updated all relevant service files to include message. --- .../Clients/ChatCompletions/ChatCompletionsClient.cs | 1 + .../Exceptions/ChatCompletionClientServiceException.cs | 5 ----- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/Standard.AI.OpenAI/Clients/ChatCompletions/ChatCompletionsClient.cs b/Standard.AI.OpenAI/Clients/ChatCompletions/ChatCompletionsClient.cs index 492c0777..2ae4d7f5 100644 --- a/Standard.AI.OpenAI/Clients/ChatCompletions/ChatCompletionsClient.cs +++ b/Standard.AI.OpenAI/Clients/ChatCompletions/ChatCompletionsClient.cs @@ -42,6 +42,7 @@ public async ValueTask SendChatCompletionAsync(ChatCompletion ch catch (ChatCompletionServiceException completionServiceException) { throw new ChatCompletionClientServiceException( + message: "Chat completion client service error occurred, contact support.", completionServiceException.InnerException as Xeption); } } diff --git a/Standard.AI.OpenAI/Models/Clients/ChatCompletions/Exceptions/ChatCompletionClientServiceException.cs b/Standard.AI.OpenAI/Models/Clients/ChatCompletions/Exceptions/ChatCompletionClientServiceException.cs index 175bed16..f98b9a14 100644 --- a/Standard.AI.OpenAI/Models/Clients/ChatCompletions/Exceptions/ChatCompletionClientServiceException.cs +++ b/Standard.AI.OpenAI/Models/Clients/ChatCompletions/Exceptions/ChatCompletionClientServiceException.cs @@ -12,11 +12,6 @@ public class ChatCompletionClientServiceException : Xeption /// This exception is thrown when a service error occurs while using the Chat completion client. /// For example, if there is a problem with the server or any other service failure. /// - public ChatCompletionClientServiceException(Xeption innerException) - : base( - message: "Chat completion client service error occurred, contact support.", - innerException: innerException) - { } public ChatCompletionClientServiceException(string message, Xeption innerException) : base(message, innerException) From 51a818f83aadac1d38aa0c94a8d550cf31eb4ee4 Mon Sep 17 00:00:00 2001 From: Lezune Date: Thu, 30 May 2024 07:19:03 -0700 Subject: [PATCH 089/283] Updated ChatCompletionClientValidationException class by removing constructors in which the error message was hard coded in. Updated all relevant service files to include message. --- .../Clients/ChatCompletions/ChatCompletionsClient.cs | 2 ++ .../Exceptions/ChatCompletionClientValidationException.cs | 5 ----- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/Standard.AI.OpenAI/Clients/ChatCompletions/ChatCompletionsClient.cs b/Standard.AI.OpenAI/Clients/ChatCompletions/ChatCompletionsClient.cs index 492c0777..7b143054 100644 --- a/Standard.AI.OpenAI/Clients/ChatCompletions/ChatCompletionsClient.cs +++ b/Standard.AI.OpenAI/Clients/ChatCompletions/ChatCompletionsClient.cs @@ -27,11 +27,13 @@ public async ValueTask SendChatCompletionAsync(ChatCompletion ch catch (ChatCompletionValidationException completionValidationException) { throw new ChatCompletionClientValidationException( + message: "Chat completion client validation error occurred, fix errors and try again.", completionValidationException.InnerException as Xeption); } catch (ChatCompletionDependencyValidationException completionDependencyValidationException) { throw new ChatCompletionClientValidationException( + message: "Chat completion client validation error occurred, fix errors and try again.", completionDependencyValidationException.InnerException as Xeption); } catch (ChatCompletionDependencyException completionDependencyException) diff --git a/Standard.AI.OpenAI/Models/Clients/ChatCompletions/Exceptions/ChatCompletionClientValidationException.cs b/Standard.AI.OpenAI/Models/Clients/ChatCompletions/Exceptions/ChatCompletionClientValidationException.cs index 3d611b91..8ed43f03 100644 --- a/Standard.AI.OpenAI/Models/Clients/ChatCompletions/Exceptions/ChatCompletionClientValidationException.cs +++ b/Standard.AI.OpenAI/Models/Clients/ChatCompletions/Exceptions/ChatCompletionClientValidationException.cs @@ -12,11 +12,6 @@ public class ChatCompletionClientValidationException : Xeption /// This exception is thrown when a validation error occurs while using the Chat completion client. /// For example, if required data is missing or invalid. /// - public ChatCompletionClientValidationException(Xeption innerException) - : base( - message: "Chat completion client validation error occurred, fix errors and try again.", - innerException: innerException) - { } public ChatCompletionClientValidationException(string message, Xeption innerException) : base(message, innerException ) From cd4c95834f01c05d30cd5a308130d6a7279dbadc Mon Sep 17 00:00:00 2001 From: Lezune Date: Thu, 30 May 2024 07:23:13 -0700 Subject: [PATCH 090/283] Updated CompletionClientDependencyException class by removing constructors in which the error message was hard coded in. Updated all relevant service files to include message. --- Standard.AI.OpenAI/Clients/Completions/CompletionsClient.cs | 1 + .../Exceptions/CompletionClientDependencyException.cs | 6 ------ 2 files changed, 1 insertion(+), 6 deletions(-) diff --git a/Standard.AI.OpenAI/Clients/Completions/CompletionsClient.cs b/Standard.AI.OpenAI/Clients/Completions/CompletionsClient.cs index 32f44593..71ac2a16 100644 --- a/Standard.AI.OpenAI/Clients/Completions/CompletionsClient.cs +++ b/Standard.AI.OpenAI/Clients/Completions/CompletionsClient.cs @@ -37,6 +37,7 @@ public async ValueTask PromptCompletionAsync(Completion completion) catch (CompletionDependencyException completionDependencyException) { throw new CompletionClientDependencyException( + message: "Completion dependency error occurred, contact support.", completionDependencyException.InnerException as Xeption); } catch (CompletionServiceException completionServiceException) diff --git a/Standard.AI.OpenAI/Models/Clients/Completions/Exceptions/CompletionClientDependencyException.cs b/Standard.AI.OpenAI/Models/Clients/Completions/Exceptions/CompletionClientDependencyException.cs index f4cf26ee..23389539 100644 --- a/Standard.AI.OpenAI/Models/Clients/Completions/Exceptions/CompletionClientDependencyException.cs +++ b/Standard.AI.OpenAI/Models/Clients/Completions/Exceptions/CompletionClientDependencyException.cs @@ -12,12 +12,6 @@ namespace Standard.AI.OpenAI.Models.Clients.Completions.Exceptions /// public class CompletionClientDependencyException : Xeption { - public CompletionClientDependencyException(Xeption innerException) - : base( - message: "Completion dependency error occurred, contact support.", - innerException: innerException) - { } - public CompletionClientDependencyException(string message, Xeption innerException) : base(message, innerException) { } From 23a26ced2f60c2b01d15cffc7c7cf2456cc7c963 Mon Sep 17 00:00:00 2001 From: Lezune Date: Thu, 30 May 2024 07:28:53 -0700 Subject: [PATCH 091/283] Updated CompletionClientServiceException class by removing constructors in which the error message was hard coded in. Updated all relevant service files to include message. --- Standard.AI.OpenAI/Clients/Completions/CompletionsClient.cs | 1 + .../Exceptions/CompletionClientServiceException.cs | 6 ------ 2 files changed, 1 insertion(+), 6 deletions(-) diff --git a/Standard.AI.OpenAI/Clients/Completions/CompletionsClient.cs b/Standard.AI.OpenAI/Clients/Completions/CompletionsClient.cs index 32f44593..9609d90e 100644 --- a/Standard.AI.OpenAI/Clients/Completions/CompletionsClient.cs +++ b/Standard.AI.OpenAI/Clients/Completions/CompletionsClient.cs @@ -42,6 +42,7 @@ public async ValueTask PromptCompletionAsync(Completion completion) catch (CompletionServiceException completionServiceException) { throw new CompletionClientServiceException( + message: "Completion client service error occurred, contact support.", completionServiceException.InnerException as Xeption); } } diff --git a/Standard.AI.OpenAI/Models/Clients/Completions/Exceptions/CompletionClientServiceException.cs b/Standard.AI.OpenAI/Models/Clients/Completions/Exceptions/CompletionClientServiceException.cs index 318c4ed9..ac5e1b5b 100644 --- a/Standard.AI.OpenAI/Models/Clients/Completions/Exceptions/CompletionClientServiceException.cs +++ b/Standard.AI.OpenAI/Models/Clients/Completions/Exceptions/CompletionClientServiceException.cs @@ -12,12 +12,6 @@ namespace Standard.AI.OpenAI.Models.Clients.Completions.Exceptions /// public class CompletionClientServiceException : Xeption { - public CompletionClientServiceException(Xeption innerException) - : base( - message: "Completion client service error occurred, contact support.", - innerException: innerException) - { } - public CompletionClientServiceException(string message, Xeption innerException) : base(message: message, innerException) { } From 7bfe2de4ec92b6ea0c0a52e97e8bdfb03bdb1dcc Mon Sep 17 00:00:00 2001 From: Lezune Date: Thu, 30 May 2024 07:33:27 -0700 Subject: [PATCH 092/283] Updated CompletionClientValidationException class by removing constructors in which the error message was hard coded in. Updated all relevant service files to include message. --- Standard.AI.OpenAI/Clients/Completions/CompletionsClient.cs | 2 ++ .../Exceptions/CompletionClientValidationException.cs | 6 ------ 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/Standard.AI.OpenAI/Clients/Completions/CompletionsClient.cs b/Standard.AI.OpenAI/Clients/Completions/CompletionsClient.cs index 32f44593..fb94b079 100644 --- a/Standard.AI.OpenAI/Clients/Completions/CompletionsClient.cs +++ b/Standard.AI.OpenAI/Clients/Completions/CompletionsClient.cs @@ -27,11 +27,13 @@ public async ValueTask PromptCompletionAsync(Completion completion) catch (CompletionValidationException completionValidationException) { throw new CompletionClientValidationException( + message: "Completion client validation error occurred, fix errors and try again.", completionValidationException.InnerException as Xeption); } catch (CompletionDependencyValidationException completionDependencyValidationException) { throw new CompletionClientValidationException( + message: "Completion client validation error occurred, fix errors and try again.", completionDependencyValidationException.InnerException as Xeption); } catch (CompletionDependencyException completionDependencyException) diff --git a/Standard.AI.OpenAI/Models/Clients/Completions/Exceptions/CompletionClientValidationException.cs b/Standard.AI.OpenAI/Models/Clients/Completions/Exceptions/CompletionClientValidationException.cs index 27720586..ecedb326 100644 --- a/Standard.AI.OpenAI/Models/Clients/Completions/Exceptions/CompletionClientValidationException.cs +++ b/Standard.AI.OpenAI/Models/Clients/Completions/Exceptions/CompletionClientValidationException.cs @@ -12,12 +12,6 @@ namespace Standard.AI.OpenAI.Models.Clients.Completions.Exceptions /// public class CompletionClientValidationException : Xeption { - public CompletionClientValidationException(Xeption innerException) - : base( - message: "Completion client validation error occurred, fix errors and try again.", - innerException: innerException) - { } - public CompletionClientValidationException(string message, Xeption innerException) : base(message, innerException) { } From eaebaf49513cacdb1397237d24b9ec065ba49cb6 Mon Sep 17 00:00:00 2001 From: Lezune Date: Thu, 30 May 2024 07:39:53 -0700 Subject: [PATCH 093/283] Updated FineTuneClientDependencyException class by removing constructors in which the error message was hard coded in. Updated all relevant service files to include message. --- Standard.AI.OpenAI/Clients/FineTunes/FineTuneClient.cs | 1 + .../Exceptions/FineTuneClientDependencyException.cs | 6 ------ 2 files changed, 1 insertion(+), 6 deletions(-) diff --git a/Standard.AI.OpenAI/Clients/FineTunes/FineTuneClient.cs b/Standard.AI.OpenAI/Clients/FineTunes/FineTuneClient.cs index c09d0e45..4c288fba 100644 --- a/Standard.AI.OpenAI/Clients/FineTunes/FineTuneClient.cs +++ b/Standard.AI.OpenAI/Clients/FineTunes/FineTuneClient.cs @@ -32,6 +32,7 @@ public async ValueTask SubmitFineTuneAsync(FineTune fineTune) catch (FineTuneDependencyException fineTuneDependencyException) { throw new FineTuneClientDependencyException( + message: "Fine tune client dependency error occurred, contact support.", fineTuneDependencyException.InnerException as Xeption); } catch (FineTuneDependencyValidationException fineTuneDependencyValidationException) diff --git a/Standard.AI.OpenAI/Models/Clients/FineTunes/Exceptions/FineTuneClientDependencyException.cs b/Standard.AI.OpenAI/Models/Clients/FineTunes/Exceptions/FineTuneClientDependencyException.cs index ea002594..98612a16 100644 --- a/Standard.AI.OpenAI/Models/Clients/FineTunes/Exceptions/FineTuneClientDependencyException.cs +++ b/Standard.AI.OpenAI/Models/Clients/FineTunes/Exceptions/FineTuneClientDependencyException.cs @@ -12,12 +12,6 @@ namespace Standard.AI.OpenAI.Models.Clients.FineTunes.Exceptions /// public class FineTuneClientDependencyException : Xeption { - public FineTuneClientDependencyException(Xeption innerException) - : base( - message: "Fine tune client dependency error occurred, contact support.", - innerException: innerException) - { } - public FineTuneClientDependencyException(string message, Xeption innerException) : base(message, innerException) { } From 328f3fa3f94613da9bb710e41db4f7b77ae7f21a Mon Sep 17 00:00:00 2001 From: Lezune Date: Thu, 30 May 2024 07:43:34 -0700 Subject: [PATCH 094/283] Updated FineTuneClientServiceException class by removing constructors in which the error message was hard coded in. Updated all relevant service files to include message. --- Standard.AI.OpenAI/Clients/FineTunes/FineTuneClient.cs | 1 + .../FineTunes/Exceptions/FineTuneClientServiceException.cs | 6 ------ 2 files changed, 1 insertion(+), 6 deletions(-) diff --git a/Standard.AI.OpenAI/Clients/FineTunes/FineTuneClient.cs b/Standard.AI.OpenAI/Clients/FineTunes/FineTuneClient.cs index c09d0e45..a2d0100e 100644 --- a/Standard.AI.OpenAI/Clients/FineTunes/FineTuneClient.cs +++ b/Standard.AI.OpenAI/Clients/FineTunes/FineTuneClient.cs @@ -42,6 +42,7 @@ public async ValueTask SubmitFineTuneAsync(FineTune fineTune) catch (FineTuneServiceException fineTuneServiceException) { throw new FineTuneClientServiceException( + message: "Fine tune client service error occurred, contact support.", fineTuneServiceException.InnerException as Xeption); } } diff --git a/Standard.AI.OpenAI/Models/Clients/FineTunes/Exceptions/FineTuneClientServiceException.cs b/Standard.AI.OpenAI/Models/Clients/FineTunes/Exceptions/FineTuneClientServiceException.cs index 72cad351..12e514f6 100644 --- a/Standard.AI.OpenAI/Models/Clients/FineTunes/Exceptions/FineTuneClientServiceException.cs +++ b/Standard.AI.OpenAI/Models/Clients/FineTunes/Exceptions/FineTuneClientServiceException.cs @@ -12,12 +12,6 @@ namespace Standard.AI.OpenAI.Models.Clients.FineTunes.Exceptions /// public class FineTuneClientServiceException : Xeption { - public FineTuneClientServiceException(Xeption innerException) - : base( - message: "Fine tune client service error occurred, contact support.", - innerException: innerException) - { } - public FineTuneClientServiceException(string message, Xeption innerException) : base(message, innerException) { } From 2cacf54972121904508ad23558bc11d385cc3b47 Mon Sep 17 00:00:00 2001 From: Lezune Date: Thu, 30 May 2024 07:48:52 -0700 Subject: [PATCH 095/283] Updated FineTuneClientValidationException class by removing constructors in which the error message was hard coded in. Updated all relevant service files to include message. --- Standard.AI.OpenAI/Clients/FineTunes/FineTuneClient.cs | 2 ++ .../Exceptions/FineTuneClientValidationException.cs | 5 ----- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/Standard.AI.OpenAI/Clients/FineTunes/FineTuneClient.cs b/Standard.AI.OpenAI/Clients/FineTunes/FineTuneClient.cs index c09d0e45..01716cfe 100644 --- a/Standard.AI.OpenAI/Clients/FineTunes/FineTuneClient.cs +++ b/Standard.AI.OpenAI/Clients/FineTunes/FineTuneClient.cs @@ -27,6 +27,7 @@ public async ValueTask SubmitFineTuneAsync(FineTune fineTune) catch (FineTuneValidationException fineTuneValidationException) { throw new FineTuneClientValidationException( + message: "Fine tune client validation error occurred, fix errors and try again.", fineTuneValidationException.InnerException as Xeption); } catch (FineTuneDependencyException fineTuneDependencyException) @@ -37,6 +38,7 @@ public async ValueTask SubmitFineTuneAsync(FineTune fineTune) catch (FineTuneDependencyValidationException fineTuneDependencyValidationException) { throw new FineTuneClientValidationException( + message: "Fine tune client validation error occurred, fix errors and try again.", fineTuneDependencyValidationException.InnerException as Xeption); } catch (FineTuneServiceException fineTuneServiceException) diff --git a/Standard.AI.OpenAI/Models/Clients/FineTunes/Exceptions/FineTuneClientValidationException.cs b/Standard.AI.OpenAI/Models/Clients/FineTunes/Exceptions/FineTuneClientValidationException.cs index 2dd56840..060770ff 100644 --- a/Standard.AI.OpenAI/Models/Clients/FineTunes/Exceptions/FineTuneClientValidationException.cs +++ b/Standard.AI.OpenAI/Models/Clients/FineTunes/Exceptions/FineTuneClientValidationException.cs @@ -12,11 +12,6 @@ namespace Standard.AI.OpenAI.Models.Clients.FineTunes.Exceptions /// public class FineTuneClientValidationException : Xeption { - public FineTuneClientValidationException(Xeption innerException) - : base(message: "Fine tune client validation error occurred, fix errors and try again.", - innerException) - { } - public FineTuneClientValidationException(string message, Xeption innerException) : base(message, innerException) { } From c7ec1925f84df376c4d096ec6890e0237f25f3b1 Mon Sep 17 00:00:00 2001 From: Lezune Date: Thu, 30 May 2024 07:54:17 -0700 Subject: [PATCH 096/283] Updated ImageGenerationClientDependencyException class by removing constructors in which the error message was hard coded in. Updated all relevant service files to include message. --- .../Clients/ImageGenerations/ImageGenerationsClient.cs | 1 + .../Exceptions/ImageGenerationClientDependencyException.cs | 6 ------ 2 files changed, 1 insertion(+), 6 deletions(-) diff --git a/Standard.AI.OpenAI/Clients/ImageGenerations/ImageGenerationsClient.cs b/Standard.AI.OpenAI/Clients/ImageGenerations/ImageGenerationsClient.cs index e19568a4..11d4e54f 100644 --- a/Standard.AI.OpenAI/Clients/ImageGenerations/ImageGenerationsClient.cs +++ b/Standard.AI.OpenAI/Clients/ImageGenerations/ImageGenerationsClient.cs @@ -37,6 +37,7 @@ public async ValueTask GenerateImageAsync(ImageGeneration image catch (ImageGenerationDependencyException imageGenerationDependencyException) { throw new ImageGenerationClientDependencyException( + message: "Image generation client dependency error occurred, contact support.", imageGenerationDependencyException.InnerException as Xeption); } catch (ImageGenerationServiceException imageGenerationServiceException) diff --git a/Standard.AI.OpenAI/Models/Clients/ImageGenerations/Exceptions/ImageGenerationClientDependencyException.cs b/Standard.AI.OpenAI/Models/Clients/ImageGenerations/Exceptions/ImageGenerationClientDependencyException.cs index 52797579..70d19142 100644 --- a/Standard.AI.OpenAI/Models/Clients/ImageGenerations/Exceptions/ImageGenerationClientDependencyException.cs +++ b/Standard.AI.OpenAI/Models/Clients/ImageGenerations/Exceptions/ImageGenerationClientDependencyException.cs @@ -12,12 +12,6 @@ namespace Standard.AI.OpenAI.Models.Clients.ImageGenerations.Exceptions /// public class ImageGenerationClientDependencyException : Xeption { - public ImageGenerationClientDependencyException(Xeption innerException) - : base( - message: "Image generation client dependency error occurred, contact support.", - innerException: innerException) - { } - public ImageGenerationClientDependencyException(string message, Xeption innerException) : base(message, innerException) { } From 4615db0d29a578f2ec05aa0c36d636f86b5e14b9 Mon Sep 17 00:00:00 2001 From: Lezune Date: Thu, 30 May 2024 07:59:38 -0700 Subject: [PATCH 097/283] Updated ImageGenerationClientServiceException class by removing constructors in which the error message was hard coded in. Updated all relevant service files to include message. --- .../Clients/ImageGenerations/ImageGenerationsClient.cs | 1 + .../Exceptions/ImageGenerationClientServiceException.cs | 6 ------ 2 files changed, 1 insertion(+), 6 deletions(-) diff --git a/Standard.AI.OpenAI/Clients/ImageGenerations/ImageGenerationsClient.cs b/Standard.AI.OpenAI/Clients/ImageGenerations/ImageGenerationsClient.cs index e19568a4..0a708d26 100644 --- a/Standard.AI.OpenAI/Clients/ImageGenerations/ImageGenerationsClient.cs +++ b/Standard.AI.OpenAI/Clients/ImageGenerations/ImageGenerationsClient.cs @@ -42,6 +42,7 @@ public async ValueTask GenerateImageAsync(ImageGeneration image catch (ImageGenerationServiceException imageGenerationServiceException) { throw new ImageGenerationClientServiceException( + message: "Image generation client service error occurred, contact support.", imageGenerationServiceException.InnerException as Xeption); } } diff --git a/Standard.AI.OpenAI/Models/Clients/ImageGenerations/Exceptions/ImageGenerationClientServiceException.cs b/Standard.AI.OpenAI/Models/Clients/ImageGenerations/Exceptions/ImageGenerationClientServiceException.cs index e0617b2c..31bdf557 100644 --- a/Standard.AI.OpenAI/Models/Clients/ImageGenerations/Exceptions/ImageGenerationClientServiceException.cs +++ b/Standard.AI.OpenAI/Models/Clients/ImageGenerations/Exceptions/ImageGenerationClientServiceException.cs @@ -12,12 +12,6 @@ namespace Standard.AI.OpenAI.Models.Clients.ImageGenerations.Exceptions /// public class ImageGenerationClientServiceException : Xeption { - public ImageGenerationClientServiceException(Xeption innerException) - : base( - message: "Image generation client service error occurred, contact support.", - innerException: innerException) - { } - public ImageGenerationClientServiceException(string message, Xeption innerException) : base(message, innerException) { } From 0b59cc36623ba911c2a7ada1fe7564f395bec050 Mon Sep 17 00:00:00 2001 From: Lezune Date: Thu, 30 May 2024 08:02:40 -0700 Subject: [PATCH 098/283] Updated ImageGenerationClientValidationException class by removing constructors in which the error message was hard coded in. Updated all relevant service files to include message. --- .../Clients/ImageGenerations/ImageGenerationsClient.cs | 2 ++ .../Exceptions/ImageGenerationClientValidationException.cs | 6 ------ 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/Standard.AI.OpenAI/Clients/ImageGenerations/ImageGenerationsClient.cs b/Standard.AI.OpenAI/Clients/ImageGenerations/ImageGenerationsClient.cs index e19568a4..2b5c54ae 100644 --- a/Standard.AI.OpenAI/Clients/ImageGenerations/ImageGenerationsClient.cs +++ b/Standard.AI.OpenAI/Clients/ImageGenerations/ImageGenerationsClient.cs @@ -27,11 +27,13 @@ public async ValueTask GenerateImageAsync(ImageGeneration image catch (ImageGenerationValidationException imageGenerationValidationException) { throw new ImageGenerationClientValidationException( + message: "Image generation client validation error occurred, fix errors and try again.", imageGenerationValidationException.InnerException as Xeption); } catch (ImageGenerationDependencyValidationException imageGenerationDependencyValidationException) { throw new ImageGenerationClientValidationException( + message: "Image generation client validation error occurred, fix errors and try again.", imageGenerationDependencyValidationException.InnerException as Xeption); } catch (ImageGenerationDependencyException imageGenerationDependencyException) diff --git a/Standard.AI.OpenAI/Models/Clients/ImageGenerations/Exceptions/ImageGenerationClientValidationException.cs b/Standard.AI.OpenAI/Models/Clients/ImageGenerations/Exceptions/ImageGenerationClientValidationException.cs index 92eced4d..7e7efa54 100644 --- a/Standard.AI.OpenAI/Models/Clients/ImageGenerations/Exceptions/ImageGenerationClientValidationException.cs +++ b/Standard.AI.OpenAI/Models/Clients/ImageGenerations/Exceptions/ImageGenerationClientValidationException.cs @@ -12,12 +12,6 @@ namespace Standard.AI.OpenAI.Models.Clients.ImageGenerations.Exceptions /// public class ImageGenerationClientValidationException : Xeption { - public ImageGenerationClientValidationException(Xeption innerException) - : base( - message: "Image generation client validation error occurred, fix errors and try again.", - innerException: innerException) - { } - public ImageGenerationClientValidationException(string message, Xeption innerException) : base(message, innerException) { } From 15e1cdaa78b5ac5db281fa1197bb770aad69df61 Mon Sep 17 00:00:00 2001 From: Lezune Date: Thu, 30 May 2024 19:29:33 -0700 Subject: [PATCH 099/283] Updated Service file with createAIModelDependencyException and refactored code --- .../AIModels/AIModelService.Exceptions.cs | 24 +++++++------------ .../Foundations/AIModels/AIModelService.cs | 11 +++++++++ 2 files changed, 19 insertions(+), 16 deletions(-) diff --git a/Standard.AI.OpenAI/Services/Foundations/AIModels/AIModelService.Exceptions.cs b/Standard.AI.OpenAI/Services/Foundations/AIModels/AIModelService.Exceptions.cs index f3a933bd..3495b042 100644 --- a/Standard.AI.OpenAI/Services/Foundations/AIModels/AIModelService.Exceptions.cs +++ b/Standard.AI.OpenAI/Services/Foundations/AIModels/AIModelService.Exceptions.cs @@ -31,8 +31,7 @@ private async ValueTask TryCatch(ReturningAIModelFunction returningAIMo var invalidConfigurationAIModelException = new InvalidConfigurationAIModelException(httpResponseUrlNotFoundException); - throw new AIModelDependencyException( - message: "AI Model dependency error occurred, contact support.", + throw createAIModelDependencyException( invalidConfigurationAIModelException); } catch (HttpResponseUnauthorizedException httpResponseUnauthorizedException) @@ -40,8 +39,7 @@ private async ValueTask TryCatch(ReturningAIModelFunction returningAIMo var unauthorizedAIModelException = new UnauthorizedAIModelException(httpResponseUnauthorizedException); - throw new AIModelDependencyException( - message: "AI Model dependency error occurred, contact support.", + throw createAIModelDependencyException( unauthorizedAIModelException); } catch (HttpResponseForbiddenException httpResponseForbiddenException) @@ -49,8 +47,7 @@ private async ValueTask TryCatch(ReturningAIModelFunction returningAIMo var unauthorizedAIModelException = new UnauthorizedAIModelException(httpResponseForbiddenException); - throw new AIModelDependencyException( - message: "AI Model dependency error occurred, contact support.", + throw createAIModelDependencyException( unauthorizedAIModelException); } catch (HttpResponseNotFoundException httpResponseNotFoundException) @@ -79,8 +76,7 @@ private async ValueTask TryCatch(ReturningAIModelFunction returningAIMo var failedServerAIModelException = new FailedServerAIModelException(httpResponseException); - throw new AIModelDependencyException( - message: "AI Model dependency error occurred, contact support.", + throw createAIModelDependencyException( failedServerAIModelException); } catch (Exception exception) @@ -104,8 +100,7 @@ private async ValueTask> TryCatch(ReturningAIModelsFunction var invalidConfigurationAIModelException = new InvalidConfigurationAIModelException(httpResponseUrlNotFoundException); - throw new AIModelDependencyException( - message: "AI Model dependency error occurred, contact support.", + throw createAIModelDependencyException( invalidConfigurationAIModelException); } catch (HttpResponseUnauthorizedException httpResponseUnauthorizedException) @@ -113,8 +108,7 @@ private async ValueTask> TryCatch(ReturningAIModelsFunction var unauthorizedAIModelException = new UnauthorizedAIModelException(httpResponseUnauthorizedException); - throw new AIModelDependencyException( - message: "AI Model dependency error occurred, contact support.", + throw createAIModelDependencyException( unauthorizedAIModelException); } catch (HttpResponseForbiddenException httpResponseForbiddenException) @@ -122,8 +116,7 @@ private async ValueTask> TryCatch(ReturningAIModelsFunction var unauthorizedAIModelException = new UnauthorizedAIModelException(httpResponseForbiddenException); - throw new AIModelDependencyException( - message: "AI Model dependency error occurred, contact support.", + throw createAIModelDependencyException( unauthorizedAIModelException); } catch (HttpResponseTooManyRequestsException httpResponseTooManyRequestsException) @@ -138,8 +131,7 @@ private async ValueTask> TryCatch(ReturningAIModelsFunction var failedServerAIModelException = new FailedServerAIModelException(httpResponseException); - throw new AIModelDependencyException( - message: "AI Model dependency error occurred, contact support.", + throw createAIModelDependencyException( failedServerAIModelException); } catch (Exception exception) diff --git a/Standard.AI.OpenAI/Services/Foundations/AIModels/AIModelService.cs b/Standard.AI.OpenAI/Services/Foundations/AIModels/AIModelService.cs index a882c467..35817ae6 100644 --- a/Standard.AI.OpenAI/Services/Foundations/AIModels/AIModelService.cs +++ b/Standard.AI.OpenAI/Services/Foundations/AIModels/AIModelService.cs @@ -8,7 +8,9 @@ using Standard.AI.OpenAI.Brokers.DateTimes; using Standard.AI.OpenAI.Brokers.OpenAIs; using Standard.AI.OpenAI.Models.Services.Foundations.AIModels; +using Standard.AI.OpenAI.Models.Services.Foundations.AIModels.Exceptions; using Standard.AI.OpenAI.Models.Services.Foundations.ExternalAIModels; +using Xeptions; namespace Standard.AI.OpenAI.Services.Foundations.AIModels { @@ -76,5 +78,14 @@ private AIModelPermission ConvertToAIModelPermission(ExternalAIModelPermission e IsBlocking = externalAIModelPermission.IsBlocking }; } + + private static AIModelDependencyException createAIModelDependencyException(Xeption innerException) + { + return new AIModelDependencyException( + message: "AI Model dependency error occurred, contact support.", + innerException); + + } + } } \ No newline at end of file From bd23c8ade507073d6d9f26cd3437ac034f68eab7 Mon Sep 17 00:00:00 2001 From: Lezune Date: Thu, 30 May 2024 19:31:27 -0700 Subject: [PATCH 100/283] Removed spacing --- .../Services/Foundations/AIModels/AIModelService.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Standard.AI.OpenAI/Services/Foundations/AIModels/AIModelService.cs b/Standard.AI.OpenAI/Services/Foundations/AIModels/AIModelService.cs index 35817ae6..55b7540b 100644 --- a/Standard.AI.OpenAI/Services/Foundations/AIModels/AIModelService.cs +++ b/Standard.AI.OpenAI/Services/Foundations/AIModels/AIModelService.cs @@ -84,8 +84,8 @@ private static AIModelDependencyException createAIModelDependencyException(Xepti return new AIModelDependencyException( message: "AI Model dependency error occurred, contact support.", innerException); - } + } } \ No newline at end of file From 6d5673283aec5b4caa56f8b0c964c8ef54f92beb Mon Sep 17 00:00:00 2001 From: Lezune Date: Thu, 30 May 2024 19:36:12 -0700 Subject: [PATCH 101/283] Added createAIModelDependencyValidationException method to service file and refactored code --- .../AIModels/AIModelService.Exceptions.cs | 12 ++++-------- .../Services/Foundations/AIModels/AIModelService.cs | 10 ++++++++++ 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/Standard.AI.OpenAI/Services/Foundations/AIModels/AIModelService.Exceptions.cs b/Standard.AI.OpenAI/Services/Foundations/AIModels/AIModelService.Exceptions.cs index f6940559..469004fc 100644 --- a/Standard.AI.OpenAI/Services/Foundations/AIModels/AIModelService.Exceptions.cs +++ b/Standard.AI.OpenAI/Services/Foundations/AIModels/AIModelService.Exceptions.cs @@ -52,8 +52,7 @@ private async ValueTask TryCatch(ReturningAIModelFunction returningAIMo var notFoundAIModelException = new NotFoundAIModelException(httpResponseNotFoundException); - throw new AIModelDependencyValidationException( - message: "AI Model dependency validation error occurred, fix errors and try again.", + throw createAIModelDependencyValidationException( notFoundAIModelException); } catch (HttpResponseBadRequestException httpResponseBadRequestException) @@ -61,8 +60,7 @@ private async ValueTask TryCatch(ReturningAIModelFunction returningAIMo var invalidAIModelException = new InvalidAIModelException(httpResponseBadRequestException); - throw new AIModelDependencyValidationException( - message: "AI Model dependency validation error occurred, fix errors and try again.", + throw createAIModelDependencyValidationException( invalidAIModelException); } catch (HttpResponseTooManyRequestsException httpResponseTooManyRequestsException) @@ -70,8 +68,7 @@ private async ValueTask TryCatch(ReturningAIModelFunction returningAIMo var excessiveCallAIModelException = new ExcessiveCallAIModelException(httpResponseTooManyRequestsException); - throw new AIModelDependencyValidationException( - message: "AI Model dependency validation error occurred, fix errors and try again.", + throw createAIModelDependencyValidationException( excessiveCallAIModelException); } catch (HttpResponseException httpResponseException) @@ -123,8 +120,7 @@ private async ValueTask> TryCatch(ReturningAIModelsFunction var excessiveCallAIModelException = new ExcessiveCallAIModelException(httpResponseTooManyRequestsException); - throw new AIModelDependencyValidationException( - message: "AI Model dependency validation error occurred, fix errors and try again.", + throw createAIModelDependencyValidationException( excessiveCallAIModelException); } catch (HttpResponseException httpResponseException) diff --git a/Standard.AI.OpenAI/Services/Foundations/AIModels/AIModelService.cs b/Standard.AI.OpenAI/Services/Foundations/AIModels/AIModelService.cs index a882c467..a532188e 100644 --- a/Standard.AI.OpenAI/Services/Foundations/AIModels/AIModelService.cs +++ b/Standard.AI.OpenAI/Services/Foundations/AIModels/AIModelService.cs @@ -8,7 +8,9 @@ using Standard.AI.OpenAI.Brokers.DateTimes; using Standard.AI.OpenAI.Brokers.OpenAIs; using Standard.AI.OpenAI.Models.Services.Foundations.AIModels; +using Standard.AI.OpenAI.Models.Services.Foundations.AIModels.Exceptions; using Standard.AI.OpenAI.Models.Services.Foundations.ExternalAIModels; +using Xeptions; namespace Standard.AI.OpenAI.Services.Foundations.AIModels { @@ -76,5 +78,13 @@ private AIModelPermission ConvertToAIModelPermission(ExternalAIModelPermission e IsBlocking = externalAIModelPermission.IsBlocking }; } + + private static AIModelDependencyValidationException createAIModelDependencyValidationException(Xeption innerException) + { + return new AIModelDependencyValidationException( + message: "AI Model dependency validation error occurred, fix errors and try again.", + innerException); + } + } } \ No newline at end of file From bf66bfac0bdcc0cc7f9c35c9019f9fe79c547d3d Mon Sep 17 00:00:00 2001 From: Lezune Date: Thu, 30 May 2024 19:44:26 -0700 Subject: [PATCH 102/283] Added createAIModelServiceException to the service file and refactored code --- .../Foundations/AIModels/AIModelService.Exceptions.cs | 6 ++---- .../Services/Foundations/AIModels/AIModelService.cs | 9 +++++++++ 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/Standard.AI.OpenAI/Services/Foundations/AIModels/AIModelService.Exceptions.cs b/Standard.AI.OpenAI/Services/Foundations/AIModels/AIModelService.Exceptions.cs index e659d6e7..b2180479 100644 --- a/Standard.AI.OpenAI/Services/Foundations/AIModels/AIModelService.Exceptions.cs +++ b/Standard.AI.OpenAI/Services/Foundations/AIModels/AIModelService.Exceptions.cs @@ -80,8 +80,7 @@ private async ValueTask TryCatch(ReturningAIModelFunction returningAIMo var failedAIModelServiceException = new FailedAIModelServiceException(exception); - throw new AIModelServiceException( - message: "AI Model service error occurred, contact support.", + throw createAIModelServiceException( failedAIModelServiceException); } } @@ -132,8 +131,7 @@ private async ValueTask> TryCatch(ReturningAIModelsFunction var failedAIModelServiceException = new FailedAIModelServiceException(exception); - throw new AIModelServiceException( - message: "AI Model service error occurred, contact support.", + throw createAIModelServiceException( failedAIModelServiceException); } } diff --git a/Standard.AI.OpenAI/Services/Foundations/AIModels/AIModelService.cs b/Standard.AI.OpenAI/Services/Foundations/AIModels/AIModelService.cs index a882c467..61c90835 100644 --- a/Standard.AI.OpenAI/Services/Foundations/AIModels/AIModelService.cs +++ b/Standard.AI.OpenAI/Services/Foundations/AIModels/AIModelService.cs @@ -8,7 +8,9 @@ using Standard.AI.OpenAI.Brokers.DateTimes; using Standard.AI.OpenAI.Brokers.OpenAIs; using Standard.AI.OpenAI.Models.Services.Foundations.AIModels; +using Standard.AI.OpenAI.Models.Services.Foundations.AIModels.Exceptions; using Standard.AI.OpenAI.Models.Services.Foundations.ExternalAIModels; +using Xeptions; namespace Standard.AI.OpenAI.Services.Foundations.AIModels { @@ -76,5 +78,12 @@ private AIModelPermission ConvertToAIModelPermission(ExternalAIModelPermission e IsBlocking = externalAIModelPermission.IsBlocking }; } + + private static AIModelServiceException createAIModelServiceException(Xeption innerException) + { + return new AIModelServiceException( + message: "AI Model service error occurred, contact support.", + innerException); + } } } \ No newline at end of file From dfcd9b88853be4e869af2687dbc33983ed136d2c Mon Sep 17 00:00:00 2001 From: Lezune Date: Thu, 30 May 2024 20:25:51 -0700 Subject: [PATCH 103/283] moved createAIModelDependencyException method to AIModelService.Exceptions --- .../Foundations/AIFiles/AIFileService.Exceptions.cs | 1 + .../Foundations/AIModels/AIModelService.Exceptions.cs | 8 ++++++++ .../Services/Foundations/AIModels/AIModelService.cs | 9 --------- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/Standard.AI.OpenAI/Services/Foundations/AIFiles/AIFileService.Exceptions.cs b/Standard.AI.OpenAI/Services/Foundations/AIFiles/AIFileService.Exceptions.cs index 3c901b0c..4b8bf222 100644 --- a/Standard.AI.OpenAI/Services/Foundations/AIFiles/AIFileService.Exceptions.cs +++ b/Standard.AI.OpenAI/Services/Foundations/AIFiles/AIFileService.Exceptions.cs @@ -137,5 +137,6 @@ private async ValueTask> TryCatch(ReturningAIFilesFu throw new AIFileServiceException(failedAIFileServiceException); } } + } } \ No newline at end of file diff --git a/Standard.AI.OpenAI/Services/Foundations/AIModels/AIModelService.Exceptions.cs b/Standard.AI.OpenAI/Services/Foundations/AIModels/AIModelService.Exceptions.cs index 3495b042..88e84543 100644 --- a/Standard.AI.OpenAI/Services/Foundations/AIModels/AIModelService.Exceptions.cs +++ b/Standard.AI.OpenAI/Services/Foundations/AIModels/AIModelService.Exceptions.cs @@ -8,6 +8,7 @@ using RESTFulSense.Exceptions; using Standard.AI.OpenAI.Models.Services.Foundations.AIModels; using Standard.AI.OpenAI.Models.Services.Foundations.AIModels.Exceptions; +using Xeptions; namespace Standard.AI.OpenAI.Services.Foundations.AIModels { @@ -143,5 +144,12 @@ private async ValueTask> TryCatch(ReturningAIModelsFunction failedAIModelServiceException); } } + + private static AIModelDependencyException createAIModelDependencyException(Xeption innerException) + { + return new AIModelDependencyException( + message: "AI Model dependency error occurred, contact support.", + innerException); + } } } \ No newline at end of file diff --git a/Standard.AI.OpenAI/Services/Foundations/AIModels/AIModelService.cs b/Standard.AI.OpenAI/Services/Foundations/AIModels/AIModelService.cs index 55b7540b..919097ee 100644 --- a/Standard.AI.OpenAI/Services/Foundations/AIModels/AIModelService.cs +++ b/Standard.AI.OpenAI/Services/Foundations/AIModels/AIModelService.cs @@ -78,14 +78,5 @@ private AIModelPermission ConvertToAIModelPermission(ExternalAIModelPermission e IsBlocking = externalAIModelPermission.IsBlocking }; } - - private static AIModelDependencyException createAIModelDependencyException(Xeption innerException) - { - return new AIModelDependencyException( - message: "AI Model dependency error occurred, contact support.", - innerException); - } - - } } \ No newline at end of file From 406216755aedc3d1794832b6064bf4d059c3f1b2 Mon Sep 17 00:00:00 2001 From: Lezune Date: Thu, 30 May 2024 20:31:20 -0700 Subject: [PATCH 104/283] Moved create method to AIModelService.Exceptions --- .../Foundations/AIModels/AIModelService.Exceptions.cs | 9 +++++++++ .../Services/Foundations/AIModels/AIModelService.cs | 7 ------- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/Standard.AI.OpenAI/Services/Foundations/AIModels/AIModelService.Exceptions.cs b/Standard.AI.OpenAI/Services/Foundations/AIModels/AIModelService.Exceptions.cs index 469004fc..5a1f3b31 100644 --- a/Standard.AI.OpenAI/Services/Foundations/AIModels/AIModelService.Exceptions.cs +++ b/Standard.AI.OpenAI/Services/Foundations/AIModels/AIModelService.Exceptions.cs @@ -8,6 +8,7 @@ using RESTFulSense.Exceptions; using Standard.AI.OpenAI.Models.Services.Foundations.AIModels; using Standard.AI.OpenAI.Models.Services.Foundations.AIModels.Exceptions; +using Xeptions; namespace Standard.AI.OpenAI.Services.Foundations.AIModels { @@ -139,5 +140,13 @@ private async ValueTask> TryCatch(ReturningAIModelsFunction failedAIModelServiceException); } } + + private static AIModelDependencyValidationException createAIModelDependencyValidationException(Xeption innerException) + { + return new AIModelDependencyValidationException( + message: "AI Model dependency validation error occurred, fix errors and try again.", + innerException); + } + } } \ No newline at end of file diff --git a/Standard.AI.OpenAI/Services/Foundations/AIModels/AIModelService.cs b/Standard.AI.OpenAI/Services/Foundations/AIModels/AIModelService.cs index a532188e..ec2be396 100644 --- a/Standard.AI.OpenAI/Services/Foundations/AIModels/AIModelService.cs +++ b/Standard.AI.OpenAI/Services/Foundations/AIModels/AIModelService.cs @@ -79,12 +79,5 @@ private AIModelPermission ConvertToAIModelPermission(ExternalAIModelPermission e }; } - private static AIModelDependencyValidationException createAIModelDependencyValidationException(Xeption innerException) - { - return new AIModelDependencyValidationException( - message: "AI Model dependency validation error occurred, fix errors and try again.", - innerException); - } - } } \ No newline at end of file From 228710eed811cbe54f97350a435abd82100e1f88 Mon Sep 17 00:00:00 2001 From: Lezune Date: Thu, 30 May 2024 20:41:24 -0700 Subject: [PATCH 105/283] Moved create method to AIModelService.Exceptions --- .../Foundations/AIModels/AIModelService.Exceptions.cs | 9 +++++++++ .../Services/Foundations/AIModels/AIModelService.cs | 6 ------ 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/Standard.AI.OpenAI/Services/Foundations/AIModels/AIModelService.Exceptions.cs b/Standard.AI.OpenAI/Services/Foundations/AIModels/AIModelService.Exceptions.cs index b2180479..26fce7c2 100644 --- a/Standard.AI.OpenAI/Services/Foundations/AIModels/AIModelService.Exceptions.cs +++ b/Standard.AI.OpenAI/Services/Foundations/AIModels/AIModelService.Exceptions.cs @@ -8,6 +8,7 @@ using RESTFulSense.Exceptions; using Standard.AI.OpenAI.Models.Services.Foundations.AIModels; using Standard.AI.OpenAI.Models.Services.Foundations.AIModels.Exceptions; +using Xeptions; namespace Standard.AI.OpenAI.Services.Foundations.AIModels { @@ -135,5 +136,13 @@ private async ValueTask> TryCatch(ReturningAIModelsFunction failedAIModelServiceException); } } + + private static AIModelServiceException createAIModelServiceException(Xeption innerException) + { + return new AIModelServiceException( + message: "AI Model service error occurred, contact support.", + innerException); + } + } } \ No newline at end of file diff --git a/Standard.AI.OpenAI/Services/Foundations/AIModels/AIModelService.cs b/Standard.AI.OpenAI/Services/Foundations/AIModels/AIModelService.cs index 61c90835..ec2be396 100644 --- a/Standard.AI.OpenAI/Services/Foundations/AIModels/AIModelService.cs +++ b/Standard.AI.OpenAI/Services/Foundations/AIModels/AIModelService.cs @@ -79,11 +79,5 @@ private AIModelPermission ConvertToAIModelPermission(ExternalAIModelPermission e }; } - private static AIModelServiceException createAIModelServiceException(Xeption innerException) - { - return new AIModelServiceException( - message: "AI Model service error occurred, contact support.", - innerException); - } } } \ No newline at end of file From e8f125b05cdf54f19d0cea06c220895d5d44a9b6 Mon Sep 17 00:00:00 2001 From: Lezune Date: Thu, 30 May 2024 20:51:17 -0700 Subject: [PATCH 106/283] Added a createExcessiveCallAIModelException method to AIModelsService.Exceptions --- .../AIModels/AIModelService.Exceptions.cs | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/Standard.AI.OpenAI/Services/Foundations/AIModels/AIModelService.Exceptions.cs b/Standard.AI.OpenAI/Services/Foundations/AIModels/AIModelService.Exceptions.cs index 9594aca3..18305519 100644 --- a/Standard.AI.OpenAI/Services/Foundations/AIModels/AIModelService.Exceptions.cs +++ b/Standard.AI.OpenAI/Services/Foundations/AIModels/AIModelService.Exceptions.cs @@ -64,8 +64,7 @@ private async ValueTask TryCatch(ReturningAIModelFunction returningAIMo catch (HttpResponseTooManyRequestsException httpResponseTooManyRequestsException) { var excessiveCallAIModelException = - new ExcessiveCallAIModelException( - message: "Excessive call error occurred, limit your calls.", + createExcessiveCallAIModelException( httpResponseTooManyRequestsException); throw new AIModelDependencyValidationException(excessiveCallAIModelException); @@ -117,8 +116,7 @@ private async ValueTask> TryCatch(ReturningAIModelsFunction catch (HttpResponseTooManyRequestsException httpResponseTooManyRequestsException) { var excessiveCallAIModelException = - new ExcessiveCallAIModelException( - message: "Excessive call error occurred, limit your calls.", + createExcessiveCallAIModelException( httpResponseTooManyRequestsException); throw new AIModelDependencyValidationException(excessiveCallAIModelException); @@ -139,5 +137,12 @@ private async ValueTask> TryCatch(ReturningAIModelsFunction failedAIModelServiceException); } } + + private static ExcessiveCallAIModelException createExcessiveCallAIModelException(Exception innerException) + { + return new ExcessiveCallAIModelException( + message: "Excessive call error occurred, limit your calls.", + innerException); + } } } \ No newline at end of file From 4f4f36af68507880cf803a5e95c0077019db7793 Mon Sep 17 00:00:00 2001 From: Lezune Date: Thu, 30 May 2024 21:17:37 -0700 Subject: [PATCH 107/283] Added a createExcessiveCallAIModelException method to Unit Test Class --- .../AIModelServiceTests.Exceptions.RetrieveAllModels.cs | 3 +-- .../AIModelServiceTests.Exceptions.RetrieveByName.cs | 9 +++++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/AIModels/AIModelServiceTests.Exceptions.RetrieveAllModels.cs b/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/AIModels/AIModelServiceTests.Exceptions.RetrieveAllModels.cs index 8ce8d21a..c74f8f93 100644 --- a/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/AIModels/AIModelServiceTests.Exceptions.RetrieveAllModels.cs +++ b/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/AIModels/AIModelServiceTests.Exceptions.RetrieveAllModels.cs @@ -106,8 +106,7 @@ private async Task ShouldThrowDependencyValidationExceptionOnRetrieveIfTooManyRe new HttpResponseTooManyRequestsException(); var excessiveCallAIModelException = - new ExcessiveCallAIModelException( - message: "Excessive call error occurred, limit your calls.", + createExcessiveCallAIModelException( innerException: httpResponseTooManyRequestsException); var expectedAIModelDependencyValidationException = diff --git a/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/AIModels/AIModelServiceTests.Exceptions.RetrieveByName.cs b/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/AIModels/AIModelServiceTests.Exceptions.RetrieveByName.cs index bcbd3414..2901f63d 100644 --- a/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/AIModels/AIModelServiceTests.Exceptions.RetrieveByName.cs +++ b/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/AIModels/AIModelServiceTests.Exceptions.RetrieveByName.cs @@ -200,8 +200,7 @@ private async Task ShouldThrowDependencyValidationExceptionOnRetrieveAIModelByNa new HttpResponseTooManyRequestsException(); var excessiveCallAIModelException = - new ExcessiveCallAIModelException( - message: "Excessive call error occurred, limit your calls.", + createExcessiveCallAIModelException( innerException: httpResponseTooManyRequestsException); var expectedAIModelDependencyValidationException = @@ -316,5 +315,11 @@ await Assert.ThrowsAsync( this.openAIBrokerMock.VerifyNoOtherCalls(); this.dateTimeBrokerMock.VerifyNoOtherCalls(); } + private static ExcessiveCallAIModelException createExcessiveCallAIModelException(Exception innerException) + { + return new ExcessiveCallAIModelException( + message: "Excessive call error occurred, limit your calls.", + innerException); + } } } \ No newline at end of file From 0733d087854259cb25b802a9939f6ee02dc05389 Mon Sep 17 00:00:00 2001 From: Lezune Date: Thu, 30 May 2024 23:31:32 -0700 Subject: [PATCH 108/283] Added create methods to the AIModelServiceTests.cs and refactored code --- .../AIModelServiceTests.Exceptions.RetrieveAllModels.cs | 9 +++------ .../AIModelServiceTests.Exceptions.RetrieveByName.cs | 9 +++------ .../Services/Foundations/AIModels/AIModelServiceTests.cs | 9 +++++++++ 3 files changed, 15 insertions(+), 12 deletions(-) diff --git a/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/AIModels/AIModelServiceTests.Exceptions.RetrieveAllModels.cs b/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/AIModels/AIModelServiceTests.Exceptions.RetrieveAllModels.cs index 8ce8d21a..bd908afe 100644 --- a/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/AIModels/AIModelServiceTests.Exceptions.RetrieveAllModels.cs +++ b/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/AIModels/AIModelServiceTests.Exceptions.RetrieveAllModels.cs @@ -29,8 +29,7 @@ private async Task ShouldThrowDependencyExceptionOnRetrieveIfUrlNotFoundAsync() innerException: httpResponseUrlNotFoundException); var expectedAIModelDependencyException = - new AIModelDependencyException( - message: "AI Model dependency error occurred, contact support.", + createAIModelDependencyException( innerException: invalidConfigurationAIModelException); this.openAIBrokerMock.Setup(broker => @@ -70,8 +69,7 @@ private async Task ShouldThrowDependencyExceptionOnRetrieveIfUnauthorizedAsync( innerException: unauthorizedException); var expectedAIModelDependencyException = - new AIModelDependencyException( - message: "AI Model dependency error occurred, contact support.", + createAIModelDependencyException( innerException: unauthorizedAIModelException); this.openAIBrokerMock.Setup(broker => @@ -152,8 +150,7 @@ private async Task ShouldThrowDependencyExceptionOnRetrieveIfServerErrorOccurred innerException: httpResponseException); var expectedAIModelDependencyException = - new AIModelDependencyException( - message: "AI Model dependency error occurred, contact support.", + createAIModelDependencyException( innerException: failedServerAIModelException); this.openAIBrokerMock.Setup(broker => diff --git a/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/AIModels/AIModelServiceTests.Exceptions.RetrieveByName.cs b/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/AIModels/AIModelServiceTests.Exceptions.RetrieveByName.cs index bcbd3414..fe9bde6d 100644 --- a/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/AIModels/AIModelServiceTests.Exceptions.RetrieveByName.cs +++ b/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/AIModels/AIModelServiceTests.Exceptions.RetrieveByName.cs @@ -30,8 +30,7 @@ private async Task ShouldThrowDependencyExceptionOnRetrieveAIModelByNameIfUrlNot innerException: httpResponseUrlNotFoundException); var expectedAIModelDependencyException = - new AIModelDependencyException( - message: "AI Model dependency error occurred, contact support.", + createAIModelDependencyException( innerException: invalidConfigurationAIModelException); this.openAIBrokerMock.Setup(broker => @@ -73,8 +72,7 @@ private async Task ShouldThrowDependencyExceptionOnRetrieveAIModelByNameIfUnauth innerException: unauthorizedException); var expectedAIModelDependencyException = - new AIModelDependencyException( - message: "AI Model dependency error occurred, contact support.", + createAIModelDependencyException( innerException: unauthorizedAIModelException); this.openAIBrokerMock.Setup(broker => @@ -248,8 +246,7 @@ private async Task ShouldThrowDependencyExceptionOnRetrieveAIModelByNameIfHttpRe innerException: httpResponseException); var expectedAIModelDependencyException = - new AIModelDependencyException( - message: "AI Model dependency error occurred, contact support.", + createAIModelDependencyException( innerException: failedServerAIModelException); this.openAIBrokerMock.Setup(broker => diff --git a/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/AIModels/AIModelServiceTests.cs b/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/AIModels/AIModelServiceTests.cs index 4bea62e7..9a0e9e65 100644 --- a/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/AIModels/AIModelServiceTests.cs +++ b/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/AIModels/AIModelServiceTests.cs @@ -10,8 +10,10 @@ using RESTFulSense.Exceptions; using Standard.AI.OpenAI.Brokers.DateTimes; using Standard.AI.OpenAI.Brokers.OpenAIs; +using Standard.AI.OpenAI.Models.Services.Foundations.AIModels.Exceptions; using Standard.AI.OpenAI.Services.Foundations.AIModels; using Tynamix.ObjectFiller; +using Xeptions; using Xunit; namespace Standard.AI.OpenAI.Tests.Unit.Services.Foundations.AIModels @@ -117,5 +119,12 @@ private static int GetRandomNumber() => private static bool GetRandomBoolean() => Randomizer.Create(); + + private static AIModelDependencyException createAIModelDependencyException(Xeption innerException) + { + return new AIModelDependencyException( + message: "AI Model dependency error occurred, contact support.", + innerException); + } } } \ No newline at end of file From a891181756683699c36aa5f9975da6423a356006 Mon Sep 17 00:00:00 2001 From: Lezune Date: Thu, 30 May 2024 23:36:43 -0700 Subject: [PATCH 109/283] Added create methods to the AIModelServiceTests.cs and refactored code --- .../AIModelServiceTests.Exceptions.RetrieveAllModels.cs | 3 +-- .../AIModelServiceTests.Exceptions.RetrieveByName.cs | 9 +++------ .../Services/Foundations/AIModels/AIModelServiceTests.cs | 9 +++++++++ 3 files changed, 13 insertions(+), 8 deletions(-) diff --git a/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/AIModels/AIModelServiceTests.Exceptions.RetrieveAllModels.cs b/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/AIModels/AIModelServiceTests.Exceptions.RetrieveAllModels.cs index 8ce8d21a..86902779 100644 --- a/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/AIModels/AIModelServiceTests.Exceptions.RetrieveAllModels.cs +++ b/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/AIModels/AIModelServiceTests.Exceptions.RetrieveAllModels.cs @@ -111,8 +111,7 @@ private async Task ShouldThrowDependencyValidationExceptionOnRetrieveIfTooManyRe innerException: httpResponseTooManyRequestsException); var expectedAIModelDependencyValidationException = - new AIModelDependencyValidationException( - message: "AI Model dependency validation error occurred, fix errors and try again.", + createAIModelDependencyValidationException( innerException: excessiveCallAIModelException); this.openAIBrokerMock.Setup(broker => diff --git a/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/AIModels/AIModelServiceTests.Exceptions.RetrieveByName.cs b/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/AIModels/AIModelServiceTests.Exceptions.RetrieveByName.cs index bcbd3414..d7869069 100644 --- a/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/AIModels/AIModelServiceTests.Exceptions.RetrieveByName.cs +++ b/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/AIModels/AIModelServiceTests.Exceptions.RetrieveByName.cs @@ -117,8 +117,7 @@ private async Task ShouldThrowDependencyValidationExceptionOnRetrieveAIModelByNa innerException: httpResponseNotFoundException); var expectedAIModelDependencyValidationException = - new AIModelDependencyValidationException( - message: "AI Model dependency validation error occurred, fix errors and try again.", + createAIModelDependencyValidationException( innerException: notFoundAIModelException); this.openAIBrokerMock.Setup(broker => @@ -161,8 +160,7 @@ private async Task ShouldThrowDependencyValidationExceptionOnRetrieveAIModelByNa innerException: httpResponseBadRequestException); var expectedAIModelDependencyValidationException = - new AIModelDependencyValidationException( - message: "AI Model dependency validation error occurred, fix errors and try again.", + createAIModelDependencyValidationException( innerException: invalidAIModelException); this.openAIBrokerMock.Setup(broker => @@ -205,8 +203,7 @@ private async Task ShouldThrowDependencyValidationExceptionOnRetrieveAIModelByNa innerException: httpResponseTooManyRequestsException); var expectedAIModelDependencyValidationException = - new AIModelDependencyValidationException( - message: "AI Model dependency validation error occurred, fix errors and try again.", + createAIModelDependencyValidationException( innerException: excessiveCallAIModelException); this.openAIBrokerMock.Setup(broker => diff --git a/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/AIModels/AIModelServiceTests.cs b/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/AIModels/AIModelServiceTests.cs index 4bea62e7..a5d97b58 100644 --- a/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/AIModels/AIModelServiceTests.cs +++ b/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/AIModels/AIModelServiceTests.cs @@ -10,8 +10,10 @@ using RESTFulSense.Exceptions; using Standard.AI.OpenAI.Brokers.DateTimes; using Standard.AI.OpenAI.Brokers.OpenAIs; +using Standard.AI.OpenAI.Models.Services.Foundations.AIModels.Exceptions; using Standard.AI.OpenAI.Services.Foundations.AIModels; using Tynamix.ObjectFiller; +using Xeptions; using Xunit; namespace Standard.AI.OpenAI.Tests.Unit.Services.Foundations.AIModels @@ -117,5 +119,12 @@ private static int GetRandomNumber() => private static bool GetRandomBoolean() => Randomizer.Create(); + + private static AIModelDependencyValidationException createAIModelDependencyValidationException(Xeption innerException) + { + return new AIModelDependencyValidationException( + message: "AI Model dependency validation error occurred, fix errors and try again.", + innerException); + } } } \ No newline at end of file From 1839392b7e1871fbccd2b3386ee45cbf82bdc1a9 Mon Sep 17 00:00:00 2001 From: Lezune Date: Thu, 30 May 2024 23:40:50 -0700 Subject: [PATCH 110/283] Added create methods to the AIModelServiceTests.cs and refactored code --- .../AIModelServiceTests.Exceptions.RetrieveAllModels.cs | 3 +-- .../AIModelServiceTests.Exceptions.RetrieveByName.cs | 3 +-- .../Services/Foundations/AIModels/AIModelServiceTests.cs | 9 +++++++++ 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/AIModels/AIModelServiceTests.Exceptions.RetrieveAllModels.cs b/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/AIModels/AIModelServiceTests.Exceptions.RetrieveAllModels.cs index 8ce8d21a..eb3425a8 100644 --- a/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/AIModels/AIModelServiceTests.Exceptions.RetrieveAllModels.cs +++ b/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/AIModels/AIModelServiceTests.Exceptions.RetrieveAllModels.cs @@ -192,8 +192,7 @@ private async Task ShouldThrowServiceExceptionOnRetrieveAllModelsIfServiceErrorO innerException: serviceException); var expectedAIModelServiceException = - new AIModelServiceException( - message: "AI Model service error occurred, contact support.", + createAIModelServiceException( innerException: failedAIModelServiceException); this.openAIBrokerMock.Setup(broker => diff --git a/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/AIModels/AIModelServiceTests.Exceptions.RetrieveByName.cs b/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/AIModels/AIModelServiceTests.Exceptions.RetrieveByName.cs index bcbd3414..6ad0f9cf 100644 --- a/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/AIModels/AIModelServiceTests.Exceptions.RetrieveByName.cs +++ b/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/AIModels/AIModelServiceTests.Exceptions.RetrieveByName.cs @@ -289,8 +289,7 @@ private async Task ShouldThrowServiceExceptionOnRetrieveAIModelByNameIfServiceEr innerException: serviceException); var expectedAIModelServiceException = - new AIModelServiceException( - message: "AI Model service error occurred, contact support.", + createAIModelServiceException( innerException: failedAIModelServiceException); this.openAIBrokerMock.Setup(broker => diff --git a/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/AIModels/AIModelServiceTests.cs b/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/AIModels/AIModelServiceTests.cs index 4bea62e7..aa66fda9 100644 --- a/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/AIModels/AIModelServiceTests.cs +++ b/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/AIModels/AIModelServiceTests.cs @@ -10,8 +10,10 @@ using RESTFulSense.Exceptions; using Standard.AI.OpenAI.Brokers.DateTimes; using Standard.AI.OpenAI.Brokers.OpenAIs; +using Standard.AI.OpenAI.Models.Services.Foundations.AIModels.Exceptions; using Standard.AI.OpenAI.Services.Foundations.AIModels; using Tynamix.ObjectFiller; +using Xeptions; using Xunit; namespace Standard.AI.OpenAI.Tests.Unit.Services.Foundations.AIModels @@ -117,5 +119,12 @@ private static int GetRandomNumber() => private static bool GetRandomBoolean() => Randomizer.Create(); + + private static AIModelServiceException createAIModelServiceException(Xeption innerException) + { + return new AIModelServiceException( + message: "AI Model service error occurred, contact support.", + innerException); + } } } \ No newline at end of file From 4450e2f71bd89ed67c89959a0ef8581a66df4611 Mon Sep 17 00:00:00 2001 From: Lezune Date: Thu, 30 May 2024 23:52:33 -0700 Subject: [PATCH 111/283] Added create methods to both AIModelService.Exceptions.cs and AIModelServiceTests.cs as well as refactored code --- ...delServiceTests.Exceptions.RetrieveAllModels.cs | 3 +-- ...IModelServiceTests.Exceptions.RetrieveByName.cs | 3 +-- .../Foundations/AIModels/AIModelServiceTests.cs | 8 ++++++++ .../AIModels/AIModelService.Exceptions.cs | 14 ++++++++++---- 4 files changed, 20 insertions(+), 8 deletions(-) diff --git a/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/AIModels/AIModelServiceTests.Exceptions.RetrieveAllModels.cs b/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/AIModels/AIModelServiceTests.Exceptions.RetrieveAllModels.cs index 8ce8d21a..47b05dba 100644 --- a/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/AIModels/AIModelServiceTests.Exceptions.RetrieveAllModels.cs +++ b/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/AIModels/AIModelServiceTests.Exceptions.RetrieveAllModels.cs @@ -187,8 +187,7 @@ private async Task ShouldThrowServiceExceptionOnRetrieveAllModelsIfServiceErrorO var serviceException = new Exception(); var failedAIModelServiceException = - new FailedAIModelServiceException( - message: "Failed AI Model Service Exception occurred, please contact support for assistance.", + createFailedAIModelServiceException( innerException: serviceException); var expectedAIModelServiceException = diff --git a/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/AIModels/AIModelServiceTests.Exceptions.RetrieveByName.cs b/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/AIModels/AIModelServiceTests.Exceptions.RetrieveByName.cs index bcbd3414..ca2353de 100644 --- a/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/AIModels/AIModelServiceTests.Exceptions.RetrieveByName.cs +++ b/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/AIModels/AIModelServiceTests.Exceptions.RetrieveByName.cs @@ -284,8 +284,7 @@ private async Task ShouldThrowServiceExceptionOnRetrieveAIModelByNameIfServiceEr var serviceException = new Exception(); var failedAIModelServiceException = - new FailedAIModelServiceException( - message: "Failed AI Model Service Exception occurred, please contact support for assistance.", + createFailedAIModelServiceException( innerException: serviceException); var expectedAIModelServiceException = diff --git a/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/AIModels/AIModelServiceTests.cs b/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/AIModels/AIModelServiceTests.cs index 4bea62e7..846c7156 100644 --- a/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/AIModels/AIModelServiceTests.cs +++ b/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/AIModels/AIModelServiceTests.cs @@ -10,6 +10,7 @@ using RESTFulSense.Exceptions; using Standard.AI.OpenAI.Brokers.DateTimes; using Standard.AI.OpenAI.Brokers.OpenAIs; +using Standard.AI.OpenAI.Models.Services.Foundations.AIModels.Exceptions; using Standard.AI.OpenAI.Services.Foundations.AIModels; using Tynamix.ObjectFiller; using Xunit; @@ -117,5 +118,12 @@ private static int GetRandomNumber() => private static bool GetRandomBoolean() => Randomizer.Create(); + + private static FailedAIModelServiceException createFailedAIModelServiceException(Exception innerException) + { + return new FailedAIModelServiceException( + message: "Failed AI Model Service Exception occurred, please contact support for assistance.", + innerException); + } } } \ No newline at end of file diff --git a/Standard.AI.OpenAI/Services/Foundations/AIModels/AIModelService.Exceptions.cs b/Standard.AI.OpenAI/Services/Foundations/AIModels/AIModelService.Exceptions.cs index a87a9c34..62e19082 100644 --- a/Standard.AI.OpenAI/Services/Foundations/AIModels/AIModelService.Exceptions.cs +++ b/Standard.AI.OpenAI/Services/Foundations/AIModels/AIModelService.Exceptions.cs @@ -8,6 +8,7 @@ using RESTFulSense.Exceptions; using Standard.AI.OpenAI.Models.Services.Foundations.AIModels; using Standard.AI.OpenAI.Models.Services.Foundations.AIModels.Exceptions; +using Xeptions; namespace Standard.AI.OpenAI.Services.Foundations.AIModels { @@ -78,8 +79,7 @@ private async ValueTask TryCatch(ReturningAIModelFunction returningAIMo catch (Exception exception) { var failedAIModelServiceException = - new FailedAIModelServiceException( - message: "Failed AI Model Service Exception occurred, please contact support for assistance.", + createFailedAIModelServiceException( exception); throw new AIModelServiceException( @@ -131,13 +131,19 @@ private async ValueTask> TryCatch(ReturningAIModelsFunction catch (Exception exception) { var failedAIModelServiceException = - new FailedAIModelServiceException( - message: "Failed AI Model Service Exception occurred, please contact support for assistance.", + createFailedAIModelServiceException( exception); throw new AIModelServiceException( failedAIModelServiceException); } } + + private static FailedAIModelServiceException createFailedAIModelServiceException(Exception innerException) + { + return new FailedAIModelServiceException( + message: "Failed AI Model Service Exception occurred, please contact support for assistance.", + innerException); + } } } \ No newline at end of file From 38a5c8d816fb25a2e0a1db177bd3c0246b75e94b Mon Sep 17 00:00:00 2001 From: Lezune Date: Thu, 30 May 2024 23:59:25 -0700 Subject: [PATCH 112/283] Added create methods to both AIModelService.Exceptions.cs and AIModelServiceTests.cs as well as refactored code --- ...odelServiceTests.Exceptions.RetrieveAllModels.cs | 3 +-- ...AIModelServiceTests.Exceptions.RetrieveByName.cs | 3 +-- .../Foundations/AIModels/AIModelServiceTests.cs | 8 ++++++++ .../AIModels/AIModelService.Exceptions.cs | 13 +++++++++---- 4 files changed, 19 insertions(+), 8 deletions(-) diff --git a/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/AIModels/AIModelServiceTests.Exceptions.RetrieveAllModels.cs b/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/AIModels/AIModelServiceTests.Exceptions.RetrieveAllModels.cs index 8ce8d21a..b52a9cb2 100644 --- a/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/AIModels/AIModelServiceTests.Exceptions.RetrieveAllModels.cs +++ b/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/AIModels/AIModelServiceTests.Exceptions.RetrieveAllModels.cs @@ -147,8 +147,7 @@ private async Task ShouldThrowDependencyExceptionOnRetrieveIfServerErrorOccurred new HttpResponseException(); var failedServerAIModelException = - new FailedServerAIModelException( - message: "Failed AI Model server error occurred, contact support", + createFailedServerAIModelException( innerException: httpResponseException); var expectedAIModelDependencyException = diff --git a/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/AIModels/AIModelServiceTests.Exceptions.RetrieveByName.cs b/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/AIModels/AIModelServiceTests.Exceptions.RetrieveByName.cs index bcbd3414..08eb161e 100644 --- a/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/AIModels/AIModelServiceTests.Exceptions.RetrieveByName.cs +++ b/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/AIModels/AIModelServiceTests.Exceptions.RetrieveByName.cs @@ -243,8 +243,7 @@ private async Task ShouldThrowDependencyExceptionOnRetrieveAIModelByNameIfHttpRe new HttpResponseException(); var failedServerAIModelException = - new FailedServerAIModelException( - message: "Failed AI Model server error occurred, contact support", + createFailedServerAIModelException( innerException: httpResponseException); var expectedAIModelDependencyException = diff --git a/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/AIModels/AIModelServiceTests.cs b/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/AIModels/AIModelServiceTests.cs index 4bea62e7..5c2be58c 100644 --- a/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/AIModels/AIModelServiceTests.cs +++ b/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/AIModels/AIModelServiceTests.cs @@ -10,6 +10,7 @@ using RESTFulSense.Exceptions; using Standard.AI.OpenAI.Brokers.DateTimes; using Standard.AI.OpenAI.Brokers.OpenAIs; +using Standard.AI.OpenAI.Models.Services.Foundations.AIModels.Exceptions; using Standard.AI.OpenAI.Services.Foundations.AIModels; using Tynamix.ObjectFiller; using Xunit; @@ -117,5 +118,12 @@ private static int GetRandomNumber() => private static bool GetRandomBoolean() => Randomizer.Create(); + + private static FailedServerAIModelException createFailedServerAIModelException(Exception innerException) + { + return new FailedServerAIModelException( + message: "Failed AI Model server error occurred, contact support", + innerException); + } } } \ No newline at end of file diff --git a/Standard.AI.OpenAI/Services/Foundations/AIModels/AIModelService.Exceptions.cs b/Standard.AI.OpenAI/Services/Foundations/AIModels/AIModelService.Exceptions.cs index ee4e10d4..6d0f6ab1 100644 --- a/Standard.AI.OpenAI/Services/Foundations/AIModels/AIModelService.Exceptions.cs +++ b/Standard.AI.OpenAI/Services/Foundations/AIModels/AIModelService.Exceptions.cs @@ -71,8 +71,7 @@ private async ValueTask TryCatch(ReturningAIModelFunction returningAIMo catch (HttpResponseException httpResponseException) { var failedServerAIModelException = - new FailedServerAIModelException( - message: "Failed AI Model server error occurred, contact support", + createFailedServerAIModelException( httpResponseException); throw new AIModelDependencyException(failedServerAIModelException); @@ -124,8 +123,7 @@ private async ValueTask> TryCatch(ReturningAIModelsFunction catch (HttpResponseException httpResponseException) { var failedServerAIModelException = - new FailedServerAIModelException( - message: "Failed AI Model server error occurred, contact support", + createFailedServerAIModelException( httpResponseException); throw new AIModelDependencyException(failedServerAIModelException); @@ -139,5 +137,12 @@ private async ValueTask> TryCatch(ReturningAIModelsFunction failedAIModelServiceException); } } + + private static FailedServerAIModelException createFailedServerAIModelException(Exception innerException) + { + return new FailedServerAIModelException( + message: "Failed AI Model server error occurred, contact support", + innerException); + } } } \ No newline at end of file From 8815d04275a4d4c09548fb6113edf4c8697384cd Mon Sep 17 00:00:00 2001 From: Lezune Date: Fri, 31 May 2024 00:05:27 -0700 Subject: [PATCH 113/283] Added create methods to both AIModelService.Exceptions.cs and AIModelServiceTests.cs as well as refactored code --- ...odelServiceTests.Exceptions.RetrieveAllModels.cs | 3 +-- ...AIModelServiceTests.Exceptions.RetrieveByName.cs | 3 +-- .../Foundations/AIModels/AIModelServiceTests.cs | 8 ++++++++ .../AIModels/AIModelService.Exceptions.cs | 13 +++++++++---- 4 files changed, 19 insertions(+), 8 deletions(-) diff --git a/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/AIModels/AIModelServiceTests.Exceptions.RetrieveAllModels.cs b/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/AIModels/AIModelServiceTests.Exceptions.RetrieveAllModels.cs index 8ce8d21a..4d65b108 100644 --- a/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/AIModels/AIModelServiceTests.Exceptions.RetrieveAllModels.cs +++ b/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/AIModels/AIModelServiceTests.Exceptions.RetrieveAllModels.cs @@ -24,8 +24,7 @@ private async Task ShouldThrowDependencyExceptionOnRetrieveIfUrlNotFoundAsync() new HttpResponseUrlNotFoundException(); var invalidConfigurationAIModelException = - new InvalidConfigurationAIModelException( - message: "Invalid AI Model configuration error occurred, contact support.", + createInvalidConfigurationAIModelException( innerException: httpResponseUrlNotFoundException); var expectedAIModelDependencyException = diff --git a/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/AIModels/AIModelServiceTests.Exceptions.RetrieveByName.cs b/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/AIModels/AIModelServiceTests.Exceptions.RetrieveByName.cs index bcbd3414..837b7e27 100644 --- a/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/AIModels/AIModelServiceTests.Exceptions.RetrieveByName.cs +++ b/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/AIModels/AIModelServiceTests.Exceptions.RetrieveByName.cs @@ -25,8 +25,7 @@ private async Task ShouldThrowDependencyExceptionOnRetrieveAIModelByNameIfUrlNot new HttpResponseUrlNotFoundException(); var invalidConfigurationAIModelException = - new InvalidConfigurationAIModelException( - message: "Invalid AI Model configuration error occurred, contact support.", + createInvalidConfigurationAIModelException( innerException: httpResponseUrlNotFoundException); var expectedAIModelDependencyException = diff --git a/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/AIModels/AIModelServiceTests.cs b/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/AIModels/AIModelServiceTests.cs index 4bea62e7..524e6b49 100644 --- a/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/AIModels/AIModelServiceTests.cs +++ b/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/AIModels/AIModelServiceTests.cs @@ -10,6 +10,7 @@ using RESTFulSense.Exceptions; using Standard.AI.OpenAI.Brokers.DateTimes; using Standard.AI.OpenAI.Brokers.OpenAIs; +using Standard.AI.OpenAI.Models.Services.Foundations.AIModels.Exceptions; using Standard.AI.OpenAI.Services.Foundations.AIModels; using Tynamix.ObjectFiller; using Xunit; @@ -117,5 +118,12 @@ private static int GetRandomNumber() => private static bool GetRandomBoolean() => Randomizer.Create(); + + private static InvalidConfigurationAIModelException createInvalidConfigurationAIModelException(Exception innerException) + { + return new InvalidConfigurationAIModelException( + message: "Invalid AI Model configuration error occurred, contact support.", + innerException); + } } } \ No newline at end of file diff --git a/Standard.AI.OpenAI/Services/Foundations/AIModels/AIModelService.Exceptions.cs b/Standard.AI.OpenAI/Services/Foundations/AIModels/AIModelService.Exceptions.cs index e37eeb63..27e68d6a 100644 --- a/Standard.AI.OpenAI/Services/Foundations/AIModels/AIModelService.Exceptions.cs +++ b/Standard.AI.OpenAI/Services/Foundations/AIModels/AIModelService.Exceptions.cs @@ -29,8 +29,7 @@ private async ValueTask TryCatch(ReturningAIModelFunction returningAIMo catch (HttpResponseUrlNotFoundException httpResponseUrlNotFoundException) { var invalidConfigurationAIModelException = - new InvalidConfigurationAIModelException( - message: "Invalid AI Model configuration error occurred, contact support.", + createInvalidConfigurationAIModelException( httpResponseUrlNotFoundException); throw new AIModelDependencyException(invalidConfigurationAIModelException); @@ -96,8 +95,7 @@ private async ValueTask> TryCatch(ReturningAIModelsFunction catch (HttpResponseUrlNotFoundException httpResponseUrlNotFoundException) { var invalidConfigurationAIModelException = - new InvalidConfigurationAIModelException( - message: "Invalid AI Model configuration error occurred, contact support.", + createInvalidConfigurationAIModelException( httpResponseUrlNotFoundException); throw new AIModelDependencyException(invalidConfigurationAIModelException); @@ -139,5 +137,12 @@ private async ValueTask> TryCatch(ReturningAIModelsFunction failedAIModelServiceException); } } + + private static InvalidConfigurationAIModelException createInvalidConfigurationAIModelException(Exception innerException) + { + return new InvalidConfigurationAIModelException( + message: "Invalid AI Model configuration error occurred, contact support.", + innerException); + } } } \ No newline at end of file From 05dbf315f17f9d681131d5069a80fbb54b22c0cb Mon Sep 17 00:00:00 2001 From: Lezune Date: Fri, 31 May 2024 00:10:42 -0700 Subject: [PATCH 114/283] Added create methods to both AIModelService.Exceptions.cs and AIModelServiceTests.cs as well as refactored code --- ...rviceTests.Exceptions.RetrieveAllModels.cs | 3 +-- ...lServiceTests.Exceptions.RetrieveByName.cs | 3 +-- .../AIModels/AIModelServiceTests.cs | 8 ++++++++ .../AIModels/AIModelService.Exceptions.cs | 20 +++++++++++-------- 4 files changed, 22 insertions(+), 12 deletions(-) diff --git a/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/AIModels/AIModelServiceTests.Exceptions.RetrieveAllModels.cs b/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/AIModels/AIModelServiceTests.Exceptions.RetrieveAllModels.cs index 8ce8d21a..e3f53e0a 100644 --- a/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/AIModels/AIModelServiceTests.Exceptions.RetrieveAllModels.cs +++ b/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/AIModels/AIModelServiceTests.Exceptions.RetrieveAllModels.cs @@ -65,8 +65,7 @@ private async Task ShouldThrowDependencyExceptionOnRetrieveIfUnauthorizedAsync( { // given var unauthorizedAIModelException = - new UnauthorizedAIModelException( - message: "Unauthorized AI Model error occurred, fix errors and try again.", + createUnauthorizedAIModelException( innerException: unauthorizedException); var expectedAIModelDependencyException = diff --git a/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/AIModels/AIModelServiceTests.Exceptions.RetrieveByName.cs b/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/AIModels/AIModelServiceTests.Exceptions.RetrieveByName.cs index bcbd3414..bef11b8e 100644 --- a/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/AIModels/AIModelServiceTests.Exceptions.RetrieveByName.cs +++ b/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/AIModels/AIModelServiceTests.Exceptions.RetrieveByName.cs @@ -68,8 +68,7 @@ private async Task ShouldThrowDependencyExceptionOnRetrieveAIModelByNameIfUnauth string someAIModelName = CreateRandomString(); var unauthorizedAIModelException = - new UnauthorizedAIModelException( - message: "Unauthorized AI Model error occurred, fix errors and try again.", + createUnauthorizedAIModelException( innerException: unauthorizedException); var expectedAIModelDependencyException = diff --git a/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/AIModels/AIModelServiceTests.cs b/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/AIModels/AIModelServiceTests.cs index 4bea62e7..72c587aa 100644 --- a/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/AIModels/AIModelServiceTests.cs +++ b/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/AIModels/AIModelServiceTests.cs @@ -10,6 +10,7 @@ using RESTFulSense.Exceptions; using Standard.AI.OpenAI.Brokers.DateTimes; using Standard.AI.OpenAI.Brokers.OpenAIs; +using Standard.AI.OpenAI.Models.Services.Foundations.AIModels.Exceptions; using Standard.AI.OpenAI.Services.Foundations.AIModels; using Tynamix.ObjectFiller; using Xunit; @@ -117,5 +118,12 @@ private static int GetRandomNumber() => private static bool GetRandomBoolean() => Randomizer.Create(); + + private static UnauthorizedAIModelException createUnauthorizedAIModelException(Exception innerException) + { + return new UnauthorizedAIModelException( + message: "Unauthorized AI Model error occurred, fix errors and try again.", + innerException); + } } } \ No newline at end of file diff --git a/Standard.AI.OpenAI/Services/Foundations/AIModels/AIModelService.Exceptions.cs b/Standard.AI.OpenAI/Services/Foundations/AIModels/AIModelService.Exceptions.cs index 54562f7d..42f6feac 100644 --- a/Standard.AI.OpenAI/Services/Foundations/AIModels/AIModelService.Exceptions.cs +++ b/Standard.AI.OpenAI/Services/Foundations/AIModels/AIModelService.Exceptions.cs @@ -36,8 +36,7 @@ private async ValueTask TryCatch(ReturningAIModelFunction returningAIMo catch (HttpResponseUnauthorizedException httpResponseUnauthorizedException) { var unauthorizedAIModelException = - new UnauthorizedAIModelException( - message: "Unauthorized AI Model error occurred, fix errors and try again.", + createUnauthorizedAIModelException( httpResponseUnauthorizedException); throw new AIModelDependencyException(unauthorizedAIModelException); @@ -45,8 +44,7 @@ private async ValueTask TryCatch(ReturningAIModelFunction returningAIMo catch (HttpResponseForbiddenException httpResponseForbiddenException) { var unauthorizedAIModelException = - new UnauthorizedAIModelException( - message: "Unauthorized AI Model error occurred, fix errors and try again.", + createUnauthorizedAIModelException( httpResponseForbiddenException); throw new AIModelDependencyException(unauthorizedAIModelException); @@ -105,8 +103,7 @@ private async ValueTask> TryCatch(ReturningAIModelsFunction catch (HttpResponseUnauthorizedException httpResponseUnauthorizedException) { var unauthorizedAIModelException = - new UnauthorizedAIModelException( - message: "Unauthorized AI Model error occurred, fix errors and try again.", + createUnauthorizedAIModelException( httpResponseUnauthorizedException); throw new AIModelDependencyException(unauthorizedAIModelException); @@ -114,8 +111,7 @@ private async ValueTask> TryCatch(ReturningAIModelsFunction catch (HttpResponseForbiddenException httpResponseForbiddenException) { var unauthorizedAIModelException = - new UnauthorizedAIModelException( - message: "Unauthorized AI Model error occurred, fix errors and try again.", + createUnauthorizedAIModelException( httpResponseForbiddenException); throw new AIModelDependencyException(unauthorizedAIModelException); @@ -143,5 +139,13 @@ private async ValueTask> TryCatch(ReturningAIModelsFunction failedAIModelServiceException); } } + + private static UnauthorizedAIModelException createUnauthorizedAIModelException(Exception innerException) + { + return new UnauthorizedAIModelException( + message: "Unauthorized AI Model error occurred, fix errors and try again.", + innerException); + } + } } \ No newline at end of file From 191a530bec16c44d819894c755d45bd3fdbb75d6 Mon Sep 17 00:00:00 2001 From: Lezune Date: Fri, 31 May 2024 00:19:45 -0700 Subject: [PATCH 115/283] Added create methods to both AIModelService.Exceptions.cs and AIModelServiceTests.cs as well as refactored code --- ...ioTranscriptionServiceTests.Validations.Send.cs | 9 +++------ .../AudioTranscriptionServiceTests.cs | 9 +++++++++ .../AudioTranscriptionService.Exceptions.cs | 14 ++++++++++---- 3 files changed, 22 insertions(+), 10 deletions(-) diff --git a/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/AudioTranscriptions/AudioTranscriptionServiceTests.Validations.Send.cs b/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/AudioTranscriptions/AudioTranscriptionServiceTests.Validations.Send.cs index 3f58eccf..6d1781f0 100644 --- a/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/AudioTranscriptions/AudioTranscriptionServiceTests.Validations.Send.cs +++ b/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/AudioTranscriptions/AudioTranscriptionServiceTests.Validations.Send.cs @@ -23,8 +23,7 @@ private async Task ShouldThrowValidationExceptionOnSendIfAudioTranscriptionIsNul var nullAudioTranscriptionException = new NullAudioTranscriptionException(); var exceptedAudioTranscriptionValidationException = - new AudioTranscriptionValidationException( - message: "Audio transcription validation error occurred, fix errors and try again.", + createAudioTranscriptionValidationException( innerException: nullAudioTranscriptionException); // when @@ -63,8 +62,7 @@ private async Task ShouldThrowValidationExceptionOnSendIfAudioTranscriptionReque values: "Value is required"); var exceptedAudioTranscriptionValidationException = - new AudioTranscriptionValidationException( - message: "Audio transcription validation error occurred, fix errors and try again.", + createAudioTranscriptionValidationException( innerException: invalidAudioTranscriptionException); // when @@ -114,8 +112,7 @@ private async Task ShouldThrowValidationExceptionOnSendIfAudioTranscriptionReque values: "Value is required"); var exceptedAudioTranscriptionValidationException = - new AudioTranscriptionValidationException( - message: "Audio transcription validation error occurred, fix errors and try again.", + createAudioTranscriptionValidationException( innerException: invalidAudioTranscriptionException); // when diff --git a/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/AudioTranscriptions/AudioTranscriptionServiceTests.cs b/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/AudioTranscriptions/AudioTranscriptionServiceTests.cs index a8c2e720..0c28a62b 100644 --- a/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/AudioTranscriptions/AudioTranscriptionServiceTests.cs +++ b/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/AudioTranscriptions/AudioTranscriptionServiceTests.cs @@ -10,9 +10,11 @@ using RESTFulSense.Exceptions; using Standard.AI.OpenAI.Brokers.OpenAIs; using Standard.AI.OpenAI.Models.Services.Foundations.AudioTranscriptions; +using Standard.AI.OpenAI.Models.Services.Foundations.AudioTranscriptions.Exceptions; using Standard.AI.OpenAI.Models.Services.Foundations.ExternalAudioTranscriptions; using Standard.AI.OpenAI.Services.Foundations.AudioTranscriptions; using Tynamix.ObjectFiller; +using Xeptions; using Xunit; namespace Standard.AI.OpenAI.Tests.Unit.Services.Foundations.AudioTranscriptions @@ -104,5 +106,12 @@ private static Filler AudioTranscriptionFiller() return filler; } + + private static AudioTranscriptionValidationException createAudioTranscriptionValidationException(Xeption innerException) + { + return new AudioTranscriptionValidationException( + message: "Audio transcription validation error occurred, fix errors and try again.", + innerException); + } } } diff --git a/Standard.AI.OpenAI/Services/Foundations/AudioTranscriptions/AudioTranscriptionService.Exceptions.cs b/Standard.AI.OpenAI/Services/Foundations/AudioTranscriptions/AudioTranscriptionService.Exceptions.cs index f0a65e9e..785396aa 100644 --- a/Standard.AI.OpenAI/Services/Foundations/AudioTranscriptions/AudioTranscriptionService.Exceptions.cs +++ b/Standard.AI.OpenAI/Services/Foundations/AudioTranscriptions/AudioTranscriptionService.Exceptions.cs @@ -7,6 +7,7 @@ using RESTFulSense.Exceptions; using Standard.AI.OpenAI.Models.Services.Foundations.AudioTranscriptions; using Standard.AI.OpenAI.Models.Services.Foundations.AudioTranscriptions.Exceptions; +using Xeptions; namespace Standard.AI.OpenAI.Services.Foundations.AudioTranscriptions { @@ -23,14 +24,12 @@ private static async ValueTask TryCatch( } catch (NullAudioTranscriptionException nullAudioTranscriptionException) { - throw new AudioTranscriptionValidationException( - message: "Audio transcription validation error occurred, fix errors and try again.", + throw createAudioTranscriptionValidationException( nullAudioTranscriptionException); } catch (InvalidAudioTranscriptionException invalidAudioTranscriptionException) { - throw new AudioTranscriptionValidationException( - message: "Audio transcription validation error occurred, fix errors and try again.", + throw createAudioTranscriptionValidationException( invalidAudioTranscriptionException); } catch (HttpResponseUrlNotFoundException httpResponseUrlNotFoundException) @@ -76,5 +75,12 @@ private static async ValueTask TryCatch( throw new AudioTranscriptionServiceException(failedAudioTranscriptionServiceException); } } + + private static AudioTranscriptionValidationException createAudioTranscriptionValidationException(Xeption innerException) + { + return new AudioTranscriptionValidationException( + message: "Audio transcription validation error occurred, fix errors and try again.", + innerException); + } } } \ No newline at end of file From 6fa596805094be7f42bfd09d5a3d593b05271a4a Mon Sep 17 00:00:00 2001 From: Lezune Date: Fri, 31 May 2024 00:29:46 -0700 Subject: [PATCH 116/283] Added create methods to both AIModelService.Exceptions.cs and AIModelServiceTests.cs as well as refactored code --- ...TranscriptionServiceTests.Exceptions.Send.cs | 6 ++---- .../AudioTranscriptionServiceTests.cs | 9 +++++++++ .../AudioTranscriptionService.Exceptions.cs | 17 +++++++++++------ 3 files changed, 22 insertions(+), 10 deletions(-) diff --git a/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/AudioTranscriptions/AudioTranscriptionServiceTests.Exceptions.Send.cs b/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/AudioTranscriptions/AudioTranscriptionServiceTests.Exceptions.Send.cs index 42627d83..de2ffdd8 100644 --- a/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/AudioTranscriptions/AudioTranscriptionServiceTests.Exceptions.Send.cs +++ b/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/AudioTranscriptions/AudioTranscriptionServiceTests.Exceptions.Send.cs @@ -32,8 +32,7 @@ private async Task ShouldThrowDependencyExceptionOnSendIfUrlNotFoundAsync() innerException: httpResponseUrlNotFoundException); var expectedAudioTranscriptionDependencyException = - new AudioTranscriptionDependencyException( - message: "Audio transcription dependency error occurred, contact support.", + createAudioTranscriptionDependencyException( innerException: invalidConfigurationAudioTranscriptionException); this.openAIBrokerMock.Setup(broker => @@ -77,8 +76,7 @@ private async Task ShouldThrowDependencyExceptionOnSendIfUnAuthorizedAsync( innerException: unAuthorizationException); var expectedAudioTranscriptionDependencyException = - new AudioTranscriptionDependencyException( - message: "Audio transcription dependency error occurred, contact support.", + createAudioTranscriptionDependencyException( innerException: unauthorizedAudioTranscriptionException); this.openAIBrokerMock.Setup(broker => diff --git a/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/AudioTranscriptions/AudioTranscriptionServiceTests.cs b/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/AudioTranscriptions/AudioTranscriptionServiceTests.cs index a8c2e720..7e3311f2 100644 --- a/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/AudioTranscriptions/AudioTranscriptionServiceTests.cs +++ b/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/AudioTranscriptions/AudioTranscriptionServiceTests.cs @@ -10,9 +10,11 @@ using RESTFulSense.Exceptions; using Standard.AI.OpenAI.Brokers.OpenAIs; using Standard.AI.OpenAI.Models.Services.Foundations.AudioTranscriptions; +using Standard.AI.OpenAI.Models.Services.Foundations.AudioTranscriptions.Exceptions; using Standard.AI.OpenAI.Models.Services.Foundations.ExternalAudioTranscriptions; using Standard.AI.OpenAI.Services.Foundations.AudioTranscriptions; using Tynamix.ObjectFiller; +using Xeptions; using Xunit; namespace Standard.AI.OpenAI.Tests.Unit.Services.Foundations.AudioTranscriptions @@ -104,5 +106,12 @@ private static Filler AudioTranscriptionFiller() return filler; } + + private static AudioTranscriptionDependencyException createAudioTranscriptionDependencyException(Xeption innerException) + { + return new AudioTranscriptionDependencyException( + message: "Audio transcription dependency error occurred, contact support.", + innerException); + } } } diff --git a/Standard.AI.OpenAI/Services/Foundations/AudioTranscriptions/AudioTranscriptionService.Exceptions.cs b/Standard.AI.OpenAI/Services/Foundations/AudioTranscriptions/AudioTranscriptionService.Exceptions.cs index d77f4082..4451e67b 100644 --- a/Standard.AI.OpenAI/Services/Foundations/AudioTranscriptions/AudioTranscriptionService.Exceptions.cs +++ b/Standard.AI.OpenAI/Services/Foundations/AudioTranscriptions/AudioTranscriptionService.Exceptions.cs @@ -7,6 +7,7 @@ using RESTFulSense.Exceptions; using Standard.AI.OpenAI.Models.Services.Foundations.AudioTranscriptions; using Standard.AI.OpenAI.Models.Services.Foundations.AudioTranscriptions.Exceptions; +using Xeptions; namespace Standard.AI.OpenAI.Services.Foundations.AudioTranscriptions { @@ -34,8 +35,7 @@ private static async ValueTask TryCatch( var invalidConfigurationAudioTranscriptionException = new InvalidConfigurationAudioTranscriptionException(httpResponseUrlNotFoundException); - throw new AudioTranscriptionDependencyException( - message: "Audio transcription dependency error occurred, contact support.", + throw createAudioTranscriptionDependencyException( invalidConfigurationAudioTranscriptionException); } catch (HttpResponseUnauthorizedException httpResponseUnauthorizedException) @@ -43,8 +43,7 @@ private static async ValueTask TryCatch( var unauthorizedAudioTranscriptionException = new UnauthorizedAudioTranscriptionException(httpResponseUnauthorizedException); - throw new AudioTranscriptionDependencyException( - message: "Audio transcription dependency error occurred, contact support.", + throw createAudioTranscriptionDependencyException( unauthorizedAudioTranscriptionException); } catch (HttpResponseForbiddenException httpResponseForbiddenException) @@ -52,8 +51,7 @@ private static async ValueTask TryCatch( var unauthorizedAudioTranscriptionException = new UnauthorizedAudioTranscriptionException(httpResponseForbiddenException); - throw new AudioTranscriptionDependencyException( - message: "Audio transcription dependency error occurred, contact support.", + throw createAudioTranscriptionDependencyException( unauthorizedAudioTranscriptionException); } catch (HttpResponseBadRequestException httpResponseBadRequestException) @@ -78,5 +76,12 @@ private static async ValueTask TryCatch( throw new AudioTranscriptionServiceException(failedAudioTranscriptionServiceException); } } + + private static AudioTranscriptionDependencyException createAudioTranscriptionDependencyException(Xeption innerException) + { + return new AudioTranscriptionDependencyException( + message: "Audio transcription dependency error occurred, contact support.", + innerException); + } } } \ No newline at end of file From 4704585b6e0a1487b5db29cc9e9884a66dacd123 Mon Sep 17 00:00:00 2001 From: Lezune Date: Fri, 31 May 2024 01:55:38 -0700 Subject: [PATCH 117/283] Added create methods to both AudioTranscriptions.Exceptions.cs and AudioTranscriptionServiceTests.cs as well as refactored code --- ...dioTranscriptionServiceTests.Exceptions.Send.cs | 6 ++---- .../AudioTranscriptionServiceTests.cs | 9 +++++++++ .../AudioTranscriptionService.Exceptions.cs | 14 ++++++++++---- 3 files changed, 21 insertions(+), 8 deletions(-) diff --git a/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/AudioTranscriptions/AudioTranscriptionServiceTests.Exceptions.Send.cs b/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/AudioTranscriptions/AudioTranscriptionServiceTests.Exceptions.Send.cs index 42627d83..04963ec8 100644 --- a/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/AudioTranscriptions/AudioTranscriptionServiceTests.Exceptions.Send.cs +++ b/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/AudioTranscriptions/AudioTranscriptionServiceTests.Exceptions.Send.cs @@ -123,8 +123,7 @@ private async Task ShouldThrowDependencyValidationExceptionOnUploadIfBadRequestE innerException: httpResponseBadRequestException); var expectedAudioTranscriptionDependencyValidationException = - new AudioTranscriptionDependencyValidationException( - message: "Chat completion dependency validation error occurred, fix errors and try again.", + createAudioTranscriptionDependencyValidationException( innerException: invalidAudioTranscriptionException); this.openAIBrokerMock.Setup(broker => @@ -212,8 +211,7 @@ private async Task ShouldThrowDependencyValidationExceptionOnSendIfTooManyReques innerException: httpResponseTooManyRequestsException); var expectedAudioTranscriptionDependencyValidationException = - new AudioTranscriptionDependencyValidationException( - message: "Chat completion dependency validation error occurred, fix errors and try again.", + createAudioTranscriptionDependencyValidationException( innerException: excessiveCallAudioTranscriptionException); this.openAIBrokerMock.Setup(broker => diff --git a/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/AudioTranscriptions/AudioTranscriptionServiceTests.cs b/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/AudioTranscriptions/AudioTranscriptionServiceTests.cs index a8c2e720..34cfc752 100644 --- a/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/AudioTranscriptions/AudioTranscriptionServiceTests.cs +++ b/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/AudioTranscriptions/AudioTranscriptionServiceTests.cs @@ -10,9 +10,11 @@ using RESTFulSense.Exceptions; using Standard.AI.OpenAI.Brokers.OpenAIs; using Standard.AI.OpenAI.Models.Services.Foundations.AudioTranscriptions; +using Standard.AI.OpenAI.Models.Services.Foundations.AudioTranscriptions.Exceptions; using Standard.AI.OpenAI.Models.Services.Foundations.ExternalAudioTranscriptions; using Standard.AI.OpenAI.Services.Foundations.AudioTranscriptions; using Tynamix.ObjectFiller; +using Xeptions; using Xunit; namespace Standard.AI.OpenAI.Tests.Unit.Services.Foundations.AudioTranscriptions @@ -104,5 +106,12 @@ private static Filler AudioTranscriptionFiller() return filler; } + + private static AudioTranscriptionDependencyValidationException createAudioTranscriptionDependencyValidationException(Xeption innerException) + { + return new AudioTranscriptionDependencyValidationException( + message: "Chat completion dependency validation error occurred, fix errors and try again.", + innerException); + } } } diff --git a/Standard.AI.OpenAI/Services/Foundations/AudioTranscriptions/AudioTranscriptionService.Exceptions.cs b/Standard.AI.OpenAI/Services/Foundations/AudioTranscriptions/AudioTranscriptionService.Exceptions.cs index 6e2bd544..43a48d46 100644 --- a/Standard.AI.OpenAI/Services/Foundations/AudioTranscriptions/AudioTranscriptionService.Exceptions.cs +++ b/Standard.AI.OpenAI/Services/Foundations/AudioTranscriptions/AudioTranscriptionService.Exceptions.cs @@ -7,6 +7,7 @@ using RESTFulSense.Exceptions; using Standard.AI.OpenAI.Models.Services.Foundations.AudioTranscriptions; using Standard.AI.OpenAI.Models.Services.Foundations.AudioTranscriptions.Exceptions; +using Xeptions; namespace Standard.AI.OpenAI.Services.Foundations.AudioTranscriptions { @@ -55,8 +56,7 @@ private static async ValueTask TryCatch( var invalidAudioTranscriptionException = new InvalidAudioTranscriptionException(httpResponseBadRequestException); - throw new AudioTranscriptionDependencyValidationException( - message: "Chat completion dependency validation error occurred, fix errors and try again.", + throw createAudioTranscriptionDependencyValidationException( invalidAudioTranscriptionException); } catch (HttpResponseTooManyRequestsException httpResponseTooManyRequestsException) @@ -64,8 +64,7 @@ private static async ValueTask TryCatch( var excessiveCallAudioTranscriptionException = new ExcessiveCallAudioTranscriptionException(httpResponseTooManyRequestsException); - throw new AudioTranscriptionDependencyValidationException( - message: "Chat completion dependency validation error occurred, fix errors and try again.", + throw createAudioTranscriptionDependencyValidationException( excessiveCallAudioTranscriptionException); } catch (Exception exception) @@ -76,5 +75,12 @@ private static async ValueTask TryCatch( throw new AudioTranscriptionServiceException(failedAudioTranscriptionServiceException); } } + + private static AudioTranscriptionDependencyValidationException createAudioTranscriptionDependencyValidationException(Xeption innerException) + { + return new AudioTranscriptionDependencyValidationException( + message: "Chat completion dependency validation error occurred, fix errors and try again.", + innerException); + } } } \ No newline at end of file From 65396bf60693a82079f2ea73c3d5d99a21e1617a Mon Sep 17 00:00:00 2001 From: Lezune Date: Fri, 31 May 2024 02:04:16 -0700 Subject: [PATCH 118/283] Added create methods to both AudioTranscriptions.Exceptions.cs and AudioTranscriptionServiceTests.cs as well as refactored code --- .../AudioTranscriptionServiceTests.Validations.Send.cs | 8 ++++---- .../AudioTranscriptions/AudioTranscriptionServiceTests.cs | 7 +++++++ 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/AudioTranscriptions/AudioTranscriptionServiceTests.Validations.Send.cs b/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/AudioTranscriptions/AudioTranscriptionServiceTests.Validations.Send.cs index 3c0613ab..f23d55c6 100644 --- a/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/AudioTranscriptions/AudioTranscriptionServiceTests.Validations.Send.cs +++ b/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/AudioTranscriptions/AudioTranscriptionServiceTests.Validations.Send.cs @@ -56,8 +56,8 @@ private async Task ShouldThrowValidationExceptionOnSendIfAudioTranscriptionReque Request = null }; - var invalidAudioTranscriptionException = new InvalidAudioTranscriptionException( - message: "Audio transcription is invalid."); + var invalidAudioTranscriptionException = + createInvalidAudioTranscriptionException(); invalidAudioTranscriptionException.AddData( key: nameof(AudioTranscription.Request), @@ -104,8 +104,8 @@ private async Task ShouldThrowValidationExceptionOnSendIfAudioTranscriptionReque } }; - var invalidAudioTranscriptionException = new InvalidAudioTranscriptionException( - message: "Audio transcription is invalid."); + var invalidAudioTranscriptionException = + createInvalidAudioTranscriptionException(); invalidAudioTranscriptionException.AddData( key: nameof(AudioTranscriptionRequest.FileName), diff --git a/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/AudioTranscriptions/AudioTranscriptionServiceTests.cs b/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/AudioTranscriptions/AudioTranscriptionServiceTests.cs index a8c2e720..f77cb56a 100644 --- a/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/AudioTranscriptions/AudioTranscriptionServiceTests.cs +++ b/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/AudioTranscriptions/AudioTranscriptionServiceTests.cs @@ -10,6 +10,7 @@ using RESTFulSense.Exceptions; using Standard.AI.OpenAI.Brokers.OpenAIs; using Standard.AI.OpenAI.Models.Services.Foundations.AudioTranscriptions; +using Standard.AI.OpenAI.Models.Services.Foundations.AudioTranscriptions.Exceptions; using Standard.AI.OpenAI.Models.Services.Foundations.ExternalAudioTranscriptions; using Standard.AI.OpenAI.Services.Foundations.AudioTranscriptions; using Tynamix.ObjectFiller; @@ -104,5 +105,11 @@ private static Filler AudioTranscriptionFiller() return filler; } + + private static InvalidAudioTranscriptionException createInvalidAudioTranscriptionException() + { + return new InvalidAudioTranscriptionException( + message: "Audio transcription is invalid."); + } } } From c4d328b366c37bcca063f6472f7d07472db3e536 Mon Sep 17 00:00:00 2001 From: Lezune Date: Fri, 31 May 2024 02:10:31 -0700 Subject: [PATCH 119/283] Added create methods to both AudioTranscriptions.Exceptions.cs and AudioTranscriptionServiceTests.cs as well as refactored code --- .../AudioTranscriptionService.Exceptions.cs | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/Standard.AI.OpenAI/Services/Foundations/AudioTranscriptions/AudioTranscriptionService.Exceptions.cs b/Standard.AI.OpenAI/Services/Foundations/AudioTranscriptions/AudioTranscriptionService.Exceptions.cs index 77c757df..1684a3f5 100644 --- a/Standard.AI.OpenAI/Services/Foundations/AudioTranscriptions/AudioTranscriptionService.Exceptions.cs +++ b/Standard.AI.OpenAI/Services/Foundations/AudioTranscriptions/AudioTranscriptionService.Exceptions.cs @@ -39,17 +39,16 @@ private static async ValueTask TryCatch( catch (HttpResponseUnauthorizedException httpResponseUnauthorizedException) { var unauthorizedAudioTranscriptionException = - new UnauthorizedAudioTranscriptionException( - message: "Unauthorized audio transcription request, fix errors and try again.", + createUnauthorizedAudioTranscriptionException( httpResponseUnauthorizedException); throw new AudioTranscriptionDependencyException(unauthorizedAudioTranscriptionException); } catch (HttpResponseForbiddenException httpResponseForbiddenException) { - var unauthorizedAudioTranscriptionException = new UnauthorizedAudioTranscriptionException( - message: "Unauthorized audio transcription request, fix errors and try again.", - httpResponseForbiddenException); + var unauthorizedAudioTranscriptionException = + createUnauthorizedAudioTranscriptionException( + httpResponseForbiddenException); throw new AudioTranscriptionDependencyException(unauthorizedAudioTranscriptionException); } @@ -75,5 +74,12 @@ private static async ValueTask TryCatch( throw new AudioTranscriptionServiceException(failedAudioTranscriptionServiceException); } } + + private static UnauthorizedAudioTranscriptionException createUnauthorizedAudioTranscriptionException(Exception innerException) + { + return new UnauthorizedAudioTranscriptionException( + message: "Unauthorized audio transcription request, fix errors and try again.", + innerException); + } } } \ No newline at end of file From 580c121374e00a18bebc74601b387194a9f591d9 Mon Sep 17 00:00:00 2001 From: Lezune Date: Fri, 31 May 2024 02:45:45 -0700 Subject: [PATCH 120/283] Added create methods to both ChatCompletions.Exceptions.cs and ChatCompletionServiceTests.cs as well as refactored code --- ...tCompletionServiceTests.Exceptions.Send.cs | 15 ++++++-------- .../ChatCompletionServiceTests.cs | 9 +++++++++ .../ChatCompletionService.Exceptions.cs | 20 +++++++++++-------- 3 files changed, 27 insertions(+), 17 deletions(-) diff --git a/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/ChatCompletions/ChatCompletionServiceTests.Exceptions.Send.cs b/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/ChatCompletions/ChatCompletionServiceTests.Exceptions.Send.cs index 31bb0a9f..ff2a00f3 100644 --- a/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/ChatCompletions/ChatCompletionServiceTests.Exceptions.Send.cs +++ b/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/ChatCompletions/ChatCompletionServiceTests.Exceptions.Send.cs @@ -32,9 +32,8 @@ private async Task ShouldThrowDependencyExceptionOnSendIfUrlNotFoundAsync() innerException: httpResponseUrlNotFoundException); var expectedChatCompletionDependencyException = - new ChatCompletionDependencyException( - message: "Chat completion dependency error occurred, contact support.", - innerException: invalidConfigurationChatCompletionException); + createChatCompletionDependencyException( + innerException: invalidConfigurationChatCompletionException); this.openAIBrokerMock.Setup(broker => broker.PostChatCompletionRequestAsync( @@ -78,9 +77,8 @@ private async Task ShouldThrowDependencyExceptionOnSendIfUnauthorizedAsync( innerException: unauthorizedException); var expectedChatCompletionDependencyException = - new ChatCompletionDependencyException( - message: "Chat completion dependency error occurred, contact support.", - innerException: unauthorizedChatCompletionException); + createChatCompletionDependencyException( + innerException: unauthorizedChatCompletionException); this.openAIBrokerMock.Setup(broker => broker.PostChatCompletionRequestAsync( @@ -260,9 +258,8 @@ private async Task ShouldThrowDependencyExceptionOnSendIfHttpResponseErrorOccurr innerException: httpResponseException); var expectedChatCompletionDependencyException = - new ChatCompletionDependencyException( - message: "Chat completion dependency error occurred, contact support.", - innerException: failedServerChatCompletionException); + createChatCompletionDependencyException( + innerException: failedServerChatCompletionException); this.openAIBrokerMock.Setup(broker => broker.PostChatCompletionRequestAsync( diff --git a/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/ChatCompletions/ChatCompletionServiceTests.cs b/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/ChatCompletions/ChatCompletionServiceTests.cs index 465752a3..e522a5a4 100644 --- a/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/ChatCompletions/ChatCompletionServiceTests.cs +++ b/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/ChatCompletions/ChatCompletionServiceTests.cs @@ -13,9 +13,11 @@ using Standard.AI.OpenAI.Brokers.DateTimes; using Standard.AI.OpenAI.Brokers.OpenAIs; using Standard.AI.OpenAI.Models.Services.Foundations.ChatCompletions; +using Standard.AI.OpenAI.Models.Services.Foundations.ChatCompletions.Exceptions; using Standard.AI.OpenAI.Models.Services.Foundations.ExternalChatCompletions; using Standard.AI.OpenAI.Services.Foundations.ChatCompletions; using Tynamix.ObjectFiller; +using Xeptions; using Xunit; namespace Standard.AI.OpenAI.Tests.Unit.Services.Foundations.ChatCompletions @@ -154,5 +156,12 @@ private static Filler ChatCompletionFiller() return filler; } + + private static ChatCompletionDependencyException createChatCompletionDependencyException(Xeption innerException) + { + return new ChatCompletionDependencyException( + message: "Chat completion dependency error occurred, contact support.", + innerException); + } } } diff --git a/Standard.AI.OpenAI/Services/Foundations/ChatCompletions/ChatCompletionService.Exceptions.cs b/Standard.AI.OpenAI/Services/Foundations/ChatCompletions/ChatCompletionService.Exceptions.cs index bed4e541..c211d5e5 100644 --- a/Standard.AI.OpenAI/Services/Foundations/ChatCompletions/ChatCompletionService.Exceptions.cs +++ b/Standard.AI.OpenAI/Services/Foundations/ChatCompletions/ChatCompletionService.Exceptions.cs @@ -7,6 +7,7 @@ using RESTFulSense.Exceptions; using Standard.AI.OpenAI.Models.Services.Foundations.ChatCompletions; using Standard.AI.OpenAI.Models.Services.Foundations.ChatCompletions.Exceptions; +using Xeptions; namespace Standard.AI.OpenAI.Services.Foundations.ChatCompletions { @@ -33,8 +34,7 @@ private async ValueTask TryCatch(ReturningChatCompletionFunction var invalidConfigurationChatCompletionException = new InvalidConfigurationChatCompletionException(httpResponseUrlNotFoundException); - throw new ChatCompletionDependencyException( - message: "Chat completion dependency error occurred, contact support.", + throw createChatCompletionDependencyException( invalidConfigurationChatCompletionException); } catch (HttpResponseUnauthorizedException httpResponseUnauthorizedException) @@ -42,8 +42,7 @@ private async ValueTask TryCatch(ReturningChatCompletionFunction var unauthorizedChatCompletionException = new UnauthorizedChatCompletionException(httpResponseUnauthorizedException); - throw new ChatCompletionDependencyException( - message: "Chat completion dependency error occurred, contact support.", + throw createChatCompletionDependencyException( unauthorizedChatCompletionException); } catch (HttpResponseForbiddenException httpResponseForbiddenException) @@ -51,8 +50,7 @@ private async ValueTask TryCatch(ReturningChatCompletionFunction var unauthorizedChatCompletionException = new UnauthorizedChatCompletionException(httpResponseForbiddenException); - throw new ChatCompletionDependencyException( - message: "Chat completion dependency error occurred, contact support.", + throw createChatCompletionDependencyException( unauthorizedChatCompletionException); } catch (HttpResponseNotFoundException httpResponseNotFoundException) @@ -81,8 +79,7 @@ private async ValueTask TryCatch(ReturningChatCompletionFunction var failedServerChatCompletionException = new FailedServerChatCompletionException(httpResponseException); - throw new ChatCompletionDependencyException( - message: "Chat completion dependency error occurred, contact support.", + throw createChatCompletionDependencyException( failedServerChatCompletionException); } catch (Exception exception) @@ -94,5 +91,12 @@ private async ValueTask TryCatch(ReturningChatCompletionFunction failedChatCompletionServiceException); } } + + private static ChatCompletionDependencyException createChatCompletionDependencyException(Xeption innerException) + { + return new ChatCompletionDependencyException( + message: "Chat completion dependency error occurred, contact support.", + innerException); + } } } \ No newline at end of file From a8b716ce813d0b5f830c24eb8597ca7ad21a1350 Mon Sep 17 00:00:00 2001 From: Lezune Date: Fri, 31 May 2024 02:52:29 -0700 Subject: [PATCH 121/283] Added create methods to both ChatCompletions.Exceptions.cs and ChatCompletionServiceTests.cs as well as refactored code --- ...hatCompletionServiceTests.Exceptions.Send.cs | 15 ++++++--------- .../ChatCompletionServiceTests.cs | 9 +++++++++ .../ChatCompletionService.Exceptions.cs | 17 +++++++++++------ 3 files changed, 26 insertions(+), 15 deletions(-) diff --git a/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/ChatCompletions/ChatCompletionServiceTests.Exceptions.Send.cs b/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/ChatCompletions/ChatCompletionServiceTests.Exceptions.Send.cs index 31bb0a9f..5a8e097f 100644 --- a/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/ChatCompletions/ChatCompletionServiceTests.Exceptions.Send.cs +++ b/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/ChatCompletions/ChatCompletionServiceTests.Exceptions.Send.cs @@ -125,9 +125,8 @@ private async Task ShouldThrowDependencyValidationExceptionOnSendIfChatCompletio innerException: httpResponseNotFoundException); var expectedChatCompletionDependencyValidationException = - new ChatCompletionDependencyValidationException( - message: "Chat completion dependency validation error occurred, fix errors and try again.", - innerException: notFoundChatCompletionException); + createChatCompletionDependencyValidationException( + innerException: notFoundChatCompletionException); this.openAIBrokerMock.Setup(broker => broker.PostChatCompletionRequestAsync( @@ -170,9 +169,8 @@ private async Task ShouldThrowDependencyValidationExceptionOnSendIfBadRequestErr innerException: httpResponseBadRequestException); var expectedChatCompletionDependencyValidationException = - new ChatCompletionDependencyValidationException( - message: "Chat completion dependency validation error occurred, fix errors and try again.", - innerException: invalidChatCompletionException); + createChatCompletionDependencyValidationException( + innerException: invalidChatCompletionException); this.openAIBrokerMock.Setup(broker => broker.PostChatCompletionRequestAsync( @@ -217,9 +215,8 @@ private async Task ShouldThrowDependencyValidationExceptionOnSendIfTooManyReques innerException: httpResponseTooManyRequestsException); var expectedChatCompletionDependencyValidationException = - new ChatCompletionDependencyValidationException( - message: "Chat completion dependency validation error occurred, fix errors and try again.", - innerException: excessiveCallChatCompletionException); + createChatCompletionDependencyValidationException( + innerException: excessiveCallChatCompletionException); this.openAIBrokerMock.Setup(broker => broker.PostChatCompletionRequestAsync( diff --git a/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/ChatCompletions/ChatCompletionServiceTests.cs b/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/ChatCompletions/ChatCompletionServiceTests.cs index 465752a3..3568039c 100644 --- a/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/ChatCompletions/ChatCompletionServiceTests.cs +++ b/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/ChatCompletions/ChatCompletionServiceTests.cs @@ -13,9 +13,11 @@ using Standard.AI.OpenAI.Brokers.DateTimes; using Standard.AI.OpenAI.Brokers.OpenAIs; using Standard.AI.OpenAI.Models.Services.Foundations.ChatCompletions; +using Standard.AI.OpenAI.Models.Services.Foundations.ChatCompletions.Exceptions; using Standard.AI.OpenAI.Models.Services.Foundations.ExternalChatCompletions; using Standard.AI.OpenAI.Services.Foundations.ChatCompletions; using Tynamix.ObjectFiller; +using Xeptions; using Xunit; namespace Standard.AI.OpenAI.Tests.Unit.Services.Foundations.ChatCompletions @@ -154,5 +156,12 @@ private static Filler ChatCompletionFiller() return filler; } + + private static ChatCompletionDependencyValidationException createChatCompletionDependencyValidationException(Xeption innerException) + { + return new ChatCompletionDependencyValidationException( + "Chat completion dependency validation error occurred, fix errors and try again.", + innerException); + } } } diff --git a/Standard.AI.OpenAI/Services/Foundations/ChatCompletions/ChatCompletionService.Exceptions.cs b/Standard.AI.OpenAI/Services/Foundations/ChatCompletions/ChatCompletionService.Exceptions.cs index e7a25e5c..0741bed9 100644 --- a/Standard.AI.OpenAI/Services/Foundations/ChatCompletions/ChatCompletionService.Exceptions.cs +++ b/Standard.AI.OpenAI/Services/Foundations/ChatCompletions/ChatCompletionService.Exceptions.cs @@ -7,6 +7,7 @@ using RESTFulSense.Exceptions; using Standard.AI.OpenAI.Models.Services.Foundations.ChatCompletions; using Standard.AI.OpenAI.Models.Services.Foundations.ChatCompletions.Exceptions; +using Xeptions; namespace Standard.AI.OpenAI.Services.Foundations.ChatCompletions { @@ -54,8 +55,7 @@ private async ValueTask TryCatch(ReturningChatCompletionFunction var notFoundChatCompletionException = new NotFoundChatCompletionException(httpResponseNotFoundException); - throw new ChatCompletionDependencyValidationException( - message: "Chat completion dependency validation error occurred, fix errors and try again.", + throw createChatCompletionDependencyValidationException( notFoundChatCompletionException); } catch (HttpResponseBadRequestException httpResponseBadRequestException) @@ -63,8 +63,7 @@ private async ValueTask TryCatch(ReturningChatCompletionFunction var invalidChatCompletionException = new InvalidChatCompletionException(httpResponseBadRequestException); - throw new ChatCompletionDependencyValidationException( - message: "Chat completion dependency validation error occurred, fix errors and try again.", + throw createChatCompletionDependencyValidationException( invalidChatCompletionException); } catch (HttpResponseTooManyRequestsException httpResponseTooManyRequestsException) @@ -72,8 +71,7 @@ private async ValueTask TryCatch(ReturningChatCompletionFunction var excessiveCallChatCompletionException = new ExcessiveCallChatCompletionException(httpResponseTooManyRequestsException); - throw new ChatCompletionDependencyValidationException( - message: "Chat completion dependency validation error occurred, fix errors and try again.", + throw createChatCompletionDependencyValidationException( excessiveCallChatCompletionException); } catch (HttpResponseException httpResponseException) @@ -92,5 +90,12 @@ private async ValueTask TryCatch(ReturningChatCompletionFunction failedChatCompletionServiceException); } } + + private static ChatCompletionDependencyValidationException createChatCompletionDependencyValidationException(Xeption innerException) + { + return new ChatCompletionDependencyValidationException( + "Chat completion dependency validation error occurred, fix errors and try again.", + innerException); + } } } \ No newline at end of file From b303722b83311fb830e34c45c7d980a0b9035999 Mon Sep 17 00:00:00 2001 From: Lezune Date: Fri, 31 May 2024 02:58:42 -0700 Subject: [PATCH 122/283] Added create methods to both ChatCompletions.Exceptions.cs and ChatCompletionServiceTests.cs as well as refactored code --- ...ChatCompletionServiceTests.Validations.Send.cs | 15 ++++++--------- .../ChatCompletions/ChatCompletionServiceTests.cs | 9 +++++++++ .../ChatCompletionService.Exceptions.cs | 14 ++++++++++---- 3 files changed, 25 insertions(+), 13 deletions(-) diff --git a/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/ChatCompletions/ChatCompletionServiceTests.Validations.Send.cs b/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/ChatCompletions/ChatCompletionServiceTests.Validations.Send.cs index 8557d1e4..697f766d 100644 --- a/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/ChatCompletions/ChatCompletionServiceTests.Validations.Send.cs +++ b/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/ChatCompletions/ChatCompletionServiceTests.Validations.Send.cs @@ -24,9 +24,8 @@ private async Task ShouldThrowValidationExceptionOnSendIfChatCompletionIsNullAsy new NullChatCompletionException(); var expectedChatCompletionValidationException = - new ChatCompletionValidationException( - message: "Chat completion validation error occurred, fix errors and try again.", - innerException: nullChatCompletionException); + createChatCompletionValidationException( + innerException: nullChatCompletionException); // when ValueTask sendChatCompletionTask = @@ -65,9 +64,8 @@ private async Task ShouldThrowValidationExceptionOnSendIfRequestIsNullAsync() values: "Value is required"); var expectedChatCompletionValidationException = - new ChatCompletionValidationException( - message: "Chat completion validation error occurred, fix errors and try again.", - innerException: invalidChatCompletionException); + createChatCompletionValidationException( + innerException: invalidChatCompletionException); // when ValueTask sendChatCompletionTask = @@ -117,9 +115,8 @@ private async Task ShouldThrowValidationExceptionOnSendIfRequestIsInvalidAsync(s values: "Value is required"); var expectedChatCompletionValidationException = - new ChatCompletionValidationException( - message: "Chat completion validation error occurred, fix errors and try again.", - innerException: invalidChatCompletionException); + createChatCompletionValidationException( + innerException: invalidChatCompletionException); // when ValueTask sendChatCompletionTask = diff --git a/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/ChatCompletions/ChatCompletionServiceTests.cs b/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/ChatCompletions/ChatCompletionServiceTests.cs index 465752a3..bdeb28f5 100644 --- a/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/ChatCompletions/ChatCompletionServiceTests.cs +++ b/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/ChatCompletions/ChatCompletionServiceTests.cs @@ -13,9 +13,11 @@ using Standard.AI.OpenAI.Brokers.DateTimes; using Standard.AI.OpenAI.Brokers.OpenAIs; using Standard.AI.OpenAI.Models.Services.Foundations.ChatCompletions; +using Standard.AI.OpenAI.Models.Services.Foundations.ChatCompletions.Exceptions; using Standard.AI.OpenAI.Models.Services.Foundations.ExternalChatCompletions; using Standard.AI.OpenAI.Services.Foundations.ChatCompletions; using Tynamix.ObjectFiller; +using Xeptions; using Xunit; namespace Standard.AI.OpenAI.Tests.Unit.Services.Foundations.ChatCompletions @@ -154,5 +156,12 @@ private static Filler ChatCompletionFiller() return filler; } + + private static ChatCompletionValidationException createChatCompletionValidationException(Xeption innerException) + { + return new ChatCompletionValidationException( + message: "Chat completion validation error occurred, fix errors and try again.", + innerException); + } } } diff --git a/Standard.AI.OpenAI/Services/Foundations/ChatCompletions/ChatCompletionService.Exceptions.cs b/Standard.AI.OpenAI/Services/Foundations/ChatCompletions/ChatCompletionService.Exceptions.cs index 00b3b3a1..7d2f1314 100644 --- a/Standard.AI.OpenAI/Services/Foundations/ChatCompletions/ChatCompletionService.Exceptions.cs +++ b/Standard.AI.OpenAI/Services/Foundations/ChatCompletions/ChatCompletionService.Exceptions.cs @@ -7,6 +7,7 @@ using RESTFulSense.Exceptions; using Standard.AI.OpenAI.Models.Services.Foundations.ChatCompletions; using Standard.AI.OpenAI.Models.Services.Foundations.ChatCompletions.Exceptions; +using Xeptions; namespace Standard.AI.OpenAI.Services.Foundations.ChatCompletions { @@ -22,14 +23,12 @@ private async ValueTask TryCatch(ReturningChatCompletionFunction } catch (NullChatCompletionException nullChatCompletionException) { - throw new ChatCompletionValidationException( - message: "Chat completion validation error occurred, fix errors and try again.", + throw createChatCompletionValidationException( nullChatCompletionException); } catch (InvalidChatCompletionException invalidChatCompletionException) { - throw new ChatCompletionValidationException( - message: "Chat completion validation error occurred, fix errors and try again.", + throw createChatCompletionValidationException( invalidChatCompletionException); } catch (HttpResponseUrlNotFoundException httpResponseUrlNotFoundException) @@ -90,5 +89,12 @@ private async ValueTask TryCatch(ReturningChatCompletionFunction failedChatCompletionServiceException); } } + + private static ChatCompletionValidationException createChatCompletionValidationException(Xeption innerException) + { + return new ChatCompletionValidationException( + message: "Chat completion validation error occurred, fix errors and try again.", + innerException); + } } } \ No newline at end of file From c21ac0c249a7b78be903a08c9a806432bbd73320 Mon Sep 17 00:00:00 2001 From: Lezune Date: Fri, 31 May 2024 03:13:07 -0700 Subject: [PATCH 123/283] Added create methods to both ChatCompletions.Exceptions.cs and ChatCompletionServiceTests.cs as well as refactored code --- .../ChatCompletionServiceTests.Validations.Send.cs | 6 ++---- .../ChatCompletions/ChatCompletionServiceTests.cs | 8 ++++++++ .../Exceptions/InvalidChatCompletionException.cs | 3 +-- .../ChatCompletionService.Exceptions.cs | 11 +++++++++-- 4 files changed, 20 insertions(+), 8 deletions(-) diff --git a/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/ChatCompletions/ChatCompletionServiceTests.Validations.Send.cs b/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/ChatCompletions/ChatCompletionServiceTests.Validations.Send.cs index a74bb45e..b33af733 100644 --- a/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/ChatCompletions/ChatCompletionServiceTests.Validations.Send.cs +++ b/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/ChatCompletions/ChatCompletionServiceTests.Validations.Send.cs @@ -58,8 +58,7 @@ private async Task ShouldThrowValidationExceptionOnSendIfRequestIsNullAsync() invalidChatCompletion.Request = null; var invalidChatCompletionException = - new InvalidChatCompletionException( - message: "Chat completion is invalid."); + createInvalidChatCompletionException(); invalidChatCompletionException.AddData( key: nameof(ChatCompletion.Request), @@ -107,8 +106,7 @@ private async Task ShouldThrowValidationExceptionOnSendIfRequestIsInvalidAsync(s }; var invalidChatCompletionException = - new InvalidChatCompletionException( - message: "Chat completion is invalid."); + createInvalidChatCompletionException(); invalidChatCompletionException.AddData( key: nameof(ChatCompletion.Request.Model), diff --git a/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/ChatCompletions/ChatCompletionServiceTests.cs b/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/ChatCompletions/ChatCompletionServiceTests.cs index 465752a3..4243b7df 100644 --- a/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/ChatCompletions/ChatCompletionServiceTests.cs +++ b/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/ChatCompletions/ChatCompletionServiceTests.cs @@ -13,9 +13,11 @@ using Standard.AI.OpenAI.Brokers.DateTimes; using Standard.AI.OpenAI.Brokers.OpenAIs; using Standard.AI.OpenAI.Models.Services.Foundations.ChatCompletions; +using Standard.AI.OpenAI.Models.Services.Foundations.ChatCompletions.Exceptions; using Standard.AI.OpenAI.Models.Services.Foundations.ExternalChatCompletions; using Standard.AI.OpenAI.Services.Foundations.ChatCompletions; using Tynamix.ObjectFiller; +using Xeptions; using Xunit; namespace Standard.AI.OpenAI.Tests.Unit.Services.Foundations.ChatCompletions @@ -154,5 +156,11 @@ private static Filler ChatCompletionFiller() return filler; } + + private static InvalidChatCompletionException createInvalidChatCompletionException() + { + return new InvalidChatCompletionException( + message: "Chat completion is invalid."); + } } } diff --git a/Standard.AI.OpenAI/Models/Services/Foundations/ChatCompletions/Exceptions/InvalidChatCompletionException.cs b/Standard.AI.OpenAI/Models/Services/Foundations/ChatCompletions/Exceptions/InvalidChatCompletionException.cs index 57f8d84d..976a17fc 100644 --- a/Standard.AI.OpenAI/Models/Services/Foundations/ChatCompletions/Exceptions/InvalidChatCompletionException.cs +++ b/Standard.AI.OpenAI/Models/Services/Foundations/ChatCompletions/Exceptions/InvalidChatCompletionException.cs @@ -10,8 +10,7 @@ namespace Standard.AI.OpenAI.Models.Services.Foundations.ChatCompletions.Excepti public class InvalidChatCompletionException : Xeption { public InvalidChatCompletionException(string message) - : base( - message: "Chat completion is invalid.") + : base(message) { } public InvalidChatCompletionException(string message, Xeption innerException) : base(message, innerException) diff --git a/Standard.AI.OpenAI/Services/Foundations/ChatCompletions/ChatCompletionService.Exceptions.cs b/Standard.AI.OpenAI/Services/Foundations/ChatCompletions/ChatCompletionService.Exceptions.cs index 9a15c1d9..f1701a42 100644 --- a/Standard.AI.OpenAI/Services/Foundations/ChatCompletions/ChatCompletionService.Exceptions.cs +++ b/Standard.AI.OpenAI/Services/Foundations/ChatCompletions/ChatCompletionService.Exceptions.cs @@ -7,6 +7,7 @@ using RESTFulSense.Exceptions; using Standard.AI.OpenAI.Models.Services.Foundations.ChatCompletions; using Standard.AI.OpenAI.Models.Services.Foundations.ChatCompletions.Exceptions; +using Xeptions; namespace Standard.AI.OpenAI.Services.Foundations.ChatCompletions { @@ -59,8 +60,7 @@ private async ValueTask TryCatch(ReturningChatCompletionFunction catch (HttpResponseBadRequestException httpResponseBadRequestException) { var invalidChatCompletionException = - new InvalidChatCompletionException( - message: "Chat completion is invalid.", + createInvalidChatCompletionException( httpResponseBadRequestException); throw new ChatCompletionDependencyValidationException(invalidChatCompletionException); @@ -88,5 +88,12 @@ private async ValueTask TryCatch(ReturningChatCompletionFunction failedChatCompletionServiceException); } } + + private static InvalidChatCompletionException createInvalidChatCompletionException(Xeption innerException) + { + return new InvalidChatCompletionException( + message: "Chat completion is invalid.", + innerException); + } } } \ No newline at end of file From efdd319fab13994502c4f5bbf3cc560b7726b407 Mon Sep 17 00:00:00 2001 From: Lezune Date: Fri, 31 May 2024 03:21:24 -0700 Subject: [PATCH 124/283] Updated NullChatCompletionException class's constructor in which the error message was hard coded in. Updated all relevant service files to include message. --- .../ChatCompletionServiceTests.Validations.Send.cs | 3 ++- .../Exceptions/NullChatCompletionException.cs | 5 ++--- .../ChatCompletions/ChatCompletionService.Validations.cs | 3 ++- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/ChatCompletions/ChatCompletionServiceTests.Validations.Send.cs b/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/ChatCompletions/ChatCompletionServiceTests.Validations.Send.cs index 8557d1e4..386cdb59 100644 --- a/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/ChatCompletions/ChatCompletionServiceTests.Validations.Send.cs +++ b/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/ChatCompletions/ChatCompletionServiceTests.Validations.Send.cs @@ -21,7 +21,8 @@ private async Task ShouldThrowValidationExceptionOnSendIfChatCompletionIsNullAsy ChatCompletion nullChatCompletion = null; var nullChatCompletionException = - new NullChatCompletionException(); + new NullChatCompletionException( + message: "Chat completion is null."); var expectedChatCompletionValidationException = new ChatCompletionValidationException( diff --git a/Standard.AI.OpenAI/Models/Services/Foundations/ChatCompletions/Exceptions/NullChatCompletionException.cs b/Standard.AI.OpenAI/Models/Services/Foundations/ChatCompletions/Exceptions/NullChatCompletionException.cs index 9e48cbc3..f850d819 100644 --- a/Standard.AI.OpenAI/Models/Services/Foundations/ChatCompletions/Exceptions/NullChatCompletionException.cs +++ b/Standard.AI.OpenAI/Models/Services/Foundations/ChatCompletions/Exceptions/NullChatCompletionException.cs @@ -8,9 +8,8 @@ namespace Standard.AI.OpenAI.Models.Services.Foundations.ChatCompletions.Excepti { public class NullChatCompletionException : Xeption { - public NullChatCompletionException() - : base( - message: "Chat completion is null.") + public NullChatCompletionException(string message) + : base(message) { } public NullChatCompletionException(string message, Xeption innerException) diff --git a/Standard.AI.OpenAI/Services/Foundations/ChatCompletions/ChatCompletionService.Validations.cs b/Standard.AI.OpenAI/Services/Foundations/ChatCompletions/ChatCompletionService.Validations.cs index d23e5168..c57fc05a 100644 --- a/Standard.AI.OpenAI/Services/Foundations/ChatCompletions/ChatCompletionService.Validations.cs +++ b/Standard.AI.OpenAI/Services/Foundations/ChatCompletions/ChatCompletionService.Validations.cs @@ -30,7 +30,8 @@ private void ValidateChatCompletionIsNotNull(ChatCompletion chatCompletion) { if (chatCompletion is null) { - throw new NullChatCompletionException(); + throw new NullChatCompletionException( + message: "Chat completion is null."); } } From 7e584b314f90f7b82980a5a1da86b1d600673fcf Mon Sep 17 00:00:00 2001 From: Lezune Date: Fri, 31 May 2024 03:24:49 -0700 Subject: [PATCH 125/283] Added create methods to both ChatCompletions.Exceptions.cs and ChatCompletionServiceTests.cs as well as refactored code --- .../ChatCompletionService.Exceptions.cs | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/Standard.AI.OpenAI/Services/Foundations/ChatCompletions/ChatCompletionService.Exceptions.cs b/Standard.AI.OpenAI/Services/Foundations/ChatCompletions/ChatCompletionService.Exceptions.cs index 09b1a050..70f19452 100644 --- a/Standard.AI.OpenAI/Services/Foundations/ChatCompletions/ChatCompletionService.Exceptions.cs +++ b/Standard.AI.OpenAI/Services/Foundations/ChatCompletions/ChatCompletionService.Exceptions.cs @@ -38,8 +38,7 @@ private async ValueTask TryCatch(ReturningChatCompletionFunction catch (HttpResponseUnauthorizedException httpResponseUnauthorizedException) { var unauthorizedChatCompletionException = - new UnauthorizedChatCompletionException( - message: "Unauthorized chat completion request, fix errors and try again.", + createUnauthorizedChatCompletionException( httpResponseUnauthorizedException); throw new ChatCompletionDependencyException(unauthorizedChatCompletionException); @@ -47,8 +46,7 @@ private async ValueTask TryCatch(ReturningChatCompletionFunction catch (HttpResponseForbiddenException httpResponseForbiddenException) { var unauthorizedChatCompletionException = - new UnauthorizedChatCompletionException( - message: "Unauthorized chat completion request, fix errors and try again.", + createUnauthorizedChatCompletionException( httpResponseForbiddenException); throw new ChatCompletionDependencyException(unauthorizedChatCompletionException); @@ -90,5 +88,12 @@ private async ValueTask TryCatch(ReturningChatCompletionFunction failedChatCompletionServiceException); } } + + private static UnauthorizedChatCompletionException createUnauthorizedChatCompletionException(Exception innerException) + { + return new UnauthorizedChatCompletionException( + message: "Unauthorized chat completion request, fix errors and try again.", + innerException); + } } } \ No newline at end of file From b0d6e603d2d097fa6e93f89204cd34a1827fa0b9 Mon Sep 17 00:00:00 2001 From: Lezune Date: Fri, 31 May 2024 03:38:55 -0700 Subject: [PATCH 126/283] Added create methods to both CompletionService.Exceptions.cs and CompletionServiceTests.cs as well as refactored code --- ...ompletionServiceTests.Exceptions.Prompt.cs | 15 ++++++--------- .../Completions/CompletionServiceTests.cs | 9 +++++++++ .../CompletionService.Exceptions.cs | 19 +++++++++++-------- .../Completions/CompletionService.cs | 2 ++ 4 files changed, 28 insertions(+), 17 deletions(-) diff --git a/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/Completions/CompletionServiceTests.Exceptions.Prompt.cs b/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/Completions/CompletionServiceTests.Exceptions.Prompt.cs index 9c1d8fa6..ac219a33 100644 --- a/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/Completions/CompletionServiceTests.Exceptions.Prompt.cs +++ b/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/Completions/CompletionServiceTests.Exceptions.Prompt.cs @@ -31,9 +31,8 @@ private async Task ShouldThrowDependencyExceptionOnPromptIfUrlNotFoundErrorOccur innerException: httpResponseUrlNotFoundException); var expectedCompletionDependencyException = - new CompletionDependencyException( - message: "Completion dependency error occurred, contact support.", - innerException: invalidConfigurationCompletionException); + createCompletionDependencyException( + innerException: invalidConfigurationCompletionException); this.openAIBrokerMock.Setup(broker => broker.PostCompletionRequestAsync( It.IsAny())) @@ -74,9 +73,8 @@ private async Task ShouldThrowDependencyExceptionOnPromptIfUnauthorizedAsync( innerException: unauthorizedException); var expectedCompletionDependencyException = - new CompletionDependencyException( - message: "Completion dependency error occurred, contact support.", - innerException: unauthorizedCompletionException); + createCompletionDependencyException( + innerException: unauthorizedCompletionException); this.openAIBrokerMock.Setup(broker => broker.PostCompletionRequestAsync( @@ -252,9 +250,8 @@ private async Task ShouldThrowDependencyExceptionOnPromptIfHttpErrorOccursAsync( innerException: httpResponseException); var expectedCompletionDependencyException = - new CompletionDependencyException( - message: "Completion dependency error occurred, contact support.", - innerException: failedServerCompletionException); + createCompletionDependencyException( + innerException: failedServerCompletionException); this.openAIBrokerMock.Setup(broker => broker.PostCompletionRequestAsync( It.IsAny())) diff --git a/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/Completions/CompletionServiceTests.cs b/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/Completions/CompletionServiceTests.cs index 265c636a..539dd672 100644 --- a/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/Completions/CompletionServiceTests.cs +++ b/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/Completions/CompletionServiceTests.cs @@ -12,9 +12,11 @@ using Standard.AI.OpenAI.Brokers.DateTimes; using Standard.AI.OpenAI.Brokers.OpenAIs; using Standard.AI.OpenAI.Models.Services.Foundations.Completions; +using Standard.AI.OpenAI.Models.Services.Foundations.Completions.Exceptions; using Standard.AI.OpenAI.Models.Services.Foundations.ExternalCompletions; using Standard.AI.OpenAI.Services.Foundations.Completions; using Tynamix.ObjectFiller; +using Xeptions; using Xunit; namespace Standard.AI.OpenAI.Tests.Unit.Services.Foundations.Completions @@ -141,5 +143,12 @@ private static Filler CreateCompletionFiller() return filler; } + + private static CompletionDependencyException createCompletionDependencyException(Xeption innerException) + { + return new CompletionDependencyException( + message: "Completion dependency error occurred, contact support.", + innerException); + } } } diff --git a/Standard.AI.OpenAI/Services/Foundations/Completions/CompletionService.Exceptions.cs b/Standard.AI.OpenAI/Services/Foundations/Completions/CompletionService.Exceptions.cs index 5ceb2894..0426c831 100644 --- a/Standard.AI.OpenAI/Services/Foundations/Completions/CompletionService.Exceptions.cs +++ b/Standard.AI.OpenAI/Services/Foundations/Completions/CompletionService.Exceptions.cs @@ -7,6 +7,7 @@ using RESTFulSense.Exceptions; using Standard.AI.OpenAI.Models.Services.Foundations.Completions; using Standard.AI.OpenAI.Models.Services.Foundations.Completions.Exceptions; +using Xeptions; namespace Standard.AI.OpenAI.Services.Foundations.Completions { @@ -34,8 +35,7 @@ private static async ValueTask TryCatch(ReturningCompletionFunction var invalidConfigurationCompletionException = new InvalidConfigurationCompletionException(httpResponseUrlNotFoundException); - throw new CompletionDependencyException( - message: "Completion dependency error occurred, contact support.", + throw createCompletionDependencyException( invalidConfigurationCompletionException); } catch (HttpResponseUnauthorizedException httpResponseUnauthorizedException) @@ -43,8 +43,7 @@ private static async ValueTask TryCatch(ReturningCompletionFunction var unauthorizedCompletionException = new UnauthorizedCompletionException(httpResponseUnauthorizedException); - throw new CompletionDependencyException( - message: "Completion dependency error occurred, contact support.", + throw createCompletionDependencyException( unauthorizedCompletionException); } catch (HttpResponseForbiddenException httpResponseForbiddenException) @@ -52,8 +51,7 @@ private static async ValueTask TryCatch(ReturningCompletionFunction var unauthorizedCompletionException = new UnauthorizedCompletionException(httpResponseForbiddenException); - throw new CompletionDependencyException( - message: "Completion dependency error occurred, contact support.", + throw createCompletionDependencyException( unauthorizedCompletionException); } catch (HttpResponseNotFoundException httpResponseNotFoundException) @@ -83,8 +81,7 @@ private static async ValueTask TryCatch(ReturningCompletionFunction var failedServerCompletionException = new FailedServerCompletionException(httpResponseException); - throw new CompletionDependencyException( - message: "Completion dependency error occurred, contact support.", + throw createCompletionDependencyException( failedServerCompletionException); } catch (Exception exception) @@ -95,5 +92,11 @@ private static async ValueTask TryCatch(ReturningCompletionFunction throw new CompletionServiceException(failedCompletionServiceException); } } + private static CompletionDependencyException createCompletionDependencyException(Xeption innerException) + { + return new CompletionDependencyException( + message: "Completion dependency error occurred, contact support.", + innerException); + } } } diff --git a/Standard.AI.OpenAI/Services/Foundations/Completions/CompletionService.cs b/Standard.AI.OpenAI/Services/Foundations/Completions/CompletionService.cs index 0083298c..f27c5ea8 100644 --- a/Standard.AI.OpenAI/Services/Foundations/Completions/CompletionService.cs +++ b/Standard.AI.OpenAI/Services/Foundations/Completions/CompletionService.cs @@ -7,7 +7,9 @@ using Standard.AI.OpenAI.Brokers.DateTimes; using Standard.AI.OpenAI.Brokers.OpenAIs; using Standard.AI.OpenAI.Models.Services.Foundations.Completions; +using Standard.AI.OpenAI.Models.Services.Foundations.Completions.Exceptions; using Standard.AI.OpenAI.Models.Services.Foundations.ExternalCompletions; +using Xeptions; namespace Standard.AI.OpenAI.Services.Foundations.Completions { From 398e1df1aef3fb852f83b7ce8175d09a262b6265 Mon Sep 17 00:00:00 2001 From: Lezune Date: Fri, 31 May 2024 03:51:43 -0700 Subject: [PATCH 127/283] Added create methods to both CompletionService.Exceptions.cs and CompletionServiceTests.cs as well as refactored code --- ...mpletionServiceTests.Validations.Prompt.cs | 20 ++++++++----------- .../Completions/CompletionServiceTests.cs | 9 +++++++++ .../CompletionService.Exceptions.cs | 15 ++++++++++---- 3 files changed, 28 insertions(+), 16 deletions(-) diff --git a/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/Completions/CompletionServiceTests.Validations.Prompt.cs b/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/Completions/CompletionServiceTests.Validations.Prompt.cs index e6b84b3c..6356ad5b 100644 --- a/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/Completions/CompletionServiceTests.Validations.Prompt.cs +++ b/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/Completions/CompletionServiceTests.Validations.Prompt.cs @@ -23,9 +23,8 @@ private async Task ShouldThrowValidationExceptionOnPromptIfCompletionIsNullAsync var nullCompletionException = new NullCompletionException(); var exceptedCompletionValidationException = - new CompletionValidationException( - message: "Completion validation error occurred, fix errors and try again.", - innerException: nullCompletionException); + createCompletionValidationException( + innerException: nullCompletionException); // when ValueTask promptCompletionTask = @@ -63,9 +62,8 @@ private async Task ShouldThrowValidationExceptionOnPromptIfRequestIsNullAsync() values: "Value is required"); var expectedCompletionValidationException = - new CompletionValidationException( - message: "Completion validation error occurred, fix errors and try again.", - innerException: invalidCompletionException); + createCompletionValidationException( + innerException: invalidCompletionException); // when ValueTask promptCompletionTask = @@ -114,9 +112,8 @@ private async Task ShouldThrowValidationExceptionOnPromptIfCompletionIsInvalidAs values: "Value is required"); var expectedCompletionValidationException = - new CompletionValidationException( - message: "Completion validation error occurred, fix errors and try again.", - innerException: invalidCompletionException); + createCompletionValidationException( + innerException: invalidCompletionException); // when ValueTask promptCompletionTask = @@ -153,9 +150,8 @@ private async Task ShouldThrowValidationExceptionOnPromptIfPromptIsEmptyAsync() values: "Value is required"); var expectedCompletionValidationException = - new CompletionValidationException( - message: "Completion validation error occurred, fix errors and try again.", - innerException: invalidCompletionException); + createCompletionValidationException( + innerException: invalidCompletionException); // when ValueTask promptCompletionTask = diff --git a/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/Completions/CompletionServiceTests.cs b/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/Completions/CompletionServiceTests.cs index 265c636a..bfa7d81b 100644 --- a/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/Completions/CompletionServiceTests.cs +++ b/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/Completions/CompletionServiceTests.cs @@ -12,9 +12,11 @@ using Standard.AI.OpenAI.Brokers.DateTimes; using Standard.AI.OpenAI.Brokers.OpenAIs; using Standard.AI.OpenAI.Models.Services.Foundations.Completions; +using Standard.AI.OpenAI.Models.Services.Foundations.Completions.Exceptions; using Standard.AI.OpenAI.Models.Services.Foundations.ExternalCompletions; using Standard.AI.OpenAI.Services.Foundations.Completions; using Tynamix.ObjectFiller; +using Xeptions; using Xunit; namespace Standard.AI.OpenAI.Tests.Unit.Services.Foundations.Completions @@ -141,5 +143,12 @@ private static Filler CreateCompletionFiller() return filler; } + + private static CompletionValidationException createCompletionValidationException(Xeption innerException) + { + return new CompletionValidationException( + message: "Completion validation error occurred, fix errors and try again.", + innerException); + } } } diff --git a/Standard.AI.OpenAI/Services/Foundations/Completions/CompletionService.Exceptions.cs b/Standard.AI.OpenAI/Services/Foundations/Completions/CompletionService.Exceptions.cs index 193ad4f5..7ecc885d 100644 --- a/Standard.AI.OpenAI/Services/Foundations/Completions/CompletionService.Exceptions.cs +++ b/Standard.AI.OpenAI/Services/Foundations/Completions/CompletionService.Exceptions.cs @@ -7,6 +7,7 @@ using RESTFulSense.Exceptions; using Standard.AI.OpenAI.Models.Services.Foundations.Completions; using Standard.AI.OpenAI.Models.Services.Foundations.Completions.Exceptions; +using Xeptions; namespace Standard.AI.OpenAI.Services.Foundations.Completions { @@ -22,14 +23,12 @@ private static async ValueTask TryCatch(ReturningCompletionFunction } catch (NullCompletionException nullCompletionException) { - throw new CompletionValidationException( - message: "Completion validation error occurred, fix errors and try again.", + throw createCompletionValidationException( nullCompletionException); } catch (InvalidCompletionException invalidCompletionException) { - throw new CompletionValidationException( - message: "Completion validation error occurred, fix errors and try again.", + throw createCompletionValidationException( invalidCompletionException); } catch (HttpResponseUrlNotFoundException httpResponseUrlNotFoundException) @@ -90,5 +89,13 @@ private static async ValueTask TryCatch(ReturningCompletionFunction throw new CompletionServiceException(failedCompletionServiceException); } } + + private static CompletionValidationException createCompletionValidationException(Xeption innerException) + { + return new CompletionValidationException( + message: "Completion validation error occurred, fix errors and try again.", + innerException); + } + } } From 503b888da414c17e9b9d8c8d361d96449fad90b3 Mon Sep 17 00:00:00 2001 From: Lezune Date: Fri, 31 May 2024 03:57:41 -0700 Subject: [PATCH 128/283] Added create methods to both CompletionService.Exceptions.cs and CompletionServiceTests.cs as well as refactored code --- .../CompletionServiceTests.Validations.Prompt.cs | 13 +++++-------- .../Completions/CompletionServiceTests.cs | 7 +++++++ 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/Completions/CompletionServiceTests.Validations.Prompt.cs b/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/Completions/CompletionServiceTests.Validations.Prompt.cs index cd1e6be8..c705dd1a 100644 --- a/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/Completions/CompletionServiceTests.Validations.Prompt.cs +++ b/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/Completions/CompletionServiceTests.Validations.Prompt.cs @@ -56,8 +56,7 @@ private async Task ShouldThrowValidationExceptionOnPromptIfRequestIsNullAsync() invalidCompletion.Request = null; var invalidCompletionException = - new InvalidCompletionException( - message: "Invalid completion error occurred, fix errors and try again."); + createInvalidCompletionException(); invalidCompletionException.AddData( key: nameof(Completion.Request), @@ -104,9 +103,8 @@ private async Task ShouldThrowValidationExceptionOnPromptIfCompletionIsInvalidAs } }; - var invalidCompletionException = - new InvalidCompletionException( - message: "Invalid completion error occurred, fix errors and try again."); + var invalidCompletionException = + createInvalidCompletionException(); invalidCompletionException.AddData( key: nameof(CompletionRequest.Model), @@ -149,9 +147,8 @@ private async Task ShouldThrowValidationExceptionOnPromptIfPromptIsEmptyAsync() } }; - var invalidCompletionException = - new InvalidCompletionException( - message: "Invalid completion error occurred, fix errors and try again."); + var invalidCompletionException = + createInvalidCompletionException(); invalidCompletionException.AddData( key: nameof(CompletionRequest.Prompts), diff --git a/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/Completions/CompletionServiceTests.cs b/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/Completions/CompletionServiceTests.cs index 265c636a..f55b9cf4 100644 --- a/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/Completions/CompletionServiceTests.cs +++ b/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/Completions/CompletionServiceTests.cs @@ -12,6 +12,7 @@ using Standard.AI.OpenAI.Brokers.DateTimes; using Standard.AI.OpenAI.Brokers.OpenAIs; using Standard.AI.OpenAI.Models.Services.Foundations.Completions; +using Standard.AI.OpenAI.Models.Services.Foundations.Completions.Exceptions; using Standard.AI.OpenAI.Models.Services.Foundations.ExternalCompletions; using Standard.AI.OpenAI.Services.Foundations.Completions; using Tynamix.ObjectFiller; @@ -141,5 +142,11 @@ private static Filler CreateCompletionFiller() return filler; } + + private static InvalidCompletionException createInvalidCompletionException() + { + return new InvalidCompletionException( + message: "Invalid completion error occurred, fix errors and try again."); + } } } From 2a090576c09429bde4313b67719a53a8db073c1d Mon Sep 17 00:00:00 2001 From: Lezune Date: Fri, 31 May 2024 04:03:58 -0700 Subject: [PATCH 129/283] Added create methods to both CompletionService.Exceptions.cs as well as refactored code --- .../Completions/CompletionService.Exceptions.cs | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/Standard.AI.OpenAI/Services/Foundations/Completions/CompletionService.Exceptions.cs b/Standard.AI.OpenAI/Services/Foundations/Completions/CompletionService.Exceptions.cs index 4d4657a5..d7eeb145 100644 --- a/Standard.AI.OpenAI/Services/Foundations/Completions/CompletionService.Exceptions.cs +++ b/Standard.AI.OpenAI/Services/Foundations/Completions/CompletionService.Exceptions.cs @@ -39,8 +39,7 @@ private static async ValueTask TryCatch(ReturningCompletionFunction catch (HttpResponseUnauthorizedException httpResponseUnauthorizedException) { var unauthorizedCompletionException = - new UnauthorizedCompletionException( - message: "Unauthorized completion request, fix errors and try again.", + createUnauthorizedCompletionException( httpResponseUnauthorizedException); throw new CompletionDependencyException(unauthorizedCompletionException); @@ -48,8 +47,7 @@ private static async ValueTask TryCatch(ReturningCompletionFunction catch (HttpResponseForbiddenException httpResponseForbiddenException) { var unauthorizedCompletionException = - new UnauthorizedCompletionException( - message: "Unauthorized completion request, fix errors and try again.", + createUnauthorizedCompletionException( httpResponseForbiddenException); throw new CompletionDependencyException(unauthorizedCompletionException); @@ -91,5 +89,12 @@ private static async ValueTask TryCatch(ReturningCompletionFunction throw new CompletionServiceException(failedCompletionServiceException); } } + + private static UnauthorizedCompletionException createUnauthorizedCompletionException(Exception innerException) + { + return new UnauthorizedCompletionException( + message: "Unauthorized completion request, fix errors and try again.", + innerException); + } } } From 1d4a1e3803599fd62c7d73776031b163e864ca2a Mon Sep 17 00:00:00 2001 From: Lezune Date: Fri, 31 May 2024 04:23:12 -0700 Subject: [PATCH 130/283] Added create methods to both FineTuneService.Exceptions.cs and FineTuneServiceTests.cs as well as refactored code --- .../FineTuneServiceTests.Exceptions.Submit.cs | 15 ++++++-------- .../FineTunes/FineTuneServiceTests.cs | 9 +++++++++ .../FineTunes/FineTuneService.Exceptions.cs | 20 +++++++++++-------- 3 files changed, 27 insertions(+), 17 deletions(-) diff --git a/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/FineTunes/FineTuneServiceTests.Exceptions.Submit.cs b/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/FineTunes/FineTuneServiceTests.Exceptions.Submit.cs index 7e22d0a0..4c482420 100644 --- a/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/FineTunes/FineTuneServiceTests.Exceptions.Submit.cs +++ b/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/FineTunes/FineTuneServiceTests.Exceptions.Submit.cs @@ -31,9 +31,8 @@ private async Task ShouldThrowDependencyExceptionOnSubmitIfUrlNotFoundAsync() innerException: httpResponseUrlNotFoundException); var expectedFineTuneDependencyException = - new FineTuneDependencyException( - message: "Fine tune dependency error ocurred, contact support.", - innerException: invalidFineTuneConfigurationException); + createFineTuneDependencyException( + innerException: invalidFineTuneConfigurationException); this.openAIBrokerMock.Setup(broker => broker.PostFineTuneAsync(It.IsAny())) @@ -74,9 +73,8 @@ private async Task ShouldThrowDependencyExceptionOnSubmitIfUnauthorizedException innerException: unauthorizedException); var expectedFineTuneDependencyException = - new FineTuneDependencyException( - message: "Fine tune dependency error ocurred, contact support.", - innerException: unauthorizedFineTuneException); + createFineTuneDependencyException( + innerException: unauthorizedFineTuneException); this.openAIBrokerMock.Setup(broker => broker.PostFineTuneAsync(It.IsAny())) @@ -206,9 +204,8 @@ private async Task ShouldThrowDependencyExceptionOnSubmitIfServerErrorOccursAsyn innerException: httpResponseException); var expectedFineTuneDependencyException = - new FineTuneDependencyException( - message: "Fine tune dependency error ocurred, contact support.", - innerException: failedServerFineTuneException); + createFineTuneDependencyException( + innerException: failedServerFineTuneException); this.openAIBrokerMock.Setup(broker => broker.PostFineTuneAsync(It.IsAny())) diff --git a/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/FineTunes/FineTuneServiceTests.cs b/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/FineTunes/FineTuneServiceTests.cs index 54baf9de..dcd0e2ed 100644 --- a/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/FineTunes/FineTuneServiceTests.cs +++ b/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/FineTunes/FineTuneServiceTests.cs @@ -13,8 +13,10 @@ using Standard.AI.OpenAI.Brokers.OpenAIs; using Standard.AI.OpenAI.Models.Services.Foundations.ExternalFineTunes; using Standard.AI.OpenAI.Models.Services.Foundations.FineTunes; +using Standard.AI.OpenAI.Models.Services.Foundations.FineTunes.Exceptions; using Standard.AI.OpenAI.Services.Foundations.FineTunes; using Tynamix.ObjectFiller; +using Xeptions; using Xunit; namespace Standard.AI.OpenAI.Tests.Unit.Services.Foundations.FineTunes @@ -186,5 +188,12 @@ private static Filler CreateRandomFineTuneFiller() return filler; } + + private static FineTuneDependencyException createFineTuneDependencyException(Xeption innerException) + { + return new FineTuneDependencyException( + message: "Fine tune dependency error ocurred, contact support.", + innerException); + } } } \ No newline at end of file diff --git a/Standard.AI.OpenAI/Services/Foundations/FineTunes/FineTuneService.Exceptions.cs b/Standard.AI.OpenAI/Services/Foundations/FineTunes/FineTuneService.Exceptions.cs index e4bcf518..987722e0 100644 --- a/Standard.AI.OpenAI/Services/Foundations/FineTunes/FineTuneService.Exceptions.cs +++ b/Standard.AI.OpenAI/Services/Foundations/FineTunes/FineTuneService.Exceptions.cs @@ -7,6 +7,7 @@ using RESTFulSense.Exceptions; using Standard.AI.OpenAI.Models.Services.Foundations.FineTunes; using Standard.AI.OpenAI.Models.Services.Foundations.FineTunes.Exceptions; +using Xeptions; namespace Standard.AI.OpenAI.Services.Foundations.FineTunes { @@ -33,8 +34,7 @@ private static async ValueTask TryCatch(ReturningFineTuneFunction retu var invalidFineTuneConfigurationException = new InvalidFineTuneConfigurationException(httpResponseUrlNotFoundException); - throw new FineTuneDependencyException( - message: "Fine tune dependency error ocurred, contact support.", + throw createFineTuneDependencyException( invalidFineTuneConfigurationException); } catch (HttpResponseUnauthorizedException httpResponseUnauthorizedException) @@ -43,8 +43,7 @@ private static async ValueTask TryCatch(ReturningFineTuneFunction retu new UnauthorizedFineTuneException( httpResponseUnauthorizedException); - throw new FineTuneDependencyException( - message: "Fine tune dependency error ocurred, contact support.", + throw createFineTuneDependencyException( unauthorizedFineTuneException); } catch (HttpResponseForbiddenException httpResponseForbiddenException) @@ -53,8 +52,7 @@ private static async ValueTask TryCatch(ReturningFineTuneFunction retu new UnauthorizedFineTuneException( httpResponseForbiddenException); - throw new FineTuneDependencyException( - message: "Fine tune dependency error ocurred, contact support.", + throw createFineTuneDependencyException( unauthorizedFineTuneException); } catch (HttpResponseBadRequestException httpResponseBadRequestException) @@ -77,8 +75,7 @@ private static async ValueTask TryCatch(ReturningFineTuneFunction retu var failedServerFineTuneException = new FailedServerFineTuneException(httpResponseException); - throw new FineTuneDependencyException( - message: "Fine tune dependency error ocurred, contact support.", + throw createFineTuneDependencyException( failedServerFineTuneException); } catch (Exception exception) @@ -89,5 +86,12 @@ private static async ValueTask TryCatch(ReturningFineTuneFunction retu throw new FineTuneServiceException(failedFineTuneServiceException); } } + + private static FineTuneDependencyException createFineTuneDependencyException(Xeption innerException) + { + return new FineTuneDependencyException( + message: "Fine tune dependency error ocurred, contact support.", + innerException); + } } } From 986c925cfd5ac75e8298442d9703c6d728b0b1ba Mon Sep 17 00:00:00 2001 From: Lezune Date: Fri, 31 May 2024 04:29:13 -0700 Subject: [PATCH 131/283] Added create methods to both FineTuneService.Exceptions.cs and FineTuneServiceTests.cs as well as refactored code --- .../FineTuneServiceTests.Exceptions.Submit.cs | 8 +++----- .../Foundations/FineTunes/FineTuneServiceTests.cs | 9 +++++++++ .../FineTunes/FineTuneService.Exceptions.cs | 14 ++++++++++---- 3 files changed, 22 insertions(+), 9 deletions(-) diff --git a/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/FineTunes/FineTuneServiceTests.Exceptions.Submit.cs b/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/FineTunes/FineTuneServiceTests.Exceptions.Submit.cs index 7e22d0a0..4ad8d5e6 100644 --- a/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/FineTunes/FineTuneServiceTests.Exceptions.Submit.cs +++ b/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/FineTunes/FineTuneServiceTests.Exceptions.Submit.cs @@ -118,9 +118,8 @@ private async Task ShouldThrowDependencyValidationExceptionOnSubmitIfBadRequestE innerException: httpResponseBadRequestException); var expectedFineTuneDependencyValidationException = - new FineTuneDependencyValidationException( - message: "Fine tune dependency validation error occurred, fix errors and try again", - innerException: invalidFineTuneException); + createFineTuneDependencyValidationException( + innerException: invalidFineTuneException); this.openAIBrokerMock.Setup(broker => broker.PostFineTuneAsync(It.IsAny())) @@ -162,8 +161,7 @@ private async Task ShouldThrowDependencyValidationExceptionOnSubmitIfTooManyRequ innerException: httpResponseTooManyRequestsException); var expectedFineTuneDependencyValidationException = - new FineTuneDependencyValidationException( - message: "Fine tune dependency validation error occurred, fix errors and try again", + createFineTuneDependencyValidationException( innerException: excessiveCallFineTuneException); this.openAIBrokerMock.Setup(broker => diff --git a/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/FineTunes/FineTuneServiceTests.cs b/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/FineTunes/FineTuneServiceTests.cs index 54baf9de..14ea1368 100644 --- a/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/FineTunes/FineTuneServiceTests.cs +++ b/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/FineTunes/FineTuneServiceTests.cs @@ -13,8 +13,10 @@ using Standard.AI.OpenAI.Brokers.OpenAIs; using Standard.AI.OpenAI.Models.Services.Foundations.ExternalFineTunes; using Standard.AI.OpenAI.Models.Services.Foundations.FineTunes; +using Standard.AI.OpenAI.Models.Services.Foundations.FineTunes.Exceptions; using Standard.AI.OpenAI.Services.Foundations.FineTunes; using Tynamix.ObjectFiller; +using Xeptions; using Xunit; namespace Standard.AI.OpenAI.Tests.Unit.Services.Foundations.FineTunes @@ -186,5 +188,12 @@ private static Filler CreateRandomFineTuneFiller() return filler; } + + private static FineTuneDependencyValidationException createFineTuneDependencyValidationException(Xeption innerException) + { + return new FineTuneDependencyValidationException( + message: "Fine tune dependency validation error occurred, fix errors and try again", + innerException); + } } } \ No newline at end of file diff --git a/Standard.AI.OpenAI/Services/Foundations/FineTunes/FineTuneService.Exceptions.cs b/Standard.AI.OpenAI/Services/Foundations/FineTunes/FineTuneService.Exceptions.cs index bb69d9d0..33809509 100644 --- a/Standard.AI.OpenAI/Services/Foundations/FineTunes/FineTuneService.Exceptions.cs +++ b/Standard.AI.OpenAI/Services/Foundations/FineTunes/FineTuneService.Exceptions.cs @@ -7,6 +7,7 @@ using RESTFulSense.Exceptions; using Standard.AI.OpenAI.Models.Services.Foundations.FineTunes; using Standard.AI.OpenAI.Models.Services.Foundations.FineTunes.Exceptions; +using Xeptions; namespace Standard.AI.OpenAI.Services.Foundations.FineTunes { @@ -57,8 +58,7 @@ private static async ValueTask TryCatch(ReturningFineTuneFunction retu new InvalidFineTuneException( httpResponseBadRequestException); - throw new FineTuneDependencyValidationException( - message: "Fine tune dependency validation error occurred, fix errors and try again", + throw createFineTuneDependencyValidationException( invalidFineTuneException); } catch (HttpResponseTooManyRequestsException httpResponseTooManyRequestsException) @@ -66,8 +66,7 @@ private static async ValueTask TryCatch(ReturningFineTuneFunction retu var excessiveCallFineTuneException = new ExcessiveCallFineTuneException(httpResponseTooManyRequestsException); - throw new FineTuneDependencyValidationException( - message: "Fine tune dependency validation error occurred, fix errors and try again", + throw createFineTuneDependencyValidationException( excessiveCallFineTuneException); } catch (HttpResponseException httpResponseException) @@ -85,5 +84,12 @@ private static async ValueTask TryCatch(ReturningFineTuneFunction retu throw new FineTuneServiceException(failedFineTuneServiceException); } } + + private static FineTuneDependencyValidationException createFineTuneDependencyValidationException(Xeption innerException) + { + return new FineTuneDependencyValidationException( + message: "Fine tune dependency validation error occurred, fix errors and try again", + innerException); + } } } From 12740c151a0e6246b8c2c2138e7d175ced869cd9 Mon Sep 17 00:00:00 2001 From: Lezune Date: Fri, 31 May 2024 04:36:50 -0700 Subject: [PATCH 132/283] Added create methods to both FineTuneService.Exceptions.cs and FineTuneServiceTests.cs as well as refactored code --- .../FineTuneServiceTests.Validations.Submit.cs | 15 ++++++--------- .../Foundations/FineTunes/FineTuneServiceTests.cs | 9 +++++++++ .../FineTunes/FineTuneService.Exceptions.cs | 14 ++++++++++---- 3 files changed, 25 insertions(+), 13 deletions(-) diff --git a/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/FineTunes/FineTuneServiceTests.Validations.Submit.cs b/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/FineTunes/FineTuneServiceTests.Validations.Submit.cs index e0bcf7b1..0e559460 100644 --- a/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/FineTunes/FineTuneServiceTests.Validations.Submit.cs +++ b/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/FineTunes/FineTuneServiceTests.Validations.Submit.cs @@ -24,9 +24,8 @@ private async Task ShouldThrowValidationExceptionOnSubmitIfFineTuneIsNullAsync() new NullFineTuneException(); var expectedFineTuneValidationException = - new FineTuneValidationException( - message: "Fine tune validation error occurred, fix errors and try again.", - innerException: nullFineTuneException); + createFineTuneValidationException( + innerException: nullFineTuneException); // when ValueTask sendFineTuneTask = @@ -67,9 +66,8 @@ private async Task ShouldThrowValidationExceptionOnSubmitIfFineTuneRequestIsNull values: "Value is required"); var expectedFineTuneValidationException = - new FineTuneValidationException( - message: "Fine tune validation error occurred, fix errors and try again.", - innerException: invalidFineTuneException); + createFineTuneValidationException( + innerException: invalidFineTuneException); // when ValueTask submitFineTuneTask = @@ -111,9 +109,8 @@ private async Task ShouldThrowValidationExceptionOnSubmitIfFineTuneRequestIsInva values: "Value is required"); var exceptedFineTuneValidationException = - new FineTuneValidationException( - message: "Fine tune validation error occurred, fix errors and try again.", - innerException: invalidFineTuneException); + createFineTuneValidationException( + innerException: invalidFineTuneException); // when ValueTask sendFineTuneTask = diff --git a/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/FineTunes/FineTuneServiceTests.cs b/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/FineTunes/FineTuneServiceTests.cs index 54baf9de..689bac6c 100644 --- a/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/FineTunes/FineTuneServiceTests.cs +++ b/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/FineTunes/FineTuneServiceTests.cs @@ -13,8 +13,10 @@ using Standard.AI.OpenAI.Brokers.OpenAIs; using Standard.AI.OpenAI.Models.Services.Foundations.ExternalFineTunes; using Standard.AI.OpenAI.Models.Services.Foundations.FineTunes; +using Standard.AI.OpenAI.Models.Services.Foundations.FineTunes.Exceptions; using Standard.AI.OpenAI.Services.Foundations.FineTunes; using Tynamix.ObjectFiller; +using Xeptions; using Xunit; namespace Standard.AI.OpenAI.Tests.Unit.Services.Foundations.FineTunes @@ -186,5 +188,12 @@ private static Filler CreateRandomFineTuneFiller() return filler; } + + private static FineTuneValidationException createFineTuneValidationException(Xeption innerException) + { + return new FineTuneValidationException( + message: "Fine tune validation error occurred, fix errors and try again.", + innerException); + } } } \ No newline at end of file diff --git a/Standard.AI.OpenAI/Services/Foundations/FineTunes/FineTuneService.Exceptions.cs b/Standard.AI.OpenAI/Services/Foundations/FineTunes/FineTuneService.Exceptions.cs index 5317331a..29eb9dc6 100644 --- a/Standard.AI.OpenAI/Services/Foundations/FineTunes/FineTuneService.Exceptions.cs +++ b/Standard.AI.OpenAI/Services/Foundations/FineTunes/FineTuneService.Exceptions.cs @@ -7,6 +7,7 @@ using RESTFulSense.Exceptions; using Standard.AI.OpenAI.Models.Services.Foundations.FineTunes; using Standard.AI.OpenAI.Models.Services.Foundations.FineTunes.Exceptions; +using Xeptions; namespace Standard.AI.OpenAI.Services.Foundations.FineTunes { @@ -22,14 +23,12 @@ private static async ValueTask TryCatch(ReturningFineTuneFunction retu } catch (NullFineTuneException nullFineTuneException) { - throw new FineTuneValidationException( - message: "Fine tune validation error occurred, fix errors and try again.", + throw createFineTuneValidationException( nullFineTuneException); } catch (InvalidFineTuneException invalidFineTuneException) { - throw new FineTuneValidationException( - message: "Fine tune validation error occurred, fix errors and try again.", + throw createFineTuneValidationException( invalidFineTuneException); } catch (HttpResponseUrlNotFoundException httpResponseUrlNotFoundException) @@ -85,5 +84,12 @@ private static async ValueTask TryCatch(ReturningFineTuneFunction retu throw new FineTuneServiceException(failedFineTuneServiceException); } } + + private static FineTuneValidationException createFineTuneValidationException(Xeption innerException) + { + return new FineTuneValidationException( + message: "Fine tune validation error occurred, fix errors and try again.", + innerException); + } } } From 978843e0e9b1a4ef7f5e3fd2ccd86aaaa5b1ccfc Mon Sep 17 00:00:00 2001 From: Lezune Date: Fri, 31 May 2024 04:42:45 -0700 Subject: [PATCH 133/283] Added create methods to both FineTuneService.Exceptions.cs and FineTuneServiceTests.cs as well as refactored code --- .../FineTunes/FineTuneServiceTests.Validations.Submit.cs | 8 +++----- .../Foundations/FineTunes/FineTuneServiceTests.cs | 7 +++++++ 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/FineTunes/FineTuneServiceTests.Validations.Submit.cs b/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/FineTunes/FineTuneServiceTests.Validations.Submit.cs index 56ed0842..ace58cf0 100644 --- a/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/FineTunes/FineTuneServiceTests.Validations.Submit.cs +++ b/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/FineTunes/FineTuneServiceTests.Validations.Submit.cs @@ -60,8 +60,7 @@ private async Task ShouldThrowValidationExceptionOnSubmitIfFineTuneRequestIsNull fineTune.Request = nullFineTuneRequest; var invalidFineTuneException = - new InvalidFineTuneException( - message: "Fine tune is invalid."); + createInvalidFineTuneException(); invalidFineTuneException.AddData( key: nameof(FineTune.Request), @@ -105,9 +104,8 @@ private async Task ShouldThrowValidationExceptionOnSubmitIfFineTuneRequestIsInva var invalidFineTune = new FineTune(); invalidFineTune.Request = new FineTuneRequest(); invalidFineTune.Request.FileId = invalidText; - var invalidFineTuneException = - new InvalidFineTuneException( - message: "Fine tune is invalid."); + var invalidFineTuneException = + createInvalidFineTuneException(); invalidFineTuneException.AddData( key: nameof(FineTuneRequest.FileId), diff --git a/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/FineTunes/FineTuneServiceTests.cs b/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/FineTunes/FineTuneServiceTests.cs index 54baf9de..593f8512 100644 --- a/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/FineTunes/FineTuneServiceTests.cs +++ b/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/FineTunes/FineTuneServiceTests.cs @@ -13,6 +13,7 @@ using Standard.AI.OpenAI.Brokers.OpenAIs; using Standard.AI.OpenAI.Models.Services.Foundations.ExternalFineTunes; using Standard.AI.OpenAI.Models.Services.Foundations.FineTunes; +using Standard.AI.OpenAI.Models.Services.Foundations.FineTunes.Exceptions; using Standard.AI.OpenAI.Services.Foundations.FineTunes; using Tynamix.ObjectFiller; using Xunit; @@ -186,5 +187,11 @@ private static Filler CreateRandomFineTuneFiller() return filler; } + + private InvalidFineTuneException createInvalidFineTuneException() + { + return new InvalidFineTuneException( + message: "Fine tune is invalid."); + } } } \ No newline at end of file From 21e9b8ac5faabe9e6cd5b8fc81517da00848f9d1 Mon Sep 17 00:00:00 2001 From: Lezune Date: Fri, 31 May 2024 04:46:32 -0700 Subject: [PATCH 134/283] Added create methods to both FineTuneService.Exceptions.cs and FineTuneServiceTests.cs as well as refactored code --- .../FineTunes/FineTuneService.Exceptions.cs | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/Standard.AI.OpenAI/Services/Foundations/FineTunes/FineTuneService.Exceptions.cs b/Standard.AI.OpenAI/Services/Foundations/FineTunes/FineTuneService.Exceptions.cs index 4e853010..01d2abec 100644 --- a/Standard.AI.OpenAI/Services/Foundations/FineTunes/FineTuneService.Exceptions.cs +++ b/Standard.AI.OpenAI/Services/Foundations/FineTunes/FineTuneService.Exceptions.cs @@ -38,8 +38,7 @@ private static async ValueTask TryCatch(ReturningFineTuneFunction retu catch (HttpResponseUnauthorizedException httpResponseUnauthorizedException) { var unauthorizedFineTuneException = - new UnauthorizedFineTuneException( - message: "Unauthorized fine tune request, fix errors and try again.", + createUnauthorizedFineTuneException( httpResponseUnauthorizedException); throw new FineTuneDependencyException(unauthorizedFineTuneException); @@ -47,8 +46,7 @@ private static async ValueTask TryCatch(ReturningFineTuneFunction retu catch (HttpResponseForbiddenException httpResponseForbiddenException) { var unauthorizedFineTuneException = - new UnauthorizedFineTuneException( - message: "Unauthorized fine tune request, fix errors and try again.", + createUnauthorizedFineTuneException( httpResponseForbiddenException); throw new FineTuneDependencyException(unauthorizedFineTuneException); @@ -83,5 +81,12 @@ private static async ValueTask TryCatch(ReturningFineTuneFunction retu throw new FineTuneServiceException(failedFineTuneServiceException); } } + + private static UnauthorizedFineTuneException createUnauthorizedFineTuneException(Exception innerException) + { + return new UnauthorizedFineTuneException( + message: "Unauthorized fine tune request, fix errors and try again.", + innerException); + } } } From 641830b0b9a572e8d70bccad8669ed3f03011f94 Mon Sep 17 00:00:00 2001 From: Lezune Date: Fri, 31 May 2024 05:23:54 -0700 Subject: [PATCH 135/283] Added create methods to both ImageGenerationService.Exceptions.cs and ImageGenerationServiceTests.cs as well as refactored code --- ...erationServiceTests.Exceptions.Generate.cs | 15 ++++++-------- .../ImageGenerationServiceTests.cs | 9 +++++++++ .../ImageGenerationService.Exceptions.cs | 20 +++++++++++-------- 3 files changed, 27 insertions(+), 17 deletions(-) diff --git a/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/ImageGenerations/ImageGenerationServiceTests.Exceptions.Generate.cs b/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/ImageGenerations/ImageGenerationServiceTests.Exceptions.Generate.cs index b694bf65..3d12bba6 100644 --- a/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/ImageGenerations/ImageGenerationServiceTests.Exceptions.Generate.cs +++ b/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/ImageGenerations/ImageGenerationServiceTests.Exceptions.Generate.cs @@ -31,9 +31,8 @@ private async Task ShouldThrowDependencyExceptionOnGenerateIfUrlNotFoundAsync() innerException: httpResponseUrlNotFoundException); var expectedImageGenerationDependencyException = - new ImageGenerationDependencyException( - message: "Image generation dependency error occurred, contact support.", - innerException: invalidConfigurationImageGenerationException); + createImageGenerationDependencyException( + innerException: invalidConfigurationImageGenerationException); this.openAIBrokerMock.Setup(broker => broker.PostImageGenerationRequestAsync( @@ -75,9 +74,8 @@ private async Task ShouldThrowDependencyExceptionOnGenerateIfUnauthorizedAsync( innerException: unauthorizedException); var expectedImageGenerationDependencyException = - new ImageGenerationDependencyException( - message: "Image generation dependency error occurred, contact support.", - innerException: unauthorizedImageGenerationException); + createImageGenerationDependencyException( + innerException: unauthorizedImageGenerationException); this.openAIBrokerMock.Setup(broker => broker.PostImageGenerationRequestAsync( @@ -253,9 +251,8 @@ private async Task ShouldThrowDependencyExceptionOnGenerateIfHttpResponseErrorOc innerException: httpResponseException); var expectedImageGenerationDependencyException = - new ImageGenerationDependencyException( - message: "Image generation dependency error occurred, contact support.", - innerException: failedServerImageGenerationException); + createImageGenerationDependencyException( + innerException: failedServerImageGenerationException); this.openAIBrokerMock.Setup(broker => broker.PostImageGenerationRequestAsync( diff --git a/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/ImageGenerations/ImageGenerationServiceTests.cs b/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/ImageGenerations/ImageGenerationServiceTests.cs index 2dcf7195..b49f3aec 100644 --- a/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/ImageGenerations/ImageGenerationServiceTests.cs +++ b/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/ImageGenerations/ImageGenerationServiceTests.cs @@ -13,8 +13,10 @@ using Standard.AI.OpenAI.Brokers.OpenAIs; using Standard.AI.OpenAI.Models.Services.Foundations.ExternalImageGenerations; using Standard.AI.OpenAI.Models.Services.Foundations.ImageGenerations; +using Standard.AI.OpenAI.Models.Services.Foundations.ImageGenerations.Exceptions; using Standard.AI.OpenAI.Services.Foundations.ImageGenerations; using Tynamix.ObjectFiller; +using Xeptions; using Xunit; namespace Standard.AI.OpenAI.Tests.Unit.Services.Foundations.ImageGenerations @@ -107,5 +109,12 @@ public static TheoryData UnauthorizedExceptions() new HttpResponseForbiddenException() }; } + + private static ImageGenerationDependencyException createImageGenerationDependencyException(Xeption innerException) + { + return new ImageGenerationDependencyException( + message: "Image generation dependency error occurred, contact support.", + innerException); + } } } \ No newline at end of file diff --git a/Standard.AI.OpenAI/Services/Foundations/ImageGenerations/ImageGenerationService.Exceptions.cs b/Standard.AI.OpenAI/Services/Foundations/ImageGenerations/ImageGenerationService.Exceptions.cs index 61aab367..a9f4727c 100644 --- a/Standard.AI.OpenAI/Services/Foundations/ImageGenerations/ImageGenerationService.Exceptions.cs +++ b/Standard.AI.OpenAI/Services/Foundations/ImageGenerations/ImageGenerationService.Exceptions.cs @@ -7,6 +7,7 @@ using RESTFulSense.Exceptions; using Standard.AI.OpenAI.Models.Services.Foundations.ImageGenerations; using Standard.AI.OpenAI.Models.Services.Foundations.ImageGenerations.Exceptions; +using Xeptions; namespace Standard.AI.OpenAI.Services.Foundations.ImageGenerations { @@ -33,8 +34,7 @@ private async ValueTask TryCatch(ReturningImageGenerationFuncti var invalidConfigurationImageGenerationException = new InvalidConfigurationImageGenerationException(httpResponseUrlNotFoundException); - throw new ImageGenerationDependencyException( - message: "Image generation dependency error occurred, contact support.", + throw createImageGenerationDependencyException( invalidConfigurationImageGenerationException); } catch (HttpResponseUnauthorizedException httpResponseUnauthorizedException) @@ -42,8 +42,7 @@ private async ValueTask TryCatch(ReturningImageGenerationFuncti var unauthorizedImageGenerationException = new UnauthorizedImageGenerationException(httpResponseUnauthorizedException); - throw new ImageGenerationDependencyException( - message: "Image generation dependency error occurred, contact support.", + throw createImageGenerationDependencyException( unauthorizedImageGenerationException); } catch (HttpResponseForbiddenException httpResponseForbiddenException) @@ -51,8 +50,7 @@ private async ValueTask TryCatch(ReturningImageGenerationFuncti var unauthorizedImageGenerationException = new UnauthorizedImageGenerationException(httpResponseForbiddenException); - throw new ImageGenerationDependencyException( - message: "Image generation dependency error occurred, contact support.", + throw createImageGenerationDependencyException( unauthorizedImageGenerationException); } catch (HttpResponseNotFoundException httpResponseNotFoundException) @@ -81,8 +79,7 @@ private async ValueTask TryCatch(ReturningImageGenerationFuncti var failedServerImageGenerationException = new FailedServerImageGenerationException(httpResponseException); - throw new ImageGenerationDependencyException( - message: "Image generation dependency error occurred, contact support.", + throw createImageGenerationDependencyException( failedServerImageGenerationException); } catch (Exception exception) @@ -93,5 +90,12 @@ private async ValueTask TryCatch(ReturningImageGenerationFuncti throw new ImageGenerationServiceException(failedImageGenerationServiceException); } } + + private static ImageGenerationDependencyException createImageGenerationDependencyException(Xeption innerException) + { + return new ImageGenerationDependencyException( + message: "Image generation dependency error occurred, contact support.", + innerException); + } } } \ No newline at end of file From ac5ee7dd7e4a743d91af468ea4e728d8e6ab8534 Mon Sep 17 00:00:00 2001 From: Lezune Date: Fri, 31 May 2024 05:29:45 -0700 Subject: [PATCH 136/283] Added create methods to both ImageGenerationService.Exceptions.cs and ImageGenerationServiceTests.cs as well as refactored code --- ...enerationServiceTests.Exceptions.Generate.cs | 15 ++++++--------- .../ImageGenerationServiceTests.cs | 9 +++++++++ .../ImageGenerationService.Exceptions.cs | 17 +++++++++++------ 3 files changed, 26 insertions(+), 15 deletions(-) diff --git a/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/ImageGenerations/ImageGenerationServiceTests.Exceptions.Generate.cs b/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/ImageGenerations/ImageGenerationServiceTests.Exceptions.Generate.cs index b694bf65..4bc725af 100644 --- a/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/ImageGenerations/ImageGenerationServiceTests.Exceptions.Generate.cs +++ b/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/ImageGenerations/ImageGenerationServiceTests.Exceptions.Generate.cs @@ -120,9 +120,8 @@ private async Task ShouldThrowDependencyValidationExceptionOnGenerateIfImageGene innerException: httpResponseNotFoundException); var expectedImageGenerationDependencyValidationException = - new ImageGenerationDependencyValidationException( - message: "Image generation dependency validation error occurred, fix errors and try again.", - innerException: notFoundImageGenerationException); + createImageGenerationDependencyValidationException( + innerException: notFoundImageGenerationException); this.openAIBrokerMock.Setup(broker => broker.PostImageGenerationRequestAsync( @@ -165,9 +164,8 @@ private async Task ShouldThrowDependencyValidationExceptionOnGenerateIfBadReques innerException: httpResponseBadRequestException); var expectedImageGenerationDependencyValidationException = - new ImageGenerationDependencyValidationException( - message: "Image generation dependency validation error occurred, fix errors and try again.", - innerException: invalidImageGenerationException); + createImageGenerationDependencyValidationException( + innerException: invalidImageGenerationException); this.openAIBrokerMock.Setup(broker => broker.PostImageGenerationRequestAsync( @@ -210,9 +208,8 @@ private async Task ShouldThrowDependencyValidationExceptionOnGenerateIfTooManyRe innerException: httpResponseTooManyRequestsException); var expectedImageGenerationDependencyValidationException = - new ImageGenerationDependencyValidationException( - message: "Image generation dependency validation error occurred, fix errors and try again.", - innerException: excessiveCallImageGenerationException); + createImageGenerationDependencyValidationException( + innerException: excessiveCallImageGenerationException); this.openAIBrokerMock.Setup(broker => broker.PostImageGenerationRequestAsync( diff --git a/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/ImageGenerations/ImageGenerationServiceTests.cs b/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/ImageGenerations/ImageGenerationServiceTests.cs index 2dcf7195..b2eb42e5 100644 --- a/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/ImageGenerations/ImageGenerationServiceTests.cs +++ b/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/ImageGenerations/ImageGenerationServiceTests.cs @@ -13,8 +13,10 @@ using Standard.AI.OpenAI.Brokers.OpenAIs; using Standard.AI.OpenAI.Models.Services.Foundations.ExternalImageGenerations; using Standard.AI.OpenAI.Models.Services.Foundations.ImageGenerations; +using Standard.AI.OpenAI.Models.Services.Foundations.ImageGenerations.Exceptions; using Standard.AI.OpenAI.Services.Foundations.ImageGenerations; using Tynamix.ObjectFiller; +using Xeptions; using Xunit; namespace Standard.AI.OpenAI.Tests.Unit.Services.Foundations.ImageGenerations @@ -107,5 +109,12 @@ public static TheoryData UnauthorizedExceptions() new HttpResponseForbiddenException() }; } + + private static ImageGenerationDependencyValidationException createImageGenerationDependencyValidationException(Xeption innerException) + { + return new ImageGenerationDependencyValidationException( + message: "Image generation dependency validation error occurred, fix errors and try again.", + innerException); + } } } \ No newline at end of file diff --git a/Standard.AI.OpenAI/Services/Foundations/ImageGenerations/ImageGenerationService.Exceptions.cs b/Standard.AI.OpenAI/Services/Foundations/ImageGenerations/ImageGenerationService.Exceptions.cs index 51f790c3..aeeb77dc 100644 --- a/Standard.AI.OpenAI/Services/Foundations/ImageGenerations/ImageGenerationService.Exceptions.cs +++ b/Standard.AI.OpenAI/Services/Foundations/ImageGenerations/ImageGenerationService.Exceptions.cs @@ -7,6 +7,7 @@ using RESTFulSense.Exceptions; using Standard.AI.OpenAI.Models.Services.Foundations.ImageGenerations; using Standard.AI.OpenAI.Models.Services.Foundations.ImageGenerations.Exceptions; +using Xeptions; namespace Standard.AI.OpenAI.Services.Foundations.ImageGenerations { @@ -54,8 +55,7 @@ private async ValueTask TryCatch(ReturningImageGenerationFuncti var notFoundImageGenerationException = new NotFoundImageGenerationException(httpResponseNotFoundException); - throw new ImageGenerationDependencyValidationException( - message: "Image generation dependency validation error occurred, fix errors and try again.", + throw createImageGenerationDependencyValidationException( notFoundImageGenerationException); } catch (HttpResponseBadRequestException httpResponseBadRequestException) @@ -63,8 +63,7 @@ private async ValueTask TryCatch(ReturningImageGenerationFuncti var invalidImageGenerationException = new InvalidImageGenerationException(httpResponseBadRequestException); - throw new ImageGenerationDependencyValidationException( - message: "Image generation dependency validation error occurred, fix errors and try again.", + throw createImageGenerationDependencyValidationException( invalidImageGenerationException); } catch (HttpResponseTooManyRequestsException httpResponseTooManyRequestsException) @@ -72,8 +71,7 @@ private async ValueTask TryCatch(ReturningImageGenerationFuncti var excessiveCallImageGenerationException = new ExcessiveCallImageGenerationException(httpResponseTooManyRequestsException); - throw new ImageGenerationDependencyValidationException( - message: "Image generation dependency validation error occurred, fix errors and try again.", + throw createImageGenerationDependencyValidationException( excessiveCallImageGenerationException); } catch (HttpResponseException httpResponseException) @@ -91,5 +89,12 @@ private async ValueTask TryCatch(ReturningImageGenerationFuncti throw new ImageGenerationServiceException(failedImageGenerationServiceException); } } + + private static ImageGenerationDependencyValidationException createImageGenerationDependencyValidationException(Xeption innerException) + { + return new ImageGenerationDependencyValidationException( + message: "Image generation dependency validation error occurred, fix errors and try again.", + innerException); + } } } \ No newline at end of file From 4c392094f299aa040e1aae6bb90a5f329853e24f Mon Sep 17 00:00:00 2001 From: Lezune Date: Fri, 31 May 2024 05:35:36 -0700 Subject: [PATCH 137/283] Added create methods to both ImageGenerationService.Exceptions.cs and ImageGenerationServiceTests.cs as well as refactored code --- ...GenerationServiceTests.Validations.Generate.cs | 15 ++++++--------- .../ImageGenerationServiceTests.cs | 9 +++++++++ .../ImageGenerationService.Exceptions.cs | 14 ++++++++++---- 3 files changed, 25 insertions(+), 13 deletions(-) diff --git a/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/ImageGenerations/ImageGenerationServiceTests.Validations.Generate.cs b/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/ImageGenerations/ImageGenerationServiceTests.Validations.Generate.cs index e1cb5395..e5abe0a6 100644 --- a/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/ImageGenerations/ImageGenerationServiceTests.Validations.Generate.cs +++ b/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/ImageGenerations/ImageGenerationServiceTests.Validations.Generate.cs @@ -24,9 +24,8 @@ private async Task ShouldThrowValidationExceptionOnGenerateIfImageGenerationIsNu new NullImageGenerationException(); var expectedImageGenerationValidationException = - new ImageGenerationValidationException( - message: "Image generation validation error occurred, fix errors and try again.", - innerException: nullImageGenerationException); + createImageGenerationValidationException( + innerException: nullImageGenerationException); // when ValueTask generateImageTask = @@ -65,9 +64,8 @@ private async Task ShouldThrowValidationExceptionOnGenerateIfRequestIsNullAsync( values: "Value is required"); var expectedImageGenerationValidationException = - new ImageGenerationValidationException( - message: "Image generation validation error occurred, fix errors and try again.", - innerException: invalidImageGenerationException); + createImageGenerationValidationException( + innerException: invalidImageGenerationException); // when ValueTask generateImageTask = @@ -113,9 +111,8 @@ private async Task ShouldThrowValidationExceptionOnGenerateIfRequestIsInvalidAsy values: "Value is required"); var expectedImageGenerationValidationException = - new ImageGenerationValidationException( - message: "Image generation validation error occurred, fix errors and try again.", - innerException: invalidImageGenerationException); + createImageGenerationValidationException( + innerException: invalidImageGenerationException); // when ValueTask generateImageTask = diff --git a/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/ImageGenerations/ImageGenerationServiceTests.cs b/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/ImageGenerations/ImageGenerationServiceTests.cs index 2dcf7195..6fa7230a 100644 --- a/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/ImageGenerations/ImageGenerationServiceTests.cs +++ b/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/ImageGenerations/ImageGenerationServiceTests.cs @@ -13,8 +13,10 @@ using Standard.AI.OpenAI.Brokers.OpenAIs; using Standard.AI.OpenAI.Models.Services.Foundations.ExternalImageGenerations; using Standard.AI.OpenAI.Models.Services.Foundations.ImageGenerations; +using Standard.AI.OpenAI.Models.Services.Foundations.ImageGenerations.Exceptions; using Standard.AI.OpenAI.Services.Foundations.ImageGenerations; using Tynamix.ObjectFiller; +using Xeptions; using Xunit; namespace Standard.AI.OpenAI.Tests.Unit.Services.Foundations.ImageGenerations @@ -107,5 +109,12 @@ public static TheoryData UnauthorizedExceptions() new HttpResponseForbiddenException() }; } + + private static ImageGenerationValidationException createImageGenerationValidationException(Xeption innerException) + { + return new ImageGenerationValidationException( + message: "Image generation validation error occurred, fix errors and try again.", + innerException); + } } } \ No newline at end of file diff --git a/Standard.AI.OpenAI/Services/Foundations/ImageGenerations/ImageGenerationService.Exceptions.cs b/Standard.AI.OpenAI/Services/Foundations/ImageGenerations/ImageGenerationService.Exceptions.cs index 4e83c98a..9a4c617c 100644 --- a/Standard.AI.OpenAI/Services/Foundations/ImageGenerations/ImageGenerationService.Exceptions.cs +++ b/Standard.AI.OpenAI/Services/Foundations/ImageGenerations/ImageGenerationService.Exceptions.cs @@ -7,6 +7,7 @@ using RESTFulSense.Exceptions; using Standard.AI.OpenAI.Models.Services.Foundations.ImageGenerations; using Standard.AI.OpenAI.Models.Services.Foundations.ImageGenerations.Exceptions; +using Xeptions; namespace Standard.AI.OpenAI.Services.Foundations.ImageGenerations { @@ -22,14 +23,12 @@ private async ValueTask TryCatch(ReturningImageGenerationFuncti } catch (NullImageGenerationException nullImageGenerationException) { - throw new ImageGenerationValidationException( - message: "Image generation validation error occurred, fix errors and try again.", + throw createImageGenerationValidationException( nullImageGenerationException); } catch (InvalidImageGenerationException invalidImageGenerationException) { - throw new ImageGenerationValidationException( - message: "Image generation validation error occurred, fix errors and try again.", + throw createImageGenerationValidationException( invalidImageGenerationException); } catch (HttpResponseUrlNotFoundException httpResponseUrlNotFoundException) @@ -89,5 +88,12 @@ private async ValueTask TryCatch(ReturningImageGenerationFuncti throw new ImageGenerationServiceException(failedImageGenerationServiceException); } } + + private static ImageGenerationValidationException createImageGenerationValidationException(Xeption innerException) + { + return new ImageGenerationValidationException( + message: "Image generation validation error occurred, fix errors and try again.", + innerException); + } } } \ No newline at end of file From ab6ad11c1b7a8c377780b8c2ec43a71ee351d9a4 Mon Sep 17 00:00:00 2001 From: Lezune Date: Fri, 31 May 2024 05:40:33 -0700 Subject: [PATCH 138/283] Added create methods to both ImageGenerationService.Exceptions.cs and ImageGenerationServiceTests.cs as well as refactored code --- .../ImageGenerationServiceTests.Validations.Generate.cs | 6 ++---- .../ImageGenerations/ImageGenerationServiceTests.cs | 7 +++++++ 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/ImageGenerations/ImageGenerationServiceTests.Validations.Generate.cs b/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/ImageGenerations/ImageGenerationServiceTests.Validations.Generate.cs index 4418a738..ac04c34d 100644 --- a/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/ImageGenerations/ImageGenerationServiceTests.Validations.Generate.cs +++ b/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/ImageGenerations/ImageGenerationServiceTests.Validations.Generate.cs @@ -58,8 +58,7 @@ private async Task ShouldThrowValidationExceptionOnGenerateIfRequestIsNullAsync( invalidImageGeneration.Request = null; var invalidImageGenerationException = - new InvalidImageGenerationException( - message: "Invalid image generation error occurred, fix errors and try again."); + createInvalidImageGenerationException(); invalidImageGenerationException.AddData( key: nameof(ImageGeneration.Request), @@ -107,8 +106,7 @@ private async Task ShouldThrowValidationExceptionOnGenerateIfRequestIsInvalidAsy }; var invalidImageGenerationException = - new InvalidImageGenerationException( - message: "Invalid image generation error occurred, fix errors and try again."); + createInvalidImageGenerationException(); invalidImageGenerationException.AddData( key: nameof(ImageGeneration.Request.Prompt), diff --git a/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/ImageGenerations/ImageGenerationServiceTests.cs b/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/ImageGenerations/ImageGenerationServiceTests.cs index 2dcf7195..b1d2a087 100644 --- a/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/ImageGenerations/ImageGenerationServiceTests.cs +++ b/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/ImageGenerations/ImageGenerationServiceTests.cs @@ -13,6 +13,7 @@ using Standard.AI.OpenAI.Brokers.OpenAIs; using Standard.AI.OpenAI.Models.Services.Foundations.ExternalImageGenerations; using Standard.AI.OpenAI.Models.Services.Foundations.ImageGenerations; +using Standard.AI.OpenAI.Models.Services.Foundations.ImageGenerations.Exceptions; using Standard.AI.OpenAI.Services.Foundations.ImageGenerations; using Tynamix.ObjectFiller; using Xunit; @@ -107,5 +108,11 @@ public static TheoryData UnauthorizedExceptions() new HttpResponseForbiddenException() }; } + + private static InvalidImageGenerationException createInvalidImageGenerationException() + { + return new InvalidImageGenerationException( + message: "Invalid image generation error occurred, fix errors and try again."); + } } } \ No newline at end of file From fef16cb4cbb6e3711fb225ca6f99aac2a63312e2 Mon Sep 17 00:00:00 2001 From: Lezune Date: Fri, 31 May 2024 05:46:22 -0700 Subject: [PATCH 139/283] Added create methods to both ImageGenerationService.Exceptions.cs and ImageGenerationServiceTests.cs as well as refactored code --- .../ImageGenerationService.Exceptions.cs | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/Standard.AI.OpenAI/Services/Foundations/ImageGenerations/ImageGenerationService.Exceptions.cs b/Standard.AI.OpenAI/Services/Foundations/ImageGenerations/ImageGenerationService.Exceptions.cs index 3333dc49..829dc110 100644 --- a/Standard.AI.OpenAI/Services/Foundations/ImageGenerations/ImageGenerationService.Exceptions.cs +++ b/Standard.AI.OpenAI/Services/Foundations/ImageGenerations/ImageGenerationService.Exceptions.cs @@ -38,8 +38,7 @@ private async ValueTask TryCatch(ReturningImageGenerationFuncti catch (HttpResponseUnauthorizedException httpResponseUnauthorizedException) { var unauthorizedImageGenerationException = - new UnauthorizedImageGenerationException( - message: "Unauthorized image generation request, fix errors and try again.", + createUnauthorizedImageGenerationException( httpResponseUnauthorizedException); throw new ImageGenerationDependencyException(unauthorizedImageGenerationException); @@ -47,8 +46,7 @@ private async ValueTask TryCatch(ReturningImageGenerationFuncti catch (HttpResponseForbiddenException httpResponseForbiddenException) { var unauthorizedImageGenerationException = - new UnauthorizedImageGenerationException( - message: "Unauthorized image generation request, fix errors and try again.", + createUnauthorizedImageGenerationException( httpResponseForbiddenException); throw new ImageGenerationDependencyException(unauthorizedImageGenerationException); @@ -89,5 +87,12 @@ private async ValueTask TryCatch(ReturningImageGenerationFuncti throw new ImageGenerationServiceException(failedImageGenerationServiceException); } } + + private static UnauthorizedImageGenerationException createUnauthorizedImageGenerationException(Exception innerException) + { + return new UnauthorizedImageGenerationException( + message: "Unauthorized image generation request, fix errors and try again.", + innerException); + } } } \ No newline at end of file From 8c0722e1bf411221142c4c786ce2bda6f0f9c8a1 Mon Sep 17 00:00:00 2001 From: Lezune Date: Fri, 31 May 2024 05:50:25 -0700 Subject: [PATCH 140/283] Added create methods to both ImageGenerationService.Exceptions.cs and ImageGenerationServiceTests.cs as well as refactored code --- .../LocalFiles/LocalFileService.Exceptions.cs | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/Standard.AI.OpenAI/Services/Foundations/LocalFiles/LocalFileService.Exceptions.cs b/Standard.AI.OpenAI/Services/Foundations/LocalFiles/LocalFileService.Exceptions.cs index 7f618785..72014e10 100644 --- a/Standard.AI.OpenAI/Services/Foundations/LocalFiles/LocalFileService.Exceptions.cs +++ b/Standard.AI.OpenAI/Services/Foundations/LocalFiles/LocalFileService.Exceptions.cs @@ -51,8 +51,7 @@ private Stream TryCatch(ReturningStreamFunction returningStreamFunction) catch (IOException ioException) { var failedFileException = - new FailedLocalFileDependencyException( - message: "Failed local file error occurred, contact support.", + createFailedLocalFileDependencyException( ioException); throw new LocalFileDependencyException(failedFileException); @@ -60,8 +59,7 @@ private Stream TryCatch(ReturningStreamFunction returningStreamFunction) catch (NotSupportedException notSupportedException) { var failedFileException = - new FailedLocalFileDependencyException( - message: "Failed local file error occurred, contact support.", + createFailedLocalFileDependencyException( notSupportedException); throw new LocalFileDependencyException(failedFileException); @@ -74,5 +72,12 @@ private Stream TryCatch(ReturningStreamFunction returningStreamFunction) throw new LocalFileServiceException(failedLocalFileServiceException); } } + + private static FailedLocalFileDependencyException createFailedLocalFileDependencyException(Exception innerException) + { + return new FailedLocalFileDependencyException( + message: "Failed local file error occurred, contact support.", + innerException); + } } } From d3a259d5c952e9002b296589c6f4a778ea077eaf Mon Sep 17 00:00:00 2001 From: Lezune Date: Fri, 31 May 2024 05:54:42 -0700 Subject: [PATCH 141/283] Added create methods to both LocalFileService.Exceptions.cs and LocalFileServiceTests.cs as well as refactored code --- .../LocalFiles/LocalFileService.Exceptions.cs | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/Standard.AI.OpenAI/Services/Foundations/LocalFiles/LocalFileService.Exceptions.cs b/Standard.AI.OpenAI/Services/Foundations/LocalFiles/LocalFileService.Exceptions.cs index fe76bb6c..c45c58a2 100644 --- a/Standard.AI.OpenAI/Services/Foundations/LocalFiles/LocalFileService.Exceptions.cs +++ b/Standard.AI.OpenAI/Services/Foundations/LocalFiles/LocalFileService.Exceptions.cs @@ -24,18 +24,16 @@ private Stream TryCatch(ReturningStreamFunction returningStreamFunction) } catch (ArgumentException argumentException) { - var invalidFileException = - new InvalidLocalFileException( - message: "Invalid local file error occurred, fix error and try again.", + var invalidFileException = + createInvalidLocalFileException( argumentException); throw new LocalFileDependencyValidationException(invalidFileException); } catch (PathTooLongException pathTooLongException) { - var invalidFileException = - new InvalidLocalFileException( - message: "Invalid local file error occurred, fix error and try again.", + var invalidFileException = + createInvalidLocalFileException( pathTooLongException); throw new LocalFileDependencyValidationException(invalidFileException); @@ -76,5 +74,12 @@ private Stream TryCatch(ReturningStreamFunction returningStreamFunction) throw new LocalFileServiceException(failedLocalFileServiceException); } } + + private static InvalidLocalFileException createInvalidLocalFileException(Exception innerException) + { + return new InvalidLocalFileException( + message: "Invalid local file error occurred, fix error and try again.", + innerException); + } } } From 75ecf4b4fd4d7621ae9c10ca6cf53b27374ec52b Mon Sep 17 00:00:00 2001 From: Lezune Date: Fri, 31 May 2024 05:59:17 -0700 Subject: [PATCH 142/283] Added create methods to both LocalFileService.Exceptions.cs and LocalFileServiceTests.cs as well as refactored code --- .../LocalFiles/LocalFileService.Exceptions.cs | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/Standard.AI.OpenAI/Services/Foundations/LocalFiles/LocalFileService.Exceptions.cs b/Standard.AI.OpenAI/Services/Foundations/LocalFiles/LocalFileService.Exceptions.cs index 0968992d..540988e5 100644 --- a/Standard.AI.OpenAI/Services/Foundations/LocalFiles/LocalFileService.Exceptions.cs +++ b/Standard.AI.OpenAI/Services/Foundations/LocalFiles/LocalFileService.Exceptions.cs @@ -5,6 +5,7 @@ using System; using System.IO; using Standard.AI.OpenAI.Models.Services.Foundations.LocalFiles.Exceptions; +using Xeptions; namespace Standard.AI.OpenAI.Services.Foundations.LocalFiles { @@ -53,8 +54,7 @@ private Stream TryCatch(ReturningStreamFunction returningStreamFunction) var failedFileException = new FailedLocalFileDependencyException(ioException); - throw new LocalFileDependencyException( - message: "Local file dependency error occurred, contact support.", + throw createLocalFileDependencyException( failedFileException); } catch (NotSupportedException notSupportedException) @@ -62,8 +62,7 @@ private Stream TryCatch(ReturningStreamFunction returningStreamFunction) var failedFileException = new FailedLocalFileDependencyException(notSupportedException); - throw new LocalFileDependencyException( - message: "Local file dependency error occurred, contact support.", + throw createLocalFileDependencyException( failedFileException); } catch (Exception exception) @@ -74,5 +73,12 @@ private Stream TryCatch(ReturningStreamFunction returningStreamFunction) throw new LocalFileServiceException(failedLocalFileServiceException); } } + + private static LocalFileDependencyException createLocalFileDependencyException(Xeption innerException) + { + return new LocalFileDependencyException( + message: "Local file dependency error occurred, contact support.", + innerException); + } } } From d912f795a1b93282d96de7a2dae150063083d526 Mon Sep 17 00:00:00 2001 From: Lezune Date: Fri, 31 May 2024 06:06:11 -0700 Subject: [PATCH 143/283] Added create methods to both LocalFileService.Exceptions.cs and LocalFileServiceTests.cs as well as refactored code --- .../LocalFileServiceTests.Exceptions.Read.cs | 6 ++---- .../LocalFiles/LocalFileServiceTests.cs | 9 +++++++++ .../LocalFiles/LocalFileService.Exceptions.cs | 20 +++++++++++-------- 3 files changed, 23 insertions(+), 12 deletions(-) diff --git a/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/LocalFiles/LocalFileServiceTests.Exceptions.Read.cs b/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/LocalFiles/LocalFileServiceTests.Exceptions.Read.cs index f0ca7edb..8c40fd78 100644 --- a/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/LocalFiles/LocalFileServiceTests.Exceptions.Read.cs +++ b/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/LocalFiles/LocalFileServiceTests.Exceptions.Read.cs @@ -24,8 +24,7 @@ private void ShouldThrowDependencyValidationExceptionOnReadIfDepedencyErrorOccur innerException: dependencyValidationException); var expectedFileDependencyValidationException = - new LocalFileDependencyValidationException( - message: "Local file dependency validation error occurred, fix the errors and try again.", + createLocalFileDependencyValidationException( innerException: invalidFileException); this.fileBrokerMock.Setup(broker => @@ -64,8 +63,7 @@ private void ShouldThrowDependencyExceptionOnReadIfFileNotFoundExceptionOccurs( innerException: fileNotFoundException); var expectedFileDependencyValidationException = - new LocalFileDependencyValidationException( - message: "Local file dependency validation error occurred, fix the errors and try again.", + createLocalFileDependencyValidationException( innerException: notFoundLocalFileException); this.fileBrokerMock.Setup(broker => diff --git a/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/LocalFiles/LocalFileServiceTests.cs b/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/LocalFiles/LocalFileServiceTests.cs index 34bb0594..ef5cc9bd 100644 --- a/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/LocalFiles/LocalFileServiceTests.cs +++ b/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/LocalFiles/LocalFileServiceTests.cs @@ -7,8 +7,10 @@ using System.Text; using Moq; using Standard.AI.OpenAI.Brokers.Files; +using Standard.AI.OpenAI.Models.Services.Foundations.LocalFiles.Exceptions; using Standard.AI.OpenAI.Services.Foundations.LocalFiles; using Tynamix.ObjectFiller; +using Xeptions; using Xunit; namespace Standard.AI.OpenAI.Tests.Unit.Services.Foundations.LocalFiles @@ -72,5 +74,12 @@ private Stream CreateRandomStream() return memoryStream; } + + private static LocalFileDependencyValidationException createLocalFileDependencyValidationException(Xeption innerException) + { + return new LocalFileDependencyValidationException( + message: "Local file dependency validation error occurred, fix the errors and try again.", + innerException); + } } } \ No newline at end of file diff --git a/Standard.AI.OpenAI/Services/Foundations/LocalFiles/LocalFileService.Exceptions.cs b/Standard.AI.OpenAI/Services/Foundations/LocalFiles/LocalFileService.Exceptions.cs index c0b4fdae..e2ef1677 100644 --- a/Standard.AI.OpenAI/Services/Foundations/LocalFiles/LocalFileService.Exceptions.cs +++ b/Standard.AI.OpenAI/Services/Foundations/LocalFiles/LocalFileService.Exceptions.cs @@ -5,6 +5,7 @@ using System; using System.IO; using Standard.AI.OpenAI.Models.Services.Foundations.LocalFiles.Exceptions; +using Xeptions; namespace Standard.AI.OpenAI.Services.Foundations.LocalFiles { @@ -26,16 +27,14 @@ private Stream TryCatch(ReturningStreamFunction returningStreamFunction) { var invalidFileException = new InvalidLocalFileException(argumentException); - throw new LocalFileDependencyValidationException( - message: "Local file dependency validation error occurred, fix the errors and try again.", + throw createLocalFileDependencyValidationException( invalidFileException); } catch (PathTooLongException pathTooLongException) { var invalidFileException = new InvalidLocalFileException(pathTooLongException); - throw new LocalFileDependencyValidationException( - message: "Local file dependency validation error occurred, fix the errors and try again.", + throw createLocalFileDependencyValidationException( invalidFileException); } catch (FileNotFoundException fileNotFoundException) @@ -43,8 +42,7 @@ private Stream TryCatch(ReturningStreamFunction returningStreamFunction) var notFoundFileException = new NotFoundLocalFileException(fileNotFoundException); - throw new LocalFileDependencyValidationException( - message: "Local file dependency validation error occurred, fix the errors and try again.", + throw createLocalFileDependencyValidationException( notFoundFileException); } catch (DirectoryNotFoundException directoryNotFoundException) @@ -52,8 +50,7 @@ private Stream TryCatch(ReturningStreamFunction returningStreamFunction) var notFoundFileException = new NotFoundLocalFileException(directoryNotFoundException); - throw new LocalFileDependencyValidationException( - message: "Local file dependency validation error occurred, fix the errors and try again.", + throw createLocalFileDependencyValidationException( notFoundFileException); } catch (IOException ioException) @@ -78,5 +75,12 @@ private Stream TryCatch(ReturningStreamFunction returningStreamFunction) throw new LocalFileServiceException(failedLocalFileServiceException); } } + + private static LocalFileDependencyValidationException createLocalFileDependencyValidationException(Xeption innerException) + { + return new LocalFileDependencyValidationException( + message: "Local file dependency validation error occurred, fix the errors and try again.", + innerException); + } } } From 99db9a93ed31c05dba713c976264ed697b577e17 Mon Sep 17 00:00:00 2001 From: Lezune Date: Fri, 31 May 2024 06:11:11 -0700 Subject: [PATCH 144/283] Added create methods to both LocalFileService.Exceptions.cs and LocalFileServiceTests.cs as well as refactored code --- .../LocalFiles/LocalFileService.Exceptions.cs | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/Standard.AI.OpenAI/Services/Foundations/LocalFiles/LocalFileService.Exceptions.cs b/Standard.AI.OpenAI/Services/Foundations/LocalFiles/LocalFileService.Exceptions.cs index d9d5350b..99b3d3e1 100644 --- a/Standard.AI.OpenAI/Services/Foundations/LocalFiles/LocalFileService.Exceptions.cs +++ b/Standard.AI.OpenAI/Services/Foundations/LocalFiles/LocalFileService.Exceptions.cs @@ -37,8 +37,7 @@ private Stream TryCatch(ReturningStreamFunction returningStreamFunction) catch (FileNotFoundException fileNotFoundException) { var notFoundFileException = - new NotFoundLocalFileException( - message: "Not found local file error occurred, fix error and try again.", + createNotFoundLocalFileException( fileNotFoundException); throw new LocalFileDependencyValidationException(notFoundFileException); @@ -46,8 +45,7 @@ private Stream TryCatch(ReturningStreamFunction returningStreamFunction) catch (DirectoryNotFoundException directoryNotFoundException) { var notFoundFileException = - new NotFoundLocalFileException( - message: "Not found local file error occurred, fix error and try again.", + createNotFoundLocalFileException( directoryNotFoundException); throw new LocalFileDependencyValidationException(notFoundFileException); @@ -74,5 +72,12 @@ private Stream TryCatch(ReturningStreamFunction returningStreamFunction) throw new LocalFileServiceException(failedLocalFileServiceException); } } + + private static NotFoundLocalFileException createNotFoundLocalFileException(Exception innerException) + { + return new NotFoundLocalFileException( + message: "Not found local file error occurred, fix error and try again.", + innerException); + } } } From da78b6cfb8f8b0a64171342c306c5cc1d745930d Mon Sep 17 00:00:00 2001 From: Lezune Date: Fri, 31 May 2024 06:16:34 -0700 Subject: [PATCH 145/283] Added create methods to both AIFileOrchestrationService.Exceptions.cs and AIFileOrchestrationServiceTests.cs as well as refactored code --- .../AIFileOrchestrationService.Exceptions.cs | 25 ++++++++++--------- 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/Standard.AI.OpenAI/Services/Orchestrations/AIFiles/AIFileOrchestrationService.Exceptions.cs b/Standard.AI.OpenAI/Services/Orchestrations/AIFiles/AIFileOrchestrationService.Exceptions.cs index 46bd6f41..0c3e00d0 100644 --- a/Standard.AI.OpenAI/Services/Orchestrations/AIFiles/AIFileOrchestrationService.Exceptions.cs +++ b/Standard.AI.OpenAI/Services/Orchestrations/AIFiles/AIFileOrchestrationService.Exceptions.cs @@ -45,14 +45,12 @@ private async ValueTask TryCatch(ReturningAIFileFunction returningAIFile } catch (LocalFileDependencyException localFileDependencyException) { - throw new AIFileOrchestrationDependencyException( - message: "AI File dependency error occurred, contact support.", + throw createAIFileOrchestrationDependencyException( localFileDependencyException.InnerException as Xeption); } catch (LocalFileServiceException localFileServiceException) { - throw new AIFileOrchestrationDependencyException( - message: "AI File dependency error occurred, contact support.", + throw createAIFileOrchestrationDependencyException( localFileServiceException.InnerException as Xeption); } catch (AIFileValidationException aIFileValidationException) @@ -67,14 +65,12 @@ private async ValueTask TryCatch(ReturningAIFileFunction returningAIFile } catch (AIFileDependencyException aIFileDependencyException) { - throw new AIFileOrchestrationDependencyException( - message: "AI File dependency error occurred, contact support.", + throw createAIFileOrchestrationDependencyException( aIFileDependencyException.InnerException as Xeption); } catch (AIFileServiceException aIFileServiceException) { - throw new AIFileOrchestrationDependencyException( - message: "AI File dependency error occurred, contact support.", + throw createAIFileOrchestrationDependencyException( aIFileServiceException.InnerException as Xeption); } catch (Exception exception) @@ -96,8 +92,7 @@ private async ValueTask> TryCatch(ReturningAIFilesFu } catch (AIFileDependencyException aIFileDependencyException) { - throw new AIFileOrchestrationDependencyException( - message: "AI File dependency error occurred, contact support.", + throw createAIFileOrchestrationDependencyException( aIFileDependencyException.InnerException as Xeption); } catch (AIFileDependencyValidationException aIFileDependencyValidationException) @@ -107,8 +102,7 @@ private async ValueTask> TryCatch(ReturningAIFilesFu } catch (AIFileServiceException aIFileServiceException) { - throw new AIFileOrchestrationDependencyException( - message: "AI File dependency error occurred, contact support.", + throw createAIFileOrchestrationDependencyException( aIFileServiceException.InnerException as Xeption); } catch (Exception exception) @@ -121,5 +115,12 @@ private async ValueTask> TryCatch(ReturningAIFilesFu failedAIFileOrchestrationServiceException); } } + + private static AIFileOrchestrationDependencyException createAIFileOrchestrationDependencyException(Xeption innerException) + { + return new AIFileOrchestrationDependencyException( + message: "AI File dependency error occurred, contact support.", + innerException); + } } } From acaaba724eb05061ff367e31460a28c177e0d750 Mon Sep 17 00:00:00 2001 From: Lezune Date: Fri, 31 May 2024 06:24:40 -0700 Subject: [PATCH 146/283] Added create methods to both AIFileOrchestrationService.Exceptions.cs and AIFileOrchestrationServiceTests.cs as well as refactored code --- ...nServiceTests.Exceptions.RemoveFileById.cs | 5 ++--- ...tionServiceTests.Exceptions.RetrieveAll.cs | 5 ++--- ...estrationServiceTests.Exceptions.Upload.cs | 3 +-- .../AIFileOrchestrationServiceTests.cs | 8 +++++++ .../AIFileOrchestrationService.Exceptions.cs | 22 ++++++++++--------- 5 files changed, 25 insertions(+), 18 deletions(-) diff --git a/Standard.AI.OpenAI.Tests.Unit/Services/Orchestrations/AIFiles/AIFileOrchestrationServiceTests.Exceptions.RemoveFileById.cs b/Standard.AI.OpenAI.Tests.Unit/Services/Orchestrations/AIFiles/AIFileOrchestrationServiceTests.Exceptions.RemoveFileById.cs index 20f78b19..157aec1c 100644 --- a/Standard.AI.OpenAI.Tests.Unit/Services/Orchestrations/AIFiles/AIFileOrchestrationServiceTests.Exceptions.RemoveFileById.cs +++ b/Standard.AI.OpenAI.Tests.Unit/Services/Orchestrations/AIFiles/AIFileOrchestrationServiceTests.Exceptions.RemoveFileById.cs @@ -24,9 +24,8 @@ private async Task ShouldThrowDependencyValidationExceptionOnRemoveFileIfDepende string someFileId = CreateRandomFileId(); var expectedAIFileOrchestrationDependencyValidationException = - new AIFileOrchestrationDependencyValidationException( - message: "AI file dependency validation error occurred, fix errors and try again.", - innerException: dependencyValidationException.InnerException as Xeption); + createAIFileOrchestrationDependencyValidationException( + innerException: dependencyValidationException.InnerException as Xeption); this.aiFileServiceMock.Setup(service => service.RemoveFileByIdAsync(It.IsAny())) diff --git a/Standard.AI.OpenAI.Tests.Unit/Services/Orchestrations/AIFiles/AIFileOrchestrationServiceTests.Exceptions.RetrieveAll.cs b/Standard.AI.OpenAI.Tests.Unit/Services/Orchestrations/AIFiles/AIFileOrchestrationServiceTests.Exceptions.RetrieveAll.cs index 6cd65890..dea40999 100644 --- a/Standard.AI.OpenAI.Tests.Unit/Services/Orchestrations/AIFiles/AIFileOrchestrationServiceTests.Exceptions.RetrieveAll.cs +++ b/Standard.AI.OpenAI.Tests.Unit/Services/Orchestrations/AIFiles/AIFileOrchestrationServiceTests.Exceptions.RetrieveAll.cs @@ -65,9 +65,8 @@ private async Task ShouldThrowDependencyValidationExceptionOnRetrieveAllIfDepend innerException: someInnerException); var expectedAIFileOrchestrationDependencyValidationException = - new AIFileOrchestrationDependencyValidationException( - message: "AI file dependency validation error occurred, fix errors and try again.", - innerException: dependencyValidationException.InnerException as Xeption); + createAIFileOrchestrationDependencyValidationException( + innerException: dependencyValidationException.InnerException as Xeption); this.aiFileServiceMock.Setup(service => service.RetrieveAllFilesAsync()) diff --git a/Standard.AI.OpenAI.Tests.Unit/Services/Orchestrations/AIFiles/AIFileOrchestrationServiceTests.Exceptions.Upload.cs b/Standard.AI.OpenAI.Tests.Unit/Services/Orchestrations/AIFiles/AIFileOrchestrationServiceTests.Exceptions.Upload.cs index 23f55635..ef8d4574 100644 --- a/Standard.AI.OpenAI.Tests.Unit/Services/Orchestrations/AIFiles/AIFileOrchestrationServiceTests.Exceptions.Upload.cs +++ b/Standard.AI.OpenAI.Tests.Unit/Services/Orchestrations/AIFiles/AIFileOrchestrationServiceTests.Exceptions.Upload.cs @@ -24,8 +24,7 @@ private async Task ShouldThrowDependencyValidationExceptionOnUploadIfDependencyV AIFile someAIFile = CreateRandomAIFile(); var expectedAIFileOrchestrationDependencyValidationException = - new AIFileOrchestrationDependencyValidationException( - message: "AI file dependency validation error occurred, fix errors and try again.", + createAIFileOrchestrationDependencyValidationException( innerException: dependencyValidationException.InnerException as Xeption); this.aiFileServiceMock.Setup(service => diff --git a/Standard.AI.OpenAI.Tests.Unit/Services/Orchestrations/AIFiles/AIFileOrchestrationServiceTests.cs b/Standard.AI.OpenAI.Tests.Unit/Services/Orchestrations/AIFiles/AIFileOrchestrationServiceTests.cs index cebfc9b8..a059c589 100644 --- a/Standard.AI.OpenAI.Tests.Unit/Services/Orchestrations/AIFiles/AIFileOrchestrationServiceTests.cs +++ b/Standard.AI.OpenAI.Tests.Unit/Services/Orchestrations/AIFiles/AIFileOrchestrationServiceTests.cs @@ -11,6 +11,7 @@ using Standard.AI.OpenAI.Models.Services.Foundations.AIFiles; using Standard.AI.OpenAI.Models.Services.Foundations.AIFiles.Exceptions; using Standard.AI.OpenAI.Models.Services.Foundations.LocalFiles.Exceptions; +using Standard.AI.OpenAI.Models.Services.Orchestrations.AIFiles.Exceptions; using Standard.AI.OpenAI.Services.Foundations.AIFiles; using Standard.AI.OpenAI.Services.Foundations.LocalFiles; using Standard.AI.OpenAI.Services.Orchestrations.AIFiles; @@ -141,5 +142,12 @@ private static string CreateRandomFileId() return randomId; } + + private static AIFileOrchestrationDependencyValidationException createAIFileOrchestrationDependencyValidationException(Xeption innerException) + { + return new AIFileOrchestrationDependencyValidationException( + message: "AI file dependency validation error occurred, fix errors and try again.", + innerException); + } } } \ No newline at end of file diff --git a/Standard.AI.OpenAI/Services/Orchestrations/AIFiles/AIFileOrchestrationService.Exceptions.cs b/Standard.AI.OpenAI/Services/Orchestrations/AIFiles/AIFileOrchestrationService.Exceptions.cs index 8741ebac..2536ae69 100644 --- a/Standard.AI.OpenAI/Services/Orchestrations/AIFiles/AIFileOrchestrationService.Exceptions.cs +++ b/Standard.AI.OpenAI/Services/Orchestrations/AIFiles/AIFileOrchestrationService.Exceptions.cs @@ -35,14 +35,12 @@ private async ValueTask TryCatch(ReturningAIFileFunction returningAIFile } catch (LocalFileValidationException localFileValidationException) { - throw new AIFileOrchestrationDependencyValidationException( - message: "AI file dependency validation error occurred, fix errors and try again.", + throw createAIFileOrchestrationDependencyValidationException( localFileValidationException.InnerException as Xeption); } catch (LocalFileDependencyValidationException localFileDependencyValidationException) { - throw new AIFileOrchestrationDependencyValidationException( - message: "AI file dependency validation error occurred, fix errors and try again.", + throw createAIFileOrchestrationDependencyValidationException( localFileDependencyValidationException.InnerException as Xeption); } catch (LocalFileDependencyException localFileDependencyException) @@ -57,14 +55,12 @@ private async ValueTask TryCatch(ReturningAIFileFunction returningAIFile } catch (AIFileValidationException aIFileValidationException) { - throw new AIFileOrchestrationDependencyValidationException( - message: "AI file dependency validation error occurred, fix errors and try again.", + throw createAIFileOrchestrationDependencyValidationException( aIFileValidationException.InnerException as Xeption); } catch (AIFileDependencyValidationException aIFileDependencyValidationException) { - throw new AIFileOrchestrationDependencyValidationException( - message: "AI file dependency validation error occurred, fix errors and try again.", + throw createAIFileOrchestrationDependencyValidationException( aIFileDependencyValidationException.InnerException as Xeption); } catch (AIFileDependencyException aIFileDependencyException) @@ -101,8 +97,7 @@ private async ValueTask> TryCatch(ReturningAIFilesFu } catch (AIFileDependencyValidationException aIFileDependencyValidationException) { - throw new AIFileOrchestrationDependencyValidationException( - message: "AI file dependency validation error occurred, fix errors and try again.", + throw createAIFileOrchestrationDependencyValidationException( aIFileDependencyValidationException.InnerException as Xeption); } catch (AIFileServiceException aIFileServiceException) @@ -120,5 +115,12 @@ private async ValueTask> TryCatch(ReturningAIFilesFu failedAIFileOrchestrationServiceException); } } + + private static AIFileOrchestrationDependencyValidationException createAIFileOrchestrationDependencyValidationException(Xeption innerException) + { + return new AIFileOrchestrationDependencyValidationException( + message: "AI file dependency validation error occurred, fix errors and try again.", + innerException); + } } } From 0ea9d989cf8bf0aa0d1105a365c18e7a364c921b Mon Sep 17 00:00:00 2001 From: Lezune Date: Fri, 31 May 2024 06:27:19 -0700 Subject: [PATCH 147/283] Added create methods to both AIFileOrchestrationService.Exceptions.cs and AIFileOrchestrationServiceTests.cs as well as refactored code --- ...OrchestrationServiceTests.Exceptions.RemoveFileById.cs | 5 ++--- ...ileOrchestrationServiceTests.Exceptions.RetrieveAll.cs | 5 ++--- .../AIFileOrchestrationServiceTests.Exceptions.Upload.cs | 5 ++--- .../AIFiles/AIFileOrchestrationServiceTests.cs | 8 ++++++++ 4 files changed, 14 insertions(+), 9 deletions(-) diff --git a/Standard.AI.OpenAI.Tests.Unit/Services/Orchestrations/AIFiles/AIFileOrchestrationServiceTests.Exceptions.RemoveFileById.cs b/Standard.AI.OpenAI.Tests.Unit/Services/Orchestrations/AIFiles/AIFileOrchestrationServiceTests.Exceptions.RemoveFileById.cs index 20f78b19..45e3f7ab 100644 --- a/Standard.AI.OpenAI.Tests.Unit/Services/Orchestrations/AIFiles/AIFileOrchestrationServiceTests.Exceptions.RemoveFileById.cs +++ b/Standard.AI.OpenAI.Tests.Unit/Services/Orchestrations/AIFiles/AIFileOrchestrationServiceTests.Exceptions.RemoveFileById.cs @@ -63,9 +63,8 @@ private async Task ShouldThrowDependencyExceptionOnRemoveFileIfDependencyExcepti string someFileId = CreateRandomFileId(); var expectedAIFileOrchestrationDependencyException = - new AIFileOrchestrationDependencyException( - message: "AI File dependency error occurred, contact support.", - innerException: dependencyException.InnerException as Xeption); + createAIFileOrchestrationDependencyException( + innerException: dependencyException.InnerException as Xeption); this.aiFileServiceMock.Setup(service => service.RemoveFileByIdAsync(It.IsAny())) diff --git a/Standard.AI.OpenAI.Tests.Unit/Services/Orchestrations/AIFiles/AIFileOrchestrationServiceTests.Exceptions.RetrieveAll.cs b/Standard.AI.OpenAI.Tests.Unit/Services/Orchestrations/AIFiles/AIFileOrchestrationServiceTests.Exceptions.RetrieveAll.cs index 6cd65890..13a2ab45 100644 --- a/Standard.AI.OpenAI.Tests.Unit/Services/Orchestrations/AIFiles/AIFileOrchestrationServiceTests.Exceptions.RetrieveAll.cs +++ b/Standard.AI.OpenAI.Tests.Unit/Services/Orchestrations/AIFiles/AIFileOrchestrationServiceTests.Exceptions.RetrieveAll.cs @@ -24,9 +24,8 @@ private async Task ShouldThrowDependencyExceptionOnRetrieveAllIfDependencyErrorO { // given var expectedAIFileOrchestrationDependencyException = - new AIFileOrchestrationDependencyException( - message: "AI File dependency error occurred, contact support.", - innerException: dependencyException.InnerException as Xeption); + createAIFileOrchestrationDependencyException( + innerException: dependencyException.InnerException as Xeption); this.aiFileServiceMock.Setup(service => service.RetrieveAllFilesAsync()) diff --git a/Standard.AI.OpenAI.Tests.Unit/Services/Orchestrations/AIFiles/AIFileOrchestrationServiceTests.Exceptions.Upload.cs b/Standard.AI.OpenAI.Tests.Unit/Services/Orchestrations/AIFiles/AIFileOrchestrationServiceTests.Exceptions.Upload.cs index 23f55635..bbfe266c 100644 --- a/Standard.AI.OpenAI.Tests.Unit/Services/Orchestrations/AIFiles/AIFileOrchestrationServiceTests.Exceptions.Upload.cs +++ b/Standard.AI.OpenAI.Tests.Unit/Services/Orchestrations/AIFiles/AIFileOrchestrationServiceTests.Exceptions.Upload.cs @@ -67,9 +67,8 @@ private async Task ShouldThrowDependencyExceptionOnUploadIfDependencyValidationE AIFile someAIFile = CreateRandomAIFile(); var expectedAIFileOrchestrationDependencyException = - new AIFileOrchestrationDependencyException( - message: "AI File dependency error occurred, contact support.", - innerException: dependencyValidationException.InnerException as Xeption); + createAIFileOrchestrationDependencyException( + innerException: dependencyValidationException.InnerException as Xeption); this.aiFileServiceMock.Setup(service => service.UploadFileAsync(It.IsAny())) diff --git a/Standard.AI.OpenAI.Tests.Unit/Services/Orchestrations/AIFiles/AIFileOrchestrationServiceTests.cs b/Standard.AI.OpenAI.Tests.Unit/Services/Orchestrations/AIFiles/AIFileOrchestrationServiceTests.cs index cebfc9b8..042dfb6e 100644 --- a/Standard.AI.OpenAI.Tests.Unit/Services/Orchestrations/AIFiles/AIFileOrchestrationServiceTests.cs +++ b/Standard.AI.OpenAI.Tests.Unit/Services/Orchestrations/AIFiles/AIFileOrchestrationServiceTests.cs @@ -11,6 +11,7 @@ using Standard.AI.OpenAI.Models.Services.Foundations.AIFiles; using Standard.AI.OpenAI.Models.Services.Foundations.AIFiles.Exceptions; using Standard.AI.OpenAI.Models.Services.Foundations.LocalFiles.Exceptions; +using Standard.AI.OpenAI.Models.Services.Orchestrations.AIFiles.Exceptions; using Standard.AI.OpenAI.Services.Foundations.AIFiles; using Standard.AI.OpenAI.Services.Foundations.LocalFiles; using Standard.AI.OpenAI.Services.Orchestrations.AIFiles; @@ -141,5 +142,12 @@ private static string CreateRandomFileId() return randomId; } + + private static AIFileOrchestrationDependencyException createAIFileOrchestrationDependencyException(Xeption innerException) + { + return new AIFileOrchestrationDependencyException( + message: "AI File dependency error occurred, contact support.", + innerException); + } } } \ No newline at end of file From 4b256e9c67edfbf47b13ed4679582390271bd5b1 Mon Sep 17 00:00:00 2001 From: Lezune Date: Fri, 31 May 2024 06:32:09 -0700 Subject: [PATCH 148/283] Added create methods to both AIFileOrchestrationService.Exceptions.cs and AIFileOrchestrationServiceTests.cs as well as refactored code --- ...trationServiceTests.Exceptions.RemoveFileById.cs | 5 ++--- ...hestrationServiceTests.Exceptions.RetrieveAll.cs | 5 ++--- ...leOrchestrationServiceTests.Exceptions.Upload.cs | 5 ++--- .../AIFiles/AIFileOrchestrationServiceTests.cs | 8 ++++++++ .../AIFileOrchestrationService.Exceptions.cs | 13 +++++++++---- 5 files changed, 23 insertions(+), 13 deletions(-) diff --git a/Standard.AI.OpenAI.Tests.Unit/Services/Orchestrations/AIFiles/AIFileOrchestrationServiceTests.Exceptions.RemoveFileById.cs b/Standard.AI.OpenAI.Tests.Unit/Services/Orchestrations/AIFiles/AIFileOrchestrationServiceTests.Exceptions.RemoveFileById.cs index 20f78b19..07318d33 100644 --- a/Standard.AI.OpenAI.Tests.Unit/Services/Orchestrations/AIFiles/AIFileOrchestrationServiceTests.Exceptions.RemoveFileById.cs +++ b/Standard.AI.OpenAI.Tests.Unit/Services/Orchestrations/AIFiles/AIFileOrchestrationServiceTests.Exceptions.RemoveFileById.cs @@ -106,9 +106,8 @@ private async Task ShouldThrowServiceExceptionOnRemoveFileIfExceptionOccursAsync innerException: serviceException); var expectedAIFileOrchestrationServiceException = - new AIFileOrchestrationServiceException( - message: "AI File error occurred, contact support.", - innerException: failedAIFileOrchestrationServiceException); + createAIFileOrchestrationServiceException( + innerException: failedAIFileOrchestrationServiceException); this.aiFileServiceMock.Setup(service => service.RemoveFileByIdAsync(It.IsAny())) diff --git a/Standard.AI.OpenAI.Tests.Unit/Services/Orchestrations/AIFiles/AIFileOrchestrationServiceTests.Exceptions.RetrieveAll.cs b/Standard.AI.OpenAI.Tests.Unit/Services/Orchestrations/AIFiles/AIFileOrchestrationServiceTests.Exceptions.RetrieveAll.cs index 6cd65890..6c9b1a81 100644 --- a/Standard.AI.OpenAI.Tests.Unit/Services/Orchestrations/AIFiles/AIFileOrchestrationServiceTests.Exceptions.RetrieveAll.cs +++ b/Standard.AI.OpenAI.Tests.Unit/Services/Orchestrations/AIFiles/AIFileOrchestrationServiceTests.Exceptions.RetrieveAll.cs @@ -106,9 +106,8 @@ private async Task ShouldThrowServiceExceptionOnRetrieveAllIfExceptionOccursAsyn innerException: serviceException); var expectedAIFileOrchestrationServiceException = - new AIFileOrchestrationServiceException( - message: "AI File error occurred, contact support.", - innerException: failedAIFileOrchestrationServiceException); + createAIFileOrchestrationServiceException( + innerException: failedAIFileOrchestrationServiceException); this.aiFileServiceMock.Setup(service => service.RetrieveAllFilesAsync()) diff --git a/Standard.AI.OpenAI.Tests.Unit/Services/Orchestrations/AIFiles/AIFileOrchestrationServiceTests.Exceptions.Upload.cs b/Standard.AI.OpenAI.Tests.Unit/Services/Orchestrations/AIFiles/AIFileOrchestrationServiceTests.Exceptions.Upload.cs index 23f55635..a2b0e0fd 100644 --- a/Standard.AI.OpenAI.Tests.Unit/Services/Orchestrations/AIFiles/AIFileOrchestrationServiceTests.Exceptions.Upload.cs +++ b/Standard.AI.OpenAI.Tests.Unit/Services/Orchestrations/AIFiles/AIFileOrchestrationServiceTests.Exceptions.Upload.cs @@ -114,9 +114,8 @@ private async Task ShouldThrowServiceExceptionOnUploadIfExceptionOccursAsync() innerException: serviceException); var expectedAIFileOrchestrationServiceException = - new AIFileOrchestrationServiceException( - message: "AI File error occurred, contact support.", - innerException: failedAIFileOrchestrationServiceException); + createAIFileOrchestrationServiceException( + innerException: failedAIFileOrchestrationServiceException); this.aiFileServiceMock.Setup(service => service.UploadFileAsync(It.IsAny())) diff --git a/Standard.AI.OpenAI.Tests.Unit/Services/Orchestrations/AIFiles/AIFileOrchestrationServiceTests.cs b/Standard.AI.OpenAI.Tests.Unit/Services/Orchestrations/AIFiles/AIFileOrchestrationServiceTests.cs index cebfc9b8..39feae70 100644 --- a/Standard.AI.OpenAI.Tests.Unit/Services/Orchestrations/AIFiles/AIFileOrchestrationServiceTests.cs +++ b/Standard.AI.OpenAI.Tests.Unit/Services/Orchestrations/AIFiles/AIFileOrchestrationServiceTests.cs @@ -11,6 +11,7 @@ using Standard.AI.OpenAI.Models.Services.Foundations.AIFiles; using Standard.AI.OpenAI.Models.Services.Foundations.AIFiles.Exceptions; using Standard.AI.OpenAI.Models.Services.Foundations.LocalFiles.Exceptions; +using Standard.AI.OpenAI.Models.Services.Orchestrations.AIFiles.Exceptions; using Standard.AI.OpenAI.Services.Foundations.AIFiles; using Standard.AI.OpenAI.Services.Foundations.LocalFiles; using Standard.AI.OpenAI.Services.Orchestrations.AIFiles; @@ -141,5 +142,12 @@ private static string CreateRandomFileId() return randomId; } + + private static AIFileOrchestrationServiceException createAIFileOrchestrationServiceException(Xeption innerException) + { + return new AIFileOrchestrationServiceException( + message: "AI File error occurred, contact support.", + innerException); + } } } \ No newline at end of file diff --git a/Standard.AI.OpenAI/Services/Orchestrations/AIFiles/AIFileOrchestrationService.Exceptions.cs b/Standard.AI.OpenAI/Services/Orchestrations/AIFiles/AIFileOrchestrationService.Exceptions.cs index 7f00f192..4395c1a7 100644 --- a/Standard.AI.OpenAI/Services/Orchestrations/AIFiles/AIFileOrchestrationService.Exceptions.cs +++ b/Standard.AI.OpenAI/Services/Orchestrations/AIFiles/AIFileOrchestrationService.Exceptions.cs @@ -79,8 +79,7 @@ private async ValueTask TryCatch(ReturningAIFileFunction returningAIFile new FailedAIFileOrchestrationServiceException( exception); - throw new AIFileOrchestrationServiceException( - message: "AI File error occurred, contact support.", + throw createAIFileOrchestrationServiceException( failedAIFileOrchestrationServiceException); } } @@ -112,10 +111,16 @@ private async ValueTask> TryCatch(ReturningAIFilesFu new FailedAIFileOrchestrationServiceException( exception); - throw new AIFileOrchestrationServiceException( - message: "AI File error occurred, contact support.", + throw createAIFileOrchestrationServiceException( failedAIFileOrchestrationServiceException); } } + + private static AIFileOrchestrationServiceException createAIFileOrchestrationServiceException(Xeption innerException) + { + return new AIFileOrchestrationServiceException( + message: "AI File error occurred, contact support.", + innerException); + } } } From a64066091a9d23df4d21ec4e3d5820d314140b2b Mon Sep 17 00:00:00 2001 From: Lezune Date: Fri, 31 May 2024 06:38:20 -0700 Subject: [PATCH 149/283] Added create methods to both AIFileOrchestrationService.Exceptions.cs and AIFileOrchestrationServiceTests.cs as well as refactored code --- ...ServiceTests.Validation.RemoveFileByIdAsync.cs | 5 ++--- ...rchestrationServiceTests.Validations.Upload.cs | 15 ++++++--------- .../AIFiles/AIFileOrchestrationServiceTests.cs | 8 ++++++++ .../AIFileOrchestrationService.Exceptions.cs | 13 +++++++++---- 4 files changed, 25 insertions(+), 16 deletions(-) diff --git a/Standard.AI.OpenAI.Tests.Unit/Services/Orchestrations/AIFiles/AIFileOrchestrationServiceTests.Validation.RemoveFileByIdAsync.cs b/Standard.AI.OpenAI.Tests.Unit/Services/Orchestrations/AIFiles/AIFileOrchestrationServiceTests.Validation.RemoveFileByIdAsync.cs index a41a6379..452744a8 100644 --- a/Standard.AI.OpenAI.Tests.Unit/Services/Orchestrations/AIFiles/AIFileOrchestrationServiceTests.Validation.RemoveFileByIdAsync.cs +++ b/Standard.AI.OpenAI.Tests.Unit/Services/Orchestrations/AIFiles/AIFileOrchestrationServiceTests.Validation.RemoveFileByIdAsync.cs @@ -25,9 +25,8 @@ private async Task ShouldThrowValidationExceptionOnRemoveFileIfFileIdIsInvalid(s values: "Value is required"); var expectedAIFileOrchestrationValidationException = - new AIFileOrchestrationValidationException( - message: "AI file validation error occurred, fix errors and try again.", - innerException: invalidAiFileOrchestrationException); + createAIFileOrchestrationValidationException( + innerException: invalidAiFileOrchestrationException); // when ValueTask removeFileTask = diff --git a/Standard.AI.OpenAI.Tests.Unit/Services/Orchestrations/AIFiles/AIFileOrchestrationServiceTests.Validations.Upload.cs b/Standard.AI.OpenAI.Tests.Unit/Services/Orchestrations/AIFiles/AIFileOrchestrationServiceTests.Validations.Upload.cs index ea6f96fa..542ff7b7 100644 --- a/Standard.AI.OpenAI.Tests.Unit/Services/Orchestrations/AIFiles/AIFileOrchestrationServiceTests.Validations.Upload.cs +++ b/Standard.AI.OpenAI.Tests.Unit/Services/Orchestrations/AIFiles/AIFileOrchestrationServiceTests.Validations.Upload.cs @@ -23,9 +23,8 @@ private async Task ShouldThrowValidationExceptionOnUploadIfFileIsNullAsync() new NullAIFileOrchestrationException(); var expectedAIFileOrchestrationValidationException = - new AIFileOrchestrationValidationException( - message: "AI file validation error occurred, fix errors and try again.", - innerException: nullAIFileOrchestrationException); + createAIFileOrchestrationValidationException( + innerException: nullAIFileOrchestrationException); // when ValueTask uploadFileTask = @@ -67,9 +66,8 @@ private async Task ShouldThrowValidationExceptionOnUploadIfRequestIsNullAsync() values: "Object is required"); var expectedAIFileOrchestrationValidationException = - new AIFileOrchestrationValidationException( - message: "AI file validation error occurred, fix errors and try again.", - innerException: invalidAIFileOrchestrationException); + createAIFileOrchestrationValidationException( + innerException: invalidAIFileOrchestrationException); // when ValueTask uploadFileTask = @@ -117,9 +115,8 @@ private async Task ShouldThrowValidationExceptionIfRequestIsInvalidAsync( "Value is required"); var expectedAIFileOrchestrationValidationException = - new AIFileOrchestrationValidationException( - message: "AI file validation error occurred, fix errors and try again.", - innerException: invalidAIFileOrchestrationException); + createAIFileOrchestrationValidationException( + innerException: invalidAIFileOrchestrationException); // when ValueTask uploadFileTask = diff --git a/Standard.AI.OpenAI.Tests.Unit/Services/Orchestrations/AIFiles/AIFileOrchestrationServiceTests.cs b/Standard.AI.OpenAI.Tests.Unit/Services/Orchestrations/AIFiles/AIFileOrchestrationServiceTests.cs index cebfc9b8..438d3c4e 100644 --- a/Standard.AI.OpenAI.Tests.Unit/Services/Orchestrations/AIFiles/AIFileOrchestrationServiceTests.cs +++ b/Standard.AI.OpenAI.Tests.Unit/Services/Orchestrations/AIFiles/AIFileOrchestrationServiceTests.cs @@ -11,6 +11,7 @@ using Standard.AI.OpenAI.Models.Services.Foundations.AIFiles; using Standard.AI.OpenAI.Models.Services.Foundations.AIFiles.Exceptions; using Standard.AI.OpenAI.Models.Services.Foundations.LocalFiles.Exceptions; +using Standard.AI.OpenAI.Models.Services.Orchestrations.AIFiles.Exceptions; using Standard.AI.OpenAI.Services.Foundations.AIFiles; using Standard.AI.OpenAI.Services.Foundations.LocalFiles; using Standard.AI.OpenAI.Services.Orchestrations.AIFiles; @@ -141,5 +142,12 @@ private static string CreateRandomFileId() return randomId; } + + private static AIFileOrchestrationValidationException createAIFileOrchestrationValidationException(Xeption innerException) + { + return new AIFileOrchestrationValidationException( + message: "AI file validation error occurred, fix errors and try again.", + innerException); + } } } \ No newline at end of file diff --git a/Standard.AI.OpenAI/Services/Orchestrations/AIFiles/AIFileOrchestrationService.Exceptions.cs b/Standard.AI.OpenAI/Services/Orchestrations/AIFiles/AIFileOrchestrationService.Exceptions.cs index ce435eb2..321830b0 100644 --- a/Standard.AI.OpenAI/Services/Orchestrations/AIFiles/AIFileOrchestrationService.Exceptions.cs +++ b/Standard.AI.OpenAI/Services/Orchestrations/AIFiles/AIFileOrchestrationService.Exceptions.cs @@ -26,14 +26,12 @@ private async ValueTask TryCatch(ReturningAIFileFunction returningAIFile } catch (NullAIFileOrchestrationException nullAIFileOrchestrationException) { - throw new AIFileOrchestrationValidationException( - message: "AI file validation error occurred, fix errors and try again.", + throw createAIFileOrchestrationValidationException( nullAIFileOrchestrationException); } catch (InvalidAIFileOrchestrationException invalidAIFileOrchestrationException) { - throw new AIFileOrchestrationValidationException( - message: "AI file validation error occurred, fix errors and try again.", + throw createAIFileOrchestrationValidationException( invalidAIFileOrchestrationException); } catch (LocalFileValidationException localFileValidationException) @@ -118,5 +116,12 @@ private async ValueTask> TryCatch(ReturningAIFilesFu failedAIFileOrchestrationServiceException); } } + + private static AIFileOrchestrationValidationException createAIFileOrchestrationValidationException(Xeption innerException) + { + return new AIFileOrchestrationValidationException( + message: "AI file validation error occurred, fix errors and try again.", + innerException); + } } } From ec750a233da5fa66f943e28c1f9029017f5abcf6 Mon Sep 17 00:00:00 2001 From: Lezune Date: Fri, 31 May 2024 06:44:37 -0700 Subject: [PATCH 150/283] Added create methods to both AIFileOrchestrationService.Exceptions.cs and AIFileOrchestrationServiceTests.cs as well as refactored code --- ...trationServiceTests.Exceptions.RemoveFileById.cs | 5 ++--- ...hestrationServiceTests.Exceptions.RetrieveAll.cs | 5 ++--- ...leOrchestrationServiceTests.Exceptions.Upload.cs | 5 ++--- .../AIFiles/AIFileOrchestrationServiceTests.cs | 8 ++++++++ .../AIFileOrchestrationService.Exceptions.cs | 13 +++++++++---- 5 files changed, 23 insertions(+), 13 deletions(-) diff --git a/Standard.AI.OpenAI.Tests.Unit/Services/Orchestrations/AIFiles/AIFileOrchestrationServiceTests.Exceptions.RemoveFileById.cs b/Standard.AI.OpenAI.Tests.Unit/Services/Orchestrations/AIFiles/AIFileOrchestrationServiceTests.Exceptions.RemoveFileById.cs index 20f78b19..39188a10 100644 --- a/Standard.AI.OpenAI.Tests.Unit/Services/Orchestrations/AIFiles/AIFileOrchestrationServiceTests.Exceptions.RemoveFileById.cs +++ b/Standard.AI.OpenAI.Tests.Unit/Services/Orchestrations/AIFiles/AIFileOrchestrationServiceTests.Exceptions.RemoveFileById.cs @@ -101,9 +101,8 @@ private async Task ShouldThrowServiceExceptionOnRemoveFileIfExceptionOccursAsync var serviceException = new Exception(); var failedAIFileOrchestrationServiceException = - new FailedAIFileOrchestrationServiceException( - message: "Failed AI file service error occurred, contact support.", - innerException: serviceException); + createFailedAIFileOrchestrationServiceException( + innerException: serviceException); var expectedAIFileOrchestrationServiceException = new AIFileOrchestrationServiceException( diff --git a/Standard.AI.OpenAI.Tests.Unit/Services/Orchestrations/AIFiles/AIFileOrchestrationServiceTests.Exceptions.RetrieveAll.cs b/Standard.AI.OpenAI.Tests.Unit/Services/Orchestrations/AIFiles/AIFileOrchestrationServiceTests.Exceptions.RetrieveAll.cs index 6cd65890..1cef502b 100644 --- a/Standard.AI.OpenAI.Tests.Unit/Services/Orchestrations/AIFiles/AIFileOrchestrationServiceTests.Exceptions.RetrieveAll.cs +++ b/Standard.AI.OpenAI.Tests.Unit/Services/Orchestrations/AIFiles/AIFileOrchestrationServiceTests.Exceptions.RetrieveAll.cs @@ -101,9 +101,8 @@ private async Task ShouldThrowServiceExceptionOnRetrieveAllIfExceptionOccursAsyn var serviceException = new Exception(); var failedAIFileOrchestrationServiceException = - new FailedAIFileOrchestrationServiceException( - message: "Failed AI file service error occurred, contact support.", - innerException: serviceException); + createFailedAIFileOrchestrationServiceException( + innerException: serviceException); var expectedAIFileOrchestrationServiceException = new AIFileOrchestrationServiceException( diff --git a/Standard.AI.OpenAI.Tests.Unit/Services/Orchestrations/AIFiles/AIFileOrchestrationServiceTests.Exceptions.Upload.cs b/Standard.AI.OpenAI.Tests.Unit/Services/Orchestrations/AIFiles/AIFileOrchestrationServiceTests.Exceptions.Upload.cs index 23f55635..492eca4c 100644 --- a/Standard.AI.OpenAI.Tests.Unit/Services/Orchestrations/AIFiles/AIFileOrchestrationServiceTests.Exceptions.Upload.cs +++ b/Standard.AI.OpenAI.Tests.Unit/Services/Orchestrations/AIFiles/AIFileOrchestrationServiceTests.Exceptions.Upload.cs @@ -109,9 +109,8 @@ private async Task ShouldThrowServiceExceptionOnUploadIfExceptionOccursAsync() var serviceException = new Exception(); var failedAIFileOrchestrationServiceException = - new FailedAIFileOrchestrationServiceException( - message: "Failed AI file service error occurred, contact support.", - innerException: serviceException); + createFailedAIFileOrchestrationServiceException( + innerException: serviceException); var expectedAIFileOrchestrationServiceException = new AIFileOrchestrationServiceException( diff --git a/Standard.AI.OpenAI.Tests.Unit/Services/Orchestrations/AIFiles/AIFileOrchestrationServiceTests.cs b/Standard.AI.OpenAI.Tests.Unit/Services/Orchestrations/AIFiles/AIFileOrchestrationServiceTests.cs index cebfc9b8..ca077291 100644 --- a/Standard.AI.OpenAI.Tests.Unit/Services/Orchestrations/AIFiles/AIFileOrchestrationServiceTests.cs +++ b/Standard.AI.OpenAI.Tests.Unit/Services/Orchestrations/AIFiles/AIFileOrchestrationServiceTests.cs @@ -11,6 +11,7 @@ using Standard.AI.OpenAI.Models.Services.Foundations.AIFiles; using Standard.AI.OpenAI.Models.Services.Foundations.AIFiles.Exceptions; using Standard.AI.OpenAI.Models.Services.Foundations.LocalFiles.Exceptions; +using Standard.AI.OpenAI.Models.Services.Orchestrations.AIFiles.Exceptions; using Standard.AI.OpenAI.Services.Foundations.AIFiles; using Standard.AI.OpenAI.Services.Foundations.LocalFiles; using Standard.AI.OpenAI.Services.Orchestrations.AIFiles; @@ -141,5 +142,12 @@ private static string CreateRandomFileId() return randomId; } + + private static FailedAIFileOrchestrationServiceException createFailedAIFileOrchestrationServiceException(Exception innerException) + { + return new FailedAIFileOrchestrationServiceException( + message: "Failed AI file service error occurred, contact support.", + innerException); + } } } \ No newline at end of file diff --git a/Standard.AI.OpenAI/Services/Orchestrations/AIFiles/AIFileOrchestrationService.Exceptions.cs b/Standard.AI.OpenAI/Services/Orchestrations/AIFiles/AIFileOrchestrationService.Exceptions.cs index ef6d3ffd..acba60ab 100644 --- a/Standard.AI.OpenAI/Services/Orchestrations/AIFiles/AIFileOrchestrationService.Exceptions.cs +++ b/Standard.AI.OpenAI/Services/Orchestrations/AIFiles/AIFileOrchestrationService.Exceptions.cs @@ -76,8 +76,7 @@ private async ValueTask TryCatch(ReturningAIFileFunction returningAIFile catch (Exception exception) { var failedAIFileOrchestrationServiceException = - new FailedAIFileOrchestrationServiceException( - message: "Failed AI file service error occurred, contact support.", + createFailedAIFileOrchestrationServiceException( exception); throw new AIFileOrchestrationServiceException( @@ -109,13 +108,19 @@ private async ValueTask> TryCatch(ReturningAIFilesFu catch (Exception exception) { var failedAIFileOrchestrationServiceException = - new FailedAIFileOrchestrationServiceException( - message: "Failed AI file service error occurred, contact support.", + createFailedAIFileOrchestrationServiceException( exception); throw new AIFileOrchestrationServiceException( failedAIFileOrchestrationServiceException); } } + + private static FailedAIFileOrchestrationServiceException createFailedAIFileOrchestrationServiceException(Exception innerException) + { + return new FailedAIFileOrchestrationServiceException( + message: "Failed AI file service error occurred, contact support.", + innerException); + } } } From 483af015b3450c79c591b7ef1f7bacd4547e8838 Mon Sep 17 00:00:00 2001 From: Lezune Date: Fri, 31 May 2024 06:49:27 -0700 Subject: [PATCH 151/283] Added create methods to both AIFileOrchestrationService.Exceptions.cs and AIFileOrchestrationServiceTests.cs as well as refactored code --- ...estrationServiceTests.Validation.RemoveFileByIdAsync.cs | 3 +-- .../AIFileOrchestrationServiceTests.Validations.Upload.cs | 6 ++---- .../AIFiles/AIFileOrchestrationServiceTests.cs | 7 +++++++ 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/Standard.AI.OpenAI.Tests.Unit/Services/Orchestrations/AIFiles/AIFileOrchestrationServiceTests.Validation.RemoveFileByIdAsync.cs b/Standard.AI.OpenAI.Tests.Unit/Services/Orchestrations/AIFiles/AIFileOrchestrationServiceTests.Validation.RemoveFileByIdAsync.cs index 5ae64533..fc322399 100644 --- a/Standard.AI.OpenAI.Tests.Unit/Services/Orchestrations/AIFiles/AIFileOrchestrationServiceTests.Validation.RemoveFileByIdAsync.cs +++ b/Standard.AI.OpenAI.Tests.Unit/Services/Orchestrations/AIFiles/AIFileOrchestrationServiceTests.Validation.RemoveFileByIdAsync.cs @@ -18,8 +18,7 @@ private async Task ShouldThrowValidationExceptionOnRemoveFileIfFileIdIsInvalid(s { // given var invalidAiFileOrchestrationException = - new InvalidAIFileOrchestrationException( - message: "AI file is invalid."); + createInvalidAIFileOrchestrationException(); invalidAiFileOrchestrationException.AddData( key: nameof(AIFile.Response.Id), diff --git a/Standard.AI.OpenAI.Tests.Unit/Services/Orchestrations/AIFiles/AIFileOrchestrationServiceTests.Validations.Upload.cs b/Standard.AI.OpenAI.Tests.Unit/Services/Orchestrations/AIFiles/AIFileOrchestrationServiceTests.Validations.Upload.cs index a4e8276b..42197485 100644 --- a/Standard.AI.OpenAI.Tests.Unit/Services/Orchestrations/AIFiles/AIFileOrchestrationServiceTests.Validations.Upload.cs +++ b/Standard.AI.OpenAI.Tests.Unit/Services/Orchestrations/AIFiles/AIFileOrchestrationServiceTests.Validations.Upload.cs @@ -60,8 +60,7 @@ private async Task ShouldThrowValidationExceptionOnUploadIfRequestIsNullAsync() var invalidAIFile = new AIFile(); var invalidAIFileOrchestrationException = - new InvalidAIFileOrchestrationException( - message: "AI file is invalid."); + createInvalidAIFileOrchestrationException(); invalidAIFileOrchestrationException.AddData( key: nameof(AIFileRequest), @@ -111,8 +110,7 @@ private async Task ShouldThrowValidationExceptionIfRequestIsInvalidAsync( invalidAIFile.Request.Name = invalidName; var invalidAIFileOrchestrationException = - new InvalidAIFileOrchestrationException( - message: "AI file is invalid."); + createInvalidAIFileOrchestrationException(); invalidAIFileOrchestrationException.AddData( key: nameof(AIFileRequest.Name), diff --git a/Standard.AI.OpenAI.Tests.Unit/Services/Orchestrations/AIFiles/AIFileOrchestrationServiceTests.cs b/Standard.AI.OpenAI.Tests.Unit/Services/Orchestrations/AIFiles/AIFileOrchestrationServiceTests.cs index cebfc9b8..d7a11018 100644 --- a/Standard.AI.OpenAI.Tests.Unit/Services/Orchestrations/AIFiles/AIFileOrchestrationServiceTests.cs +++ b/Standard.AI.OpenAI.Tests.Unit/Services/Orchestrations/AIFiles/AIFileOrchestrationServiceTests.cs @@ -11,6 +11,7 @@ using Standard.AI.OpenAI.Models.Services.Foundations.AIFiles; using Standard.AI.OpenAI.Models.Services.Foundations.AIFiles.Exceptions; using Standard.AI.OpenAI.Models.Services.Foundations.LocalFiles.Exceptions; +using Standard.AI.OpenAI.Models.Services.Orchestrations.AIFiles.Exceptions; using Standard.AI.OpenAI.Services.Foundations.AIFiles; using Standard.AI.OpenAI.Services.Foundations.LocalFiles; using Standard.AI.OpenAI.Services.Orchestrations.AIFiles; @@ -141,5 +142,11 @@ private static string CreateRandomFileId() return randomId; } + + private static InvalidAIFileOrchestrationException createInvalidAIFileOrchestrationException() + { + return new InvalidAIFileOrchestrationException( + message: "AI file is invalid."); + } } } \ No newline at end of file From 24e444583d29f84e4a69e61f16c5c061404865fa Mon Sep 17 00:00:00 2001 From: Lezune Date: Fri, 31 May 2024 06:56:52 -0700 Subject: [PATCH 152/283] Refactored Code --- .../Clients/AIFiles/AIFilesClient.cs | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/Standard.AI.OpenAI/Clients/AIFiles/AIFilesClient.cs b/Standard.AI.OpenAI/Clients/AIFiles/AIFilesClient.cs index 2835d723..65d9631f 100644 --- a/Standard.AI.OpenAI/Clients/AIFiles/AIFilesClient.cs +++ b/Standard.AI.OpenAI/Clients/AIFiles/AIFilesClient.cs @@ -37,8 +37,7 @@ public async ValueTask UploadFileAsync(AIFile aiFile) } catch (AIFileOrchestrationDependencyException aiFileOrchestrationDependencyException) { - throw new AIFileClientDependencyException( - message: "AI file client dependency error occurred, contact support.", + throw createAIFileClientDependencyException( aiFileOrchestrationDependencyException.InnerException as Xeption); } catch (AIFileOrchestrationServiceException aiFileOrchestrationServiceException) @@ -61,8 +60,7 @@ public async ValueTask> RetrieveAllFilesAsync() } catch (AIFileOrchestrationDependencyException aiFileOrchestrationDependencyException) { - throw new AIFileClientDependencyException( - message: "AI file client dependency error occurred, contact support.", + throw createAIFileClientDependencyException( aiFileOrchestrationDependencyException.InnerException as Xeption); } catch (AIFileOrchestrationServiceException aiFileOrchestrationServiceException) @@ -90,8 +88,7 @@ public async ValueTask RemoveFileByIdAsync(string fileId) } catch (AIFileOrchestrationDependencyException aiFileOrchestrationDependencyException) { - throw new AIFileClientDependencyException( - message: "AI file client dependency error occurred, contact support.", + throw createAIFileClientDependencyException( aiFileOrchestrationDependencyException.InnerException as Xeption); } catch (AIFileOrchestrationServiceException aiFileOrchestrationServiceException) @@ -100,5 +97,12 @@ public async ValueTask RemoveFileByIdAsync(string fileId) aiFileOrchestrationServiceException.InnerException as Xeption); } } + + private static AIFileClientDependencyException createAIFileClientDependencyException(Xeption innerException) + { + return new AIFileClientDependencyException( + message: "AI file client dependency error occurred, contact support.", + innerException); + } } } From 9b03351297f5b20f546ca644eeb913ce9d3cbacd Mon Sep 17 00:00:00 2001 From: Lezune Date: Fri, 31 May 2024 07:02:26 -0700 Subject: [PATCH 153/283] Added a create method and refactored Code --- .../Clients/AIFiles/AIFilesClient.cs | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/Standard.AI.OpenAI/Clients/AIFiles/AIFilesClient.cs b/Standard.AI.OpenAI/Clients/AIFiles/AIFilesClient.cs index cf763f42..c6c3536d 100644 --- a/Standard.AI.OpenAI/Clients/AIFiles/AIFilesClient.cs +++ b/Standard.AI.OpenAI/Clients/AIFiles/AIFilesClient.cs @@ -42,8 +42,7 @@ public async ValueTask UploadFileAsync(AIFile aiFile) } catch (AIFileOrchestrationServiceException aiFileOrchestrationServiceException) { - throw new AIFileClientServiceException( - message: "AI file client service error occurred, contact support.", + throw createAIFileClientServiceException( aiFileOrchestrationServiceException.InnerException as Xeption); } } @@ -66,8 +65,7 @@ public async ValueTask> RetrieveAllFilesAsync() } catch (AIFileOrchestrationServiceException aiFileOrchestrationServiceException) { - throw new AIFileClientServiceException( - message: "AI file client service error occurred, contact support.", + throw createAIFileClientServiceException( aiFileOrchestrationServiceException.InnerException as Xeption); } } @@ -95,10 +93,16 @@ public async ValueTask RemoveFileByIdAsync(string fileId) } catch (AIFileOrchestrationServiceException aiFileOrchestrationServiceException) { - throw new AIFileClientServiceException( - message: "AI file client service error occurred, contact support.", + throw createAIFileClientServiceException( aiFileOrchestrationServiceException.InnerException as Xeption); } } + + private static AIFileClientServiceException createAIFileClientServiceException(Xeption innerException) + { + return new AIFileClientServiceException( + message: "AI file client service error occurred, contact support.", + innerException); + } } } From cc0b2623a45a8defe44a98fb73aabb316247e61f Mon Sep 17 00:00:00 2001 From: Lezune Date: Fri, 31 May 2024 07:05:35 -0700 Subject: [PATCH 154/283] Added a create method and refactored Code --- .../Clients/AIFiles/AIFilesClient.cs | 22 ++++++++++--------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/Standard.AI.OpenAI/Clients/AIFiles/AIFilesClient.cs b/Standard.AI.OpenAI/Clients/AIFiles/AIFilesClient.cs index 8a400f0f..4669b552 100644 --- a/Standard.AI.OpenAI/Clients/AIFiles/AIFilesClient.cs +++ b/Standard.AI.OpenAI/Clients/AIFiles/AIFilesClient.cs @@ -27,14 +27,12 @@ public async ValueTask UploadFileAsync(AIFile aiFile) } catch (AIFileOrchestrationValidationException aiFileOrchestrationValidationException) { - throw new AIFileClientValidationException( - message: "AI file client validation error occurred, fix errors and try again.", + throw createAIFileClientValidationException( aiFileOrchestrationValidationException.InnerException as Xeption); } catch (AIFileOrchestrationDependencyValidationException aiFileOrchestrationDependencyValidationException) { - throw new AIFileClientValidationException( - message: "AI file client validation error occurred, fix errors and try again.", + throw createAIFileClientValidationException( aiFileOrchestrationDependencyValidationException.InnerException as Xeption); } catch (AIFileOrchestrationDependencyException aiFileOrchestrationDependencyException) @@ -57,8 +55,7 @@ public async ValueTask> RetrieveAllFilesAsync() } catch (AIFileOrchestrationDependencyValidationException aiFileOrchestrationDependencyValidationException) { - throw new AIFileClientValidationException( - message: "AI file client validation error occurred, fix errors and try again.", + throw createAIFileClientValidationException( aiFileOrchestrationDependencyValidationException.InnerException as Xeption); } catch (AIFileOrchestrationDependencyException aiFileOrchestrationDependencyException) @@ -81,14 +78,12 @@ public async ValueTask RemoveFileByIdAsync(string fileId) } catch (AIFileOrchestrationValidationException aiFileOrchestrationValidationException) { - throw new AIFileClientValidationException( - message: "AI file client validation error occurred, fix errors and try again.", + throw createAIFileClientValidationException( aiFileOrchestrationValidationException.InnerException as Xeption); } catch (AIFileOrchestrationDependencyValidationException aiFileOrchestrationDependencyValidationException) { - throw new AIFileClientValidationException( - message: "AI file client validation error occurred, fix errors and try again.", + throw createAIFileClientValidationException( aiFileOrchestrationDependencyValidationException.InnerException as Xeption); } catch (AIFileOrchestrationDependencyException aiFileOrchestrationDependencyException) @@ -102,5 +97,12 @@ public async ValueTask RemoveFileByIdAsync(string fileId) aiFileOrchestrationServiceException.InnerException as Xeption); } } + + private static AIFileClientValidationException createAIFileClientValidationException(Xeption innerException) + { + return new AIFileClientValidationException( + message: "AI file client validation error occurred, fix errors and try again.", + innerException); + } } } From 521c52ce25066b4a9012369bac52085915317726 Mon Sep 17 00:00:00 2001 From: Lezune Date: Fri, 31 May 2024 07:16:48 -0700 Subject: [PATCH 155/283] Added a create method and refactored Code --- .../Clients/AIModels/AIModelsClient.cs | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/Standard.AI.OpenAI/Clients/AIModels/AIModelsClient.cs b/Standard.AI.OpenAI/Clients/AIModels/AIModelsClient.cs index 6cd499d9..556c3664 100644 --- a/Standard.AI.OpenAI/Clients/AIModels/AIModelsClient.cs +++ b/Standard.AI.OpenAI/Clients/AIModels/AIModelsClient.cs @@ -33,8 +33,7 @@ public async ValueTask> RetrieveAIModelsAsync() } catch (AIModelDependencyException aiModelDependencyException) { - throw new AIModelClientDependencyException( - message: "AI model client dependency error occurred, contact support.", + throw createAIModelClientDependencyException( aiModelDependencyException.InnerException as Xeption); } catch (AIModelServiceException aiModelServiceException) @@ -62,8 +61,7 @@ public async ValueTask RetrieveAIModelByNameAsync(string aiModelName) } catch (AIModelDependencyException aiModelDependencyException) { - throw new AIModelClientDependencyException( - message: "AI model client dependency error occurred, contact support.", + throw createAIModelClientDependencyException( aiModelDependencyException.InnerException as Xeption); } catch (AIModelServiceException aiModelServiceException) @@ -72,5 +70,12 @@ public async ValueTask RetrieveAIModelByNameAsync(string aiModelName) aiModelServiceException.InnerException as Xeption); } } + + private static AIModelClientDependencyException createAIModelClientDependencyException(Xeption innerException) + { + return new AIModelClientDependencyException( + message: "AI model client dependency error occurred, contact support.", + innerException); + } } } From 2e00f7b8a6e954481065cf649fecf9362d6e36fe Mon Sep 17 00:00:00 2001 From: Lezune Date: Fri, 31 May 2024 07:20:08 -0700 Subject: [PATCH 156/283] Added a create method and refactored Code --- .../Clients/AIModels/AIModelsClient.cs | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/Standard.AI.OpenAI/Clients/AIModels/AIModelsClient.cs b/Standard.AI.OpenAI/Clients/AIModels/AIModelsClient.cs index 2f00ac47..c8c2f18a 100644 --- a/Standard.AI.OpenAI/Clients/AIModels/AIModelsClient.cs +++ b/Standard.AI.OpenAI/Clients/AIModels/AIModelsClient.cs @@ -38,8 +38,7 @@ public async ValueTask> RetrieveAIModelsAsync() } catch (AIModelServiceException aiModelServiceException) { - throw new AIModelClientServiceException( - message: "AI Model client service error occurred, contact support.", + throw createAIModelClientServiceException( aiModelServiceException.InnerException as Xeption); } } @@ -67,10 +66,16 @@ public async ValueTask RetrieveAIModelByNameAsync(string aiModelName) } catch (AIModelServiceException aiModelServiceException) { - throw new AIModelClientServiceException( - message: "AI Model client service error occurred, contact support.", + throw createAIModelClientServiceException( aiModelServiceException.InnerException as Xeption); } } + + private static AIModelClientServiceException createAIModelClientServiceException(Xeption innerException) + { + return new AIModelClientServiceException( + message: "AI Model client service error occurred, contact support.", + innerException); + } } } From bdd050e3cd8ae8ec2966628d75fa28055da67f5c Mon Sep 17 00:00:00 2001 From: Lezune Date: Fri, 31 May 2024 07:23:19 -0700 Subject: [PATCH 157/283] Added a create method and refactored Code --- .../Clients/AIModels/AIModelsClient.cs | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/Standard.AI.OpenAI/Clients/AIModels/AIModelsClient.cs b/Standard.AI.OpenAI/Clients/AIModels/AIModelsClient.cs index 66a0437b..24c35d6f 100644 --- a/Standard.AI.OpenAI/Clients/AIModels/AIModelsClient.cs +++ b/Standard.AI.OpenAI/Clients/AIModels/AIModelsClient.cs @@ -28,8 +28,7 @@ public async ValueTask> RetrieveAIModelsAsync() } catch (AIModelDependencyValidationException aiModelDependencyValidationException) { - throw new AIModelClientValidationException( - message: "AI model client validation error occurred, fix errors and try again.", + throw createAIModelClientValidationException( aiModelDependencyValidationException.InnerException as Xeption); } catch (AIModelDependencyException aiModelDependencyException) @@ -52,14 +51,12 @@ public async ValueTask RetrieveAIModelByNameAsync(string aiModelName) } catch (AIModelValidationException aIModelValidationException) { - throw new AIModelClientValidationException( - message: "AI model client validation error occurred, fix errors and try again.", + throw createAIModelClientValidationException( aIModelValidationException.InnerException as Xeption); } catch (AIModelDependencyValidationException aiModelDependencyValidationException) { - throw new AIModelClientValidationException( - message: "AI model client validation error occurred, fix errors and try again.", + throw createAIModelClientValidationException( aiModelDependencyValidationException.InnerException as Xeption); } catch (AIModelDependencyException aiModelDependencyException) @@ -73,5 +70,12 @@ public async ValueTask RetrieveAIModelByNameAsync(string aiModelName) aiModelServiceException.InnerException as Xeption); } } + + private static AIModelClientValidationException createAIModelClientValidationException(Xeption innerException) + { + return new AIModelClientValidationException( + message: "AI model client validation error occurred, fix errors and try again.", + innerException); + } } } From 8b3bffcaa3ff997c5f33f04961f21958bd80835e Mon Sep 17 00:00:00 2001 From: Lezune Date: Fri, 31 May 2024 07:28:56 -0700 Subject: [PATCH 158/283] Added a create method and refactored Code --- .../ChatCompletions/ChatCompletionsClient.cs | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/Standard.AI.OpenAI/Clients/ChatCompletions/ChatCompletionsClient.cs b/Standard.AI.OpenAI/Clients/ChatCompletions/ChatCompletionsClient.cs index 7b143054..d1932318 100644 --- a/Standard.AI.OpenAI/Clients/ChatCompletions/ChatCompletionsClient.cs +++ b/Standard.AI.OpenAI/Clients/ChatCompletions/ChatCompletionsClient.cs @@ -26,14 +26,12 @@ public async ValueTask SendChatCompletionAsync(ChatCompletion ch } catch (ChatCompletionValidationException completionValidationException) { - throw new ChatCompletionClientValidationException( - message: "Chat completion client validation error occurred, fix errors and try again.", + throw createChatCompletionClientValidationException( completionValidationException.InnerException as Xeption); } catch (ChatCompletionDependencyValidationException completionDependencyValidationException) { - throw new ChatCompletionClientValidationException( - message: "Chat completion client validation error occurred, fix errors and try again.", + throw createChatCompletionClientValidationException( completionDependencyValidationException.InnerException as Xeption); } catch (ChatCompletionDependencyException completionDependencyException) @@ -47,5 +45,12 @@ public async ValueTask SendChatCompletionAsync(ChatCompletion ch completionServiceException.InnerException as Xeption); } } + + private static ChatCompletionClientValidationException createChatCompletionClientValidationException(Xeption innerException) + { + return new ChatCompletionClientValidationException( + message: "Chat completion client validation error occurred, fix errors and try again.", + innerException); + } } } From 6764e756ce0070c6fe0e0787e000f2f9f1302ac3 Mon Sep 17 00:00:00 2001 From: Lezune Date: Fri, 31 May 2024 07:33:09 -0700 Subject: [PATCH 159/283] Added a create method and refactored Code --- .../Clients/Completions/CompletionsClient.cs | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/Standard.AI.OpenAI/Clients/Completions/CompletionsClient.cs b/Standard.AI.OpenAI/Clients/Completions/CompletionsClient.cs index fb94b079..57532657 100644 --- a/Standard.AI.OpenAI/Clients/Completions/CompletionsClient.cs +++ b/Standard.AI.OpenAI/Clients/Completions/CompletionsClient.cs @@ -26,14 +26,12 @@ public async ValueTask PromptCompletionAsync(Completion completion) } catch (CompletionValidationException completionValidationException) { - throw new CompletionClientValidationException( - message: "Completion client validation error occurred, fix errors and try again.", + throw createCompletionClientValidationException( completionValidationException.InnerException as Xeption); } catch (CompletionDependencyValidationException completionDependencyValidationException) { - throw new CompletionClientValidationException( - message: "Completion client validation error occurred, fix errors and try again.", + throw createCompletionClientValidationException( completionDependencyValidationException.InnerException as Xeption); } catch (CompletionDependencyException completionDependencyException) @@ -47,5 +45,12 @@ public async ValueTask PromptCompletionAsync(Completion completion) completionServiceException.InnerException as Xeption); } } + + private static CompletionClientValidationException createCompletionClientValidationException(Xeption innerException) + { + return new CompletionClientValidationException( + message: "Completion client validation error occurred, fix errors and try again.", + innerException); + } } } From 483b3fca4f5f89f0755199f4523ca8c3d9b17827 Mon Sep 17 00:00:00 2001 From: Lezune Date: Fri, 31 May 2024 07:37:26 -0700 Subject: [PATCH 160/283] Added a create method and refactored Code --- .../Clients/FineTunes/FineTuneClient.cs | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/Standard.AI.OpenAI/Clients/FineTunes/FineTuneClient.cs b/Standard.AI.OpenAI/Clients/FineTunes/FineTuneClient.cs index 01716cfe..302ec6e6 100644 --- a/Standard.AI.OpenAI/Clients/FineTunes/FineTuneClient.cs +++ b/Standard.AI.OpenAI/Clients/FineTunes/FineTuneClient.cs @@ -26,8 +26,7 @@ public async ValueTask SubmitFineTuneAsync(FineTune fineTune) } catch (FineTuneValidationException fineTuneValidationException) { - throw new FineTuneClientValidationException( - message: "Fine tune client validation error occurred, fix errors and try again.", + throw createFineTuneClientValidationException( fineTuneValidationException.InnerException as Xeption); } catch (FineTuneDependencyException fineTuneDependencyException) @@ -37,8 +36,7 @@ public async ValueTask SubmitFineTuneAsync(FineTune fineTune) } catch (FineTuneDependencyValidationException fineTuneDependencyValidationException) { - throw new FineTuneClientValidationException( - message: "Fine tune client validation error occurred, fix errors and try again.", + throw createFineTuneClientValidationException( fineTuneDependencyValidationException.InnerException as Xeption); } catch (FineTuneServiceException fineTuneServiceException) @@ -47,5 +45,12 @@ public async ValueTask SubmitFineTuneAsync(FineTune fineTune) fineTuneServiceException.InnerException as Xeption); } } + + private static FineTuneClientValidationException createFineTuneClientValidationException(Xeption innerException) + { + return new FineTuneClientValidationException( + message: "Fine tune client validation error occurred, fix errors and try again.", + innerException); + } } } From 566a661c7b30c3e7859bf5509a4c99178244db3f Mon Sep 17 00:00:00 2001 From: Lezune Date: Fri, 31 May 2024 07:41:02 -0700 Subject: [PATCH 161/283] Added a create method and refactored Code --- .../ImageGenerations/ImageGenerationsClient.cs | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/Standard.AI.OpenAI/Clients/ImageGenerations/ImageGenerationsClient.cs b/Standard.AI.OpenAI/Clients/ImageGenerations/ImageGenerationsClient.cs index 2b5c54ae..526ac9b5 100644 --- a/Standard.AI.OpenAI/Clients/ImageGenerations/ImageGenerationsClient.cs +++ b/Standard.AI.OpenAI/Clients/ImageGenerations/ImageGenerationsClient.cs @@ -26,14 +26,12 @@ public async ValueTask GenerateImageAsync(ImageGeneration image } catch (ImageGenerationValidationException imageGenerationValidationException) { - throw new ImageGenerationClientValidationException( - message: "Image generation client validation error occurred, fix errors and try again.", + throw createImageGenerationClientValidationException( imageGenerationValidationException.InnerException as Xeption); } catch (ImageGenerationDependencyValidationException imageGenerationDependencyValidationException) { - throw new ImageGenerationClientValidationException( - message: "Image generation client validation error occurred, fix errors and try again.", + throw createImageGenerationClientValidationException( imageGenerationDependencyValidationException.InnerException as Xeption); } catch (ImageGenerationDependencyException imageGenerationDependencyException) @@ -47,5 +45,12 @@ public async ValueTask GenerateImageAsync(ImageGeneration image imageGenerationServiceException.InnerException as Xeption); } } + + private static ImageGenerationClientValidationException createImageGenerationClientValidationException(Xeption innerException) + { + return new ImageGenerationClientValidationException( + message: "Image generation client validation error occurred, fix errors and try again.", + innerException); + } } } \ No newline at end of file From 626f3837dd2a01c3a760510a8ebd4ad59717a113 Mon Sep 17 00:00:00 2001 From: Lezune Date: Sun, 2 Jun 2024 23:04:20 -0700 Subject: [PATCH 162/283] Updated the method call name to adhere to method naming policy, CreateImageGenerationClientValidationException() --- .../Clients/ImageGenerations/ImageGenerationsClient.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Standard.AI.OpenAI/Clients/ImageGenerations/ImageGenerationsClient.cs b/Standard.AI.OpenAI/Clients/ImageGenerations/ImageGenerationsClient.cs index 526ac9b5..930a27f4 100644 --- a/Standard.AI.OpenAI/Clients/ImageGenerations/ImageGenerationsClient.cs +++ b/Standard.AI.OpenAI/Clients/ImageGenerations/ImageGenerationsClient.cs @@ -26,12 +26,12 @@ public async ValueTask GenerateImageAsync(ImageGeneration image } catch (ImageGenerationValidationException imageGenerationValidationException) { - throw createImageGenerationClientValidationException( + throw CreateImageGenerationClientValidationException( imageGenerationValidationException.InnerException as Xeption); } catch (ImageGenerationDependencyValidationException imageGenerationDependencyValidationException) { - throw createImageGenerationClientValidationException( + throw CreateImageGenerationClientValidationException( imageGenerationDependencyValidationException.InnerException as Xeption); } catch (ImageGenerationDependencyException imageGenerationDependencyException) @@ -46,7 +46,7 @@ public async ValueTask GenerateImageAsync(ImageGeneration image } } - private static ImageGenerationClientValidationException createImageGenerationClientValidationException(Xeption innerException) + private static ImageGenerationClientValidationException CreateImageGenerationClientValidationException(Xeption innerException) { return new ImageGenerationClientValidationException( message: "Image generation client validation error occurred, fix errors and try again.", From 35bfe73c82681ae70ce21afb55439c8d0f578f48 Mon Sep 17 00:00:00 2001 From: Lezune Date: Thu, 6 Jun 2024 06:22:14 -0700 Subject: [PATCH 163/283] Reverted Unit Test files and updated create method declaration and calls to adhere to method naming standards --- ...erviceTests.Exceptions.RetrieveAllModels.cs | 9 ++++++--- ...elServiceTests.Exceptions.RetrieveByName.cs | 9 ++++++--- .../AIModels/AIModelServiceTests.cs | 9 --------- .../AIModels/AIModelService.Exceptions.cs | 18 +++++++++--------- 4 files changed, 21 insertions(+), 24 deletions(-) diff --git a/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/AIModels/AIModelServiceTests.Exceptions.RetrieveAllModels.cs b/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/AIModels/AIModelServiceTests.Exceptions.RetrieveAllModels.cs index bd908afe..8ce8d21a 100644 --- a/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/AIModels/AIModelServiceTests.Exceptions.RetrieveAllModels.cs +++ b/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/AIModels/AIModelServiceTests.Exceptions.RetrieveAllModels.cs @@ -29,7 +29,8 @@ private async Task ShouldThrowDependencyExceptionOnRetrieveIfUrlNotFoundAsync() innerException: httpResponseUrlNotFoundException); var expectedAIModelDependencyException = - createAIModelDependencyException( + new AIModelDependencyException( + message: "AI Model dependency error occurred, contact support.", innerException: invalidConfigurationAIModelException); this.openAIBrokerMock.Setup(broker => @@ -69,7 +70,8 @@ private async Task ShouldThrowDependencyExceptionOnRetrieveIfUnauthorizedAsync( innerException: unauthorizedException); var expectedAIModelDependencyException = - createAIModelDependencyException( + new AIModelDependencyException( + message: "AI Model dependency error occurred, contact support.", innerException: unauthorizedAIModelException); this.openAIBrokerMock.Setup(broker => @@ -150,7 +152,8 @@ private async Task ShouldThrowDependencyExceptionOnRetrieveIfServerErrorOccurred innerException: httpResponseException); var expectedAIModelDependencyException = - createAIModelDependencyException( + new AIModelDependencyException( + message: "AI Model dependency error occurred, contact support.", innerException: failedServerAIModelException); this.openAIBrokerMock.Setup(broker => diff --git a/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/AIModels/AIModelServiceTests.Exceptions.RetrieveByName.cs b/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/AIModels/AIModelServiceTests.Exceptions.RetrieveByName.cs index fe9bde6d..bcbd3414 100644 --- a/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/AIModels/AIModelServiceTests.Exceptions.RetrieveByName.cs +++ b/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/AIModels/AIModelServiceTests.Exceptions.RetrieveByName.cs @@ -30,7 +30,8 @@ private async Task ShouldThrowDependencyExceptionOnRetrieveAIModelByNameIfUrlNot innerException: httpResponseUrlNotFoundException); var expectedAIModelDependencyException = - createAIModelDependencyException( + new AIModelDependencyException( + message: "AI Model dependency error occurred, contact support.", innerException: invalidConfigurationAIModelException); this.openAIBrokerMock.Setup(broker => @@ -72,7 +73,8 @@ private async Task ShouldThrowDependencyExceptionOnRetrieveAIModelByNameIfUnauth innerException: unauthorizedException); var expectedAIModelDependencyException = - createAIModelDependencyException( + new AIModelDependencyException( + message: "AI Model dependency error occurred, contact support.", innerException: unauthorizedAIModelException); this.openAIBrokerMock.Setup(broker => @@ -246,7 +248,8 @@ private async Task ShouldThrowDependencyExceptionOnRetrieveAIModelByNameIfHttpRe innerException: httpResponseException); var expectedAIModelDependencyException = - createAIModelDependencyException( + new AIModelDependencyException( + message: "AI Model dependency error occurred, contact support.", innerException: failedServerAIModelException); this.openAIBrokerMock.Setup(broker => diff --git a/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/AIModels/AIModelServiceTests.cs b/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/AIModels/AIModelServiceTests.cs index 9a0e9e65..4bea62e7 100644 --- a/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/AIModels/AIModelServiceTests.cs +++ b/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/AIModels/AIModelServiceTests.cs @@ -10,10 +10,8 @@ using RESTFulSense.Exceptions; using Standard.AI.OpenAI.Brokers.DateTimes; using Standard.AI.OpenAI.Brokers.OpenAIs; -using Standard.AI.OpenAI.Models.Services.Foundations.AIModels.Exceptions; using Standard.AI.OpenAI.Services.Foundations.AIModels; using Tynamix.ObjectFiller; -using Xeptions; using Xunit; namespace Standard.AI.OpenAI.Tests.Unit.Services.Foundations.AIModels @@ -119,12 +117,5 @@ private static int GetRandomNumber() => private static bool GetRandomBoolean() => Randomizer.Create(); - - private static AIModelDependencyException createAIModelDependencyException(Xeption innerException) - { - return new AIModelDependencyException( - message: "AI Model dependency error occurred, contact support.", - innerException); - } } } \ No newline at end of file diff --git a/Standard.AI.OpenAI/Services/Foundations/AIModels/AIModelService.Exceptions.cs b/Standard.AI.OpenAI/Services/Foundations/AIModels/AIModelService.Exceptions.cs index 88e84543..3ec6fc5a 100644 --- a/Standard.AI.OpenAI/Services/Foundations/AIModels/AIModelService.Exceptions.cs +++ b/Standard.AI.OpenAI/Services/Foundations/AIModels/AIModelService.Exceptions.cs @@ -32,7 +32,7 @@ private async ValueTask TryCatch(ReturningAIModelFunction returningAIMo var invalidConfigurationAIModelException = new InvalidConfigurationAIModelException(httpResponseUrlNotFoundException); - throw createAIModelDependencyException( + throw CreateAIModelDependencyException( invalidConfigurationAIModelException); } catch (HttpResponseUnauthorizedException httpResponseUnauthorizedException) @@ -40,7 +40,7 @@ private async ValueTask TryCatch(ReturningAIModelFunction returningAIMo var unauthorizedAIModelException = new UnauthorizedAIModelException(httpResponseUnauthorizedException); - throw createAIModelDependencyException( + throw CreateAIModelDependencyException( unauthorizedAIModelException); } catch (HttpResponseForbiddenException httpResponseForbiddenException) @@ -48,7 +48,7 @@ private async ValueTask TryCatch(ReturningAIModelFunction returningAIMo var unauthorizedAIModelException = new UnauthorizedAIModelException(httpResponseForbiddenException); - throw createAIModelDependencyException( + throw CreateAIModelDependencyException( unauthorizedAIModelException); } catch (HttpResponseNotFoundException httpResponseNotFoundException) @@ -77,7 +77,7 @@ private async ValueTask TryCatch(ReturningAIModelFunction returningAIMo var failedServerAIModelException = new FailedServerAIModelException(httpResponseException); - throw createAIModelDependencyException( + throw CreateAIModelDependencyException( failedServerAIModelException); } catch (Exception exception) @@ -101,7 +101,7 @@ private async ValueTask> TryCatch(ReturningAIModelsFunction var invalidConfigurationAIModelException = new InvalidConfigurationAIModelException(httpResponseUrlNotFoundException); - throw createAIModelDependencyException( + throw CreateAIModelDependencyException( invalidConfigurationAIModelException); } catch (HttpResponseUnauthorizedException httpResponseUnauthorizedException) @@ -109,7 +109,7 @@ private async ValueTask> TryCatch(ReturningAIModelsFunction var unauthorizedAIModelException = new UnauthorizedAIModelException(httpResponseUnauthorizedException); - throw createAIModelDependencyException( + throw CreateAIModelDependencyException( unauthorizedAIModelException); } catch (HttpResponseForbiddenException httpResponseForbiddenException) @@ -117,7 +117,7 @@ private async ValueTask> TryCatch(ReturningAIModelsFunction var unauthorizedAIModelException = new UnauthorizedAIModelException(httpResponseForbiddenException); - throw createAIModelDependencyException( + throw CreateAIModelDependencyException( unauthorizedAIModelException); } catch (HttpResponseTooManyRequestsException httpResponseTooManyRequestsException) @@ -132,7 +132,7 @@ private async ValueTask> TryCatch(ReturningAIModelsFunction var failedServerAIModelException = new FailedServerAIModelException(httpResponseException); - throw createAIModelDependencyException( + throw CreateAIModelDependencyException( failedServerAIModelException); } catch (Exception exception) @@ -145,7 +145,7 @@ private async ValueTask> TryCatch(ReturningAIModelsFunction } } - private static AIModelDependencyException createAIModelDependencyException(Xeption innerException) + private static AIModelDependencyException CreateAIModelDependencyException(Xeption innerException) { return new AIModelDependencyException( message: "AI Model dependency error occurred, contact support.", From e99a945964779343ee968523720dad4476f70e9a Mon Sep 17 00:00:00 2001 From: Lezune Date: Thu, 6 Jun 2024 06:24:34 -0700 Subject: [PATCH 164/283] Reverted Unit Test files and updated create method declaration and calls to adhere to method naming standards --- ...AIModelServiceTests.Exceptions.RetrieveAllModels.cs | 3 ++- .../AIModelServiceTests.Exceptions.RetrieveByName.cs | 9 ++++++--- .../Foundations/AIModels/AIModelServiceTests.cs | 9 --------- .../Foundations/AIModels/AIModelService.Exceptions.cs | 10 +++++----- 4 files changed, 13 insertions(+), 18 deletions(-) diff --git a/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/AIModels/AIModelServiceTests.Exceptions.RetrieveAllModels.cs b/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/AIModels/AIModelServiceTests.Exceptions.RetrieveAllModels.cs index 86902779..8ce8d21a 100644 --- a/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/AIModels/AIModelServiceTests.Exceptions.RetrieveAllModels.cs +++ b/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/AIModels/AIModelServiceTests.Exceptions.RetrieveAllModels.cs @@ -111,7 +111,8 @@ private async Task ShouldThrowDependencyValidationExceptionOnRetrieveIfTooManyRe innerException: httpResponseTooManyRequestsException); var expectedAIModelDependencyValidationException = - createAIModelDependencyValidationException( + new AIModelDependencyValidationException( + message: "AI Model dependency validation error occurred, fix errors and try again.", innerException: excessiveCallAIModelException); this.openAIBrokerMock.Setup(broker => diff --git a/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/AIModels/AIModelServiceTests.Exceptions.RetrieveByName.cs b/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/AIModels/AIModelServiceTests.Exceptions.RetrieveByName.cs index d7869069..bcbd3414 100644 --- a/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/AIModels/AIModelServiceTests.Exceptions.RetrieveByName.cs +++ b/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/AIModels/AIModelServiceTests.Exceptions.RetrieveByName.cs @@ -117,7 +117,8 @@ private async Task ShouldThrowDependencyValidationExceptionOnRetrieveAIModelByNa innerException: httpResponseNotFoundException); var expectedAIModelDependencyValidationException = - createAIModelDependencyValidationException( + new AIModelDependencyValidationException( + message: "AI Model dependency validation error occurred, fix errors and try again.", innerException: notFoundAIModelException); this.openAIBrokerMock.Setup(broker => @@ -160,7 +161,8 @@ private async Task ShouldThrowDependencyValidationExceptionOnRetrieveAIModelByNa innerException: httpResponseBadRequestException); var expectedAIModelDependencyValidationException = - createAIModelDependencyValidationException( + new AIModelDependencyValidationException( + message: "AI Model dependency validation error occurred, fix errors and try again.", innerException: invalidAIModelException); this.openAIBrokerMock.Setup(broker => @@ -203,7 +205,8 @@ private async Task ShouldThrowDependencyValidationExceptionOnRetrieveAIModelByNa innerException: httpResponseTooManyRequestsException); var expectedAIModelDependencyValidationException = - createAIModelDependencyValidationException( + new AIModelDependencyValidationException( + message: "AI Model dependency validation error occurred, fix errors and try again.", innerException: excessiveCallAIModelException); this.openAIBrokerMock.Setup(broker => diff --git a/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/AIModels/AIModelServiceTests.cs b/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/AIModels/AIModelServiceTests.cs index a5d97b58..4bea62e7 100644 --- a/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/AIModels/AIModelServiceTests.cs +++ b/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/AIModels/AIModelServiceTests.cs @@ -10,10 +10,8 @@ using RESTFulSense.Exceptions; using Standard.AI.OpenAI.Brokers.DateTimes; using Standard.AI.OpenAI.Brokers.OpenAIs; -using Standard.AI.OpenAI.Models.Services.Foundations.AIModels.Exceptions; using Standard.AI.OpenAI.Services.Foundations.AIModels; using Tynamix.ObjectFiller; -using Xeptions; using Xunit; namespace Standard.AI.OpenAI.Tests.Unit.Services.Foundations.AIModels @@ -119,12 +117,5 @@ private static int GetRandomNumber() => private static bool GetRandomBoolean() => Randomizer.Create(); - - private static AIModelDependencyValidationException createAIModelDependencyValidationException(Xeption innerException) - { - return new AIModelDependencyValidationException( - message: "AI Model dependency validation error occurred, fix errors and try again.", - innerException); - } } } \ No newline at end of file diff --git a/Standard.AI.OpenAI/Services/Foundations/AIModels/AIModelService.Exceptions.cs b/Standard.AI.OpenAI/Services/Foundations/AIModels/AIModelService.Exceptions.cs index 5a1f3b31..7b294645 100644 --- a/Standard.AI.OpenAI/Services/Foundations/AIModels/AIModelService.Exceptions.cs +++ b/Standard.AI.OpenAI/Services/Foundations/AIModels/AIModelService.Exceptions.cs @@ -53,7 +53,7 @@ private async ValueTask TryCatch(ReturningAIModelFunction returningAIMo var notFoundAIModelException = new NotFoundAIModelException(httpResponseNotFoundException); - throw createAIModelDependencyValidationException( + throw CreateAIModelDependencyValidationException( notFoundAIModelException); } catch (HttpResponseBadRequestException httpResponseBadRequestException) @@ -61,7 +61,7 @@ private async ValueTask TryCatch(ReturningAIModelFunction returningAIMo var invalidAIModelException = new InvalidAIModelException(httpResponseBadRequestException); - throw createAIModelDependencyValidationException( + throw CreateAIModelDependencyValidationException( invalidAIModelException); } catch (HttpResponseTooManyRequestsException httpResponseTooManyRequestsException) @@ -69,7 +69,7 @@ private async ValueTask TryCatch(ReturningAIModelFunction returningAIMo var excessiveCallAIModelException = new ExcessiveCallAIModelException(httpResponseTooManyRequestsException); - throw createAIModelDependencyValidationException( + throw CreateAIModelDependencyValidationException( excessiveCallAIModelException); } catch (HttpResponseException httpResponseException) @@ -121,7 +121,7 @@ private async ValueTask> TryCatch(ReturningAIModelsFunction var excessiveCallAIModelException = new ExcessiveCallAIModelException(httpResponseTooManyRequestsException); - throw createAIModelDependencyValidationException( + throw CreateAIModelDependencyValidationException( excessiveCallAIModelException); } catch (HttpResponseException httpResponseException) @@ -141,7 +141,7 @@ private async ValueTask> TryCatch(ReturningAIModelsFunction } } - private static AIModelDependencyValidationException createAIModelDependencyValidationException(Xeption innerException) + private static AIModelDependencyValidationException CreateAIModelDependencyValidationException(Xeption innerException) { return new AIModelDependencyValidationException( message: "AI Model dependency validation error occurred, fix errors and try again.", From 9c019fe6aff51bd1110924bb03c14f496dee0bcd Mon Sep 17 00:00:00 2001 From: Lezune Date: Thu, 6 Jun 2024 06:27:45 -0700 Subject: [PATCH 165/283] Reverted Unit Test files and updated create method declaration and calls to adhere to method naming standards --- .../AIModelServiceTests.Exceptions.RetrieveAllModels.cs | 3 ++- .../AIModelServiceTests.Exceptions.RetrieveByName.cs | 3 ++- .../Services/Foundations/AIModels/AIModelServiceTests.cs | 9 --------- 3 files changed, 4 insertions(+), 11 deletions(-) diff --git a/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/AIModels/AIModelServiceTests.Exceptions.RetrieveAllModels.cs b/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/AIModels/AIModelServiceTests.Exceptions.RetrieveAllModels.cs index eb3425a8..8ce8d21a 100644 --- a/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/AIModels/AIModelServiceTests.Exceptions.RetrieveAllModels.cs +++ b/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/AIModels/AIModelServiceTests.Exceptions.RetrieveAllModels.cs @@ -192,7 +192,8 @@ private async Task ShouldThrowServiceExceptionOnRetrieveAllModelsIfServiceErrorO innerException: serviceException); var expectedAIModelServiceException = - createAIModelServiceException( + new AIModelServiceException( + message: "AI Model service error occurred, contact support.", innerException: failedAIModelServiceException); this.openAIBrokerMock.Setup(broker => diff --git a/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/AIModels/AIModelServiceTests.Exceptions.RetrieveByName.cs b/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/AIModels/AIModelServiceTests.Exceptions.RetrieveByName.cs index 6ad0f9cf..bcbd3414 100644 --- a/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/AIModels/AIModelServiceTests.Exceptions.RetrieveByName.cs +++ b/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/AIModels/AIModelServiceTests.Exceptions.RetrieveByName.cs @@ -289,7 +289,8 @@ private async Task ShouldThrowServiceExceptionOnRetrieveAIModelByNameIfServiceEr innerException: serviceException); var expectedAIModelServiceException = - createAIModelServiceException( + new AIModelServiceException( + message: "AI Model service error occurred, contact support.", innerException: failedAIModelServiceException); this.openAIBrokerMock.Setup(broker => diff --git a/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/AIModels/AIModelServiceTests.cs b/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/AIModels/AIModelServiceTests.cs index aa66fda9..4bea62e7 100644 --- a/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/AIModels/AIModelServiceTests.cs +++ b/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/AIModels/AIModelServiceTests.cs @@ -10,10 +10,8 @@ using RESTFulSense.Exceptions; using Standard.AI.OpenAI.Brokers.DateTimes; using Standard.AI.OpenAI.Brokers.OpenAIs; -using Standard.AI.OpenAI.Models.Services.Foundations.AIModels.Exceptions; using Standard.AI.OpenAI.Services.Foundations.AIModels; using Tynamix.ObjectFiller; -using Xeptions; using Xunit; namespace Standard.AI.OpenAI.Tests.Unit.Services.Foundations.AIModels @@ -119,12 +117,5 @@ private static int GetRandomNumber() => private static bool GetRandomBoolean() => Randomizer.Create(); - - private static AIModelServiceException createAIModelServiceException(Xeption innerException) - { - return new AIModelServiceException( - message: "AI Model service error occurred, contact support.", - innerException); - } } } \ No newline at end of file From 2d0e35da19491ef54c46e5fec0976bdd12340794 Mon Sep 17 00:00:00 2001 From: Lezune Date: Thu, 6 Jun 2024 06:29:59 -0700 Subject: [PATCH 166/283] Updated create method declaration and calls to adhere to method naming standards --- .../Foundations/AIModels/AIModelService.Exceptions.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Standard.AI.OpenAI/Services/Foundations/AIModels/AIModelService.Exceptions.cs b/Standard.AI.OpenAI/Services/Foundations/AIModels/AIModelService.Exceptions.cs index 26fce7c2..c5e29c39 100644 --- a/Standard.AI.OpenAI/Services/Foundations/AIModels/AIModelService.Exceptions.cs +++ b/Standard.AI.OpenAI/Services/Foundations/AIModels/AIModelService.Exceptions.cs @@ -81,7 +81,7 @@ private async ValueTask TryCatch(ReturningAIModelFunction returningAIMo var failedAIModelServiceException = new FailedAIModelServiceException(exception); - throw createAIModelServiceException( + throw CreateAIModelServiceException( failedAIModelServiceException); } } @@ -132,12 +132,12 @@ private async ValueTask> TryCatch(ReturningAIModelsFunction var failedAIModelServiceException = new FailedAIModelServiceException(exception); - throw createAIModelServiceException( + throw CreateAIModelServiceException( failedAIModelServiceException); } } - private static AIModelServiceException createAIModelServiceException(Xeption innerException) + private static AIModelServiceException CreateAIModelServiceException(Xeption innerException) { return new AIModelServiceException( message: "AI Model service error occurred, contact support.", From 898a1e59e784b0b0fe9a049ab19c4dd183960be8 Mon Sep 17 00:00:00 2001 From: Lezune Date: Thu, 6 Jun 2024 06:33:18 -0700 Subject: [PATCH 167/283] Reverted Unit Test files and updated create method declaration and calls to adhere to method naming standards --- .../AIModelServiceTests.Exceptions.RetrieveAllModels.cs | 3 ++- .../AIModelServiceTests.Exceptions.RetrieveByName.cs | 9 ++------- .../Foundations/AIModels/AIModelService.Exceptions.cs | 6 +++--- 3 files changed, 7 insertions(+), 11 deletions(-) diff --git a/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/AIModels/AIModelServiceTests.Exceptions.RetrieveAllModels.cs b/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/AIModels/AIModelServiceTests.Exceptions.RetrieveAllModels.cs index c74f8f93..8ce8d21a 100644 --- a/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/AIModels/AIModelServiceTests.Exceptions.RetrieveAllModels.cs +++ b/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/AIModels/AIModelServiceTests.Exceptions.RetrieveAllModels.cs @@ -106,7 +106,8 @@ private async Task ShouldThrowDependencyValidationExceptionOnRetrieveIfTooManyRe new HttpResponseTooManyRequestsException(); var excessiveCallAIModelException = - createExcessiveCallAIModelException( + new ExcessiveCallAIModelException( + message: "Excessive call error occurred, limit your calls.", innerException: httpResponseTooManyRequestsException); var expectedAIModelDependencyValidationException = diff --git a/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/AIModels/AIModelServiceTests.Exceptions.RetrieveByName.cs b/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/AIModels/AIModelServiceTests.Exceptions.RetrieveByName.cs index 2901f63d..bcbd3414 100644 --- a/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/AIModels/AIModelServiceTests.Exceptions.RetrieveByName.cs +++ b/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/AIModels/AIModelServiceTests.Exceptions.RetrieveByName.cs @@ -200,7 +200,8 @@ private async Task ShouldThrowDependencyValidationExceptionOnRetrieveAIModelByNa new HttpResponseTooManyRequestsException(); var excessiveCallAIModelException = - createExcessiveCallAIModelException( + new ExcessiveCallAIModelException( + message: "Excessive call error occurred, limit your calls.", innerException: httpResponseTooManyRequestsException); var expectedAIModelDependencyValidationException = @@ -315,11 +316,5 @@ await Assert.ThrowsAsync( this.openAIBrokerMock.VerifyNoOtherCalls(); this.dateTimeBrokerMock.VerifyNoOtherCalls(); } - private static ExcessiveCallAIModelException createExcessiveCallAIModelException(Exception innerException) - { - return new ExcessiveCallAIModelException( - message: "Excessive call error occurred, limit your calls.", - innerException); - } } } \ No newline at end of file diff --git a/Standard.AI.OpenAI/Services/Foundations/AIModels/AIModelService.Exceptions.cs b/Standard.AI.OpenAI/Services/Foundations/AIModels/AIModelService.Exceptions.cs index 18305519..7eb25258 100644 --- a/Standard.AI.OpenAI/Services/Foundations/AIModels/AIModelService.Exceptions.cs +++ b/Standard.AI.OpenAI/Services/Foundations/AIModels/AIModelService.Exceptions.cs @@ -64,7 +64,7 @@ private async ValueTask TryCatch(ReturningAIModelFunction returningAIMo catch (HttpResponseTooManyRequestsException httpResponseTooManyRequestsException) { var excessiveCallAIModelException = - createExcessiveCallAIModelException( + CreateExcessiveCallAIModelException( httpResponseTooManyRequestsException); throw new AIModelDependencyValidationException(excessiveCallAIModelException); @@ -116,7 +116,7 @@ private async ValueTask> TryCatch(ReturningAIModelsFunction catch (HttpResponseTooManyRequestsException httpResponseTooManyRequestsException) { var excessiveCallAIModelException = - createExcessiveCallAIModelException( + CreateExcessiveCallAIModelException( httpResponseTooManyRequestsException); throw new AIModelDependencyValidationException(excessiveCallAIModelException); @@ -138,7 +138,7 @@ private async ValueTask> TryCatch(ReturningAIModelsFunction } } - private static ExcessiveCallAIModelException createExcessiveCallAIModelException(Exception innerException) + private static ExcessiveCallAIModelException CreateExcessiveCallAIModelException(Exception innerException) { return new ExcessiveCallAIModelException( message: "Excessive call error occurred, limit your calls.", From 5f011ae111788c28a91bedea228caff35ee254a4 Mon Sep 17 00:00:00 2001 From: Lezune Date: Thu, 6 Jun 2024 06:34:54 -0700 Subject: [PATCH 168/283] Reverted Unit Test files and updated create method declaration and calls to adhere to method naming standards --- .../AIModelServiceTests.Exceptions.RetrieveAllModels.cs | 3 ++- .../AIModelServiceTests.Exceptions.RetrieveByName.cs | 3 ++- .../Services/Foundations/AIModels/AIModelServiceTests.cs | 8 -------- .../Foundations/AIModels/AIModelService.Exceptions.cs | 6 +++--- 4 files changed, 7 insertions(+), 13 deletions(-) diff --git a/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/AIModels/AIModelServiceTests.Exceptions.RetrieveAllModels.cs b/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/AIModels/AIModelServiceTests.Exceptions.RetrieveAllModels.cs index 47b05dba..8ce8d21a 100644 --- a/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/AIModels/AIModelServiceTests.Exceptions.RetrieveAllModels.cs +++ b/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/AIModels/AIModelServiceTests.Exceptions.RetrieveAllModels.cs @@ -187,7 +187,8 @@ private async Task ShouldThrowServiceExceptionOnRetrieveAllModelsIfServiceErrorO var serviceException = new Exception(); var failedAIModelServiceException = - createFailedAIModelServiceException( + new FailedAIModelServiceException( + message: "Failed AI Model Service Exception occurred, please contact support for assistance.", innerException: serviceException); var expectedAIModelServiceException = diff --git a/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/AIModels/AIModelServiceTests.Exceptions.RetrieveByName.cs b/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/AIModels/AIModelServiceTests.Exceptions.RetrieveByName.cs index ca2353de..bcbd3414 100644 --- a/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/AIModels/AIModelServiceTests.Exceptions.RetrieveByName.cs +++ b/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/AIModels/AIModelServiceTests.Exceptions.RetrieveByName.cs @@ -284,7 +284,8 @@ private async Task ShouldThrowServiceExceptionOnRetrieveAIModelByNameIfServiceEr var serviceException = new Exception(); var failedAIModelServiceException = - createFailedAIModelServiceException( + new FailedAIModelServiceException( + message: "Failed AI Model Service Exception occurred, please contact support for assistance.", innerException: serviceException); var expectedAIModelServiceException = diff --git a/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/AIModels/AIModelServiceTests.cs b/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/AIModels/AIModelServiceTests.cs index 846c7156..4bea62e7 100644 --- a/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/AIModels/AIModelServiceTests.cs +++ b/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/AIModels/AIModelServiceTests.cs @@ -10,7 +10,6 @@ using RESTFulSense.Exceptions; using Standard.AI.OpenAI.Brokers.DateTimes; using Standard.AI.OpenAI.Brokers.OpenAIs; -using Standard.AI.OpenAI.Models.Services.Foundations.AIModels.Exceptions; using Standard.AI.OpenAI.Services.Foundations.AIModels; using Tynamix.ObjectFiller; using Xunit; @@ -118,12 +117,5 @@ private static int GetRandomNumber() => private static bool GetRandomBoolean() => Randomizer.Create(); - - private static FailedAIModelServiceException createFailedAIModelServiceException(Exception innerException) - { - return new FailedAIModelServiceException( - message: "Failed AI Model Service Exception occurred, please contact support for assistance.", - innerException); - } } } \ No newline at end of file diff --git a/Standard.AI.OpenAI/Services/Foundations/AIModels/AIModelService.Exceptions.cs b/Standard.AI.OpenAI/Services/Foundations/AIModels/AIModelService.Exceptions.cs index 62e19082..7f1ea728 100644 --- a/Standard.AI.OpenAI/Services/Foundations/AIModels/AIModelService.Exceptions.cs +++ b/Standard.AI.OpenAI/Services/Foundations/AIModels/AIModelService.Exceptions.cs @@ -79,7 +79,7 @@ private async ValueTask TryCatch(ReturningAIModelFunction returningAIMo catch (Exception exception) { var failedAIModelServiceException = - createFailedAIModelServiceException( + CreateFailedAIModelServiceException( exception); throw new AIModelServiceException( @@ -131,7 +131,7 @@ private async ValueTask> TryCatch(ReturningAIModelsFunction catch (Exception exception) { var failedAIModelServiceException = - createFailedAIModelServiceException( + CreateFailedAIModelServiceException( exception); throw new AIModelServiceException( @@ -139,7 +139,7 @@ private async ValueTask> TryCatch(ReturningAIModelsFunction } } - private static FailedAIModelServiceException createFailedAIModelServiceException(Exception innerException) + private static FailedAIModelServiceException CreateFailedAIModelServiceException(Exception innerException) { return new FailedAIModelServiceException( message: "Failed AI Model Service Exception occurred, please contact support for assistance.", From 72e828f8a8204e465ef144ab51bf5e073aeab883 Mon Sep 17 00:00:00 2001 From: Lezune Date: Thu, 6 Jun 2024 06:36:57 -0700 Subject: [PATCH 169/283] Reverted Unit Test files and updated create method declaration and calls to adhere to method naming standards --- .../AIModelServiceTests.Exceptions.RetrieveAllModels.cs | 3 ++- .../AIModelServiceTests.Exceptions.RetrieveByName.cs | 3 ++- .../Services/Foundations/AIModels/AIModelServiceTests.cs | 8 -------- .../Foundations/AIModels/AIModelService.Exceptions.cs | 6 +++--- 4 files changed, 7 insertions(+), 13 deletions(-) diff --git a/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/AIModels/AIModelServiceTests.Exceptions.RetrieveAllModels.cs b/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/AIModels/AIModelServiceTests.Exceptions.RetrieveAllModels.cs index b52a9cb2..8ce8d21a 100644 --- a/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/AIModels/AIModelServiceTests.Exceptions.RetrieveAllModels.cs +++ b/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/AIModels/AIModelServiceTests.Exceptions.RetrieveAllModels.cs @@ -147,7 +147,8 @@ private async Task ShouldThrowDependencyExceptionOnRetrieveIfServerErrorOccurred new HttpResponseException(); var failedServerAIModelException = - createFailedServerAIModelException( + new FailedServerAIModelException( + message: "Failed AI Model server error occurred, contact support", innerException: httpResponseException); var expectedAIModelDependencyException = diff --git a/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/AIModels/AIModelServiceTests.Exceptions.RetrieveByName.cs b/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/AIModels/AIModelServiceTests.Exceptions.RetrieveByName.cs index 08eb161e..bcbd3414 100644 --- a/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/AIModels/AIModelServiceTests.Exceptions.RetrieveByName.cs +++ b/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/AIModels/AIModelServiceTests.Exceptions.RetrieveByName.cs @@ -243,7 +243,8 @@ private async Task ShouldThrowDependencyExceptionOnRetrieveAIModelByNameIfHttpRe new HttpResponseException(); var failedServerAIModelException = - createFailedServerAIModelException( + new FailedServerAIModelException( + message: "Failed AI Model server error occurred, contact support", innerException: httpResponseException); var expectedAIModelDependencyException = diff --git a/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/AIModels/AIModelServiceTests.cs b/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/AIModels/AIModelServiceTests.cs index 5c2be58c..4bea62e7 100644 --- a/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/AIModels/AIModelServiceTests.cs +++ b/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/AIModels/AIModelServiceTests.cs @@ -10,7 +10,6 @@ using RESTFulSense.Exceptions; using Standard.AI.OpenAI.Brokers.DateTimes; using Standard.AI.OpenAI.Brokers.OpenAIs; -using Standard.AI.OpenAI.Models.Services.Foundations.AIModels.Exceptions; using Standard.AI.OpenAI.Services.Foundations.AIModels; using Tynamix.ObjectFiller; using Xunit; @@ -118,12 +117,5 @@ private static int GetRandomNumber() => private static bool GetRandomBoolean() => Randomizer.Create(); - - private static FailedServerAIModelException createFailedServerAIModelException(Exception innerException) - { - return new FailedServerAIModelException( - message: "Failed AI Model server error occurred, contact support", - innerException); - } } } \ No newline at end of file diff --git a/Standard.AI.OpenAI/Services/Foundations/AIModels/AIModelService.Exceptions.cs b/Standard.AI.OpenAI/Services/Foundations/AIModels/AIModelService.Exceptions.cs index 6d0f6ab1..79619958 100644 --- a/Standard.AI.OpenAI/Services/Foundations/AIModels/AIModelService.Exceptions.cs +++ b/Standard.AI.OpenAI/Services/Foundations/AIModels/AIModelService.Exceptions.cs @@ -71,7 +71,7 @@ private async ValueTask TryCatch(ReturningAIModelFunction returningAIMo catch (HttpResponseException httpResponseException) { var failedServerAIModelException = - createFailedServerAIModelException( + CreateFailedServerAIModelException( httpResponseException); throw new AIModelDependencyException(failedServerAIModelException); @@ -123,7 +123,7 @@ private async ValueTask> TryCatch(ReturningAIModelsFunction catch (HttpResponseException httpResponseException) { var failedServerAIModelException = - createFailedServerAIModelException( + CreateFailedServerAIModelException( httpResponseException); throw new AIModelDependencyException(failedServerAIModelException); @@ -138,7 +138,7 @@ private async ValueTask> TryCatch(ReturningAIModelsFunction } } - private static FailedServerAIModelException createFailedServerAIModelException(Exception innerException) + private static FailedServerAIModelException CreateFailedServerAIModelException(Exception innerException) { return new FailedServerAIModelException( message: "Failed AI Model server error occurred, contact support", From bd7905a09a4e97023ea14a5bd60881eaba8e3768 Mon Sep 17 00:00:00 2001 From: Lezune Date: Thu, 6 Jun 2024 06:44:23 -0700 Subject: [PATCH 170/283] Reverted Unit Test files and updated create method declaration and calls to adhere to method naming standards --- .../AIModelServiceTests.Exceptions.RetrieveAllModels.cs | 3 ++- .../AIModelServiceTests.Exceptions.RetrieveByName.cs | 3 ++- .../Services/Foundations/AIModels/AIModelServiceTests.cs | 8 -------- .../Foundations/AIModels/AIModelService.Exceptions.cs | 6 +++--- 4 files changed, 7 insertions(+), 13 deletions(-) diff --git a/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/AIModels/AIModelServiceTests.Exceptions.RetrieveAllModels.cs b/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/AIModels/AIModelServiceTests.Exceptions.RetrieveAllModels.cs index 4d65b108..8ce8d21a 100644 --- a/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/AIModels/AIModelServiceTests.Exceptions.RetrieveAllModels.cs +++ b/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/AIModels/AIModelServiceTests.Exceptions.RetrieveAllModels.cs @@ -24,7 +24,8 @@ private async Task ShouldThrowDependencyExceptionOnRetrieveIfUrlNotFoundAsync() new HttpResponseUrlNotFoundException(); var invalidConfigurationAIModelException = - createInvalidConfigurationAIModelException( + new InvalidConfigurationAIModelException( + message: "Invalid AI Model configuration error occurred, contact support.", innerException: httpResponseUrlNotFoundException); var expectedAIModelDependencyException = diff --git a/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/AIModels/AIModelServiceTests.Exceptions.RetrieveByName.cs b/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/AIModels/AIModelServiceTests.Exceptions.RetrieveByName.cs index 837b7e27..bcbd3414 100644 --- a/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/AIModels/AIModelServiceTests.Exceptions.RetrieveByName.cs +++ b/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/AIModels/AIModelServiceTests.Exceptions.RetrieveByName.cs @@ -25,7 +25,8 @@ private async Task ShouldThrowDependencyExceptionOnRetrieveAIModelByNameIfUrlNot new HttpResponseUrlNotFoundException(); var invalidConfigurationAIModelException = - createInvalidConfigurationAIModelException( + new InvalidConfigurationAIModelException( + message: "Invalid AI Model configuration error occurred, contact support.", innerException: httpResponseUrlNotFoundException); var expectedAIModelDependencyException = diff --git a/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/AIModels/AIModelServiceTests.cs b/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/AIModels/AIModelServiceTests.cs index 524e6b49..4bea62e7 100644 --- a/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/AIModels/AIModelServiceTests.cs +++ b/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/AIModels/AIModelServiceTests.cs @@ -10,7 +10,6 @@ using RESTFulSense.Exceptions; using Standard.AI.OpenAI.Brokers.DateTimes; using Standard.AI.OpenAI.Brokers.OpenAIs; -using Standard.AI.OpenAI.Models.Services.Foundations.AIModels.Exceptions; using Standard.AI.OpenAI.Services.Foundations.AIModels; using Tynamix.ObjectFiller; using Xunit; @@ -118,12 +117,5 @@ private static int GetRandomNumber() => private static bool GetRandomBoolean() => Randomizer.Create(); - - private static InvalidConfigurationAIModelException createInvalidConfigurationAIModelException(Exception innerException) - { - return new InvalidConfigurationAIModelException( - message: "Invalid AI Model configuration error occurred, contact support.", - innerException); - } } } \ No newline at end of file diff --git a/Standard.AI.OpenAI/Services/Foundations/AIModels/AIModelService.Exceptions.cs b/Standard.AI.OpenAI/Services/Foundations/AIModels/AIModelService.Exceptions.cs index 27e68d6a..82c5e840 100644 --- a/Standard.AI.OpenAI/Services/Foundations/AIModels/AIModelService.Exceptions.cs +++ b/Standard.AI.OpenAI/Services/Foundations/AIModels/AIModelService.Exceptions.cs @@ -29,7 +29,7 @@ private async ValueTask TryCatch(ReturningAIModelFunction returningAIMo catch (HttpResponseUrlNotFoundException httpResponseUrlNotFoundException) { var invalidConfigurationAIModelException = - createInvalidConfigurationAIModelException( + CreateInvalidConfigurationAIModelException( httpResponseUrlNotFoundException); throw new AIModelDependencyException(invalidConfigurationAIModelException); @@ -95,7 +95,7 @@ private async ValueTask> TryCatch(ReturningAIModelsFunction catch (HttpResponseUrlNotFoundException httpResponseUrlNotFoundException) { var invalidConfigurationAIModelException = - createInvalidConfigurationAIModelException( + CreateInvalidConfigurationAIModelException( httpResponseUrlNotFoundException); throw new AIModelDependencyException(invalidConfigurationAIModelException); @@ -138,7 +138,7 @@ private async ValueTask> TryCatch(ReturningAIModelsFunction } } - private static InvalidConfigurationAIModelException createInvalidConfigurationAIModelException(Exception innerException) + private static InvalidConfigurationAIModelException CreateInvalidConfigurationAIModelException(Exception innerException) { return new InvalidConfigurationAIModelException( message: "Invalid AI Model configuration error occurred, contact support.", From 6b3d370ec68487f37addd8211b7acb9330229c2f Mon Sep 17 00:00:00 2001 From: Lezune Date: Thu, 6 Jun 2024 06:47:16 -0700 Subject: [PATCH 171/283] Reverted Unit Test files and updated create method declaration and calls to adhere to method naming standards --- .../AIModelServiceTests.Exceptions.RetrieveAllModels.cs | 3 ++- .../AIModelServiceTests.Exceptions.RetrieveByName.cs | 3 ++- .../Services/Foundations/AIModels/AIModelServiceTests.cs | 8 -------- 3 files changed, 4 insertions(+), 10 deletions(-) diff --git a/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/AIModels/AIModelServiceTests.Exceptions.RetrieveAllModels.cs b/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/AIModels/AIModelServiceTests.Exceptions.RetrieveAllModels.cs index e3f53e0a..8ce8d21a 100644 --- a/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/AIModels/AIModelServiceTests.Exceptions.RetrieveAllModels.cs +++ b/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/AIModels/AIModelServiceTests.Exceptions.RetrieveAllModels.cs @@ -65,7 +65,8 @@ private async Task ShouldThrowDependencyExceptionOnRetrieveIfUnauthorizedAsync( { // given var unauthorizedAIModelException = - createUnauthorizedAIModelException( + new UnauthorizedAIModelException( + message: "Unauthorized AI Model error occurred, fix errors and try again.", innerException: unauthorizedException); var expectedAIModelDependencyException = diff --git a/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/AIModels/AIModelServiceTests.Exceptions.RetrieveByName.cs b/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/AIModels/AIModelServiceTests.Exceptions.RetrieveByName.cs index bef11b8e..bcbd3414 100644 --- a/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/AIModels/AIModelServiceTests.Exceptions.RetrieveByName.cs +++ b/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/AIModels/AIModelServiceTests.Exceptions.RetrieveByName.cs @@ -68,7 +68,8 @@ private async Task ShouldThrowDependencyExceptionOnRetrieveAIModelByNameIfUnauth string someAIModelName = CreateRandomString(); var unauthorizedAIModelException = - createUnauthorizedAIModelException( + new UnauthorizedAIModelException( + message: "Unauthorized AI Model error occurred, fix errors and try again.", innerException: unauthorizedException); var expectedAIModelDependencyException = diff --git a/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/AIModels/AIModelServiceTests.cs b/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/AIModels/AIModelServiceTests.cs index 72c587aa..4bea62e7 100644 --- a/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/AIModels/AIModelServiceTests.cs +++ b/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/AIModels/AIModelServiceTests.cs @@ -10,7 +10,6 @@ using RESTFulSense.Exceptions; using Standard.AI.OpenAI.Brokers.DateTimes; using Standard.AI.OpenAI.Brokers.OpenAIs; -using Standard.AI.OpenAI.Models.Services.Foundations.AIModels.Exceptions; using Standard.AI.OpenAI.Services.Foundations.AIModels; using Tynamix.ObjectFiller; using Xunit; @@ -118,12 +117,5 @@ private static int GetRandomNumber() => private static bool GetRandomBoolean() => Randomizer.Create(); - - private static UnauthorizedAIModelException createUnauthorizedAIModelException(Exception innerException) - { - return new UnauthorizedAIModelException( - message: "Unauthorized AI Model error occurred, fix errors and try again.", - innerException); - } } } \ No newline at end of file From e2fc1e23d8f893dd2f3bbfb77b0105c43fa9fe08 Mon Sep 17 00:00:00 2001 From: Lezune Date: Thu, 6 Jun 2024 06:47:48 -0700 Subject: [PATCH 172/283] Reverted Unit Test files and updated create method declaration and calls to adhere to method naming standards --- .../Foundations/AIModels/AIModelService.Exceptions.cs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Standard.AI.OpenAI/Services/Foundations/AIModels/AIModelService.Exceptions.cs b/Standard.AI.OpenAI/Services/Foundations/AIModels/AIModelService.Exceptions.cs index 42f6feac..2c577f94 100644 --- a/Standard.AI.OpenAI/Services/Foundations/AIModels/AIModelService.Exceptions.cs +++ b/Standard.AI.OpenAI/Services/Foundations/AIModels/AIModelService.Exceptions.cs @@ -36,7 +36,7 @@ private async ValueTask TryCatch(ReturningAIModelFunction returningAIMo catch (HttpResponseUnauthorizedException httpResponseUnauthorizedException) { var unauthorizedAIModelException = - createUnauthorizedAIModelException( + CreateUnauthorizedAIModelException( httpResponseUnauthorizedException); throw new AIModelDependencyException(unauthorizedAIModelException); @@ -44,7 +44,7 @@ private async ValueTask TryCatch(ReturningAIModelFunction returningAIMo catch (HttpResponseForbiddenException httpResponseForbiddenException) { var unauthorizedAIModelException = - createUnauthorizedAIModelException( + CreateUnauthorizedAIModelException( httpResponseForbiddenException); throw new AIModelDependencyException(unauthorizedAIModelException); @@ -103,7 +103,7 @@ private async ValueTask> TryCatch(ReturningAIModelsFunction catch (HttpResponseUnauthorizedException httpResponseUnauthorizedException) { var unauthorizedAIModelException = - createUnauthorizedAIModelException( + CreateUnauthorizedAIModelException( httpResponseUnauthorizedException); throw new AIModelDependencyException(unauthorizedAIModelException); @@ -111,7 +111,7 @@ private async ValueTask> TryCatch(ReturningAIModelsFunction catch (HttpResponseForbiddenException httpResponseForbiddenException) { var unauthorizedAIModelException = - createUnauthorizedAIModelException( + CreateUnauthorizedAIModelException( httpResponseForbiddenException); throw new AIModelDependencyException(unauthorizedAIModelException); @@ -140,7 +140,7 @@ private async ValueTask> TryCatch(ReturningAIModelsFunction } } - private static UnauthorizedAIModelException createUnauthorizedAIModelException(Exception innerException) + private static UnauthorizedAIModelException CreateUnauthorizedAIModelException(Exception innerException) { return new UnauthorizedAIModelException( message: "Unauthorized AI Model error occurred, fix errors and try again.", From babce74329d7578ae2a7e1f601d8fc3825363c6c Mon Sep 17 00:00:00 2001 From: Lezune Date: Thu, 6 Jun 2024 06:52:06 -0700 Subject: [PATCH 173/283] Reverted Unit Test files and updated create method declaration and calls to adhere to method naming standards --- .../AudioTranscriptionServiceTests.Exceptions.Send.cs | 6 ++++-- .../AudioTranscriptionServiceTests.cs | 9 --------- .../AudioTranscriptionService.Exceptions.cs | 8 ++++---- 3 files changed, 8 insertions(+), 15 deletions(-) diff --git a/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/AudioTranscriptions/AudioTranscriptionServiceTests.Exceptions.Send.cs b/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/AudioTranscriptions/AudioTranscriptionServiceTests.Exceptions.Send.cs index de2ffdd8..42627d83 100644 --- a/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/AudioTranscriptions/AudioTranscriptionServiceTests.Exceptions.Send.cs +++ b/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/AudioTranscriptions/AudioTranscriptionServiceTests.Exceptions.Send.cs @@ -32,7 +32,8 @@ private async Task ShouldThrowDependencyExceptionOnSendIfUrlNotFoundAsync() innerException: httpResponseUrlNotFoundException); var expectedAudioTranscriptionDependencyException = - createAudioTranscriptionDependencyException( + new AudioTranscriptionDependencyException( + message: "Audio transcription dependency error occurred, contact support.", innerException: invalidConfigurationAudioTranscriptionException); this.openAIBrokerMock.Setup(broker => @@ -76,7 +77,8 @@ private async Task ShouldThrowDependencyExceptionOnSendIfUnAuthorizedAsync( innerException: unAuthorizationException); var expectedAudioTranscriptionDependencyException = - createAudioTranscriptionDependencyException( + new AudioTranscriptionDependencyException( + message: "Audio transcription dependency error occurred, contact support.", innerException: unauthorizedAudioTranscriptionException); this.openAIBrokerMock.Setup(broker => diff --git a/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/AudioTranscriptions/AudioTranscriptionServiceTests.cs b/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/AudioTranscriptions/AudioTranscriptionServiceTests.cs index 7e3311f2..a8c2e720 100644 --- a/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/AudioTranscriptions/AudioTranscriptionServiceTests.cs +++ b/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/AudioTranscriptions/AudioTranscriptionServiceTests.cs @@ -10,11 +10,9 @@ using RESTFulSense.Exceptions; using Standard.AI.OpenAI.Brokers.OpenAIs; using Standard.AI.OpenAI.Models.Services.Foundations.AudioTranscriptions; -using Standard.AI.OpenAI.Models.Services.Foundations.AudioTranscriptions.Exceptions; using Standard.AI.OpenAI.Models.Services.Foundations.ExternalAudioTranscriptions; using Standard.AI.OpenAI.Services.Foundations.AudioTranscriptions; using Tynamix.ObjectFiller; -using Xeptions; using Xunit; namespace Standard.AI.OpenAI.Tests.Unit.Services.Foundations.AudioTranscriptions @@ -106,12 +104,5 @@ private static Filler AudioTranscriptionFiller() return filler; } - - private static AudioTranscriptionDependencyException createAudioTranscriptionDependencyException(Xeption innerException) - { - return new AudioTranscriptionDependencyException( - message: "Audio transcription dependency error occurred, contact support.", - innerException); - } } } diff --git a/Standard.AI.OpenAI/Services/Foundations/AudioTranscriptions/AudioTranscriptionService.Exceptions.cs b/Standard.AI.OpenAI/Services/Foundations/AudioTranscriptions/AudioTranscriptionService.Exceptions.cs index 4451e67b..f01ceb2a 100644 --- a/Standard.AI.OpenAI/Services/Foundations/AudioTranscriptions/AudioTranscriptionService.Exceptions.cs +++ b/Standard.AI.OpenAI/Services/Foundations/AudioTranscriptions/AudioTranscriptionService.Exceptions.cs @@ -35,7 +35,7 @@ private static async ValueTask TryCatch( var invalidConfigurationAudioTranscriptionException = new InvalidConfigurationAudioTranscriptionException(httpResponseUrlNotFoundException); - throw createAudioTranscriptionDependencyException( + throw CreateAudioTranscriptionDependencyException( invalidConfigurationAudioTranscriptionException); } catch (HttpResponseUnauthorizedException httpResponseUnauthorizedException) @@ -43,7 +43,7 @@ private static async ValueTask TryCatch( var unauthorizedAudioTranscriptionException = new UnauthorizedAudioTranscriptionException(httpResponseUnauthorizedException); - throw createAudioTranscriptionDependencyException( + throw CreateAudioTranscriptionDependencyException( unauthorizedAudioTranscriptionException); } catch (HttpResponseForbiddenException httpResponseForbiddenException) @@ -51,7 +51,7 @@ private static async ValueTask TryCatch( var unauthorizedAudioTranscriptionException = new UnauthorizedAudioTranscriptionException(httpResponseForbiddenException); - throw createAudioTranscriptionDependencyException( + throw CreateAudioTranscriptionDependencyException( unauthorizedAudioTranscriptionException); } catch (HttpResponseBadRequestException httpResponseBadRequestException) @@ -77,7 +77,7 @@ private static async ValueTask TryCatch( } } - private static AudioTranscriptionDependencyException createAudioTranscriptionDependencyException(Xeption innerException) + private static AudioTranscriptionDependencyException CreateAudioTranscriptionDependencyException(Xeption innerException) { return new AudioTranscriptionDependencyException( message: "Audio transcription dependency error occurred, contact support.", From 967b3fa1f4e6d48e7e00f277d188f2ca37430ea5 Mon Sep 17 00:00:00 2001 From: Lezune Date: Thu, 6 Jun 2024 06:53:59 -0700 Subject: [PATCH 174/283] Reverted Unit Test files and updated create method declaration and calls to adhere to method naming standards --- .../AudioTranscriptionServiceTests.Exceptions.Send.cs | 6 ++++-- .../AudioTranscriptionServiceTests.cs | 9 --------- .../AudioTranscriptionService.Exceptions.cs | 6 +++--- 3 files changed, 7 insertions(+), 14 deletions(-) diff --git a/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/AudioTranscriptions/AudioTranscriptionServiceTests.Exceptions.Send.cs b/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/AudioTranscriptions/AudioTranscriptionServiceTests.Exceptions.Send.cs index 04963ec8..42627d83 100644 --- a/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/AudioTranscriptions/AudioTranscriptionServiceTests.Exceptions.Send.cs +++ b/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/AudioTranscriptions/AudioTranscriptionServiceTests.Exceptions.Send.cs @@ -123,7 +123,8 @@ private async Task ShouldThrowDependencyValidationExceptionOnUploadIfBadRequestE innerException: httpResponseBadRequestException); var expectedAudioTranscriptionDependencyValidationException = - createAudioTranscriptionDependencyValidationException( + new AudioTranscriptionDependencyValidationException( + message: "Chat completion dependency validation error occurred, fix errors and try again.", innerException: invalidAudioTranscriptionException); this.openAIBrokerMock.Setup(broker => @@ -211,7 +212,8 @@ private async Task ShouldThrowDependencyValidationExceptionOnSendIfTooManyReques innerException: httpResponseTooManyRequestsException); var expectedAudioTranscriptionDependencyValidationException = - createAudioTranscriptionDependencyValidationException( + new AudioTranscriptionDependencyValidationException( + message: "Chat completion dependency validation error occurred, fix errors and try again.", innerException: excessiveCallAudioTranscriptionException); this.openAIBrokerMock.Setup(broker => diff --git a/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/AudioTranscriptions/AudioTranscriptionServiceTests.cs b/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/AudioTranscriptions/AudioTranscriptionServiceTests.cs index 34cfc752..a8c2e720 100644 --- a/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/AudioTranscriptions/AudioTranscriptionServiceTests.cs +++ b/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/AudioTranscriptions/AudioTranscriptionServiceTests.cs @@ -10,11 +10,9 @@ using RESTFulSense.Exceptions; using Standard.AI.OpenAI.Brokers.OpenAIs; using Standard.AI.OpenAI.Models.Services.Foundations.AudioTranscriptions; -using Standard.AI.OpenAI.Models.Services.Foundations.AudioTranscriptions.Exceptions; using Standard.AI.OpenAI.Models.Services.Foundations.ExternalAudioTranscriptions; using Standard.AI.OpenAI.Services.Foundations.AudioTranscriptions; using Tynamix.ObjectFiller; -using Xeptions; using Xunit; namespace Standard.AI.OpenAI.Tests.Unit.Services.Foundations.AudioTranscriptions @@ -106,12 +104,5 @@ private static Filler AudioTranscriptionFiller() return filler; } - - private static AudioTranscriptionDependencyValidationException createAudioTranscriptionDependencyValidationException(Xeption innerException) - { - return new AudioTranscriptionDependencyValidationException( - message: "Chat completion dependency validation error occurred, fix errors and try again.", - innerException); - } } } diff --git a/Standard.AI.OpenAI/Services/Foundations/AudioTranscriptions/AudioTranscriptionService.Exceptions.cs b/Standard.AI.OpenAI/Services/Foundations/AudioTranscriptions/AudioTranscriptionService.Exceptions.cs index 43a48d46..4f70de39 100644 --- a/Standard.AI.OpenAI/Services/Foundations/AudioTranscriptions/AudioTranscriptionService.Exceptions.cs +++ b/Standard.AI.OpenAI/Services/Foundations/AudioTranscriptions/AudioTranscriptionService.Exceptions.cs @@ -56,7 +56,7 @@ private static async ValueTask TryCatch( var invalidAudioTranscriptionException = new InvalidAudioTranscriptionException(httpResponseBadRequestException); - throw createAudioTranscriptionDependencyValidationException( + throw CreateAudioTranscriptionDependencyValidationException( invalidAudioTranscriptionException); } catch (HttpResponseTooManyRequestsException httpResponseTooManyRequestsException) @@ -64,7 +64,7 @@ private static async ValueTask TryCatch( var excessiveCallAudioTranscriptionException = new ExcessiveCallAudioTranscriptionException(httpResponseTooManyRequestsException); - throw createAudioTranscriptionDependencyValidationException( + throw CreateAudioTranscriptionDependencyValidationException( excessiveCallAudioTranscriptionException); } catch (Exception exception) @@ -76,7 +76,7 @@ private static async ValueTask TryCatch( } } - private static AudioTranscriptionDependencyValidationException createAudioTranscriptionDependencyValidationException(Xeption innerException) + private static AudioTranscriptionDependencyValidationException CreateAudioTranscriptionDependencyValidationException(Xeption innerException) { return new AudioTranscriptionDependencyValidationException( message: "Chat completion dependency validation error occurred, fix errors and try again.", From 6de4765f36b8a57acb931d58725c7390a448571e Mon Sep 17 00:00:00 2001 From: Lezune Date: Thu, 6 Jun 2024 06:58:47 -0700 Subject: [PATCH 175/283] Reverted Unit Test files and updated create method declaration and calls to adhere to method naming standards --- .../AudioTranscriptionServiceTests.Validations.Send.cs | 9 ++++++--- .../AudioTranscriptionServiceTests.cs | 9 --------- .../AudioTranscriptionService.Exceptions.cs | 6 +++--- 3 files changed, 9 insertions(+), 15 deletions(-) diff --git a/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/AudioTranscriptions/AudioTranscriptionServiceTests.Validations.Send.cs b/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/AudioTranscriptions/AudioTranscriptionServiceTests.Validations.Send.cs index 6d1781f0..3f58eccf 100644 --- a/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/AudioTranscriptions/AudioTranscriptionServiceTests.Validations.Send.cs +++ b/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/AudioTranscriptions/AudioTranscriptionServiceTests.Validations.Send.cs @@ -23,7 +23,8 @@ private async Task ShouldThrowValidationExceptionOnSendIfAudioTranscriptionIsNul var nullAudioTranscriptionException = new NullAudioTranscriptionException(); var exceptedAudioTranscriptionValidationException = - createAudioTranscriptionValidationException( + new AudioTranscriptionValidationException( + message: "Audio transcription validation error occurred, fix errors and try again.", innerException: nullAudioTranscriptionException); // when @@ -62,7 +63,8 @@ private async Task ShouldThrowValidationExceptionOnSendIfAudioTranscriptionReque values: "Value is required"); var exceptedAudioTranscriptionValidationException = - createAudioTranscriptionValidationException( + new AudioTranscriptionValidationException( + message: "Audio transcription validation error occurred, fix errors and try again.", innerException: invalidAudioTranscriptionException); // when @@ -112,7 +114,8 @@ private async Task ShouldThrowValidationExceptionOnSendIfAudioTranscriptionReque values: "Value is required"); var exceptedAudioTranscriptionValidationException = - createAudioTranscriptionValidationException( + new AudioTranscriptionValidationException( + message: "Audio transcription validation error occurred, fix errors and try again.", innerException: invalidAudioTranscriptionException); // when diff --git a/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/AudioTranscriptions/AudioTranscriptionServiceTests.cs b/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/AudioTranscriptions/AudioTranscriptionServiceTests.cs index 0c28a62b..a8c2e720 100644 --- a/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/AudioTranscriptions/AudioTranscriptionServiceTests.cs +++ b/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/AudioTranscriptions/AudioTranscriptionServiceTests.cs @@ -10,11 +10,9 @@ using RESTFulSense.Exceptions; using Standard.AI.OpenAI.Brokers.OpenAIs; using Standard.AI.OpenAI.Models.Services.Foundations.AudioTranscriptions; -using Standard.AI.OpenAI.Models.Services.Foundations.AudioTranscriptions.Exceptions; using Standard.AI.OpenAI.Models.Services.Foundations.ExternalAudioTranscriptions; using Standard.AI.OpenAI.Services.Foundations.AudioTranscriptions; using Tynamix.ObjectFiller; -using Xeptions; using Xunit; namespace Standard.AI.OpenAI.Tests.Unit.Services.Foundations.AudioTranscriptions @@ -106,12 +104,5 @@ private static Filler AudioTranscriptionFiller() return filler; } - - private static AudioTranscriptionValidationException createAudioTranscriptionValidationException(Xeption innerException) - { - return new AudioTranscriptionValidationException( - message: "Audio transcription validation error occurred, fix errors and try again.", - innerException); - } } } diff --git a/Standard.AI.OpenAI/Services/Foundations/AudioTranscriptions/AudioTranscriptionService.Exceptions.cs b/Standard.AI.OpenAI/Services/Foundations/AudioTranscriptions/AudioTranscriptionService.Exceptions.cs index 785396aa..2012d1d9 100644 --- a/Standard.AI.OpenAI/Services/Foundations/AudioTranscriptions/AudioTranscriptionService.Exceptions.cs +++ b/Standard.AI.OpenAI/Services/Foundations/AudioTranscriptions/AudioTranscriptionService.Exceptions.cs @@ -24,12 +24,12 @@ private static async ValueTask TryCatch( } catch (NullAudioTranscriptionException nullAudioTranscriptionException) { - throw createAudioTranscriptionValidationException( + throw CreateAudioTranscriptionValidationException( nullAudioTranscriptionException); } catch (InvalidAudioTranscriptionException invalidAudioTranscriptionException) { - throw createAudioTranscriptionValidationException( + throw CreateAudioTranscriptionValidationException( invalidAudioTranscriptionException); } catch (HttpResponseUrlNotFoundException httpResponseUrlNotFoundException) @@ -76,7 +76,7 @@ private static async ValueTask TryCatch( } } - private static AudioTranscriptionValidationException createAudioTranscriptionValidationException(Xeption innerException) + private static AudioTranscriptionValidationException CreateAudioTranscriptionValidationException(Xeption innerException) { return new AudioTranscriptionValidationException( message: "Audio transcription validation error occurred, fix errors and try again.", From ff8f0acfb53480a81652a356f82217928bdba1d1 Mon Sep 17 00:00:00 2001 From: Lezune Date: Thu, 6 Jun 2024 07:05:46 -0700 Subject: [PATCH 176/283] Removed one of the constructors so the class can adhere to anemic model standards. Updated all calls to adhere to the change. --- .../Exceptions/ExcessiveCallAudioTranscriptionException.cs | 6 ------ .../AudioTranscriptionService.Exceptions.cs | 4 +++- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/Standard.AI.OpenAI/Models/Services/Foundations/AudioTranscriptions/Exceptions/ExcessiveCallAudioTranscriptionException.cs b/Standard.AI.OpenAI/Models/Services/Foundations/AudioTranscriptions/Exceptions/ExcessiveCallAudioTranscriptionException.cs index caaf5253..bc8b60ed 100644 --- a/Standard.AI.OpenAI/Models/Services/Foundations/AudioTranscriptions/Exceptions/ExcessiveCallAudioTranscriptionException.cs +++ b/Standard.AI.OpenAI/Models/Services/Foundations/AudioTranscriptions/Exceptions/ExcessiveCallAudioTranscriptionException.cs @@ -10,12 +10,6 @@ namespace Standard.AI.OpenAI.Models.Services.Foundations.AudioTranscriptions.Exc #pragma warning disable RCS1194 // Implement exception constructors. public class ExcessiveCallAudioTranscriptionException : Xeption { - public ExcessiveCallAudioTranscriptionException(Exception innerException) - : base( - message: "Excessive call error occurred, limit your calls.", - innerException: innerException) - { } - public ExcessiveCallAudioTranscriptionException(string message, Exception innerException) : base(message, innerException) { } diff --git a/Standard.AI.OpenAI/Services/Foundations/AudioTranscriptions/AudioTranscriptionService.Exceptions.cs b/Standard.AI.OpenAI/Services/Foundations/AudioTranscriptions/AudioTranscriptionService.Exceptions.cs index 0a729e95..dc1d135c 100644 --- a/Standard.AI.OpenAI/Services/Foundations/AudioTranscriptions/AudioTranscriptionService.Exceptions.cs +++ b/Standard.AI.OpenAI/Services/Foundations/AudioTranscriptions/AudioTranscriptionService.Exceptions.cs @@ -60,7 +60,9 @@ private static async ValueTask TryCatch( catch (HttpResponseTooManyRequestsException httpResponseTooManyRequestsException) { var excessiveCallAudioTranscriptionException = - new ExcessiveCallAudioTranscriptionException(httpResponseTooManyRequestsException); + new ExcessiveCallAudioTranscriptionException( + message: "Excessive call error occurred, limit your calls.", + httpResponseTooManyRequestsException); throw new AudioTranscriptionDependencyValidationException(excessiveCallAudioTranscriptionException); } From c61e4abc3ffd41b629b752ad8a682fd9ca96569b Mon Sep 17 00:00:00 2001 From: Lezune Date: Thu, 6 Jun 2024 07:15:16 -0700 Subject: [PATCH 177/283] Updated create method to adhere to method naming standards --- .../AudioTranscriptionService.Exceptions.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Standard.AI.OpenAI/Services/Foundations/AudioTranscriptions/AudioTranscriptionService.Exceptions.cs b/Standard.AI.OpenAI/Services/Foundations/AudioTranscriptions/AudioTranscriptionService.Exceptions.cs index 1684a3f5..b9a19024 100644 --- a/Standard.AI.OpenAI/Services/Foundations/AudioTranscriptions/AudioTranscriptionService.Exceptions.cs +++ b/Standard.AI.OpenAI/Services/Foundations/AudioTranscriptions/AudioTranscriptionService.Exceptions.cs @@ -39,7 +39,7 @@ private static async ValueTask TryCatch( catch (HttpResponseUnauthorizedException httpResponseUnauthorizedException) { var unauthorizedAudioTranscriptionException = - createUnauthorizedAudioTranscriptionException( + CreateUnauthorizedAudioTranscriptionException( httpResponseUnauthorizedException); throw new AudioTranscriptionDependencyException(unauthorizedAudioTranscriptionException); @@ -47,7 +47,7 @@ private static async ValueTask TryCatch( catch (HttpResponseForbiddenException httpResponseForbiddenException) { var unauthorizedAudioTranscriptionException = - createUnauthorizedAudioTranscriptionException( + CreateUnauthorizedAudioTranscriptionException( httpResponseForbiddenException); throw new AudioTranscriptionDependencyException(unauthorizedAudioTranscriptionException); @@ -75,7 +75,7 @@ private static async ValueTask TryCatch( } } - private static UnauthorizedAudioTranscriptionException createUnauthorizedAudioTranscriptionException(Exception innerException) + private static UnauthorizedAudioTranscriptionException CreateUnauthorizedAudioTranscriptionException(Exception innerException) { return new UnauthorizedAudioTranscriptionException( message: "Unauthorized audio transcription request, fix errors and try again.", From 63a7cb0e42e6ca2cc1e810aee1333e882f9b4149 Mon Sep 17 00:00:00 2001 From: Lezune Date: Thu, 6 Jun 2024 08:11:43 -0700 Subject: [PATCH 178/283] Reverted Unit Test files and updated create method declaration and calls to adhere to method naming standards --- .../ChatCompletionServiceTests.Exceptions.Send.cs | 15 +++++++++------ .../ChatCompletions/ChatCompletionServiceTests.cs | 9 --------- .../ChatCompletionService.Exceptions.cs | 10 +++++----- 3 files changed, 14 insertions(+), 20 deletions(-) diff --git a/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/ChatCompletions/ChatCompletionServiceTests.Exceptions.Send.cs b/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/ChatCompletions/ChatCompletionServiceTests.Exceptions.Send.cs index ff2a00f3..31bb0a9f 100644 --- a/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/ChatCompletions/ChatCompletionServiceTests.Exceptions.Send.cs +++ b/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/ChatCompletions/ChatCompletionServiceTests.Exceptions.Send.cs @@ -32,8 +32,9 @@ private async Task ShouldThrowDependencyExceptionOnSendIfUrlNotFoundAsync() innerException: httpResponseUrlNotFoundException); var expectedChatCompletionDependencyException = - createChatCompletionDependencyException( - innerException: invalidConfigurationChatCompletionException); + new ChatCompletionDependencyException( + message: "Chat completion dependency error occurred, contact support.", + innerException: invalidConfigurationChatCompletionException); this.openAIBrokerMock.Setup(broker => broker.PostChatCompletionRequestAsync( @@ -77,8 +78,9 @@ private async Task ShouldThrowDependencyExceptionOnSendIfUnauthorizedAsync( innerException: unauthorizedException); var expectedChatCompletionDependencyException = - createChatCompletionDependencyException( - innerException: unauthorizedChatCompletionException); + new ChatCompletionDependencyException( + message: "Chat completion dependency error occurred, contact support.", + innerException: unauthorizedChatCompletionException); this.openAIBrokerMock.Setup(broker => broker.PostChatCompletionRequestAsync( @@ -258,8 +260,9 @@ private async Task ShouldThrowDependencyExceptionOnSendIfHttpResponseErrorOccurr innerException: httpResponseException); var expectedChatCompletionDependencyException = - createChatCompletionDependencyException( - innerException: failedServerChatCompletionException); + new ChatCompletionDependencyException( + message: "Chat completion dependency error occurred, contact support.", + innerException: failedServerChatCompletionException); this.openAIBrokerMock.Setup(broker => broker.PostChatCompletionRequestAsync( diff --git a/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/ChatCompletions/ChatCompletionServiceTests.cs b/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/ChatCompletions/ChatCompletionServiceTests.cs index e522a5a4..465752a3 100644 --- a/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/ChatCompletions/ChatCompletionServiceTests.cs +++ b/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/ChatCompletions/ChatCompletionServiceTests.cs @@ -13,11 +13,9 @@ using Standard.AI.OpenAI.Brokers.DateTimes; using Standard.AI.OpenAI.Brokers.OpenAIs; using Standard.AI.OpenAI.Models.Services.Foundations.ChatCompletions; -using Standard.AI.OpenAI.Models.Services.Foundations.ChatCompletions.Exceptions; using Standard.AI.OpenAI.Models.Services.Foundations.ExternalChatCompletions; using Standard.AI.OpenAI.Services.Foundations.ChatCompletions; using Tynamix.ObjectFiller; -using Xeptions; using Xunit; namespace Standard.AI.OpenAI.Tests.Unit.Services.Foundations.ChatCompletions @@ -156,12 +154,5 @@ private static Filler ChatCompletionFiller() return filler; } - - private static ChatCompletionDependencyException createChatCompletionDependencyException(Xeption innerException) - { - return new ChatCompletionDependencyException( - message: "Chat completion dependency error occurred, contact support.", - innerException); - } } } diff --git a/Standard.AI.OpenAI/Services/Foundations/ChatCompletions/ChatCompletionService.Exceptions.cs b/Standard.AI.OpenAI/Services/Foundations/ChatCompletions/ChatCompletionService.Exceptions.cs index c211d5e5..b29d1e6e 100644 --- a/Standard.AI.OpenAI/Services/Foundations/ChatCompletions/ChatCompletionService.Exceptions.cs +++ b/Standard.AI.OpenAI/Services/Foundations/ChatCompletions/ChatCompletionService.Exceptions.cs @@ -34,7 +34,7 @@ private async ValueTask TryCatch(ReturningChatCompletionFunction var invalidConfigurationChatCompletionException = new InvalidConfigurationChatCompletionException(httpResponseUrlNotFoundException); - throw createChatCompletionDependencyException( + throw CreateChatCompletionDependencyException( invalidConfigurationChatCompletionException); } catch (HttpResponseUnauthorizedException httpResponseUnauthorizedException) @@ -42,7 +42,7 @@ private async ValueTask TryCatch(ReturningChatCompletionFunction var unauthorizedChatCompletionException = new UnauthorizedChatCompletionException(httpResponseUnauthorizedException); - throw createChatCompletionDependencyException( + throw CreateChatCompletionDependencyException( unauthorizedChatCompletionException); } catch (HttpResponseForbiddenException httpResponseForbiddenException) @@ -50,7 +50,7 @@ private async ValueTask TryCatch(ReturningChatCompletionFunction var unauthorizedChatCompletionException = new UnauthorizedChatCompletionException(httpResponseForbiddenException); - throw createChatCompletionDependencyException( + throw CreateChatCompletionDependencyException( unauthorizedChatCompletionException); } catch (HttpResponseNotFoundException httpResponseNotFoundException) @@ -79,7 +79,7 @@ private async ValueTask TryCatch(ReturningChatCompletionFunction var failedServerChatCompletionException = new FailedServerChatCompletionException(httpResponseException); - throw createChatCompletionDependencyException( + throw CreateChatCompletionDependencyException( failedServerChatCompletionException); } catch (Exception exception) @@ -92,7 +92,7 @@ private async ValueTask TryCatch(ReturningChatCompletionFunction } } - private static ChatCompletionDependencyException createChatCompletionDependencyException(Xeption innerException) + private static ChatCompletionDependencyException CreateChatCompletionDependencyException(Xeption innerException) { return new ChatCompletionDependencyException( message: "Chat completion dependency error occurred, contact support.", From 42f4a89261c0efb370c1035e3c19fecb2253dda5 Mon Sep 17 00:00:00 2001 From: Lezune Date: Thu, 6 Jun 2024 08:13:45 -0700 Subject: [PATCH 179/283] Updated create method to adhere to method naming standards --- .../ChatCompletions/ChatCompletionService.Exceptions.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Standard.AI.OpenAI/Services/Foundations/ChatCompletions/ChatCompletionService.Exceptions.cs b/Standard.AI.OpenAI/Services/Foundations/ChatCompletions/ChatCompletionService.Exceptions.cs index 0741bed9..cfa537e4 100644 --- a/Standard.AI.OpenAI/Services/Foundations/ChatCompletions/ChatCompletionService.Exceptions.cs +++ b/Standard.AI.OpenAI/Services/Foundations/ChatCompletions/ChatCompletionService.Exceptions.cs @@ -55,7 +55,7 @@ private async ValueTask TryCatch(ReturningChatCompletionFunction var notFoundChatCompletionException = new NotFoundChatCompletionException(httpResponseNotFoundException); - throw createChatCompletionDependencyValidationException( + throw CreateChatCompletionDependencyValidationException( notFoundChatCompletionException); } catch (HttpResponseBadRequestException httpResponseBadRequestException) @@ -63,7 +63,7 @@ private async ValueTask TryCatch(ReturningChatCompletionFunction var invalidChatCompletionException = new InvalidChatCompletionException(httpResponseBadRequestException); - throw createChatCompletionDependencyValidationException( + throw CreateChatCompletionDependencyValidationException( invalidChatCompletionException); } catch (HttpResponseTooManyRequestsException httpResponseTooManyRequestsException) @@ -71,7 +71,7 @@ private async ValueTask TryCatch(ReturningChatCompletionFunction var excessiveCallChatCompletionException = new ExcessiveCallChatCompletionException(httpResponseTooManyRequestsException); - throw createChatCompletionDependencyValidationException( + throw CreateChatCompletionDependencyValidationException( excessiveCallChatCompletionException); } catch (HttpResponseException httpResponseException) @@ -91,7 +91,7 @@ private async ValueTask TryCatch(ReturningChatCompletionFunction } } - private static ChatCompletionDependencyValidationException createChatCompletionDependencyValidationException(Xeption innerException) + private static ChatCompletionDependencyValidationException CreateChatCompletionDependencyValidationException(Xeption innerException) { return new ChatCompletionDependencyValidationException( "Chat completion dependency validation error occurred, fix errors and try again.", From 2ebbe8db52a93ad977b27a521f4188718c9a94c0 Mon Sep 17 00:00:00 2001 From: Lezune Date: Thu, 6 Jun 2024 08:14:29 -0700 Subject: [PATCH 180/283] Reverted Unit Test files to original state --- .../ChatCompletionServiceTests.Exceptions.Send.cs | 15 +++++++++------ .../ChatCompletions/ChatCompletionServiceTests.cs | 9 --------- 2 files changed, 9 insertions(+), 15 deletions(-) diff --git a/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/ChatCompletions/ChatCompletionServiceTests.Exceptions.Send.cs b/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/ChatCompletions/ChatCompletionServiceTests.Exceptions.Send.cs index 5a8e097f..31bb0a9f 100644 --- a/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/ChatCompletions/ChatCompletionServiceTests.Exceptions.Send.cs +++ b/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/ChatCompletions/ChatCompletionServiceTests.Exceptions.Send.cs @@ -125,8 +125,9 @@ private async Task ShouldThrowDependencyValidationExceptionOnSendIfChatCompletio innerException: httpResponseNotFoundException); var expectedChatCompletionDependencyValidationException = - createChatCompletionDependencyValidationException( - innerException: notFoundChatCompletionException); + new ChatCompletionDependencyValidationException( + message: "Chat completion dependency validation error occurred, fix errors and try again.", + innerException: notFoundChatCompletionException); this.openAIBrokerMock.Setup(broker => broker.PostChatCompletionRequestAsync( @@ -169,8 +170,9 @@ private async Task ShouldThrowDependencyValidationExceptionOnSendIfBadRequestErr innerException: httpResponseBadRequestException); var expectedChatCompletionDependencyValidationException = - createChatCompletionDependencyValidationException( - innerException: invalidChatCompletionException); + new ChatCompletionDependencyValidationException( + message: "Chat completion dependency validation error occurred, fix errors and try again.", + innerException: invalidChatCompletionException); this.openAIBrokerMock.Setup(broker => broker.PostChatCompletionRequestAsync( @@ -215,8 +217,9 @@ private async Task ShouldThrowDependencyValidationExceptionOnSendIfTooManyReques innerException: httpResponseTooManyRequestsException); var expectedChatCompletionDependencyValidationException = - createChatCompletionDependencyValidationException( - innerException: excessiveCallChatCompletionException); + new ChatCompletionDependencyValidationException( + message: "Chat completion dependency validation error occurred, fix errors and try again.", + innerException: excessiveCallChatCompletionException); this.openAIBrokerMock.Setup(broker => broker.PostChatCompletionRequestAsync( diff --git a/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/ChatCompletions/ChatCompletionServiceTests.cs b/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/ChatCompletions/ChatCompletionServiceTests.cs index 3568039c..465752a3 100644 --- a/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/ChatCompletions/ChatCompletionServiceTests.cs +++ b/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/ChatCompletions/ChatCompletionServiceTests.cs @@ -13,11 +13,9 @@ using Standard.AI.OpenAI.Brokers.DateTimes; using Standard.AI.OpenAI.Brokers.OpenAIs; using Standard.AI.OpenAI.Models.Services.Foundations.ChatCompletions; -using Standard.AI.OpenAI.Models.Services.Foundations.ChatCompletions.Exceptions; using Standard.AI.OpenAI.Models.Services.Foundations.ExternalChatCompletions; using Standard.AI.OpenAI.Services.Foundations.ChatCompletions; using Tynamix.ObjectFiller; -using Xeptions; using Xunit; namespace Standard.AI.OpenAI.Tests.Unit.Services.Foundations.ChatCompletions @@ -156,12 +154,5 @@ private static Filler ChatCompletionFiller() return filler; } - - private static ChatCompletionDependencyValidationException createChatCompletionDependencyValidationException(Xeption innerException) - { - return new ChatCompletionDependencyValidationException( - "Chat completion dependency validation error occurred, fix errors and try again.", - innerException); - } } } From c9d8b4070eddef2ca2be60e1c13799896872caf4 Mon Sep 17 00:00:00 2001 From: Lezune Date: Thu, 6 Jun 2024 08:16:51 -0700 Subject: [PATCH 181/283] Updated create method to adhere to method naming standards --- .../ChatCompletions/ChatCompletionService.Exceptions.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Standard.AI.OpenAI/Services/Foundations/ChatCompletions/ChatCompletionService.Exceptions.cs b/Standard.AI.OpenAI/Services/Foundations/ChatCompletions/ChatCompletionService.Exceptions.cs index 7d2f1314..7ede95e8 100644 --- a/Standard.AI.OpenAI/Services/Foundations/ChatCompletions/ChatCompletionService.Exceptions.cs +++ b/Standard.AI.OpenAI/Services/Foundations/ChatCompletions/ChatCompletionService.Exceptions.cs @@ -23,12 +23,12 @@ private async ValueTask TryCatch(ReturningChatCompletionFunction } catch (NullChatCompletionException nullChatCompletionException) { - throw createChatCompletionValidationException( + throw CreateChatCompletionValidationException( nullChatCompletionException); } catch (InvalidChatCompletionException invalidChatCompletionException) { - throw createChatCompletionValidationException( + throw CreateChatCompletionValidationException( invalidChatCompletionException); } catch (HttpResponseUrlNotFoundException httpResponseUrlNotFoundException) @@ -90,7 +90,7 @@ private async ValueTask TryCatch(ReturningChatCompletionFunction } } - private static ChatCompletionValidationException createChatCompletionValidationException(Xeption innerException) + private static ChatCompletionValidationException CreateChatCompletionValidationException(Xeption innerException) { return new ChatCompletionValidationException( message: "Chat completion validation error occurred, fix errors and try again.", From bdf3ef94efc25040a86d5a50e22f5bd984bcc646 Mon Sep 17 00:00:00 2001 From: Lezune Date: Thu, 6 Jun 2024 08:17:31 -0700 Subject: [PATCH 182/283] Reverted Unit Test files to original state --- ...ChatCompletionServiceTests.Validations.Send.cs | 15 +++++++++------ .../ChatCompletions/ChatCompletionServiceTests.cs | 9 --------- 2 files changed, 9 insertions(+), 15 deletions(-) diff --git a/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/ChatCompletions/ChatCompletionServiceTests.Validations.Send.cs b/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/ChatCompletions/ChatCompletionServiceTests.Validations.Send.cs index 697f766d..8557d1e4 100644 --- a/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/ChatCompletions/ChatCompletionServiceTests.Validations.Send.cs +++ b/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/ChatCompletions/ChatCompletionServiceTests.Validations.Send.cs @@ -24,8 +24,9 @@ private async Task ShouldThrowValidationExceptionOnSendIfChatCompletionIsNullAsy new NullChatCompletionException(); var expectedChatCompletionValidationException = - createChatCompletionValidationException( - innerException: nullChatCompletionException); + new ChatCompletionValidationException( + message: "Chat completion validation error occurred, fix errors and try again.", + innerException: nullChatCompletionException); // when ValueTask sendChatCompletionTask = @@ -64,8 +65,9 @@ private async Task ShouldThrowValidationExceptionOnSendIfRequestIsNullAsync() values: "Value is required"); var expectedChatCompletionValidationException = - createChatCompletionValidationException( - innerException: invalidChatCompletionException); + new ChatCompletionValidationException( + message: "Chat completion validation error occurred, fix errors and try again.", + innerException: invalidChatCompletionException); // when ValueTask sendChatCompletionTask = @@ -115,8 +117,9 @@ private async Task ShouldThrowValidationExceptionOnSendIfRequestIsInvalidAsync(s values: "Value is required"); var expectedChatCompletionValidationException = - createChatCompletionValidationException( - innerException: invalidChatCompletionException); + new ChatCompletionValidationException( + message: "Chat completion validation error occurred, fix errors and try again.", + innerException: invalidChatCompletionException); // when ValueTask sendChatCompletionTask = diff --git a/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/ChatCompletions/ChatCompletionServiceTests.cs b/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/ChatCompletions/ChatCompletionServiceTests.cs index bdeb28f5..465752a3 100644 --- a/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/ChatCompletions/ChatCompletionServiceTests.cs +++ b/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/ChatCompletions/ChatCompletionServiceTests.cs @@ -13,11 +13,9 @@ using Standard.AI.OpenAI.Brokers.DateTimes; using Standard.AI.OpenAI.Brokers.OpenAIs; using Standard.AI.OpenAI.Models.Services.Foundations.ChatCompletions; -using Standard.AI.OpenAI.Models.Services.Foundations.ChatCompletions.Exceptions; using Standard.AI.OpenAI.Models.Services.Foundations.ExternalChatCompletions; using Standard.AI.OpenAI.Services.Foundations.ChatCompletions; using Tynamix.ObjectFiller; -using Xeptions; using Xunit; namespace Standard.AI.OpenAI.Tests.Unit.Services.Foundations.ChatCompletions @@ -156,12 +154,5 @@ private static Filler ChatCompletionFiller() return filler; } - - private static ChatCompletionValidationException createChatCompletionValidationException(Xeption innerException) - { - return new ChatCompletionValidationException( - message: "Chat completion validation error occurred, fix errors and try again.", - innerException); - } } } From 5780832564793aa8174db783bb0ea2493ad395ca Mon Sep 17 00:00:00 2001 From: Lezune Date: Thu, 6 Jun 2024 08:21:19 -0700 Subject: [PATCH 183/283] Updated create method to adhere to method naming standards --- .../ChatCompletions/ChatCompletionService.Exceptions.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Standard.AI.OpenAI/Services/Foundations/ChatCompletions/ChatCompletionService.Exceptions.cs b/Standard.AI.OpenAI/Services/Foundations/ChatCompletions/ChatCompletionService.Exceptions.cs index f1701a42..399f96ad 100644 --- a/Standard.AI.OpenAI/Services/Foundations/ChatCompletions/ChatCompletionService.Exceptions.cs +++ b/Standard.AI.OpenAI/Services/Foundations/ChatCompletions/ChatCompletionService.Exceptions.cs @@ -60,7 +60,7 @@ private async ValueTask TryCatch(ReturningChatCompletionFunction catch (HttpResponseBadRequestException httpResponseBadRequestException) { var invalidChatCompletionException = - createInvalidChatCompletionException( + CreateInvalidChatCompletionException( httpResponseBadRequestException); throw new ChatCompletionDependencyValidationException(invalidChatCompletionException); @@ -89,7 +89,7 @@ private async ValueTask TryCatch(ReturningChatCompletionFunction } } - private static InvalidChatCompletionException createInvalidChatCompletionException(Xeption innerException) + private static InvalidChatCompletionException CreateInvalidChatCompletionException(Xeption innerException) { return new InvalidChatCompletionException( message: "Chat completion is invalid.", From 09f3b341fa6c29714d359e9e69999df6bed64d6e Mon Sep 17 00:00:00 2001 From: Lezune Date: Thu, 6 Jun 2024 08:27:01 -0700 Subject: [PATCH 184/283] Updated create method to adhere to method naming standards --- .../ChatCompletions/ChatCompletionService.Exceptions.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Standard.AI.OpenAI/Services/Foundations/ChatCompletions/ChatCompletionService.Exceptions.cs b/Standard.AI.OpenAI/Services/Foundations/ChatCompletions/ChatCompletionService.Exceptions.cs index 70f19452..e67ec4ea 100644 --- a/Standard.AI.OpenAI/Services/Foundations/ChatCompletions/ChatCompletionService.Exceptions.cs +++ b/Standard.AI.OpenAI/Services/Foundations/ChatCompletions/ChatCompletionService.Exceptions.cs @@ -38,7 +38,7 @@ private async ValueTask TryCatch(ReturningChatCompletionFunction catch (HttpResponseUnauthorizedException httpResponseUnauthorizedException) { var unauthorizedChatCompletionException = - createUnauthorizedChatCompletionException( + CreateUnauthorizedChatCompletionException( httpResponseUnauthorizedException); throw new ChatCompletionDependencyException(unauthorizedChatCompletionException); @@ -46,7 +46,7 @@ private async ValueTask TryCatch(ReturningChatCompletionFunction catch (HttpResponseForbiddenException httpResponseForbiddenException) { var unauthorizedChatCompletionException = - createUnauthorizedChatCompletionException( + CreateUnauthorizedChatCompletionException( httpResponseForbiddenException); throw new ChatCompletionDependencyException(unauthorizedChatCompletionException); @@ -89,7 +89,7 @@ private async ValueTask TryCatch(ReturningChatCompletionFunction } } - private static UnauthorizedChatCompletionException createUnauthorizedChatCompletionException(Exception innerException) + private static UnauthorizedChatCompletionException CreateUnauthorizedChatCompletionException(Exception innerException) { return new UnauthorizedChatCompletionException( message: "Unauthorized chat completion request, fix errors and try again.", From 1534f1afd104ce4953e421defdfb124d4e8db713 Mon Sep 17 00:00:00 2001 From: Lezune Date: Thu, 6 Jun 2024 08:32:38 -0700 Subject: [PATCH 185/283] Updated create method to adhere to method naming standards --- .../Completions/CompletionService.Exceptions.cs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Standard.AI.OpenAI/Services/Foundations/Completions/CompletionService.Exceptions.cs b/Standard.AI.OpenAI/Services/Foundations/Completions/CompletionService.Exceptions.cs index 0426c831..93905741 100644 --- a/Standard.AI.OpenAI/Services/Foundations/Completions/CompletionService.Exceptions.cs +++ b/Standard.AI.OpenAI/Services/Foundations/Completions/CompletionService.Exceptions.cs @@ -35,7 +35,7 @@ private static async ValueTask TryCatch(ReturningCompletionFunction var invalidConfigurationCompletionException = new InvalidConfigurationCompletionException(httpResponseUrlNotFoundException); - throw createCompletionDependencyException( + throw CreateCompletionDependencyException( invalidConfigurationCompletionException); } catch (HttpResponseUnauthorizedException httpResponseUnauthorizedException) @@ -43,7 +43,7 @@ private static async ValueTask TryCatch(ReturningCompletionFunction var unauthorizedCompletionException = new UnauthorizedCompletionException(httpResponseUnauthorizedException); - throw createCompletionDependencyException( + throw CreateCompletionDependencyException( unauthorizedCompletionException); } catch (HttpResponseForbiddenException httpResponseForbiddenException) @@ -51,7 +51,7 @@ private static async ValueTask TryCatch(ReturningCompletionFunction var unauthorizedCompletionException = new UnauthorizedCompletionException(httpResponseForbiddenException); - throw createCompletionDependencyException( + throw CreateCompletionDependencyException( unauthorizedCompletionException); } catch (HttpResponseNotFoundException httpResponseNotFoundException) @@ -81,7 +81,7 @@ private static async ValueTask TryCatch(ReturningCompletionFunction var failedServerCompletionException = new FailedServerCompletionException(httpResponseException); - throw createCompletionDependencyException( + throw CreateCompletionDependencyException( failedServerCompletionException); } catch (Exception exception) @@ -92,7 +92,7 @@ private static async ValueTask TryCatch(ReturningCompletionFunction throw new CompletionServiceException(failedCompletionServiceException); } } - private static CompletionDependencyException createCompletionDependencyException(Xeption innerException) + private static CompletionDependencyException CreateCompletionDependencyException(Xeption innerException) { return new CompletionDependencyException( message: "Completion dependency error occurred, contact support.", From 7df44ba3388a692d0a274304376387e8f2341824 Mon Sep 17 00:00:00 2001 From: Lezune Date: Thu, 6 Jun 2024 08:33:28 -0700 Subject: [PATCH 186/283] Reverted Unit Test files to original state --- .../CompletionServiceTests.Exceptions.Prompt.cs | 15 +++++++++------ .../Completions/CompletionServiceTests.cs | 9 --------- 2 files changed, 9 insertions(+), 15 deletions(-) diff --git a/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/Completions/CompletionServiceTests.Exceptions.Prompt.cs b/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/Completions/CompletionServiceTests.Exceptions.Prompt.cs index ac219a33..9c1d8fa6 100644 --- a/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/Completions/CompletionServiceTests.Exceptions.Prompt.cs +++ b/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/Completions/CompletionServiceTests.Exceptions.Prompt.cs @@ -31,8 +31,9 @@ private async Task ShouldThrowDependencyExceptionOnPromptIfUrlNotFoundErrorOccur innerException: httpResponseUrlNotFoundException); var expectedCompletionDependencyException = - createCompletionDependencyException( - innerException: invalidConfigurationCompletionException); + new CompletionDependencyException( + message: "Completion dependency error occurred, contact support.", + innerException: invalidConfigurationCompletionException); this.openAIBrokerMock.Setup(broker => broker.PostCompletionRequestAsync( It.IsAny())) @@ -73,8 +74,9 @@ private async Task ShouldThrowDependencyExceptionOnPromptIfUnauthorizedAsync( innerException: unauthorizedException); var expectedCompletionDependencyException = - createCompletionDependencyException( - innerException: unauthorizedCompletionException); + new CompletionDependencyException( + message: "Completion dependency error occurred, contact support.", + innerException: unauthorizedCompletionException); this.openAIBrokerMock.Setup(broker => broker.PostCompletionRequestAsync( @@ -250,8 +252,9 @@ private async Task ShouldThrowDependencyExceptionOnPromptIfHttpErrorOccursAsync( innerException: httpResponseException); var expectedCompletionDependencyException = - createCompletionDependencyException( - innerException: failedServerCompletionException); + new CompletionDependencyException( + message: "Completion dependency error occurred, contact support.", + innerException: failedServerCompletionException); this.openAIBrokerMock.Setup(broker => broker.PostCompletionRequestAsync( It.IsAny())) diff --git a/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/Completions/CompletionServiceTests.cs b/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/Completions/CompletionServiceTests.cs index 539dd672..265c636a 100644 --- a/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/Completions/CompletionServiceTests.cs +++ b/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/Completions/CompletionServiceTests.cs @@ -12,11 +12,9 @@ using Standard.AI.OpenAI.Brokers.DateTimes; using Standard.AI.OpenAI.Brokers.OpenAIs; using Standard.AI.OpenAI.Models.Services.Foundations.Completions; -using Standard.AI.OpenAI.Models.Services.Foundations.Completions.Exceptions; using Standard.AI.OpenAI.Models.Services.Foundations.ExternalCompletions; using Standard.AI.OpenAI.Services.Foundations.Completions; using Tynamix.ObjectFiller; -using Xeptions; using Xunit; namespace Standard.AI.OpenAI.Tests.Unit.Services.Foundations.Completions @@ -143,12 +141,5 @@ private static Filler CreateCompletionFiller() return filler; } - - private static CompletionDependencyException createCompletionDependencyException(Xeption innerException) - { - return new CompletionDependencyException( - message: "Completion dependency error occurred, contact support.", - innerException); - } } } From 4905130e25afe119bd866293611ee486f5b65f18 Mon Sep 17 00:00:00 2001 From: Lezune Date: Thu, 6 Jun 2024 08:37:52 -0700 Subject: [PATCH 187/283] Updated create method to adhere to method naming standards --- .../Foundations/Completions/CompletionService.Exceptions.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Standard.AI.OpenAI/Services/Foundations/Completions/CompletionService.Exceptions.cs b/Standard.AI.OpenAI/Services/Foundations/Completions/CompletionService.Exceptions.cs index 7ecc885d..54651727 100644 --- a/Standard.AI.OpenAI/Services/Foundations/Completions/CompletionService.Exceptions.cs +++ b/Standard.AI.OpenAI/Services/Foundations/Completions/CompletionService.Exceptions.cs @@ -23,12 +23,12 @@ private static async ValueTask TryCatch(ReturningCompletionFunction } catch (NullCompletionException nullCompletionException) { - throw createCompletionValidationException( + throw CreateCompletionValidationException( nullCompletionException); } catch (InvalidCompletionException invalidCompletionException) { - throw createCompletionValidationException( + throw CreateCompletionValidationException( invalidCompletionException); } catch (HttpResponseUrlNotFoundException httpResponseUrlNotFoundException) @@ -90,7 +90,7 @@ private static async ValueTask TryCatch(ReturningCompletionFunction } } - private static CompletionValidationException createCompletionValidationException(Xeption innerException) + private static CompletionValidationException CreateCompletionValidationException(Xeption innerException) { return new CompletionValidationException( message: "Completion validation error occurred, fix errors and try again.", From f19e18a1c50aaff64188a706b1840c0ffdb1f100 Mon Sep 17 00:00:00 2001 From: Lezune Date: Thu, 6 Jun 2024 08:38:34 -0700 Subject: [PATCH 188/283] Reverted Unit Test files to original state --- ...mpletionServiceTests.Validations.Prompt.cs | 20 +++++++++++-------- .../Completions/CompletionServiceTests.cs | 9 --------- 2 files changed, 12 insertions(+), 17 deletions(-) diff --git a/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/Completions/CompletionServiceTests.Validations.Prompt.cs b/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/Completions/CompletionServiceTests.Validations.Prompt.cs index 6356ad5b..e6b84b3c 100644 --- a/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/Completions/CompletionServiceTests.Validations.Prompt.cs +++ b/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/Completions/CompletionServiceTests.Validations.Prompt.cs @@ -23,8 +23,9 @@ private async Task ShouldThrowValidationExceptionOnPromptIfCompletionIsNullAsync var nullCompletionException = new NullCompletionException(); var exceptedCompletionValidationException = - createCompletionValidationException( - innerException: nullCompletionException); + new CompletionValidationException( + message: "Completion validation error occurred, fix errors and try again.", + innerException: nullCompletionException); // when ValueTask promptCompletionTask = @@ -62,8 +63,9 @@ private async Task ShouldThrowValidationExceptionOnPromptIfRequestIsNullAsync() values: "Value is required"); var expectedCompletionValidationException = - createCompletionValidationException( - innerException: invalidCompletionException); + new CompletionValidationException( + message: "Completion validation error occurred, fix errors and try again.", + innerException: invalidCompletionException); // when ValueTask promptCompletionTask = @@ -112,8 +114,9 @@ private async Task ShouldThrowValidationExceptionOnPromptIfCompletionIsInvalidAs values: "Value is required"); var expectedCompletionValidationException = - createCompletionValidationException( - innerException: invalidCompletionException); + new CompletionValidationException( + message: "Completion validation error occurred, fix errors and try again.", + innerException: invalidCompletionException); // when ValueTask promptCompletionTask = @@ -150,8 +153,9 @@ private async Task ShouldThrowValidationExceptionOnPromptIfPromptIsEmptyAsync() values: "Value is required"); var expectedCompletionValidationException = - createCompletionValidationException( - innerException: invalidCompletionException); + new CompletionValidationException( + message: "Completion validation error occurred, fix errors and try again.", + innerException: invalidCompletionException); // when ValueTask promptCompletionTask = diff --git a/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/Completions/CompletionServiceTests.cs b/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/Completions/CompletionServiceTests.cs index bfa7d81b..265c636a 100644 --- a/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/Completions/CompletionServiceTests.cs +++ b/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/Completions/CompletionServiceTests.cs @@ -12,11 +12,9 @@ using Standard.AI.OpenAI.Brokers.DateTimes; using Standard.AI.OpenAI.Brokers.OpenAIs; using Standard.AI.OpenAI.Models.Services.Foundations.Completions; -using Standard.AI.OpenAI.Models.Services.Foundations.Completions.Exceptions; using Standard.AI.OpenAI.Models.Services.Foundations.ExternalCompletions; using Standard.AI.OpenAI.Services.Foundations.Completions; using Tynamix.ObjectFiller; -using Xeptions; using Xunit; namespace Standard.AI.OpenAI.Tests.Unit.Services.Foundations.Completions @@ -143,12 +141,5 @@ private static Filler CreateCompletionFiller() return filler; } - - private static CompletionValidationException createCompletionValidationException(Xeption innerException) - { - return new CompletionValidationException( - message: "Completion validation error occurred, fix errors and try again.", - innerException); - } } } From c40ab40ca12c67913ed2bbb4ad6ae7a84cddb66c Mon Sep 17 00:00:00 2001 From: Lezune Date: Thu, 6 Jun 2024 08:41:09 -0700 Subject: [PATCH 189/283] Reverted Unit Test files to original state --- .../CompletionServiceTests.Validations.Prompt.cs | 8 +++----- .../Foundations/Completions/CompletionServiceTests.cs | 7 ------- 2 files changed, 3 insertions(+), 12 deletions(-) diff --git a/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/Completions/CompletionServiceTests.Validations.Prompt.cs b/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/Completions/CompletionServiceTests.Validations.Prompt.cs index c705dd1a..e6b84b3c 100644 --- a/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/Completions/CompletionServiceTests.Validations.Prompt.cs +++ b/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/Completions/CompletionServiceTests.Validations.Prompt.cs @@ -56,7 +56,7 @@ private async Task ShouldThrowValidationExceptionOnPromptIfRequestIsNullAsync() invalidCompletion.Request = null; var invalidCompletionException = - createInvalidCompletionException(); + new InvalidCompletionException(); invalidCompletionException.AddData( key: nameof(Completion.Request), @@ -103,8 +103,7 @@ private async Task ShouldThrowValidationExceptionOnPromptIfCompletionIsInvalidAs } }; - var invalidCompletionException = - createInvalidCompletionException(); + var invalidCompletionException = new InvalidCompletionException(); invalidCompletionException.AddData( key: nameof(CompletionRequest.Model), @@ -147,8 +146,7 @@ private async Task ShouldThrowValidationExceptionOnPromptIfPromptIsEmptyAsync() } }; - var invalidCompletionException = - createInvalidCompletionException(); + var invalidCompletionException = new InvalidCompletionException(); invalidCompletionException.AddData( key: nameof(CompletionRequest.Prompts), diff --git a/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/Completions/CompletionServiceTests.cs b/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/Completions/CompletionServiceTests.cs index f55b9cf4..265c636a 100644 --- a/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/Completions/CompletionServiceTests.cs +++ b/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/Completions/CompletionServiceTests.cs @@ -12,7 +12,6 @@ using Standard.AI.OpenAI.Brokers.DateTimes; using Standard.AI.OpenAI.Brokers.OpenAIs; using Standard.AI.OpenAI.Models.Services.Foundations.Completions; -using Standard.AI.OpenAI.Models.Services.Foundations.Completions.Exceptions; using Standard.AI.OpenAI.Models.Services.Foundations.ExternalCompletions; using Standard.AI.OpenAI.Services.Foundations.Completions; using Tynamix.ObjectFiller; @@ -142,11 +141,5 @@ private static Filler CreateCompletionFiller() return filler; } - - private static InvalidCompletionException createInvalidCompletionException() - { - return new InvalidCompletionException( - message: "Invalid completion error occurred, fix errors and try again."); - } } } From 9f135524e214c12b39af9dcdf9f489bcbd576f54 Mon Sep 17 00:00:00 2001 From: Lezune Date: Thu, 6 Jun 2024 08:43:59 -0700 Subject: [PATCH 190/283] Reverting changes --- .../CompletionServiceTests.Validations.Prompt.cs | 8 +++++--- .../Foundations/Completions/CompletionServiceTests.cs | 7 +++++++ 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/Completions/CompletionServiceTests.Validations.Prompt.cs b/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/Completions/CompletionServiceTests.Validations.Prompt.cs index e6b84b3c..c705dd1a 100644 --- a/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/Completions/CompletionServiceTests.Validations.Prompt.cs +++ b/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/Completions/CompletionServiceTests.Validations.Prompt.cs @@ -56,7 +56,7 @@ private async Task ShouldThrowValidationExceptionOnPromptIfRequestIsNullAsync() invalidCompletion.Request = null; var invalidCompletionException = - new InvalidCompletionException(); + createInvalidCompletionException(); invalidCompletionException.AddData( key: nameof(Completion.Request), @@ -103,7 +103,8 @@ private async Task ShouldThrowValidationExceptionOnPromptIfCompletionIsInvalidAs } }; - var invalidCompletionException = new InvalidCompletionException(); + var invalidCompletionException = + createInvalidCompletionException(); invalidCompletionException.AddData( key: nameof(CompletionRequest.Model), @@ -146,7 +147,8 @@ private async Task ShouldThrowValidationExceptionOnPromptIfPromptIsEmptyAsync() } }; - var invalidCompletionException = new InvalidCompletionException(); + var invalidCompletionException = + createInvalidCompletionException(); invalidCompletionException.AddData( key: nameof(CompletionRequest.Prompts), diff --git a/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/Completions/CompletionServiceTests.cs b/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/Completions/CompletionServiceTests.cs index 265c636a..f55b9cf4 100644 --- a/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/Completions/CompletionServiceTests.cs +++ b/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/Completions/CompletionServiceTests.cs @@ -12,6 +12,7 @@ using Standard.AI.OpenAI.Brokers.DateTimes; using Standard.AI.OpenAI.Brokers.OpenAIs; using Standard.AI.OpenAI.Models.Services.Foundations.Completions; +using Standard.AI.OpenAI.Models.Services.Foundations.Completions.Exceptions; using Standard.AI.OpenAI.Models.Services.Foundations.ExternalCompletions; using Standard.AI.OpenAI.Services.Foundations.Completions; using Tynamix.ObjectFiller; @@ -141,5 +142,11 @@ private static Filler CreateCompletionFiller() return filler; } + + private static InvalidCompletionException createInvalidCompletionException() + { + return new InvalidCompletionException( + message: "Invalid completion error occurred, fix errors and try again."); + } } } From e0aa20ba647f8fee63813da1a79e1340c3f43204 Mon Sep 17 00:00:00 2001 From: Lezune Date: Thu, 6 Jun 2024 08:49:12 -0700 Subject: [PATCH 191/283] Updated create method to adhere to method naming standards --- .../CompletionServiceTests.Validations.Prompt.cs | 6 +++--- .../Foundations/Completions/CompletionServiceTests.cs | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/Completions/CompletionServiceTests.Validations.Prompt.cs b/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/Completions/CompletionServiceTests.Validations.Prompt.cs index c705dd1a..749e296d 100644 --- a/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/Completions/CompletionServiceTests.Validations.Prompt.cs +++ b/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/Completions/CompletionServiceTests.Validations.Prompt.cs @@ -56,7 +56,7 @@ private async Task ShouldThrowValidationExceptionOnPromptIfRequestIsNullAsync() invalidCompletion.Request = null; var invalidCompletionException = - createInvalidCompletionException(); + CreateInvalidCompletionException(); invalidCompletionException.AddData( key: nameof(Completion.Request), @@ -104,7 +104,7 @@ private async Task ShouldThrowValidationExceptionOnPromptIfCompletionIsInvalidAs }; var invalidCompletionException = - createInvalidCompletionException(); + CreateInvalidCompletionException(); invalidCompletionException.AddData( key: nameof(CompletionRequest.Model), @@ -148,7 +148,7 @@ private async Task ShouldThrowValidationExceptionOnPromptIfPromptIsEmptyAsync() }; var invalidCompletionException = - createInvalidCompletionException(); + CreateInvalidCompletionException(); invalidCompletionException.AddData( key: nameof(CompletionRequest.Prompts), diff --git a/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/Completions/CompletionServiceTests.cs b/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/Completions/CompletionServiceTests.cs index f55b9cf4..50afe12d 100644 --- a/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/Completions/CompletionServiceTests.cs +++ b/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/Completions/CompletionServiceTests.cs @@ -143,7 +143,7 @@ private static Filler CreateCompletionFiller() return filler; } - private static InvalidCompletionException createInvalidCompletionException() + private static InvalidCompletionException CreateInvalidCompletionException() { return new InvalidCompletionException( message: "Invalid completion error occurred, fix errors and try again."); From c892cf51a64f0c1cb8852fefd5094be7d4d085d2 Mon Sep 17 00:00:00 2001 From: Lezune Date: Thu, 6 Jun 2024 08:53:13 -0700 Subject: [PATCH 192/283] Updated create method to adhere to method naming standards --- .../Foundations/Completions/CompletionService.Exceptions.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Standard.AI.OpenAI/Services/Foundations/Completions/CompletionService.Exceptions.cs b/Standard.AI.OpenAI/Services/Foundations/Completions/CompletionService.Exceptions.cs index d7eeb145..61de7fe0 100644 --- a/Standard.AI.OpenAI/Services/Foundations/Completions/CompletionService.Exceptions.cs +++ b/Standard.AI.OpenAI/Services/Foundations/Completions/CompletionService.Exceptions.cs @@ -39,7 +39,7 @@ private static async ValueTask TryCatch(ReturningCompletionFunction catch (HttpResponseUnauthorizedException httpResponseUnauthorizedException) { var unauthorizedCompletionException = - createUnauthorizedCompletionException( + CreateUnauthorizedCompletionException( httpResponseUnauthorizedException); throw new CompletionDependencyException(unauthorizedCompletionException); @@ -47,7 +47,7 @@ private static async ValueTask TryCatch(ReturningCompletionFunction catch (HttpResponseForbiddenException httpResponseForbiddenException) { var unauthorizedCompletionException = - createUnauthorizedCompletionException( + CreateUnauthorizedCompletionException( httpResponseForbiddenException); throw new CompletionDependencyException(unauthorizedCompletionException); @@ -90,7 +90,7 @@ private static async ValueTask TryCatch(ReturningCompletionFunction } } - private static UnauthorizedCompletionException createUnauthorizedCompletionException(Exception innerException) + private static UnauthorizedCompletionException CreateUnauthorizedCompletionException(Exception innerException) { return new UnauthorizedCompletionException( message: "Unauthorized completion request, fix errors and try again.", From a1f3b529f1f0724ff24c226e77b7d7a9d417dca6 Mon Sep 17 00:00:00 2001 From: Lezune Date: Thu, 6 Jun 2024 08:56:48 -0700 Subject: [PATCH 193/283] Updated create method to adhere to method naming standards --- .../FineTunes/FineTuneService.Exceptions.cs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Standard.AI.OpenAI/Services/Foundations/FineTunes/FineTuneService.Exceptions.cs b/Standard.AI.OpenAI/Services/Foundations/FineTunes/FineTuneService.Exceptions.cs index 987722e0..a695427f 100644 --- a/Standard.AI.OpenAI/Services/Foundations/FineTunes/FineTuneService.Exceptions.cs +++ b/Standard.AI.OpenAI/Services/Foundations/FineTunes/FineTuneService.Exceptions.cs @@ -34,7 +34,7 @@ private static async ValueTask TryCatch(ReturningFineTuneFunction retu var invalidFineTuneConfigurationException = new InvalidFineTuneConfigurationException(httpResponseUrlNotFoundException); - throw createFineTuneDependencyException( + throw CreateFineTuneDependencyException( invalidFineTuneConfigurationException); } catch (HttpResponseUnauthorizedException httpResponseUnauthorizedException) @@ -43,7 +43,7 @@ private static async ValueTask TryCatch(ReturningFineTuneFunction retu new UnauthorizedFineTuneException( httpResponseUnauthorizedException); - throw createFineTuneDependencyException( + throw CreateFineTuneDependencyException( unauthorizedFineTuneException); } catch (HttpResponseForbiddenException httpResponseForbiddenException) @@ -52,7 +52,7 @@ private static async ValueTask TryCatch(ReturningFineTuneFunction retu new UnauthorizedFineTuneException( httpResponseForbiddenException); - throw createFineTuneDependencyException( + throw CreateFineTuneDependencyException( unauthorizedFineTuneException); } catch (HttpResponseBadRequestException httpResponseBadRequestException) @@ -75,7 +75,7 @@ private static async ValueTask TryCatch(ReturningFineTuneFunction retu var failedServerFineTuneException = new FailedServerFineTuneException(httpResponseException); - throw createFineTuneDependencyException( + throw CreateFineTuneDependencyException( failedServerFineTuneException); } catch (Exception exception) @@ -87,7 +87,7 @@ private static async ValueTask TryCatch(ReturningFineTuneFunction retu } } - private static FineTuneDependencyException createFineTuneDependencyException(Xeption innerException) + private static FineTuneDependencyException CreateFineTuneDependencyException(Xeption innerException) { return new FineTuneDependencyException( message: "Fine tune dependency error ocurred, contact support.", From baa93e5a01b905e9965c0c091f9eefaf77d29685 Mon Sep 17 00:00:00 2001 From: Lezune Date: Thu, 6 Jun 2024 08:57:57 -0700 Subject: [PATCH 194/283] Reverted Unit Test files to original state --- .../FineTuneServiceTests.Exceptions.Submit.cs | 15 +++++++++------ .../Foundations/FineTunes/FineTuneServiceTests.cs | 9 --------- 2 files changed, 9 insertions(+), 15 deletions(-) diff --git a/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/FineTunes/FineTuneServiceTests.Exceptions.Submit.cs b/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/FineTunes/FineTuneServiceTests.Exceptions.Submit.cs index 4c482420..7e22d0a0 100644 --- a/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/FineTunes/FineTuneServiceTests.Exceptions.Submit.cs +++ b/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/FineTunes/FineTuneServiceTests.Exceptions.Submit.cs @@ -31,8 +31,9 @@ private async Task ShouldThrowDependencyExceptionOnSubmitIfUrlNotFoundAsync() innerException: httpResponseUrlNotFoundException); var expectedFineTuneDependencyException = - createFineTuneDependencyException( - innerException: invalidFineTuneConfigurationException); + new FineTuneDependencyException( + message: "Fine tune dependency error ocurred, contact support.", + innerException: invalidFineTuneConfigurationException); this.openAIBrokerMock.Setup(broker => broker.PostFineTuneAsync(It.IsAny())) @@ -73,8 +74,9 @@ private async Task ShouldThrowDependencyExceptionOnSubmitIfUnauthorizedException innerException: unauthorizedException); var expectedFineTuneDependencyException = - createFineTuneDependencyException( - innerException: unauthorizedFineTuneException); + new FineTuneDependencyException( + message: "Fine tune dependency error ocurred, contact support.", + innerException: unauthorizedFineTuneException); this.openAIBrokerMock.Setup(broker => broker.PostFineTuneAsync(It.IsAny())) @@ -204,8 +206,9 @@ private async Task ShouldThrowDependencyExceptionOnSubmitIfServerErrorOccursAsyn innerException: httpResponseException); var expectedFineTuneDependencyException = - createFineTuneDependencyException( - innerException: failedServerFineTuneException); + new FineTuneDependencyException( + message: "Fine tune dependency error ocurred, contact support.", + innerException: failedServerFineTuneException); this.openAIBrokerMock.Setup(broker => broker.PostFineTuneAsync(It.IsAny())) diff --git a/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/FineTunes/FineTuneServiceTests.cs b/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/FineTunes/FineTuneServiceTests.cs index dcd0e2ed..54baf9de 100644 --- a/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/FineTunes/FineTuneServiceTests.cs +++ b/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/FineTunes/FineTuneServiceTests.cs @@ -13,10 +13,8 @@ using Standard.AI.OpenAI.Brokers.OpenAIs; using Standard.AI.OpenAI.Models.Services.Foundations.ExternalFineTunes; using Standard.AI.OpenAI.Models.Services.Foundations.FineTunes; -using Standard.AI.OpenAI.Models.Services.Foundations.FineTunes.Exceptions; using Standard.AI.OpenAI.Services.Foundations.FineTunes; using Tynamix.ObjectFiller; -using Xeptions; using Xunit; namespace Standard.AI.OpenAI.Tests.Unit.Services.Foundations.FineTunes @@ -188,12 +186,5 @@ private static Filler CreateRandomFineTuneFiller() return filler; } - - private static FineTuneDependencyException createFineTuneDependencyException(Xeption innerException) - { - return new FineTuneDependencyException( - message: "Fine tune dependency error ocurred, contact support.", - innerException); - } } } \ No newline at end of file From e896ca60e3cb9cde754b1f5a37aad0336d91bf5e Mon Sep 17 00:00:00 2001 From: Lezune Date: Thu, 6 Jun 2024 09:01:17 -0700 Subject: [PATCH 195/283] Updated create method to adhere to method naming standards --- .../Foundations/FineTunes/FineTuneService.Exceptions.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Standard.AI.OpenAI/Services/Foundations/FineTunes/FineTuneService.Exceptions.cs b/Standard.AI.OpenAI/Services/Foundations/FineTunes/FineTuneService.Exceptions.cs index 33809509..1d7ba1a0 100644 --- a/Standard.AI.OpenAI/Services/Foundations/FineTunes/FineTuneService.Exceptions.cs +++ b/Standard.AI.OpenAI/Services/Foundations/FineTunes/FineTuneService.Exceptions.cs @@ -58,7 +58,7 @@ private static async ValueTask TryCatch(ReturningFineTuneFunction retu new InvalidFineTuneException( httpResponseBadRequestException); - throw createFineTuneDependencyValidationException( + throw CreateFineTuneDependencyValidationException( invalidFineTuneException); } catch (HttpResponseTooManyRequestsException httpResponseTooManyRequestsException) @@ -66,7 +66,7 @@ private static async ValueTask TryCatch(ReturningFineTuneFunction retu var excessiveCallFineTuneException = new ExcessiveCallFineTuneException(httpResponseTooManyRequestsException); - throw createFineTuneDependencyValidationException( + throw CreateFineTuneDependencyValidationException( excessiveCallFineTuneException); } catch (HttpResponseException httpResponseException) @@ -85,7 +85,7 @@ private static async ValueTask TryCatch(ReturningFineTuneFunction retu } } - private static FineTuneDependencyValidationException createFineTuneDependencyValidationException(Xeption innerException) + private static FineTuneDependencyValidationException CreateFineTuneDependencyValidationException(Xeption innerException) { return new FineTuneDependencyValidationException( message: "Fine tune dependency validation error occurred, fix errors and try again", From 6d3734e8f14156c201fc9e35684fa96329d3cb26 Mon Sep 17 00:00:00 2001 From: Lezune Date: Thu, 6 Jun 2024 09:01:55 -0700 Subject: [PATCH 196/283] Reverted Unit Test files to original state --- .../FineTunes/FineTuneServiceTests.Exceptions.Submit.cs | 8 +++++--- .../Foundations/FineTunes/FineTuneServiceTests.cs | 9 --------- 2 files changed, 5 insertions(+), 12 deletions(-) diff --git a/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/FineTunes/FineTuneServiceTests.Exceptions.Submit.cs b/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/FineTunes/FineTuneServiceTests.Exceptions.Submit.cs index 4ad8d5e6..7e22d0a0 100644 --- a/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/FineTunes/FineTuneServiceTests.Exceptions.Submit.cs +++ b/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/FineTunes/FineTuneServiceTests.Exceptions.Submit.cs @@ -118,8 +118,9 @@ private async Task ShouldThrowDependencyValidationExceptionOnSubmitIfBadRequestE innerException: httpResponseBadRequestException); var expectedFineTuneDependencyValidationException = - createFineTuneDependencyValidationException( - innerException: invalidFineTuneException); + new FineTuneDependencyValidationException( + message: "Fine tune dependency validation error occurred, fix errors and try again", + innerException: invalidFineTuneException); this.openAIBrokerMock.Setup(broker => broker.PostFineTuneAsync(It.IsAny())) @@ -161,7 +162,8 @@ private async Task ShouldThrowDependencyValidationExceptionOnSubmitIfTooManyRequ innerException: httpResponseTooManyRequestsException); var expectedFineTuneDependencyValidationException = - createFineTuneDependencyValidationException( + new FineTuneDependencyValidationException( + message: "Fine tune dependency validation error occurred, fix errors and try again", innerException: excessiveCallFineTuneException); this.openAIBrokerMock.Setup(broker => diff --git a/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/FineTunes/FineTuneServiceTests.cs b/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/FineTunes/FineTuneServiceTests.cs index 14ea1368..54baf9de 100644 --- a/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/FineTunes/FineTuneServiceTests.cs +++ b/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/FineTunes/FineTuneServiceTests.cs @@ -13,10 +13,8 @@ using Standard.AI.OpenAI.Brokers.OpenAIs; using Standard.AI.OpenAI.Models.Services.Foundations.ExternalFineTunes; using Standard.AI.OpenAI.Models.Services.Foundations.FineTunes; -using Standard.AI.OpenAI.Models.Services.Foundations.FineTunes.Exceptions; using Standard.AI.OpenAI.Services.Foundations.FineTunes; using Tynamix.ObjectFiller; -using Xeptions; using Xunit; namespace Standard.AI.OpenAI.Tests.Unit.Services.Foundations.FineTunes @@ -188,12 +186,5 @@ private static Filler CreateRandomFineTuneFiller() return filler; } - - private static FineTuneDependencyValidationException createFineTuneDependencyValidationException(Xeption innerException) - { - return new FineTuneDependencyValidationException( - message: "Fine tune dependency validation error occurred, fix errors and try again", - innerException); - } } } \ No newline at end of file From 60ed59e637c1c475ddaf6e890128c8ae7bd72a97 Mon Sep 17 00:00:00 2001 From: Lezune Date: Thu, 6 Jun 2024 09:04:06 -0700 Subject: [PATCH 197/283] Updated create method to adhere to method naming standards --- .../Foundations/FineTunes/FineTuneService.Exceptions.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Standard.AI.OpenAI/Services/Foundations/FineTunes/FineTuneService.Exceptions.cs b/Standard.AI.OpenAI/Services/Foundations/FineTunes/FineTuneService.Exceptions.cs index 29eb9dc6..462805a7 100644 --- a/Standard.AI.OpenAI/Services/Foundations/FineTunes/FineTuneService.Exceptions.cs +++ b/Standard.AI.OpenAI/Services/Foundations/FineTunes/FineTuneService.Exceptions.cs @@ -23,12 +23,12 @@ private static async ValueTask TryCatch(ReturningFineTuneFunction retu } catch (NullFineTuneException nullFineTuneException) { - throw createFineTuneValidationException( + throw CreateFineTuneValidationException( nullFineTuneException); } catch (InvalidFineTuneException invalidFineTuneException) { - throw createFineTuneValidationException( + throw CreateFineTuneValidationException( invalidFineTuneException); } catch (HttpResponseUrlNotFoundException httpResponseUrlNotFoundException) @@ -85,7 +85,7 @@ private static async ValueTask TryCatch(ReturningFineTuneFunction retu } } - private static FineTuneValidationException createFineTuneValidationException(Xeption innerException) + private static FineTuneValidationException CreateFineTuneValidationException(Xeption innerException) { return new FineTuneValidationException( message: "Fine tune validation error occurred, fix errors and try again.", From 892be3bbee3ddd1e1aec96f2ce6ea650a7244094 Mon Sep 17 00:00:00 2001 From: Lezune Date: Thu, 6 Jun 2024 09:04:41 -0700 Subject: [PATCH 198/283] Reverted Unit Test files to original state --- .../FineTuneServiceTests.Validations.Submit.cs | 15 +++++++++------ .../Foundations/FineTunes/FineTuneServiceTests.cs | 9 --------- 2 files changed, 9 insertions(+), 15 deletions(-) diff --git a/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/FineTunes/FineTuneServiceTests.Validations.Submit.cs b/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/FineTunes/FineTuneServiceTests.Validations.Submit.cs index 0e559460..e0bcf7b1 100644 --- a/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/FineTunes/FineTuneServiceTests.Validations.Submit.cs +++ b/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/FineTunes/FineTuneServiceTests.Validations.Submit.cs @@ -24,8 +24,9 @@ private async Task ShouldThrowValidationExceptionOnSubmitIfFineTuneIsNullAsync() new NullFineTuneException(); var expectedFineTuneValidationException = - createFineTuneValidationException( - innerException: nullFineTuneException); + new FineTuneValidationException( + message: "Fine tune validation error occurred, fix errors and try again.", + innerException: nullFineTuneException); // when ValueTask sendFineTuneTask = @@ -66,8 +67,9 @@ private async Task ShouldThrowValidationExceptionOnSubmitIfFineTuneRequestIsNull values: "Value is required"); var expectedFineTuneValidationException = - createFineTuneValidationException( - innerException: invalidFineTuneException); + new FineTuneValidationException( + message: "Fine tune validation error occurred, fix errors and try again.", + innerException: invalidFineTuneException); // when ValueTask submitFineTuneTask = @@ -109,8 +111,9 @@ private async Task ShouldThrowValidationExceptionOnSubmitIfFineTuneRequestIsInva values: "Value is required"); var exceptedFineTuneValidationException = - createFineTuneValidationException( - innerException: invalidFineTuneException); + new FineTuneValidationException( + message: "Fine tune validation error occurred, fix errors and try again.", + innerException: invalidFineTuneException); // when ValueTask sendFineTuneTask = diff --git a/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/FineTunes/FineTuneServiceTests.cs b/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/FineTunes/FineTuneServiceTests.cs index 689bac6c..54baf9de 100644 --- a/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/FineTunes/FineTuneServiceTests.cs +++ b/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/FineTunes/FineTuneServiceTests.cs @@ -13,10 +13,8 @@ using Standard.AI.OpenAI.Brokers.OpenAIs; using Standard.AI.OpenAI.Models.Services.Foundations.ExternalFineTunes; using Standard.AI.OpenAI.Models.Services.Foundations.FineTunes; -using Standard.AI.OpenAI.Models.Services.Foundations.FineTunes.Exceptions; using Standard.AI.OpenAI.Services.Foundations.FineTunes; using Tynamix.ObjectFiller; -using Xeptions; using Xunit; namespace Standard.AI.OpenAI.Tests.Unit.Services.Foundations.FineTunes @@ -188,12 +186,5 @@ private static Filler CreateRandomFineTuneFiller() return filler; } - - private static FineTuneValidationException createFineTuneValidationException(Xeption innerException) - { - return new FineTuneValidationException( - message: "Fine tune validation error occurred, fix errors and try again.", - innerException); - } } } \ No newline at end of file From cb22f81fe4b15ee34bb83d0e52a3db435881fc30 Mon Sep 17 00:00:00 2001 From: Lezune Date: Thu, 6 Jun 2024 09:07:44 -0700 Subject: [PATCH 199/283] Updated create method to adhere to method naming standards --- .../Foundations/FineTunes/FineTuneService.Exceptions.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Standard.AI.OpenAI/Services/Foundations/FineTunes/FineTuneService.Exceptions.cs b/Standard.AI.OpenAI/Services/Foundations/FineTunes/FineTuneService.Exceptions.cs index 01d2abec..8eeef274 100644 --- a/Standard.AI.OpenAI/Services/Foundations/FineTunes/FineTuneService.Exceptions.cs +++ b/Standard.AI.OpenAI/Services/Foundations/FineTunes/FineTuneService.Exceptions.cs @@ -38,7 +38,7 @@ private static async ValueTask TryCatch(ReturningFineTuneFunction retu catch (HttpResponseUnauthorizedException httpResponseUnauthorizedException) { var unauthorizedFineTuneException = - createUnauthorizedFineTuneException( + CreateUnauthorizedFineTuneException( httpResponseUnauthorizedException); throw new FineTuneDependencyException(unauthorizedFineTuneException); @@ -46,7 +46,7 @@ private static async ValueTask TryCatch(ReturningFineTuneFunction retu catch (HttpResponseForbiddenException httpResponseForbiddenException) { var unauthorizedFineTuneException = - createUnauthorizedFineTuneException( + CreateUnauthorizedFineTuneException( httpResponseForbiddenException); throw new FineTuneDependencyException(unauthorizedFineTuneException); @@ -82,7 +82,7 @@ private static async ValueTask TryCatch(ReturningFineTuneFunction retu } } - private static UnauthorizedFineTuneException createUnauthorizedFineTuneException(Exception innerException) + private static UnauthorizedFineTuneException CreateUnauthorizedFineTuneException(Exception innerException) { return new UnauthorizedFineTuneException( message: "Unauthorized fine tune request, fix errors and try again.", From 4cde18dfaf77dc4312bcfe5dac1d32485cb5f3f5 Mon Sep 17 00:00:00 2001 From: Lezune Date: Thu, 6 Jun 2024 09:16:18 -0700 Subject: [PATCH 200/283] Updated create method to adhere to method naming standards --- .../ImageGenerationService.Exceptions.cs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Standard.AI.OpenAI/Services/Foundations/ImageGenerations/ImageGenerationService.Exceptions.cs b/Standard.AI.OpenAI/Services/Foundations/ImageGenerations/ImageGenerationService.Exceptions.cs index a9f4727c..3abf647f 100644 --- a/Standard.AI.OpenAI/Services/Foundations/ImageGenerations/ImageGenerationService.Exceptions.cs +++ b/Standard.AI.OpenAI/Services/Foundations/ImageGenerations/ImageGenerationService.Exceptions.cs @@ -34,7 +34,7 @@ private async ValueTask TryCatch(ReturningImageGenerationFuncti var invalidConfigurationImageGenerationException = new InvalidConfigurationImageGenerationException(httpResponseUrlNotFoundException); - throw createImageGenerationDependencyException( + throw CreateImageGenerationDependencyException( invalidConfigurationImageGenerationException); } catch (HttpResponseUnauthorizedException httpResponseUnauthorizedException) @@ -42,7 +42,7 @@ private async ValueTask TryCatch(ReturningImageGenerationFuncti var unauthorizedImageGenerationException = new UnauthorizedImageGenerationException(httpResponseUnauthorizedException); - throw createImageGenerationDependencyException( + throw CreateImageGenerationDependencyException( unauthorizedImageGenerationException); } catch (HttpResponseForbiddenException httpResponseForbiddenException) @@ -50,7 +50,7 @@ private async ValueTask TryCatch(ReturningImageGenerationFuncti var unauthorizedImageGenerationException = new UnauthorizedImageGenerationException(httpResponseForbiddenException); - throw createImageGenerationDependencyException( + throw CreateImageGenerationDependencyException( unauthorizedImageGenerationException); } catch (HttpResponseNotFoundException httpResponseNotFoundException) @@ -79,7 +79,7 @@ private async ValueTask TryCatch(ReturningImageGenerationFuncti var failedServerImageGenerationException = new FailedServerImageGenerationException(httpResponseException); - throw createImageGenerationDependencyException( + throw CreateImageGenerationDependencyException( failedServerImageGenerationException); } catch (Exception exception) @@ -91,7 +91,7 @@ private async ValueTask TryCatch(ReturningImageGenerationFuncti } } - private static ImageGenerationDependencyException createImageGenerationDependencyException(Xeption innerException) + private static ImageGenerationDependencyException CreateImageGenerationDependencyException(Xeption innerException) { return new ImageGenerationDependencyException( message: "Image generation dependency error occurred, contact support.", From f9d3b697e3b786027036e248dae96c1a77d2560e Mon Sep 17 00:00:00 2001 From: Lezune Date: Thu, 6 Jun 2024 09:16:31 -0700 Subject: [PATCH 201/283] Reverted Unit Test files to original state --- ...eGenerationServiceTests.Exceptions.Generate.cs | 15 +++++++++------ .../ImageGenerationServiceTests.cs | 9 --------- 2 files changed, 9 insertions(+), 15 deletions(-) diff --git a/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/ImageGenerations/ImageGenerationServiceTests.Exceptions.Generate.cs b/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/ImageGenerations/ImageGenerationServiceTests.Exceptions.Generate.cs index 3d12bba6..b694bf65 100644 --- a/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/ImageGenerations/ImageGenerationServiceTests.Exceptions.Generate.cs +++ b/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/ImageGenerations/ImageGenerationServiceTests.Exceptions.Generate.cs @@ -31,8 +31,9 @@ private async Task ShouldThrowDependencyExceptionOnGenerateIfUrlNotFoundAsync() innerException: httpResponseUrlNotFoundException); var expectedImageGenerationDependencyException = - createImageGenerationDependencyException( - innerException: invalidConfigurationImageGenerationException); + new ImageGenerationDependencyException( + message: "Image generation dependency error occurred, contact support.", + innerException: invalidConfigurationImageGenerationException); this.openAIBrokerMock.Setup(broker => broker.PostImageGenerationRequestAsync( @@ -74,8 +75,9 @@ private async Task ShouldThrowDependencyExceptionOnGenerateIfUnauthorizedAsync( innerException: unauthorizedException); var expectedImageGenerationDependencyException = - createImageGenerationDependencyException( - innerException: unauthorizedImageGenerationException); + new ImageGenerationDependencyException( + message: "Image generation dependency error occurred, contact support.", + innerException: unauthorizedImageGenerationException); this.openAIBrokerMock.Setup(broker => broker.PostImageGenerationRequestAsync( @@ -251,8 +253,9 @@ private async Task ShouldThrowDependencyExceptionOnGenerateIfHttpResponseErrorOc innerException: httpResponseException); var expectedImageGenerationDependencyException = - createImageGenerationDependencyException( - innerException: failedServerImageGenerationException); + new ImageGenerationDependencyException( + message: "Image generation dependency error occurred, contact support.", + innerException: failedServerImageGenerationException); this.openAIBrokerMock.Setup(broker => broker.PostImageGenerationRequestAsync( diff --git a/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/ImageGenerations/ImageGenerationServiceTests.cs b/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/ImageGenerations/ImageGenerationServiceTests.cs index b49f3aec..2dcf7195 100644 --- a/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/ImageGenerations/ImageGenerationServiceTests.cs +++ b/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/ImageGenerations/ImageGenerationServiceTests.cs @@ -13,10 +13,8 @@ using Standard.AI.OpenAI.Brokers.OpenAIs; using Standard.AI.OpenAI.Models.Services.Foundations.ExternalImageGenerations; using Standard.AI.OpenAI.Models.Services.Foundations.ImageGenerations; -using Standard.AI.OpenAI.Models.Services.Foundations.ImageGenerations.Exceptions; using Standard.AI.OpenAI.Services.Foundations.ImageGenerations; using Tynamix.ObjectFiller; -using Xeptions; using Xunit; namespace Standard.AI.OpenAI.Tests.Unit.Services.Foundations.ImageGenerations @@ -109,12 +107,5 @@ public static TheoryData UnauthorizedExceptions() new HttpResponseForbiddenException() }; } - - private static ImageGenerationDependencyException createImageGenerationDependencyException(Xeption innerException) - { - return new ImageGenerationDependencyException( - message: "Image generation dependency error occurred, contact support.", - innerException); - } } } \ No newline at end of file From bb8b461848a29dbf98f2d0d3e526969b108559c8 Mon Sep 17 00:00:00 2001 From: Lezune Date: Thu, 6 Jun 2024 09:18:25 -0700 Subject: [PATCH 202/283] Reverted Unit Test files to original state --- ...eGenerationServiceTests.Exceptions.Generate.cs | 15 +++++++++------ .../ImageGenerationServiceTests.cs | 9 --------- 2 files changed, 9 insertions(+), 15 deletions(-) diff --git a/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/ImageGenerations/ImageGenerationServiceTests.Exceptions.Generate.cs b/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/ImageGenerations/ImageGenerationServiceTests.Exceptions.Generate.cs index 4bc725af..b694bf65 100644 --- a/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/ImageGenerations/ImageGenerationServiceTests.Exceptions.Generate.cs +++ b/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/ImageGenerations/ImageGenerationServiceTests.Exceptions.Generate.cs @@ -120,8 +120,9 @@ private async Task ShouldThrowDependencyValidationExceptionOnGenerateIfImageGene innerException: httpResponseNotFoundException); var expectedImageGenerationDependencyValidationException = - createImageGenerationDependencyValidationException( - innerException: notFoundImageGenerationException); + new ImageGenerationDependencyValidationException( + message: "Image generation dependency validation error occurred, fix errors and try again.", + innerException: notFoundImageGenerationException); this.openAIBrokerMock.Setup(broker => broker.PostImageGenerationRequestAsync( @@ -164,8 +165,9 @@ private async Task ShouldThrowDependencyValidationExceptionOnGenerateIfBadReques innerException: httpResponseBadRequestException); var expectedImageGenerationDependencyValidationException = - createImageGenerationDependencyValidationException( - innerException: invalidImageGenerationException); + new ImageGenerationDependencyValidationException( + message: "Image generation dependency validation error occurred, fix errors and try again.", + innerException: invalidImageGenerationException); this.openAIBrokerMock.Setup(broker => broker.PostImageGenerationRequestAsync( @@ -208,8 +210,9 @@ private async Task ShouldThrowDependencyValidationExceptionOnGenerateIfTooManyRe innerException: httpResponseTooManyRequestsException); var expectedImageGenerationDependencyValidationException = - createImageGenerationDependencyValidationException( - innerException: excessiveCallImageGenerationException); + new ImageGenerationDependencyValidationException( + message: "Image generation dependency validation error occurred, fix errors and try again.", + innerException: excessiveCallImageGenerationException); this.openAIBrokerMock.Setup(broker => broker.PostImageGenerationRequestAsync( diff --git a/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/ImageGenerations/ImageGenerationServiceTests.cs b/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/ImageGenerations/ImageGenerationServiceTests.cs index b2eb42e5..2dcf7195 100644 --- a/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/ImageGenerations/ImageGenerationServiceTests.cs +++ b/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/ImageGenerations/ImageGenerationServiceTests.cs @@ -13,10 +13,8 @@ using Standard.AI.OpenAI.Brokers.OpenAIs; using Standard.AI.OpenAI.Models.Services.Foundations.ExternalImageGenerations; using Standard.AI.OpenAI.Models.Services.Foundations.ImageGenerations; -using Standard.AI.OpenAI.Models.Services.Foundations.ImageGenerations.Exceptions; using Standard.AI.OpenAI.Services.Foundations.ImageGenerations; using Tynamix.ObjectFiller; -using Xeptions; using Xunit; namespace Standard.AI.OpenAI.Tests.Unit.Services.Foundations.ImageGenerations @@ -109,12 +107,5 @@ public static TheoryData UnauthorizedExceptions() new HttpResponseForbiddenException() }; } - - private static ImageGenerationDependencyValidationException createImageGenerationDependencyValidationException(Xeption innerException) - { - return new ImageGenerationDependencyValidationException( - message: "Image generation dependency validation error occurred, fix errors and try again.", - innerException); - } } } \ No newline at end of file From 67487193e54973d20be8c709b96bba32ccf3267a Mon Sep 17 00:00:00 2001 From: Lezune Date: Thu, 6 Jun 2024 09:19:51 -0700 Subject: [PATCH 203/283] Updated create method to adhere to method naming standards --- .../ImageGenerations/ImageGenerationService.Exceptions.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Standard.AI.OpenAI/Services/Foundations/ImageGenerations/ImageGenerationService.Exceptions.cs b/Standard.AI.OpenAI/Services/Foundations/ImageGenerations/ImageGenerationService.Exceptions.cs index aeeb77dc..f48263e8 100644 --- a/Standard.AI.OpenAI/Services/Foundations/ImageGenerations/ImageGenerationService.Exceptions.cs +++ b/Standard.AI.OpenAI/Services/Foundations/ImageGenerations/ImageGenerationService.Exceptions.cs @@ -55,7 +55,7 @@ private async ValueTask TryCatch(ReturningImageGenerationFuncti var notFoundImageGenerationException = new NotFoundImageGenerationException(httpResponseNotFoundException); - throw createImageGenerationDependencyValidationException( + throw CreateImageGenerationDependencyValidationException( notFoundImageGenerationException); } catch (HttpResponseBadRequestException httpResponseBadRequestException) @@ -63,7 +63,7 @@ private async ValueTask TryCatch(ReturningImageGenerationFuncti var invalidImageGenerationException = new InvalidImageGenerationException(httpResponseBadRequestException); - throw createImageGenerationDependencyValidationException( + throw CreateImageGenerationDependencyValidationException( invalidImageGenerationException); } catch (HttpResponseTooManyRequestsException httpResponseTooManyRequestsException) @@ -71,7 +71,7 @@ private async ValueTask TryCatch(ReturningImageGenerationFuncti var excessiveCallImageGenerationException = new ExcessiveCallImageGenerationException(httpResponseTooManyRequestsException); - throw createImageGenerationDependencyValidationException( + throw CreateImageGenerationDependencyValidationException( excessiveCallImageGenerationException); } catch (HttpResponseException httpResponseException) @@ -90,7 +90,7 @@ private async ValueTask TryCatch(ReturningImageGenerationFuncti } } - private static ImageGenerationDependencyValidationException createImageGenerationDependencyValidationException(Xeption innerException) + private static ImageGenerationDependencyValidationException CreateImageGenerationDependencyValidationException(Xeption innerException) { return new ImageGenerationDependencyValidationException( message: "Image generation dependency validation error occurred, fix errors and try again.", From 1f0bce911ea2e7c6819df40c10371eb27b5e76de Mon Sep 17 00:00:00 2001 From: Lezune Date: Thu, 6 Jun 2024 09:22:23 -0700 Subject: [PATCH 204/283] Updated create method to adhere to method naming standards --- .../ImageGenerations/ImageGenerationService.Exceptions.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Standard.AI.OpenAI/Services/Foundations/ImageGenerations/ImageGenerationService.Exceptions.cs b/Standard.AI.OpenAI/Services/Foundations/ImageGenerations/ImageGenerationService.Exceptions.cs index 9a4c617c..d75a28f3 100644 --- a/Standard.AI.OpenAI/Services/Foundations/ImageGenerations/ImageGenerationService.Exceptions.cs +++ b/Standard.AI.OpenAI/Services/Foundations/ImageGenerations/ImageGenerationService.Exceptions.cs @@ -23,12 +23,12 @@ private async ValueTask TryCatch(ReturningImageGenerationFuncti } catch (NullImageGenerationException nullImageGenerationException) { - throw createImageGenerationValidationException( + throw CreateImageGenerationValidationException( nullImageGenerationException); } catch (InvalidImageGenerationException invalidImageGenerationException) { - throw createImageGenerationValidationException( + throw CreateImageGenerationValidationException( invalidImageGenerationException); } catch (HttpResponseUrlNotFoundException httpResponseUrlNotFoundException) @@ -89,7 +89,7 @@ private async ValueTask TryCatch(ReturningImageGenerationFuncti } } - private static ImageGenerationValidationException createImageGenerationValidationException(Xeption innerException) + private static ImageGenerationValidationException CreateImageGenerationValidationException(Xeption innerException) { return new ImageGenerationValidationException( message: "Image generation validation error occurred, fix errors and try again.", From fc335ef34c4c8deca918c37eeefbf6e881e9a4a1 Mon Sep 17 00:00:00 2001 From: Lezune Date: Thu, 6 Jun 2024 09:22:54 -0700 Subject: [PATCH 205/283] Reverted Unit Test files to original state --- ...GenerationServiceTests.Validations.Generate.cs | 15 +++++++++------ .../ImageGenerationServiceTests.cs | 9 --------- 2 files changed, 9 insertions(+), 15 deletions(-) diff --git a/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/ImageGenerations/ImageGenerationServiceTests.Validations.Generate.cs b/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/ImageGenerations/ImageGenerationServiceTests.Validations.Generate.cs index e5abe0a6..e1cb5395 100644 --- a/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/ImageGenerations/ImageGenerationServiceTests.Validations.Generate.cs +++ b/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/ImageGenerations/ImageGenerationServiceTests.Validations.Generate.cs @@ -24,8 +24,9 @@ private async Task ShouldThrowValidationExceptionOnGenerateIfImageGenerationIsNu new NullImageGenerationException(); var expectedImageGenerationValidationException = - createImageGenerationValidationException( - innerException: nullImageGenerationException); + new ImageGenerationValidationException( + message: "Image generation validation error occurred, fix errors and try again.", + innerException: nullImageGenerationException); // when ValueTask generateImageTask = @@ -64,8 +65,9 @@ private async Task ShouldThrowValidationExceptionOnGenerateIfRequestIsNullAsync( values: "Value is required"); var expectedImageGenerationValidationException = - createImageGenerationValidationException( - innerException: invalidImageGenerationException); + new ImageGenerationValidationException( + message: "Image generation validation error occurred, fix errors and try again.", + innerException: invalidImageGenerationException); // when ValueTask generateImageTask = @@ -111,8 +113,9 @@ private async Task ShouldThrowValidationExceptionOnGenerateIfRequestIsInvalidAsy values: "Value is required"); var expectedImageGenerationValidationException = - createImageGenerationValidationException( - innerException: invalidImageGenerationException); + new ImageGenerationValidationException( + message: "Image generation validation error occurred, fix errors and try again.", + innerException: invalidImageGenerationException); // when ValueTask generateImageTask = diff --git a/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/ImageGenerations/ImageGenerationServiceTests.cs b/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/ImageGenerations/ImageGenerationServiceTests.cs index 6fa7230a..2dcf7195 100644 --- a/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/ImageGenerations/ImageGenerationServiceTests.cs +++ b/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/ImageGenerations/ImageGenerationServiceTests.cs @@ -13,10 +13,8 @@ using Standard.AI.OpenAI.Brokers.OpenAIs; using Standard.AI.OpenAI.Models.Services.Foundations.ExternalImageGenerations; using Standard.AI.OpenAI.Models.Services.Foundations.ImageGenerations; -using Standard.AI.OpenAI.Models.Services.Foundations.ImageGenerations.Exceptions; using Standard.AI.OpenAI.Services.Foundations.ImageGenerations; using Tynamix.ObjectFiller; -using Xeptions; using Xunit; namespace Standard.AI.OpenAI.Tests.Unit.Services.Foundations.ImageGenerations @@ -109,12 +107,5 @@ public static TheoryData UnauthorizedExceptions() new HttpResponseForbiddenException() }; } - - private static ImageGenerationValidationException createImageGenerationValidationException(Xeption innerException) - { - return new ImageGenerationValidationException( - message: "Image generation validation error occurred, fix errors and try again.", - innerException); - } } } \ No newline at end of file From 223dee450ebfce78c0bf05a7b6efef03d0050efe Mon Sep 17 00:00:00 2001 From: Lezune Date: Thu, 6 Jun 2024 09:27:03 -0700 Subject: [PATCH 206/283] Updated create method to adhere to method naming standards --- .../ImageGenerationServiceTests.Validations.Generate.cs | 4 ++-- .../ImageGenerations/ImageGenerationServiceTests.cs | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/ImageGenerations/ImageGenerationServiceTests.Validations.Generate.cs b/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/ImageGenerations/ImageGenerationServiceTests.Validations.Generate.cs index ac04c34d..91e81981 100644 --- a/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/ImageGenerations/ImageGenerationServiceTests.Validations.Generate.cs +++ b/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/ImageGenerations/ImageGenerationServiceTests.Validations.Generate.cs @@ -58,7 +58,7 @@ private async Task ShouldThrowValidationExceptionOnGenerateIfRequestIsNullAsync( invalidImageGeneration.Request = null; var invalidImageGenerationException = - createInvalidImageGenerationException(); + CreateInvalidImageGenerationException(); invalidImageGenerationException.AddData( key: nameof(ImageGeneration.Request), @@ -106,7 +106,7 @@ private async Task ShouldThrowValidationExceptionOnGenerateIfRequestIsInvalidAsy }; var invalidImageGenerationException = - createInvalidImageGenerationException(); + CreateInvalidImageGenerationException(); invalidImageGenerationException.AddData( key: nameof(ImageGeneration.Request.Prompt), diff --git a/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/ImageGenerations/ImageGenerationServiceTests.cs b/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/ImageGenerations/ImageGenerationServiceTests.cs index b1d2a087..52c03567 100644 --- a/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/ImageGenerations/ImageGenerationServiceTests.cs +++ b/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/ImageGenerations/ImageGenerationServiceTests.cs @@ -109,7 +109,7 @@ public static TheoryData UnauthorizedExceptions() }; } - private static InvalidImageGenerationException createInvalidImageGenerationException() + private static InvalidImageGenerationException CreateInvalidImageGenerationException() { return new InvalidImageGenerationException( message: "Invalid image generation error occurred, fix errors and try again."); From 99f86df3d169cdd7ab9ebea1e6c79878cd05e704 Mon Sep 17 00:00:00 2001 From: Lezune Date: Thu, 6 Jun 2024 09:29:51 -0700 Subject: [PATCH 207/283] Updated create method to adhere to method naming standards --- .../ImageGenerations/ImageGenerationService.Exceptions.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Standard.AI.OpenAI/Services/Foundations/ImageGenerations/ImageGenerationService.Exceptions.cs b/Standard.AI.OpenAI/Services/Foundations/ImageGenerations/ImageGenerationService.Exceptions.cs index 829dc110..785d3766 100644 --- a/Standard.AI.OpenAI/Services/Foundations/ImageGenerations/ImageGenerationService.Exceptions.cs +++ b/Standard.AI.OpenAI/Services/Foundations/ImageGenerations/ImageGenerationService.Exceptions.cs @@ -38,7 +38,7 @@ private async ValueTask TryCatch(ReturningImageGenerationFuncti catch (HttpResponseUnauthorizedException httpResponseUnauthorizedException) { var unauthorizedImageGenerationException = - createUnauthorizedImageGenerationException( + CreateUnauthorizedImageGenerationException( httpResponseUnauthorizedException); throw new ImageGenerationDependencyException(unauthorizedImageGenerationException); @@ -46,7 +46,7 @@ private async ValueTask TryCatch(ReturningImageGenerationFuncti catch (HttpResponseForbiddenException httpResponseForbiddenException) { var unauthorizedImageGenerationException = - createUnauthorizedImageGenerationException( + CreateUnauthorizedImageGenerationException( httpResponseForbiddenException); throw new ImageGenerationDependencyException(unauthorizedImageGenerationException); @@ -88,7 +88,7 @@ private async ValueTask TryCatch(ReturningImageGenerationFuncti } } - private static UnauthorizedImageGenerationException createUnauthorizedImageGenerationException(Exception innerException) + private static UnauthorizedImageGenerationException CreateUnauthorizedImageGenerationException(Exception innerException) { return new UnauthorizedImageGenerationException( message: "Unauthorized image generation request, fix errors and try again.", From 8874bd83664090890fa9d4d6a1c0b54cea8ed817 Mon Sep 17 00:00:00 2001 From: Lezune Date: Thu, 6 Jun 2024 09:32:12 -0700 Subject: [PATCH 208/283] Updated create method to adhere to method naming standards --- .../Foundations/LocalFiles/LocalFileService.Exceptions.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Standard.AI.OpenAI/Services/Foundations/LocalFiles/LocalFileService.Exceptions.cs b/Standard.AI.OpenAI/Services/Foundations/LocalFiles/LocalFileService.Exceptions.cs index 72014e10..74f6ed8f 100644 --- a/Standard.AI.OpenAI/Services/Foundations/LocalFiles/LocalFileService.Exceptions.cs +++ b/Standard.AI.OpenAI/Services/Foundations/LocalFiles/LocalFileService.Exceptions.cs @@ -51,7 +51,7 @@ private Stream TryCatch(ReturningStreamFunction returningStreamFunction) catch (IOException ioException) { var failedFileException = - createFailedLocalFileDependencyException( + CreateFailedLocalFileDependencyException( ioException); throw new LocalFileDependencyException(failedFileException); @@ -59,7 +59,7 @@ private Stream TryCatch(ReturningStreamFunction returningStreamFunction) catch (NotSupportedException notSupportedException) { var failedFileException = - createFailedLocalFileDependencyException( + CreateFailedLocalFileDependencyException( notSupportedException); throw new LocalFileDependencyException(failedFileException); @@ -73,7 +73,7 @@ private Stream TryCatch(ReturningStreamFunction returningStreamFunction) } } - private static FailedLocalFileDependencyException createFailedLocalFileDependencyException(Exception innerException) + private static FailedLocalFileDependencyException CreateFailedLocalFileDependencyException(Exception innerException) { return new FailedLocalFileDependencyException( message: "Failed local file error occurred, contact support.", From 013d40d56042a1df25991c59a4761dfd06b76547 Mon Sep 17 00:00:00 2001 From: Lezune Date: Thu, 6 Jun 2024 09:34:16 -0700 Subject: [PATCH 209/283] Updated create method to adhere to method naming standards --- .../Foundations/LocalFiles/LocalFileService.Exceptions.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Standard.AI.OpenAI/Services/Foundations/LocalFiles/LocalFileService.Exceptions.cs b/Standard.AI.OpenAI/Services/Foundations/LocalFiles/LocalFileService.Exceptions.cs index c45c58a2..38393fbd 100644 --- a/Standard.AI.OpenAI/Services/Foundations/LocalFiles/LocalFileService.Exceptions.cs +++ b/Standard.AI.OpenAI/Services/Foundations/LocalFiles/LocalFileService.Exceptions.cs @@ -25,7 +25,7 @@ private Stream TryCatch(ReturningStreamFunction returningStreamFunction) catch (ArgumentException argumentException) { var invalidFileException = - createInvalidLocalFileException( + CreateInvalidLocalFileException( argumentException); throw new LocalFileDependencyValidationException(invalidFileException); @@ -33,7 +33,7 @@ private Stream TryCatch(ReturningStreamFunction returningStreamFunction) catch (PathTooLongException pathTooLongException) { var invalidFileException = - createInvalidLocalFileException( + CreateInvalidLocalFileException( pathTooLongException); throw new LocalFileDependencyValidationException(invalidFileException); @@ -75,7 +75,7 @@ private Stream TryCatch(ReturningStreamFunction returningStreamFunction) } } - private static InvalidLocalFileException createInvalidLocalFileException(Exception innerException) + private static InvalidLocalFileException CreateInvalidLocalFileException(Exception innerException) { return new InvalidLocalFileException( message: "Invalid local file error occurred, fix error and try again.", From 353b1a387b4e1a70b39cf157d197426dc309d01e Mon Sep 17 00:00:00 2001 From: Lezune Date: Thu, 6 Jun 2024 09:35:44 -0700 Subject: [PATCH 210/283] Updated create method to adhere to method naming standards --- .../Foundations/LocalFiles/LocalFileService.Exceptions.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Standard.AI.OpenAI/Services/Foundations/LocalFiles/LocalFileService.Exceptions.cs b/Standard.AI.OpenAI/Services/Foundations/LocalFiles/LocalFileService.Exceptions.cs index 540988e5..da085272 100644 --- a/Standard.AI.OpenAI/Services/Foundations/LocalFiles/LocalFileService.Exceptions.cs +++ b/Standard.AI.OpenAI/Services/Foundations/LocalFiles/LocalFileService.Exceptions.cs @@ -54,7 +54,7 @@ private Stream TryCatch(ReturningStreamFunction returningStreamFunction) var failedFileException = new FailedLocalFileDependencyException(ioException); - throw createLocalFileDependencyException( + throw CreateLocalFileDependencyException( failedFileException); } catch (NotSupportedException notSupportedException) @@ -62,7 +62,7 @@ private Stream TryCatch(ReturningStreamFunction returningStreamFunction) var failedFileException = new FailedLocalFileDependencyException(notSupportedException); - throw createLocalFileDependencyException( + throw CreateLocalFileDependencyException( failedFileException); } catch (Exception exception) @@ -74,7 +74,7 @@ private Stream TryCatch(ReturningStreamFunction returningStreamFunction) } } - private static LocalFileDependencyException createLocalFileDependencyException(Xeption innerException) + private static LocalFileDependencyException CreateLocalFileDependencyException(Xeption innerException) { return new LocalFileDependencyException( message: "Local file dependency error occurred, contact support.", From 59cd6e88688f4d5fc1b1abb6e342c968f9ee1e1b Mon Sep 17 00:00:00 2001 From: Lezune Date: Thu, 6 Jun 2024 09:42:56 -0700 Subject: [PATCH 211/283] Updated create method to adhere to method naming standards --- .../LocalFiles/LocalFileService.Exceptions.cs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Standard.AI.OpenAI/Services/Foundations/LocalFiles/LocalFileService.Exceptions.cs b/Standard.AI.OpenAI/Services/Foundations/LocalFiles/LocalFileService.Exceptions.cs index e2ef1677..3103608e 100644 --- a/Standard.AI.OpenAI/Services/Foundations/LocalFiles/LocalFileService.Exceptions.cs +++ b/Standard.AI.OpenAI/Services/Foundations/LocalFiles/LocalFileService.Exceptions.cs @@ -27,14 +27,14 @@ private Stream TryCatch(ReturningStreamFunction returningStreamFunction) { var invalidFileException = new InvalidLocalFileException(argumentException); - throw createLocalFileDependencyValidationException( + throw CreateLocalFileDependencyValidationException( invalidFileException); } catch (PathTooLongException pathTooLongException) { var invalidFileException = new InvalidLocalFileException(pathTooLongException); - throw createLocalFileDependencyValidationException( + throw CreateLocalFileDependencyValidationException( invalidFileException); } catch (FileNotFoundException fileNotFoundException) @@ -42,7 +42,7 @@ private Stream TryCatch(ReturningStreamFunction returningStreamFunction) var notFoundFileException = new NotFoundLocalFileException(fileNotFoundException); - throw createLocalFileDependencyValidationException( + throw CreateLocalFileDependencyValidationException( notFoundFileException); } catch (DirectoryNotFoundException directoryNotFoundException) @@ -50,7 +50,7 @@ private Stream TryCatch(ReturningStreamFunction returningStreamFunction) var notFoundFileException = new NotFoundLocalFileException(directoryNotFoundException); - throw createLocalFileDependencyValidationException( + throw CreateLocalFileDependencyValidationException( notFoundFileException); } catch (IOException ioException) @@ -76,7 +76,7 @@ private Stream TryCatch(ReturningStreamFunction returningStreamFunction) } } - private static LocalFileDependencyValidationException createLocalFileDependencyValidationException(Xeption innerException) + private static LocalFileDependencyValidationException CreateLocalFileDependencyValidationException(Xeption innerException) { return new LocalFileDependencyValidationException( message: "Local file dependency validation error occurred, fix the errors and try again.", From 49242b1bc4bd505b6dbe770a9775bf8998018ad1 Mon Sep 17 00:00:00 2001 From: Lezune Date: Thu, 6 Jun 2024 09:47:15 -0700 Subject: [PATCH 212/283] Reverted Unit Test files to original state and refactored code to adhere to the change in the method declaration --- .../LocalFiles/LocalFileServiceTests.Exceptions.Read.cs | 6 ++++-- .../Foundations/LocalFiles/LocalFileServiceTests.cs | 9 --------- .../AIFiles/AIFileOrchestrationServiceTests.cs | 4 +--- 3 files changed, 5 insertions(+), 14 deletions(-) diff --git a/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/LocalFiles/LocalFileServiceTests.Exceptions.Read.cs b/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/LocalFiles/LocalFileServiceTests.Exceptions.Read.cs index 8c40fd78..f0ca7edb 100644 --- a/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/LocalFiles/LocalFileServiceTests.Exceptions.Read.cs +++ b/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/LocalFiles/LocalFileServiceTests.Exceptions.Read.cs @@ -24,7 +24,8 @@ private void ShouldThrowDependencyValidationExceptionOnReadIfDepedencyErrorOccur innerException: dependencyValidationException); var expectedFileDependencyValidationException = - createLocalFileDependencyValidationException( + new LocalFileDependencyValidationException( + message: "Local file dependency validation error occurred, fix the errors and try again.", innerException: invalidFileException); this.fileBrokerMock.Setup(broker => @@ -63,7 +64,8 @@ private void ShouldThrowDependencyExceptionOnReadIfFileNotFoundExceptionOccurs( innerException: fileNotFoundException); var expectedFileDependencyValidationException = - createLocalFileDependencyValidationException( + new LocalFileDependencyValidationException( + message: "Local file dependency validation error occurred, fix the errors and try again.", innerException: notFoundLocalFileException); this.fileBrokerMock.Setup(broker => diff --git a/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/LocalFiles/LocalFileServiceTests.cs b/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/LocalFiles/LocalFileServiceTests.cs index ef5cc9bd..34bb0594 100644 --- a/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/LocalFiles/LocalFileServiceTests.cs +++ b/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/LocalFiles/LocalFileServiceTests.cs @@ -7,10 +7,8 @@ using System.Text; using Moq; using Standard.AI.OpenAI.Brokers.Files; -using Standard.AI.OpenAI.Models.Services.Foundations.LocalFiles.Exceptions; using Standard.AI.OpenAI.Services.Foundations.LocalFiles; using Tynamix.ObjectFiller; -using Xeptions; using Xunit; namespace Standard.AI.OpenAI.Tests.Unit.Services.Foundations.LocalFiles @@ -74,12 +72,5 @@ private Stream CreateRandomStream() return memoryStream; } - - private static LocalFileDependencyValidationException createLocalFileDependencyValidationException(Xeption innerException) - { - return new LocalFileDependencyValidationException( - message: "Local file dependency validation error occurred, fix the errors and try again.", - innerException); - } } } \ No newline at end of file diff --git a/Standard.AI.OpenAI.Tests.Unit/Services/Orchestrations/AIFiles/AIFileOrchestrationServiceTests.cs b/Standard.AI.OpenAI.Tests.Unit/Services/Orchestrations/AIFiles/AIFileOrchestrationServiceTests.cs index 205e0466..cebfc9b8 100644 --- a/Standard.AI.OpenAI.Tests.Unit/Services/Orchestrations/AIFiles/AIFileOrchestrationServiceTests.cs +++ b/Standard.AI.OpenAI.Tests.Unit/Services/Orchestrations/AIFiles/AIFileOrchestrationServiceTests.cs @@ -45,9 +45,7 @@ public static TheoryData DependencyValidationExceptions() return new TheoryData { new LocalFileValidationException(someInnerException), - new LocalFileDependencyValidationException( - message: "Local file dependency validation error occurred, fix the errors and try again.", - someInnerException), + new LocalFileDependencyValidationException(someInnerException), new AIFileValidationException(someInnerException), new AIFileDependencyValidationException(someInnerException) }; From 38cf9fd2119774677d7be7cb642b0dc89e077665 Mon Sep 17 00:00:00 2001 From: Lezune Date: Thu, 6 Jun 2024 09:49:32 -0700 Subject: [PATCH 213/283] Refactored code to adhere to the change in the method declaration --- .../Orchestrations/AIFiles/AIFileOrchestrationServiceTests.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Standard.AI.OpenAI.Tests.Unit/Services/Orchestrations/AIFiles/AIFileOrchestrationServiceTests.cs b/Standard.AI.OpenAI.Tests.Unit/Services/Orchestrations/AIFiles/AIFileOrchestrationServiceTests.cs index cebfc9b8..205e0466 100644 --- a/Standard.AI.OpenAI.Tests.Unit/Services/Orchestrations/AIFiles/AIFileOrchestrationServiceTests.cs +++ b/Standard.AI.OpenAI.Tests.Unit/Services/Orchestrations/AIFiles/AIFileOrchestrationServiceTests.cs @@ -45,7 +45,9 @@ public static TheoryData DependencyValidationExceptions() return new TheoryData { new LocalFileValidationException(someInnerException), - new LocalFileDependencyValidationException(someInnerException), + new LocalFileDependencyValidationException( + message: "Local file dependency validation error occurred, fix the errors and try again.", + someInnerException), new AIFileValidationException(someInnerException), new AIFileDependencyValidationException(someInnerException) }; From b97e768ecbd7bd02ae4882447f2159664e22e6a1 Mon Sep 17 00:00:00 2001 From: Lezune Date: Thu, 6 Jun 2024 09:52:33 -0700 Subject: [PATCH 214/283] Updated create method to adhere to method naming standards --- .../Foundations/LocalFiles/LocalFileService.Exceptions.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Standard.AI.OpenAI/Services/Foundations/LocalFiles/LocalFileService.Exceptions.cs b/Standard.AI.OpenAI/Services/Foundations/LocalFiles/LocalFileService.Exceptions.cs index 99b3d3e1..2c615c3e 100644 --- a/Standard.AI.OpenAI/Services/Foundations/LocalFiles/LocalFileService.Exceptions.cs +++ b/Standard.AI.OpenAI/Services/Foundations/LocalFiles/LocalFileService.Exceptions.cs @@ -37,7 +37,7 @@ private Stream TryCatch(ReturningStreamFunction returningStreamFunction) catch (FileNotFoundException fileNotFoundException) { var notFoundFileException = - createNotFoundLocalFileException( + CreateNotFoundLocalFileException( fileNotFoundException); throw new LocalFileDependencyValidationException(notFoundFileException); @@ -45,7 +45,7 @@ private Stream TryCatch(ReturningStreamFunction returningStreamFunction) catch (DirectoryNotFoundException directoryNotFoundException) { var notFoundFileException = - createNotFoundLocalFileException( + CreateNotFoundLocalFileException( directoryNotFoundException); throw new LocalFileDependencyValidationException(notFoundFileException); @@ -73,7 +73,7 @@ private Stream TryCatch(ReturningStreamFunction returningStreamFunction) } } - private static NotFoundLocalFileException createNotFoundLocalFileException(Exception innerException) + private static NotFoundLocalFileException CreateNotFoundLocalFileException(Exception innerException) { return new NotFoundLocalFileException( message: "Not found local file error occurred, fix error and try again.", From c6174e6b3d0887dde923daf0fa13e4eaf18428a5 Mon Sep 17 00:00:00 2001 From: Lezune Date: Thu, 6 Jun 2024 09:55:03 -0700 Subject: [PATCH 215/283] Updated create method to adhere to method naming standards --- .../AIFileOrchestrationService.Exceptions.cs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/Standard.AI.OpenAI/Services/Orchestrations/AIFiles/AIFileOrchestrationService.Exceptions.cs b/Standard.AI.OpenAI/Services/Orchestrations/AIFiles/AIFileOrchestrationService.Exceptions.cs index 0c3e00d0..0ff730ec 100644 --- a/Standard.AI.OpenAI/Services/Orchestrations/AIFiles/AIFileOrchestrationService.Exceptions.cs +++ b/Standard.AI.OpenAI/Services/Orchestrations/AIFiles/AIFileOrchestrationService.Exceptions.cs @@ -45,12 +45,12 @@ private async ValueTask TryCatch(ReturningAIFileFunction returningAIFile } catch (LocalFileDependencyException localFileDependencyException) { - throw createAIFileOrchestrationDependencyException( + throw CreateAIFileOrchestrationDependencyException( localFileDependencyException.InnerException as Xeption); } catch (LocalFileServiceException localFileServiceException) { - throw createAIFileOrchestrationDependencyException( + throw CreateAIFileOrchestrationDependencyException( localFileServiceException.InnerException as Xeption); } catch (AIFileValidationException aIFileValidationException) @@ -65,12 +65,12 @@ private async ValueTask TryCatch(ReturningAIFileFunction returningAIFile } catch (AIFileDependencyException aIFileDependencyException) { - throw createAIFileOrchestrationDependencyException( + throw CreateAIFileOrchestrationDependencyException( aIFileDependencyException.InnerException as Xeption); } catch (AIFileServiceException aIFileServiceException) { - throw createAIFileOrchestrationDependencyException( + throw CreateAIFileOrchestrationDependencyException( aIFileServiceException.InnerException as Xeption); } catch (Exception exception) @@ -92,7 +92,7 @@ private async ValueTask> TryCatch(ReturningAIFilesFu } catch (AIFileDependencyException aIFileDependencyException) { - throw createAIFileOrchestrationDependencyException( + throw CreateAIFileOrchestrationDependencyException( aIFileDependencyException.InnerException as Xeption); } catch (AIFileDependencyValidationException aIFileDependencyValidationException) @@ -102,7 +102,7 @@ private async ValueTask> TryCatch(ReturningAIFilesFu } catch (AIFileServiceException aIFileServiceException) { - throw createAIFileOrchestrationDependencyException( + throw CreateAIFileOrchestrationDependencyException( aIFileServiceException.InnerException as Xeption); } catch (Exception exception) @@ -116,7 +116,7 @@ private async ValueTask> TryCatch(ReturningAIFilesFu } } - private static AIFileOrchestrationDependencyException createAIFileOrchestrationDependencyException(Xeption innerException) + private static AIFileOrchestrationDependencyException CreateAIFileOrchestrationDependencyException(Xeption innerException) { return new AIFileOrchestrationDependencyException( message: "AI File dependency error occurred, contact support.", From 30ba0f56d3ea3a6b31c06a7ede441babee7d7a7f Mon Sep 17 00:00:00 2001 From: Lezune Date: Thu, 6 Jun 2024 09:56:27 -0700 Subject: [PATCH 216/283] Reverted Unit Test files to original state --- ...OrchestrationServiceTests.Exceptions.RemoveFileById.cs | 5 +++-- ...ileOrchestrationServiceTests.Exceptions.RetrieveAll.cs | 5 +++-- .../AIFileOrchestrationServiceTests.Exceptions.Upload.cs | 5 +++-- .../AIFiles/AIFileOrchestrationServiceTests.cs | 8 -------- 4 files changed, 9 insertions(+), 14 deletions(-) diff --git a/Standard.AI.OpenAI.Tests.Unit/Services/Orchestrations/AIFiles/AIFileOrchestrationServiceTests.Exceptions.RemoveFileById.cs b/Standard.AI.OpenAI.Tests.Unit/Services/Orchestrations/AIFiles/AIFileOrchestrationServiceTests.Exceptions.RemoveFileById.cs index 45e3f7ab..20f78b19 100644 --- a/Standard.AI.OpenAI.Tests.Unit/Services/Orchestrations/AIFiles/AIFileOrchestrationServiceTests.Exceptions.RemoveFileById.cs +++ b/Standard.AI.OpenAI.Tests.Unit/Services/Orchestrations/AIFiles/AIFileOrchestrationServiceTests.Exceptions.RemoveFileById.cs @@ -63,8 +63,9 @@ private async Task ShouldThrowDependencyExceptionOnRemoveFileIfDependencyExcepti string someFileId = CreateRandomFileId(); var expectedAIFileOrchestrationDependencyException = - createAIFileOrchestrationDependencyException( - innerException: dependencyException.InnerException as Xeption); + new AIFileOrchestrationDependencyException( + message: "AI File dependency error occurred, contact support.", + innerException: dependencyException.InnerException as Xeption); this.aiFileServiceMock.Setup(service => service.RemoveFileByIdAsync(It.IsAny())) diff --git a/Standard.AI.OpenAI.Tests.Unit/Services/Orchestrations/AIFiles/AIFileOrchestrationServiceTests.Exceptions.RetrieveAll.cs b/Standard.AI.OpenAI.Tests.Unit/Services/Orchestrations/AIFiles/AIFileOrchestrationServiceTests.Exceptions.RetrieveAll.cs index 13a2ab45..6cd65890 100644 --- a/Standard.AI.OpenAI.Tests.Unit/Services/Orchestrations/AIFiles/AIFileOrchestrationServiceTests.Exceptions.RetrieveAll.cs +++ b/Standard.AI.OpenAI.Tests.Unit/Services/Orchestrations/AIFiles/AIFileOrchestrationServiceTests.Exceptions.RetrieveAll.cs @@ -24,8 +24,9 @@ private async Task ShouldThrowDependencyExceptionOnRetrieveAllIfDependencyErrorO { // given var expectedAIFileOrchestrationDependencyException = - createAIFileOrchestrationDependencyException( - innerException: dependencyException.InnerException as Xeption); + new AIFileOrchestrationDependencyException( + message: "AI File dependency error occurred, contact support.", + innerException: dependencyException.InnerException as Xeption); this.aiFileServiceMock.Setup(service => service.RetrieveAllFilesAsync()) diff --git a/Standard.AI.OpenAI.Tests.Unit/Services/Orchestrations/AIFiles/AIFileOrchestrationServiceTests.Exceptions.Upload.cs b/Standard.AI.OpenAI.Tests.Unit/Services/Orchestrations/AIFiles/AIFileOrchestrationServiceTests.Exceptions.Upload.cs index bbfe266c..23f55635 100644 --- a/Standard.AI.OpenAI.Tests.Unit/Services/Orchestrations/AIFiles/AIFileOrchestrationServiceTests.Exceptions.Upload.cs +++ b/Standard.AI.OpenAI.Tests.Unit/Services/Orchestrations/AIFiles/AIFileOrchestrationServiceTests.Exceptions.Upload.cs @@ -67,8 +67,9 @@ private async Task ShouldThrowDependencyExceptionOnUploadIfDependencyValidationE AIFile someAIFile = CreateRandomAIFile(); var expectedAIFileOrchestrationDependencyException = - createAIFileOrchestrationDependencyException( - innerException: dependencyValidationException.InnerException as Xeption); + new AIFileOrchestrationDependencyException( + message: "AI File dependency error occurred, contact support.", + innerException: dependencyValidationException.InnerException as Xeption); this.aiFileServiceMock.Setup(service => service.UploadFileAsync(It.IsAny())) diff --git a/Standard.AI.OpenAI.Tests.Unit/Services/Orchestrations/AIFiles/AIFileOrchestrationServiceTests.cs b/Standard.AI.OpenAI.Tests.Unit/Services/Orchestrations/AIFiles/AIFileOrchestrationServiceTests.cs index 042dfb6e..cebfc9b8 100644 --- a/Standard.AI.OpenAI.Tests.Unit/Services/Orchestrations/AIFiles/AIFileOrchestrationServiceTests.cs +++ b/Standard.AI.OpenAI.Tests.Unit/Services/Orchestrations/AIFiles/AIFileOrchestrationServiceTests.cs @@ -11,7 +11,6 @@ using Standard.AI.OpenAI.Models.Services.Foundations.AIFiles; using Standard.AI.OpenAI.Models.Services.Foundations.AIFiles.Exceptions; using Standard.AI.OpenAI.Models.Services.Foundations.LocalFiles.Exceptions; -using Standard.AI.OpenAI.Models.Services.Orchestrations.AIFiles.Exceptions; using Standard.AI.OpenAI.Services.Foundations.AIFiles; using Standard.AI.OpenAI.Services.Foundations.LocalFiles; using Standard.AI.OpenAI.Services.Orchestrations.AIFiles; @@ -142,12 +141,5 @@ private static string CreateRandomFileId() return randomId; } - - private static AIFileOrchestrationDependencyException createAIFileOrchestrationDependencyException(Xeption innerException) - { - return new AIFileOrchestrationDependencyException( - message: "AI File dependency error occurred, contact support.", - innerException); - } } } \ No newline at end of file From 191a5d431e01974639d9efc0459c9da678389f9e Mon Sep 17 00:00:00 2001 From: Lezune Date: Thu, 6 Jun 2024 09:58:15 -0700 Subject: [PATCH 217/283] Updated create method to adhere to method naming standards --- .../AIFiles/AIFileOrchestrationService.Exceptions.cs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Standard.AI.OpenAI/Services/Orchestrations/AIFiles/AIFileOrchestrationService.Exceptions.cs b/Standard.AI.OpenAI/Services/Orchestrations/AIFiles/AIFileOrchestrationService.Exceptions.cs index 2536ae69..49a0308f 100644 --- a/Standard.AI.OpenAI/Services/Orchestrations/AIFiles/AIFileOrchestrationService.Exceptions.cs +++ b/Standard.AI.OpenAI/Services/Orchestrations/AIFiles/AIFileOrchestrationService.Exceptions.cs @@ -35,12 +35,12 @@ private async ValueTask TryCatch(ReturningAIFileFunction returningAIFile } catch (LocalFileValidationException localFileValidationException) { - throw createAIFileOrchestrationDependencyValidationException( + throw CreateAIFileOrchestrationDependencyValidationException( localFileValidationException.InnerException as Xeption); } catch (LocalFileDependencyValidationException localFileDependencyValidationException) { - throw createAIFileOrchestrationDependencyValidationException( + throw CreateAIFileOrchestrationDependencyValidationException( localFileDependencyValidationException.InnerException as Xeption); } catch (LocalFileDependencyException localFileDependencyException) @@ -55,12 +55,12 @@ private async ValueTask TryCatch(ReturningAIFileFunction returningAIFile } catch (AIFileValidationException aIFileValidationException) { - throw createAIFileOrchestrationDependencyValidationException( + throw CreateAIFileOrchestrationDependencyValidationException( aIFileValidationException.InnerException as Xeption); } catch (AIFileDependencyValidationException aIFileDependencyValidationException) { - throw createAIFileOrchestrationDependencyValidationException( + throw CreateAIFileOrchestrationDependencyValidationException( aIFileDependencyValidationException.InnerException as Xeption); } catch (AIFileDependencyException aIFileDependencyException) @@ -97,7 +97,7 @@ private async ValueTask> TryCatch(ReturningAIFilesFu } catch (AIFileDependencyValidationException aIFileDependencyValidationException) { - throw createAIFileOrchestrationDependencyValidationException( + throw CreateAIFileOrchestrationDependencyValidationException( aIFileDependencyValidationException.InnerException as Xeption); } catch (AIFileServiceException aIFileServiceException) @@ -116,7 +116,7 @@ private async ValueTask> TryCatch(ReturningAIFilesFu } } - private static AIFileOrchestrationDependencyValidationException createAIFileOrchestrationDependencyValidationException(Xeption innerException) + private static AIFileOrchestrationDependencyValidationException CreateAIFileOrchestrationDependencyValidationException(Xeption innerException) { return new AIFileOrchestrationDependencyValidationException( message: "AI file dependency validation error occurred, fix errors and try again.", From bf65a434e413752cb7918d0cc9149a0cf89416e4 Mon Sep 17 00:00:00 2001 From: Lezune Date: Thu, 6 Jun 2024 09:58:53 -0700 Subject: [PATCH 218/283] Reverted Unit Test files to original state --- ...OrchestrationServiceTests.Exceptions.RemoveFileById.cs | 5 +++-- ...ileOrchestrationServiceTests.Exceptions.RetrieveAll.cs | 5 +++-- .../AIFileOrchestrationServiceTests.Exceptions.Upload.cs | 3 ++- .../AIFiles/AIFileOrchestrationServiceTests.cs | 8 -------- 4 files changed, 8 insertions(+), 13 deletions(-) diff --git a/Standard.AI.OpenAI.Tests.Unit/Services/Orchestrations/AIFiles/AIFileOrchestrationServiceTests.Exceptions.RemoveFileById.cs b/Standard.AI.OpenAI.Tests.Unit/Services/Orchestrations/AIFiles/AIFileOrchestrationServiceTests.Exceptions.RemoveFileById.cs index 157aec1c..20f78b19 100644 --- a/Standard.AI.OpenAI.Tests.Unit/Services/Orchestrations/AIFiles/AIFileOrchestrationServiceTests.Exceptions.RemoveFileById.cs +++ b/Standard.AI.OpenAI.Tests.Unit/Services/Orchestrations/AIFiles/AIFileOrchestrationServiceTests.Exceptions.RemoveFileById.cs @@ -24,8 +24,9 @@ private async Task ShouldThrowDependencyValidationExceptionOnRemoveFileIfDepende string someFileId = CreateRandomFileId(); var expectedAIFileOrchestrationDependencyValidationException = - createAIFileOrchestrationDependencyValidationException( - innerException: dependencyValidationException.InnerException as Xeption); + new AIFileOrchestrationDependencyValidationException( + message: "AI file dependency validation error occurred, fix errors and try again.", + innerException: dependencyValidationException.InnerException as Xeption); this.aiFileServiceMock.Setup(service => service.RemoveFileByIdAsync(It.IsAny())) diff --git a/Standard.AI.OpenAI.Tests.Unit/Services/Orchestrations/AIFiles/AIFileOrchestrationServiceTests.Exceptions.RetrieveAll.cs b/Standard.AI.OpenAI.Tests.Unit/Services/Orchestrations/AIFiles/AIFileOrchestrationServiceTests.Exceptions.RetrieveAll.cs index dea40999..6cd65890 100644 --- a/Standard.AI.OpenAI.Tests.Unit/Services/Orchestrations/AIFiles/AIFileOrchestrationServiceTests.Exceptions.RetrieveAll.cs +++ b/Standard.AI.OpenAI.Tests.Unit/Services/Orchestrations/AIFiles/AIFileOrchestrationServiceTests.Exceptions.RetrieveAll.cs @@ -65,8 +65,9 @@ private async Task ShouldThrowDependencyValidationExceptionOnRetrieveAllIfDepend innerException: someInnerException); var expectedAIFileOrchestrationDependencyValidationException = - createAIFileOrchestrationDependencyValidationException( - innerException: dependencyValidationException.InnerException as Xeption); + new AIFileOrchestrationDependencyValidationException( + message: "AI file dependency validation error occurred, fix errors and try again.", + innerException: dependencyValidationException.InnerException as Xeption); this.aiFileServiceMock.Setup(service => service.RetrieveAllFilesAsync()) diff --git a/Standard.AI.OpenAI.Tests.Unit/Services/Orchestrations/AIFiles/AIFileOrchestrationServiceTests.Exceptions.Upload.cs b/Standard.AI.OpenAI.Tests.Unit/Services/Orchestrations/AIFiles/AIFileOrchestrationServiceTests.Exceptions.Upload.cs index ef8d4574..23f55635 100644 --- a/Standard.AI.OpenAI.Tests.Unit/Services/Orchestrations/AIFiles/AIFileOrchestrationServiceTests.Exceptions.Upload.cs +++ b/Standard.AI.OpenAI.Tests.Unit/Services/Orchestrations/AIFiles/AIFileOrchestrationServiceTests.Exceptions.Upload.cs @@ -24,7 +24,8 @@ private async Task ShouldThrowDependencyValidationExceptionOnUploadIfDependencyV AIFile someAIFile = CreateRandomAIFile(); var expectedAIFileOrchestrationDependencyValidationException = - createAIFileOrchestrationDependencyValidationException( + new AIFileOrchestrationDependencyValidationException( + message: "AI file dependency validation error occurred, fix errors and try again.", innerException: dependencyValidationException.InnerException as Xeption); this.aiFileServiceMock.Setup(service => diff --git a/Standard.AI.OpenAI.Tests.Unit/Services/Orchestrations/AIFiles/AIFileOrchestrationServiceTests.cs b/Standard.AI.OpenAI.Tests.Unit/Services/Orchestrations/AIFiles/AIFileOrchestrationServiceTests.cs index a059c589..cebfc9b8 100644 --- a/Standard.AI.OpenAI.Tests.Unit/Services/Orchestrations/AIFiles/AIFileOrchestrationServiceTests.cs +++ b/Standard.AI.OpenAI.Tests.Unit/Services/Orchestrations/AIFiles/AIFileOrchestrationServiceTests.cs @@ -11,7 +11,6 @@ using Standard.AI.OpenAI.Models.Services.Foundations.AIFiles; using Standard.AI.OpenAI.Models.Services.Foundations.AIFiles.Exceptions; using Standard.AI.OpenAI.Models.Services.Foundations.LocalFiles.Exceptions; -using Standard.AI.OpenAI.Models.Services.Orchestrations.AIFiles.Exceptions; using Standard.AI.OpenAI.Services.Foundations.AIFiles; using Standard.AI.OpenAI.Services.Foundations.LocalFiles; using Standard.AI.OpenAI.Services.Orchestrations.AIFiles; @@ -142,12 +141,5 @@ private static string CreateRandomFileId() return randomId; } - - private static AIFileOrchestrationDependencyValidationException createAIFileOrchestrationDependencyValidationException(Xeption innerException) - { - return new AIFileOrchestrationDependencyValidationException( - message: "AI file dependency validation error occurred, fix errors and try again.", - innerException); - } } } \ No newline at end of file From 31c1f61963e39535c770b12744d1ecba2ec767d6 Mon Sep 17 00:00:00 2001 From: Lezune Date: Thu, 6 Jun 2024 10:01:45 -0700 Subject: [PATCH 219/283] Updated create method to adhere to method naming standards --- .../AIFiles/AIFileOrchestrationService.Exceptions.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Standard.AI.OpenAI/Services/Orchestrations/AIFiles/AIFileOrchestrationService.Exceptions.cs b/Standard.AI.OpenAI/Services/Orchestrations/AIFiles/AIFileOrchestrationService.Exceptions.cs index 4395c1a7..8128e8e7 100644 --- a/Standard.AI.OpenAI/Services/Orchestrations/AIFiles/AIFileOrchestrationService.Exceptions.cs +++ b/Standard.AI.OpenAI/Services/Orchestrations/AIFiles/AIFileOrchestrationService.Exceptions.cs @@ -79,7 +79,7 @@ private async ValueTask TryCatch(ReturningAIFileFunction returningAIFile new FailedAIFileOrchestrationServiceException( exception); - throw createAIFileOrchestrationServiceException( + throw CreateAIFileOrchestrationServiceException( failedAIFileOrchestrationServiceException); } } @@ -111,12 +111,12 @@ private async ValueTask> TryCatch(ReturningAIFilesFu new FailedAIFileOrchestrationServiceException( exception); - throw createAIFileOrchestrationServiceException( + throw CreateAIFileOrchestrationServiceException( failedAIFileOrchestrationServiceException); } } - private static AIFileOrchestrationServiceException createAIFileOrchestrationServiceException(Xeption innerException) + private static AIFileOrchestrationServiceException CreateAIFileOrchestrationServiceException(Xeption innerException) { return new AIFileOrchestrationServiceException( message: "AI File error occurred, contact support.", From 27ba3c792e3d00557b203e4a51811db3d822b0cd Mon Sep 17 00:00:00 2001 From: Lezune Date: Thu, 6 Jun 2024 10:02:18 -0700 Subject: [PATCH 220/283] Reverted Unit Test files to original state --- ...OrchestrationServiceTests.Exceptions.RemoveFileById.cs | 5 +++-- ...ileOrchestrationServiceTests.Exceptions.RetrieveAll.cs | 5 +++-- .../AIFileOrchestrationServiceTests.Exceptions.Upload.cs | 5 +++-- .../AIFiles/AIFileOrchestrationServiceTests.cs | 8 -------- 4 files changed, 9 insertions(+), 14 deletions(-) diff --git a/Standard.AI.OpenAI.Tests.Unit/Services/Orchestrations/AIFiles/AIFileOrchestrationServiceTests.Exceptions.RemoveFileById.cs b/Standard.AI.OpenAI.Tests.Unit/Services/Orchestrations/AIFiles/AIFileOrchestrationServiceTests.Exceptions.RemoveFileById.cs index 07318d33..20f78b19 100644 --- a/Standard.AI.OpenAI.Tests.Unit/Services/Orchestrations/AIFiles/AIFileOrchestrationServiceTests.Exceptions.RemoveFileById.cs +++ b/Standard.AI.OpenAI.Tests.Unit/Services/Orchestrations/AIFiles/AIFileOrchestrationServiceTests.Exceptions.RemoveFileById.cs @@ -106,8 +106,9 @@ private async Task ShouldThrowServiceExceptionOnRemoveFileIfExceptionOccursAsync innerException: serviceException); var expectedAIFileOrchestrationServiceException = - createAIFileOrchestrationServiceException( - innerException: failedAIFileOrchestrationServiceException); + new AIFileOrchestrationServiceException( + message: "AI File error occurred, contact support.", + innerException: failedAIFileOrchestrationServiceException); this.aiFileServiceMock.Setup(service => service.RemoveFileByIdAsync(It.IsAny())) diff --git a/Standard.AI.OpenAI.Tests.Unit/Services/Orchestrations/AIFiles/AIFileOrchestrationServiceTests.Exceptions.RetrieveAll.cs b/Standard.AI.OpenAI.Tests.Unit/Services/Orchestrations/AIFiles/AIFileOrchestrationServiceTests.Exceptions.RetrieveAll.cs index 6c9b1a81..6cd65890 100644 --- a/Standard.AI.OpenAI.Tests.Unit/Services/Orchestrations/AIFiles/AIFileOrchestrationServiceTests.Exceptions.RetrieveAll.cs +++ b/Standard.AI.OpenAI.Tests.Unit/Services/Orchestrations/AIFiles/AIFileOrchestrationServiceTests.Exceptions.RetrieveAll.cs @@ -106,8 +106,9 @@ private async Task ShouldThrowServiceExceptionOnRetrieveAllIfExceptionOccursAsyn innerException: serviceException); var expectedAIFileOrchestrationServiceException = - createAIFileOrchestrationServiceException( - innerException: failedAIFileOrchestrationServiceException); + new AIFileOrchestrationServiceException( + message: "AI File error occurred, contact support.", + innerException: failedAIFileOrchestrationServiceException); this.aiFileServiceMock.Setup(service => service.RetrieveAllFilesAsync()) diff --git a/Standard.AI.OpenAI.Tests.Unit/Services/Orchestrations/AIFiles/AIFileOrchestrationServiceTests.Exceptions.Upload.cs b/Standard.AI.OpenAI.Tests.Unit/Services/Orchestrations/AIFiles/AIFileOrchestrationServiceTests.Exceptions.Upload.cs index a2b0e0fd..23f55635 100644 --- a/Standard.AI.OpenAI.Tests.Unit/Services/Orchestrations/AIFiles/AIFileOrchestrationServiceTests.Exceptions.Upload.cs +++ b/Standard.AI.OpenAI.Tests.Unit/Services/Orchestrations/AIFiles/AIFileOrchestrationServiceTests.Exceptions.Upload.cs @@ -114,8 +114,9 @@ private async Task ShouldThrowServiceExceptionOnUploadIfExceptionOccursAsync() innerException: serviceException); var expectedAIFileOrchestrationServiceException = - createAIFileOrchestrationServiceException( - innerException: failedAIFileOrchestrationServiceException); + new AIFileOrchestrationServiceException( + message: "AI File error occurred, contact support.", + innerException: failedAIFileOrchestrationServiceException); this.aiFileServiceMock.Setup(service => service.UploadFileAsync(It.IsAny())) diff --git a/Standard.AI.OpenAI.Tests.Unit/Services/Orchestrations/AIFiles/AIFileOrchestrationServiceTests.cs b/Standard.AI.OpenAI.Tests.Unit/Services/Orchestrations/AIFiles/AIFileOrchestrationServiceTests.cs index 39feae70..cebfc9b8 100644 --- a/Standard.AI.OpenAI.Tests.Unit/Services/Orchestrations/AIFiles/AIFileOrchestrationServiceTests.cs +++ b/Standard.AI.OpenAI.Tests.Unit/Services/Orchestrations/AIFiles/AIFileOrchestrationServiceTests.cs @@ -11,7 +11,6 @@ using Standard.AI.OpenAI.Models.Services.Foundations.AIFiles; using Standard.AI.OpenAI.Models.Services.Foundations.AIFiles.Exceptions; using Standard.AI.OpenAI.Models.Services.Foundations.LocalFiles.Exceptions; -using Standard.AI.OpenAI.Models.Services.Orchestrations.AIFiles.Exceptions; using Standard.AI.OpenAI.Services.Foundations.AIFiles; using Standard.AI.OpenAI.Services.Foundations.LocalFiles; using Standard.AI.OpenAI.Services.Orchestrations.AIFiles; @@ -142,12 +141,5 @@ private static string CreateRandomFileId() return randomId; } - - private static AIFileOrchestrationServiceException createAIFileOrchestrationServiceException(Xeption innerException) - { - return new AIFileOrchestrationServiceException( - message: "AI File error occurred, contact support.", - innerException); - } } } \ No newline at end of file From 175f88bfe414c1db7c9d92af13376e2dd6dc3f7b Mon Sep 17 00:00:00 2001 From: Lezune Date: Thu, 6 Jun 2024 10:03:44 -0700 Subject: [PATCH 221/283] Updated create method to adhere to method naming standards --- .../AIFiles/AIFileOrchestrationService.Exceptions.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Standard.AI.OpenAI/Services/Orchestrations/AIFiles/AIFileOrchestrationService.Exceptions.cs b/Standard.AI.OpenAI/Services/Orchestrations/AIFiles/AIFileOrchestrationService.Exceptions.cs index 321830b0..318264b5 100644 --- a/Standard.AI.OpenAI/Services/Orchestrations/AIFiles/AIFileOrchestrationService.Exceptions.cs +++ b/Standard.AI.OpenAI/Services/Orchestrations/AIFiles/AIFileOrchestrationService.Exceptions.cs @@ -26,12 +26,12 @@ private async ValueTask TryCatch(ReturningAIFileFunction returningAIFile } catch (NullAIFileOrchestrationException nullAIFileOrchestrationException) { - throw createAIFileOrchestrationValidationException( + throw CreateAIFileOrchestrationValidationException( nullAIFileOrchestrationException); } catch (InvalidAIFileOrchestrationException invalidAIFileOrchestrationException) { - throw createAIFileOrchestrationValidationException( + throw CreateAIFileOrchestrationValidationException( invalidAIFileOrchestrationException); } catch (LocalFileValidationException localFileValidationException) @@ -117,7 +117,7 @@ private async ValueTask> TryCatch(ReturningAIFilesFu } } - private static AIFileOrchestrationValidationException createAIFileOrchestrationValidationException(Xeption innerException) + private static AIFileOrchestrationValidationException CreateAIFileOrchestrationValidationException(Xeption innerException) { return new AIFileOrchestrationValidationException( message: "AI file validation error occurred, fix errors and try again.", From 455952b0a28c9c8f04b18efaf9e64b4587adec63 Mon Sep 17 00:00:00 2001 From: Lezune Date: Thu, 6 Jun 2024 10:04:08 -0700 Subject: [PATCH 222/283] Reverted Unit Test files to original state --- ...ServiceTests.Validation.RemoveFileByIdAsync.cs | 5 +++-- ...rchestrationServiceTests.Validations.Upload.cs | 15 +++++++++------ .../AIFiles/AIFileOrchestrationServiceTests.cs | 8 -------- 3 files changed, 12 insertions(+), 16 deletions(-) diff --git a/Standard.AI.OpenAI.Tests.Unit/Services/Orchestrations/AIFiles/AIFileOrchestrationServiceTests.Validation.RemoveFileByIdAsync.cs b/Standard.AI.OpenAI.Tests.Unit/Services/Orchestrations/AIFiles/AIFileOrchestrationServiceTests.Validation.RemoveFileByIdAsync.cs index 452744a8..a41a6379 100644 --- a/Standard.AI.OpenAI.Tests.Unit/Services/Orchestrations/AIFiles/AIFileOrchestrationServiceTests.Validation.RemoveFileByIdAsync.cs +++ b/Standard.AI.OpenAI.Tests.Unit/Services/Orchestrations/AIFiles/AIFileOrchestrationServiceTests.Validation.RemoveFileByIdAsync.cs @@ -25,8 +25,9 @@ private async Task ShouldThrowValidationExceptionOnRemoveFileIfFileIdIsInvalid(s values: "Value is required"); var expectedAIFileOrchestrationValidationException = - createAIFileOrchestrationValidationException( - innerException: invalidAiFileOrchestrationException); + new AIFileOrchestrationValidationException( + message: "AI file validation error occurred, fix errors and try again.", + innerException: invalidAiFileOrchestrationException); // when ValueTask removeFileTask = diff --git a/Standard.AI.OpenAI.Tests.Unit/Services/Orchestrations/AIFiles/AIFileOrchestrationServiceTests.Validations.Upload.cs b/Standard.AI.OpenAI.Tests.Unit/Services/Orchestrations/AIFiles/AIFileOrchestrationServiceTests.Validations.Upload.cs index 542ff7b7..ea6f96fa 100644 --- a/Standard.AI.OpenAI.Tests.Unit/Services/Orchestrations/AIFiles/AIFileOrchestrationServiceTests.Validations.Upload.cs +++ b/Standard.AI.OpenAI.Tests.Unit/Services/Orchestrations/AIFiles/AIFileOrchestrationServiceTests.Validations.Upload.cs @@ -23,8 +23,9 @@ private async Task ShouldThrowValidationExceptionOnUploadIfFileIsNullAsync() new NullAIFileOrchestrationException(); var expectedAIFileOrchestrationValidationException = - createAIFileOrchestrationValidationException( - innerException: nullAIFileOrchestrationException); + new AIFileOrchestrationValidationException( + message: "AI file validation error occurred, fix errors and try again.", + innerException: nullAIFileOrchestrationException); // when ValueTask uploadFileTask = @@ -66,8 +67,9 @@ private async Task ShouldThrowValidationExceptionOnUploadIfRequestIsNullAsync() values: "Object is required"); var expectedAIFileOrchestrationValidationException = - createAIFileOrchestrationValidationException( - innerException: invalidAIFileOrchestrationException); + new AIFileOrchestrationValidationException( + message: "AI file validation error occurred, fix errors and try again.", + innerException: invalidAIFileOrchestrationException); // when ValueTask uploadFileTask = @@ -115,8 +117,9 @@ private async Task ShouldThrowValidationExceptionIfRequestIsInvalidAsync( "Value is required"); var expectedAIFileOrchestrationValidationException = - createAIFileOrchestrationValidationException( - innerException: invalidAIFileOrchestrationException); + new AIFileOrchestrationValidationException( + message: "AI file validation error occurred, fix errors and try again.", + innerException: invalidAIFileOrchestrationException); // when ValueTask uploadFileTask = diff --git a/Standard.AI.OpenAI.Tests.Unit/Services/Orchestrations/AIFiles/AIFileOrchestrationServiceTests.cs b/Standard.AI.OpenAI.Tests.Unit/Services/Orchestrations/AIFiles/AIFileOrchestrationServiceTests.cs index 438d3c4e..cebfc9b8 100644 --- a/Standard.AI.OpenAI.Tests.Unit/Services/Orchestrations/AIFiles/AIFileOrchestrationServiceTests.cs +++ b/Standard.AI.OpenAI.Tests.Unit/Services/Orchestrations/AIFiles/AIFileOrchestrationServiceTests.cs @@ -11,7 +11,6 @@ using Standard.AI.OpenAI.Models.Services.Foundations.AIFiles; using Standard.AI.OpenAI.Models.Services.Foundations.AIFiles.Exceptions; using Standard.AI.OpenAI.Models.Services.Foundations.LocalFiles.Exceptions; -using Standard.AI.OpenAI.Models.Services.Orchestrations.AIFiles.Exceptions; using Standard.AI.OpenAI.Services.Foundations.AIFiles; using Standard.AI.OpenAI.Services.Foundations.LocalFiles; using Standard.AI.OpenAI.Services.Orchestrations.AIFiles; @@ -142,12 +141,5 @@ private static string CreateRandomFileId() return randomId; } - - private static AIFileOrchestrationValidationException createAIFileOrchestrationValidationException(Xeption innerException) - { - return new AIFileOrchestrationValidationException( - message: "AI file validation error occurred, fix errors and try again.", - innerException); - } } } \ No newline at end of file From c9e9645f0b4afef002d2ef2def789b5f83245324 Mon Sep 17 00:00:00 2001 From: Lezune Date: Thu, 6 Jun 2024 10:06:21 -0700 Subject: [PATCH 223/283] Updated create method to adhere to method naming standards --- .../AIFiles/AIFileOrchestrationService.Exceptions.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Standard.AI.OpenAI/Services/Orchestrations/AIFiles/AIFileOrchestrationService.Exceptions.cs b/Standard.AI.OpenAI/Services/Orchestrations/AIFiles/AIFileOrchestrationService.Exceptions.cs index acba60ab..b67ed215 100644 --- a/Standard.AI.OpenAI/Services/Orchestrations/AIFiles/AIFileOrchestrationService.Exceptions.cs +++ b/Standard.AI.OpenAI/Services/Orchestrations/AIFiles/AIFileOrchestrationService.Exceptions.cs @@ -76,7 +76,7 @@ private async ValueTask TryCatch(ReturningAIFileFunction returningAIFile catch (Exception exception) { var failedAIFileOrchestrationServiceException = - createFailedAIFileOrchestrationServiceException( + CreateFailedAIFileOrchestrationServiceException( exception); throw new AIFileOrchestrationServiceException( @@ -108,7 +108,7 @@ private async ValueTask> TryCatch(ReturningAIFilesFu catch (Exception exception) { var failedAIFileOrchestrationServiceException = - createFailedAIFileOrchestrationServiceException( + CreateFailedAIFileOrchestrationServiceException( exception); throw new AIFileOrchestrationServiceException( @@ -116,7 +116,7 @@ private async ValueTask> TryCatch(ReturningAIFilesFu } } - private static FailedAIFileOrchestrationServiceException createFailedAIFileOrchestrationServiceException(Exception innerException) + private static FailedAIFileOrchestrationServiceException CreateFailedAIFileOrchestrationServiceException(Exception innerException) { return new FailedAIFileOrchestrationServiceException( message: "Failed AI file service error occurred, contact support.", From 556f00c53462cadc855c2ae7d88536c23f0ecd2c Mon Sep 17 00:00:00 2001 From: Lezune Date: Thu, 6 Jun 2024 10:06:40 -0700 Subject: [PATCH 224/283] Reverted Unit Test files to original state --- ...OrchestrationServiceTests.Exceptions.RemoveFileById.cs | 5 +++-- ...ileOrchestrationServiceTests.Exceptions.RetrieveAll.cs | 5 +++-- .../AIFileOrchestrationServiceTests.Exceptions.Upload.cs | 5 +++-- .../AIFiles/AIFileOrchestrationServiceTests.cs | 8 -------- 4 files changed, 9 insertions(+), 14 deletions(-) diff --git a/Standard.AI.OpenAI.Tests.Unit/Services/Orchestrations/AIFiles/AIFileOrchestrationServiceTests.Exceptions.RemoveFileById.cs b/Standard.AI.OpenAI.Tests.Unit/Services/Orchestrations/AIFiles/AIFileOrchestrationServiceTests.Exceptions.RemoveFileById.cs index 39188a10..20f78b19 100644 --- a/Standard.AI.OpenAI.Tests.Unit/Services/Orchestrations/AIFiles/AIFileOrchestrationServiceTests.Exceptions.RemoveFileById.cs +++ b/Standard.AI.OpenAI.Tests.Unit/Services/Orchestrations/AIFiles/AIFileOrchestrationServiceTests.Exceptions.RemoveFileById.cs @@ -101,8 +101,9 @@ private async Task ShouldThrowServiceExceptionOnRemoveFileIfExceptionOccursAsync var serviceException = new Exception(); var failedAIFileOrchestrationServiceException = - createFailedAIFileOrchestrationServiceException( - innerException: serviceException); + new FailedAIFileOrchestrationServiceException( + message: "Failed AI file service error occurred, contact support.", + innerException: serviceException); var expectedAIFileOrchestrationServiceException = new AIFileOrchestrationServiceException( diff --git a/Standard.AI.OpenAI.Tests.Unit/Services/Orchestrations/AIFiles/AIFileOrchestrationServiceTests.Exceptions.RetrieveAll.cs b/Standard.AI.OpenAI.Tests.Unit/Services/Orchestrations/AIFiles/AIFileOrchestrationServiceTests.Exceptions.RetrieveAll.cs index 1cef502b..6cd65890 100644 --- a/Standard.AI.OpenAI.Tests.Unit/Services/Orchestrations/AIFiles/AIFileOrchestrationServiceTests.Exceptions.RetrieveAll.cs +++ b/Standard.AI.OpenAI.Tests.Unit/Services/Orchestrations/AIFiles/AIFileOrchestrationServiceTests.Exceptions.RetrieveAll.cs @@ -101,8 +101,9 @@ private async Task ShouldThrowServiceExceptionOnRetrieveAllIfExceptionOccursAsyn var serviceException = new Exception(); var failedAIFileOrchestrationServiceException = - createFailedAIFileOrchestrationServiceException( - innerException: serviceException); + new FailedAIFileOrchestrationServiceException( + message: "Failed AI file service error occurred, contact support.", + innerException: serviceException); var expectedAIFileOrchestrationServiceException = new AIFileOrchestrationServiceException( diff --git a/Standard.AI.OpenAI.Tests.Unit/Services/Orchestrations/AIFiles/AIFileOrchestrationServiceTests.Exceptions.Upload.cs b/Standard.AI.OpenAI.Tests.Unit/Services/Orchestrations/AIFiles/AIFileOrchestrationServiceTests.Exceptions.Upload.cs index 492eca4c..23f55635 100644 --- a/Standard.AI.OpenAI.Tests.Unit/Services/Orchestrations/AIFiles/AIFileOrchestrationServiceTests.Exceptions.Upload.cs +++ b/Standard.AI.OpenAI.Tests.Unit/Services/Orchestrations/AIFiles/AIFileOrchestrationServiceTests.Exceptions.Upload.cs @@ -109,8 +109,9 @@ private async Task ShouldThrowServiceExceptionOnUploadIfExceptionOccursAsync() var serviceException = new Exception(); var failedAIFileOrchestrationServiceException = - createFailedAIFileOrchestrationServiceException( - innerException: serviceException); + new FailedAIFileOrchestrationServiceException( + message: "Failed AI file service error occurred, contact support.", + innerException: serviceException); var expectedAIFileOrchestrationServiceException = new AIFileOrchestrationServiceException( diff --git a/Standard.AI.OpenAI.Tests.Unit/Services/Orchestrations/AIFiles/AIFileOrchestrationServiceTests.cs b/Standard.AI.OpenAI.Tests.Unit/Services/Orchestrations/AIFiles/AIFileOrchestrationServiceTests.cs index ca077291..cebfc9b8 100644 --- a/Standard.AI.OpenAI.Tests.Unit/Services/Orchestrations/AIFiles/AIFileOrchestrationServiceTests.cs +++ b/Standard.AI.OpenAI.Tests.Unit/Services/Orchestrations/AIFiles/AIFileOrchestrationServiceTests.cs @@ -11,7 +11,6 @@ using Standard.AI.OpenAI.Models.Services.Foundations.AIFiles; using Standard.AI.OpenAI.Models.Services.Foundations.AIFiles.Exceptions; using Standard.AI.OpenAI.Models.Services.Foundations.LocalFiles.Exceptions; -using Standard.AI.OpenAI.Models.Services.Orchestrations.AIFiles.Exceptions; using Standard.AI.OpenAI.Services.Foundations.AIFiles; using Standard.AI.OpenAI.Services.Foundations.LocalFiles; using Standard.AI.OpenAI.Services.Orchestrations.AIFiles; @@ -142,12 +141,5 @@ private static string CreateRandomFileId() return randomId; } - - private static FailedAIFileOrchestrationServiceException createFailedAIFileOrchestrationServiceException(Exception innerException) - { - return new FailedAIFileOrchestrationServiceException( - message: "Failed AI file service error occurred, contact support.", - innerException); - } } } \ No newline at end of file From a37b59f03b5d19001076a4b1daecf75e213ff877 Mon Sep 17 00:00:00 2001 From: Lezune Date: Thu, 6 Jun 2024 10:14:55 -0700 Subject: [PATCH 225/283] Updated create method to adhere to method naming standards --- ...rchestrationServiceTests.Validation.RemoveFileByIdAsync.cs | 2 +- .../AIFileOrchestrationServiceTests.Validations.Upload.cs | 4 ++-- .../Orchestrations/AIFiles/AIFileOrchestrationServiceTests.cs | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Standard.AI.OpenAI.Tests.Unit/Services/Orchestrations/AIFiles/AIFileOrchestrationServiceTests.Validation.RemoveFileByIdAsync.cs b/Standard.AI.OpenAI.Tests.Unit/Services/Orchestrations/AIFiles/AIFileOrchestrationServiceTests.Validation.RemoveFileByIdAsync.cs index fc322399..11f3c6ba 100644 --- a/Standard.AI.OpenAI.Tests.Unit/Services/Orchestrations/AIFiles/AIFileOrchestrationServiceTests.Validation.RemoveFileByIdAsync.cs +++ b/Standard.AI.OpenAI.Tests.Unit/Services/Orchestrations/AIFiles/AIFileOrchestrationServiceTests.Validation.RemoveFileByIdAsync.cs @@ -18,7 +18,7 @@ private async Task ShouldThrowValidationExceptionOnRemoveFileIfFileIdIsInvalid(s { // given var invalidAiFileOrchestrationException = - createInvalidAIFileOrchestrationException(); + CreateInvalidAIFileOrchestrationException(); invalidAiFileOrchestrationException.AddData( key: nameof(AIFile.Response.Id), diff --git a/Standard.AI.OpenAI.Tests.Unit/Services/Orchestrations/AIFiles/AIFileOrchestrationServiceTests.Validations.Upload.cs b/Standard.AI.OpenAI.Tests.Unit/Services/Orchestrations/AIFiles/AIFileOrchestrationServiceTests.Validations.Upload.cs index 42197485..9515d032 100644 --- a/Standard.AI.OpenAI.Tests.Unit/Services/Orchestrations/AIFiles/AIFileOrchestrationServiceTests.Validations.Upload.cs +++ b/Standard.AI.OpenAI.Tests.Unit/Services/Orchestrations/AIFiles/AIFileOrchestrationServiceTests.Validations.Upload.cs @@ -60,7 +60,7 @@ private async Task ShouldThrowValidationExceptionOnUploadIfRequestIsNullAsync() var invalidAIFile = new AIFile(); var invalidAIFileOrchestrationException = - createInvalidAIFileOrchestrationException(); + CreateInvalidAIFileOrchestrationException(); invalidAIFileOrchestrationException.AddData( key: nameof(AIFileRequest), @@ -110,7 +110,7 @@ private async Task ShouldThrowValidationExceptionIfRequestIsInvalidAsync( invalidAIFile.Request.Name = invalidName; var invalidAIFileOrchestrationException = - createInvalidAIFileOrchestrationException(); + CreateInvalidAIFileOrchestrationException(); invalidAIFileOrchestrationException.AddData( key: nameof(AIFileRequest.Name), diff --git a/Standard.AI.OpenAI.Tests.Unit/Services/Orchestrations/AIFiles/AIFileOrchestrationServiceTests.cs b/Standard.AI.OpenAI.Tests.Unit/Services/Orchestrations/AIFiles/AIFileOrchestrationServiceTests.cs index d7a11018..4e6437cf 100644 --- a/Standard.AI.OpenAI.Tests.Unit/Services/Orchestrations/AIFiles/AIFileOrchestrationServiceTests.cs +++ b/Standard.AI.OpenAI.Tests.Unit/Services/Orchestrations/AIFiles/AIFileOrchestrationServiceTests.cs @@ -143,7 +143,7 @@ private static string CreateRandomFileId() return randomId; } - private static InvalidAIFileOrchestrationException createInvalidAIFileOrchestrationException() + private static InvalidAIFileOrchestrationException CreateInvalidAIFileOrchestrationException() { return new InvalidAIFileOrchestrationException( message: "AI file is invalid."); From 7eefdc72fada5f6d102df91b0aefc95baf2148a7 Mon Sep 17 00:00:00 2001 From: Lezune Date: Thu, 6 Jun 2024 10:19:19 -0700 Subject: [PATCH 226/283] Updated create method to adhere to method naming standards --- Standard.AI.OpenAI/Clients/AIFiles/AIFilesClient.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Standard.AI.OpenAI/Clients/AIFiles/AIFilesClient.cs b/Standard.AI.OpenAI/Clients/AIFiles/AIFilesClient.cs index 65d9631f..ab254b8b 100644 --- a/Standard.AI.OpenAI/Clients/AIFiles/AIFilesClient.cs +++ b/Standard.AI.OpenAI/Clients/AIFiles/AIFilesClient.cs @@ -37,7 +37,7 @@ public async ValueTask UploadFileAsync(AIFile aiFile) } catch (AIFileOrchestrationDependencyException aiFileOrchestrationDependencyException) { - throw createAIFileClientDependencyException( + throw CreateAIFileClientDependencyException( aiFileOrchestrationDependencyException.InnerException as Xeption); } catch (AIFileOrchestrationServiceException aiFileOrchestrationServiceException) @@ -60,7 +60,7 @@ public async ValueTask> RetrieveAllFilesAsync() } catch (AIFileOrchestrationDependencyException aiFileOrchestrationDependencyException) { - throw createAIFileClientDependencyException( + throw CreateAIFileClientDependencyException( aiFileOrchestrationDependencyException.InnerException as Xeption); } catch (AIFileOrchestrationServiceException aiFileOrchestrationServiceException) @@ -88,7 +88,7 @@ public async ValueTask RemoveFileByIdAsync(string fileId) } catch (AIFileOrchestrationDependencyException aiFileOrchestrationDependencyException) { - throw createAIFileClientDependencyException( + throw CreateAIFileClientDependencyException( aiFileOrchestrationDependencyException.InnerException as Xeption); } catch (AIFileOrchestrationServiceException aiFileOrchestrationServiceException) @@ -98,7 +98,7 @@ public async ValueTask RemoveFileByIdAsync(string fileId) } } - private static AIFileClientDependencyException createAIFileClientDependencyException(Xeption innerException) + private static AIFileClientDependencyException CreateAIFileClientDependencyException(Xeption innerException) { return new AIFileClientDependencyException( message: "AI file client dependency error occurred, contact support.", From 5e6aa496fc2b9fd691c322fc32034291596e365f Mon Sep 17 00:00:00 2001 From: Lezune Date: Thu, 6 Jun 2024 10:20:45 -0700 Subject: [PATCH 227/283] Updated create method to adhere to method naming standards --- Standard.AI.OpenAI/Clients/AIFiles/AIFilesClient.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Standard.AI.OpenAI/Clients/AIFiles/AIFilesClient.cs b/Standard.AI.OpenAI/Clients/AIFiles/AIFilesClient.cs index c6c3536d..50c44223 100644 --- a/Standard.AI.OpenAI/Clients/AIFiles/AIFilesClient.cs +++ b/Standard.AI.OpenAI/Clients/AIFiles/AIFilesClient.cs @@ -42,7 +42,7 @@ public async ValueTask UploadFileAsync(AIFile aiFile) } catch (AIFileOrchestrationServiceException aiFileOrchestrationServiceException) { - throw createAIFileClientServiceException( + throw CreateAIFileClientServiceException( aiFileOrchestrationServiceException.InnerException as Xeption); } } @@ -65,7 +65,7 @@ public async ValueTask> RetrieveAllFilesAsync() } catch (AIFileOrchestrationServiceException aiFileOrchestrationServiceException) { - throw createAIFileClientServiceException( + throw CreateAIFileClientServiceException( aiFileOrchestrationServiceException.InnerException as Xeption); } } @@ -93,12 +93,12 @@ public async ValueTask RemoveFileByIdAsync(string fileId) } catch (AIFileOrchestrationServiceException aiFileOrchestrationServiceException) { - throw createAIFileClientServiceException( + throw CreateAIFileClientServiceException( aiFileOrchestrationServiceException.InnerException as Xeption); } } - private static AIFileClientServiceException createAIFileClientServiceException(Xeption innerException) + private static AIFileClientServiceException CreateAIFileClientServiceException(Xeption innerException) { return new AIFileClientServiceException( message: "AI file client service error occurred, contact support.", From dd45019b9805e0c90b2a5f76a9acf3486e26ebb9 Mon Sep 17 00:00:00 2001 From: Lezune Date: Thu, 6 Jun 2024 10:22:37 -0700 Subject: [PATCH 228/283] Updated create method to adhere to method naming standards --- Standard.AI.OpenAI/Clients/AIFiles/AIFilesClient.cs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Standard.AI.OpenAI/Clients/AIFiles/AIFilesClient.cs b/Standard.AI.OpenAI/Clients/AIFiles/AIFilesClient.cs index 4669b552..438197eb 100644 --- a/Standard.AI.OpenAI/Clients/AIFiles/AIFilesClient.cs +++ b/Standard.AI.OpenAI/Clients/AIFiles/AIFilesClient.cs @@ -27,12 +27,12 @@ public async ValueTask UploadFileAsync(AIFile aiFile) } catch (AIFileOrchestrationValidationException aiFileOrchestrationValidationException) { - throw createAIFileClientValidationException( + throw CreateAIFileClientValidationException( aiFileOrchestrationValidationException.InnerException as Xeption); } catch (AIFileOrchestrationDependencyValidationException aiFileOrchestrationDependencyValidationException) { - throw createAIFileClientValidationException( + throw CreateAIFileClientValidationException( aiFileOrchestrationDependencyValidationException.InnerException as Xeption); } catch (AIFileOrchestrationDependencyException aiFileOrchestrationDependencyException) @@ -55,7 +55,7 @@ public async ValueTask> RetrieveAllFilesAsync() } catch (AIFileOrchestrationDependencyValidationException aiFileOrchestrationDependencyValidationException) { - throw createAIFileClientValidationException( + throw CreateAIFileClientValidationException( aiFileOrchestrationDependencyValidationException.InnerException as Xeption); } catch (AIFileOrchestrationDependencyException aiFileOrchestrationDependencyException) @@ -78,12 +78,12 @@ public async ValueTask RemoveFileByIdAsync(string fileId) } catch (AIFileOrchestrationValidationException aiFileOrchestrationValidationException) { - throw createAIFileClientValidationException( + throw CreateAIFileClientValidationException( aiFileOrchestrationValidationException.InnerException as Xeption); } catch (AIFileOrchestrationDependencyValidationException aiFileOrchestrationDependencyValidationException) { - throw createAIFileClientValidationException( + throw CreateAIFileClientValidationException( aiFileOrchestrationDependencyValidationException.InnerException as Xeption); } catch (AIFileOrchestrationDependencyException aiFileOrchestrationDependencyException) @@ -98,7 +98,7 @@ public async ValueTask RemoveFileByIdAsync(string fileId) } } - private static AIFileClientValidationException createAIFileClientValidationException(Xeption innerException) + private static AIFileClientValidationException CreateAIFileClientValidationException(Xeption innerException) { return new AIFileClientValidationException( message: "AI file client validation error occurred, fix errors and try again.", From 4e62f6aa4d34f1c4aa5f91827b96f21c4082aaf3 Mon Sep 17 00:00:00 2001 From: Lezune Date: Thu, 6 Jun 2024 10:24:19 -0700 Subject: [PATCH 229/283] Updated create method to adhere to method naming standards --- Standard.AI.OpenAI/Clients/AIModels/AIModelsClient.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Standard.AI.OpenAI/Clients/AIModels/AIModelsClient.cs b/Standard.AI.OpenAI/Clients/AIModels/AIModelsClient.cs index 556c3664..98b45d00 100644 --- a/Standard.AI.OpenAI/Clients/AIModels/AIModelsClient.cs +++ b/Standard.AI.OpenAI/Clients/AIModels/AIModelsClient.cs @@ -33,7 +33,7 @@ public async ValueTask> RetrieveAIModelsAsync() } catch (AIModelDependencyException aiModelDependencyException) { - throw createAIModelClientDependencyException( + throw CreateAIModelClientDependencyException( aiModelDependencyException.InnerException as Xeption); } catch (AIModelServiceException aiModelServiceException) @@ -61,7 +61,7 @@ public async ValueTask RetrieveAIModelByNameAsync(string aiModelName) } catch (AIModelDependencyException aiModelDependencyException) { - throw createAIModelClientDependencyException( + throw CreateAIModelClientDependencyException( aiModelDependencyException.InnerException as Xeption); } catch (AIModelServiceException aiModelServiceException) @@ -71,7 +71,7 @@ public async ValueTask RetrieveAIModelByNameAsync(string aiModelName) } } - private static AIModelClientDependencyException createAIModelClientDependencyException(Xeption innerException) + private static AIModelClientDependencyException CreateAIModelClientDependencyException(Xeption innerException) { return new AIModelClientDependencyException( message: "AI model client dependency error occurred, contact support.", From 9f8b7e9ce8a6ae6133b739266bba75c26dc230b4 Mon Sep 17 00:00:00 2001 From: Lezune Date: Thu, 6 Jun 2024 10:25:21 -0700 Subject: [PATCH 230/283] Updated create method to adhere to method naming standards --- Standard.AI.OpenAI/Clients/AIModels/AIModelsClient.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Standard.AI.OpenAI/Clients/AIModels/AIModelsClient.cs b/Standard.AI.OpenAI/Clients/AIModels/AIModelsClient.cs index c8c2f18a..623d4ab1 100644 --- a/Standard.AI.OpenAI/Clients/AIModels/AIModelsClient.cs +++ b/Standard.AI.OpenAI/Clients/AIModels/AIModelsClient.cs @@ -38,7 +38,7 @@ public async ValueTask> RetrieveAIModelsAsync() } catch (AIModelServiceException aiModelServiceException) { - throw createAIModelClientServiceException( + throw CreateAIModelClientServiceException( aiModelServiceException.InnerException as Xeption); } } @@ -66,12 +66,12 @@ public async ValueTask RetrieveAIModelByNameAsync(string aiModelName) } catch (AIModelServiceException aiModelServiceException) { - throw createAIModelClientServiceException( + throw CreateAIModelClientServiceException( aiModelServiceException.InnerException as Xeption); } } - private static AIModelClientServiceException createAIModelClientServiceException(Xeption innerException) + private static AIModelClientServiceException CreateAIModelClientServiceException(Xeption innerException) { return new AIModelClientServiceException( message: "AI Model client service error occurred, contact support.", From b9a82292e6aa219a27c4d2f5d7b261d4f6258009 Mon Sep 17 00:00:00 2001 From: Lezune Date: Thu, 6 Jun 2024 10:26:49 -0700 Subject: [PATCH 231/283] Updated create method to adhere to method naming standards --- Standard.AI.OpenAI/Clients/AIModels/AIModelsClient.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Standard.AI.OpenAI/Clients/AIModels/AIModelsClient.cs b/Standard.AI.OpenAI/Clients/AIModels/AIModelsClient.cs index 24c35d6f..a55b5437 100644 --- a/Standard.AI.OpenAI/Clients/AIModels/AIModelsClient.cs +++ b/Standard.AI.OpenAI/Clients/AIModels/AIModelsClient.cs @@ -28,7 +28,7 @@ public async ValueTask> RetrieveAIModelsAsync() } catch (AIModelDependencyValidationException aiModelDependencyValidationException) { - throw createAIModelClientValidationException( + throw CreateAIModelClientValidationException( aiModelDependencyValidationException.InnerException as Xeption); } catch (AIModelDependencyException aiModelDependencyException) @@ -51,12 +51,12 @@ public async ValueTask RetrieveAIModelByNameAsync(string aiModelName) } catch (AIModelValidationException aIModelValidationException) { - throw createAIModelClientValidationException( + throw CreateAIModelClientValidationException( aIModelValidationException.InnerException as Xeption); } catch (AIModelDependencyValidationException aiModelDependencyValidationException) { - throw createAIModelClientValidationException( + throw CreateAIModelClientValidationException( aiModelDependencyValidationException.InnerException as Xeption); } catch (AIModelDependencyException aiModelDependencyException) @@ -71,7 +71,7 @@ public async ValueTask RetrieveAIModelByNameAsync(string aiModelName) } } - private static AIModelClientValidationException createAIModelClientValidationException(Xeption innerException) + private static AIModelClientValidationException CreateAIModelClientValidationException(Xeption innerException) { return new AIModelClientValidationException( message: "AI model client validation error occurred, fix errors and try again.", From 4c8efab93b6d7ab541483549936a9884b1390899 Mon Sep 17 00:00:00 2001 From: Lezune Date: Thu, 6 Jun 2024 10:30:49 -0700 Subject: [PATCH 232/283] Updated create method to adhere to method naming standards --- .../Clients/ChatCompletions/ChatCompletionsClient.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Standard.AI.OpenAI/Clients/ChatCompletions/ChatCompletionsClient.cs b/Standard.AI.OpenAI/Clients/ChatCompletions/ChatCompletionsClient.cs index d1932318..bc6b8d2f 100644 --- a/Standard.AI.OpenAI/Clients/ChatCompletions/ChatCompletionsClient.cs +++ b/Standard.AI.OpenAI/Clients/ChatCompletions/ChatCompletionsClient.cs @@ -26,12 +26,12 @@ public async ValueTask SendChatCompletionAsync(ChatCompletion ch } catch (ChatCompletionValidationException completionValidationException) { - throw createChatCompletionClientValidationException( + throw CreateChatCompletionClientValidationException( completionValidationException.InnerException as Xeption); } catch (ChatCompletionDependencyValidationException completionDependencyValidationException) { - throw createChatCompletionClientValidationException( + throw CreateChatCompletionClientValidationException( completionDependencyValidationException.InnerException as Xeption); } catch (ChatCompletionDependencyException completionDependencyException) @@ -46,7 +46,7 @@ public async ValueTask SendChatCompletionAsync(ChatCompletion ch } } - private static ChatCompletionClientValidationException createChatCompletionClientValidationException(Xeption innerException) + private static ChatCompletionClientValidationException CreateChatCompletionClientValidationException(Xeption innerException) { return new ChatCompletionClientValidationException( message: "Chat completion client validation error occurred, fix errors and try again.", From a359aada11b41114299921a7e92e669dc1b66e60 Mon Sep 17 00:00:00 2001 From: Lezune Date: Thu, 6 Jun 2024 10:33:30 -0700 Subject: [PATCH 233/283] Updated create method to adhere to method naming standards --- Standard.AI.OpenAI/Clients/Completions/CompletionsClient.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Standard.AI.OpenAI/Clients/Completions/CompletionsClient.cs b/Standard.AI.OpenAI/Clients/Completions/CompletionsClient.cs index 57532657..391983cd 100644 --- a/Standard.AI.OpenAI/Clients/Completions/CompletionsClient.cs +++ b/Standard.AI.OpenAI/Clients/Completions/CompletionsClient.cs @@ -26,12 +26,12 @@ public async ValueTask PromptCompletionAsync(Completion completion) } catch (CompletionValidationException completionValidationException) { - throw createCompletionClientValidationException( + throw CreateCompletionClientValidationException( completionValidationException.InnerException as Xeption); } catch (CompletionDependencyValidationException completionDependencyValidationException) { - throw createCompletionClientValidationException( + throw CreateCompletionClientValidationException( completionDependencyValidationException.InnerException as Xeption); } catch (CompletionDependencyException completionDependencyException) @@ -46,7 +46,7 @@ public async ValueTask PromptCompletionAsync(Completion completion) } } - private static CompletionClientValidationException createCompletionClientValidationException(Xeption innerException) + private static CompletionClientValidationException CreateCompletionClientValidationException(Xeption innerException) { return new CompletionClientValidationException( message: "Completion client validation error occurred, fix errors and try again.", From b6e570d5e979a0f8eab7fb632314a83fbf684e87 Mon Sep 17 00:00:00 2001 From: Lezune Date: Thu, 6 Jun 2024 10:35:33 -0700 Subject: [PATCH 234/283] Updated create method to adhere to method naming standards --- Standard.AI.OpenAI/Clients/FineTunes/FineTuneClient.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Standard.AI.OpenAI/Clients/FineTunes/FineTuneClient.cs b/Standard.AI.OpenAI/Clients/FineTunes/FineTuneClient.cs index 302ec6e6..d3f807b1 100644 --- a/Standard.AI.OpenAI/Clients/FineTunes/FineTuneClient.cs +++ b/Standard.AI.OpenAI/Clients/FineTunes/FineTuneClient.cs @@ -26,7 +26,7 @@ public async ValueTask SubmitFineTuneAsync(FineTune fineTune) } catch (FineTuneValidationException fineTuneValidationException) { - throw createFineTuneClientValidationException( + throw CreateFineTuneClientValidationException( fineTuneValidationException.InnerException as Xeption); } catch (FineTuneDependencyException fineTuneDependencyException) @@ -36,7 +36,7 @@ public async ValueTask SubmitFineTuneAsync(FineTune fineTune) } catch (FineTuneDependencyValidationException fineTuneDependencyValidationException) { - throw createFineTuneClientValidationException( + throw CreateFineTuneClientValidationException( fineTuneDependencyValidationException.InnerException as Xeption); } catch (FineTuneServiceException fineTuneServiceException) @@ -46,7 +46,7 @@ public async ValueTask SubmitFineTuneAsync(FineTune fineTune) } } - private static FineTuneClientValidationException createFineTuneClientValidationException(Xeption innerException) + private static FineTuneClientValidationException CreateFineTuneClientValidationException(Xeption innerException) { return new FineTuneClientValidationException( message: "Fine tune client validation error occurred, fix errors and try again.", From acf8c48b5f750cee36f86e0311e82577915f25b5 Mon Sep 17 00:00:00 2001 From: Lezune Date: Thu, 6 Jun 2024 12:56:55 -0700 Subject: [PATCH 235/283] Added create method --- .../Clients/FineTunes/FineTuneClient.cs | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/Standard.AI.OpenAI/Clients/FineTunes/FineTuneClient.cs b/Standard.AI.OpenAI/Clients/FineTunes/FineTuneClient.cs index a2d0100e..d81522d1 100644 --- a/Standard.AI.OpenAI/Clients/FineTunes/FineTuneClient.cs +++ b/Standard.AI.OpenAI/Clients/FineTunes/FineTuneClient.cs @@ -41,10 +41,15 @@ public async ValueTask SubmitFineTuneAsync(FineTune fineTune) } catch (FineTuneServiceException fineTuneServiceException) { - throw new FineTuneClientServiceException( - message: "Fine tune client service error occurred, contact support.", - fineTuneServiceException.InnerException as Xeption); + throw CreateFineTuneClientServiceException(fineTuneServiceException); } } + + private static FineTuneClientServiceException CreateFineTuneClientServiceException(FineTuneServiceException fineTuneServiceException) + { + return new FineTuneClientServiceException( + message: "Fine tune client service error occurred, contact support.", + fineTuneServiceException.InnerException as Xeption); + } } } From 7ae2a0ffd4718a3db560b9c581f0cf7f4db44c91 Mon Sep 17 00:00:00 2001 From: Lezune Date: Thu, 6 Jun 2024 14:01:28 -0700 Subject: [PATCH 236/283] Reverted code to previous commit(Removed create method) --- .../Clients/FineTunes/FineTuneClient.cs | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/Standard.AI.OpenAI/Clients/FineTunes/FineTuneClient.cs b/Standard.AI.OpenAI/Clients/FineTunes/FineTuneClient.cs index d81522d1..a2d0100e 100644 --- a/Standard.AI.OpenAI/Clients/FineTunes/FineTuneClient.cs +++ b/Standard.AI.OpenAI/Clients/FineTunes/FineTuneClient.cs @@ -41,15 +41,10 @@ public async ValueTask SubmitFineTuneAsync(FineTune fineTune) } catch (FineTuneServiceException fineTuneServiceException) { - throw CreateFineTuneClientServiceException(fineTuneServiceException); + throw new FineTuneClientServiceException( + message: "Fine tune client service error occurred, contact support.", + fineTuneServiceException.InnerException as Xeption); } } - - private static FineTuneClientServiceException CreateFineTuneClientServiceException(FineTuneServiceException fineTuneServiceException) - { - return new FineTuneClientServiceException( - message: "Fine tune client service error occurred, contact support.", - fineTuneServiceException.InnerException as Xeption); - } } } From 12a8c684daf28a98b74c8ba02ead8b9281e65919 Mon Sep 17 00:00:00 2001 From: Lezune Date: Sun, 9 Jun 2024 16:26:21 -0700 Subject: [PATCH 237/283] Updated AIFilesClient.cs --- Standard.AI.OpenAI/Clients/AIFiles/AIFilesClient.cs | 2 -- 1 file changed, 2 deletions(-) diff --git a/Standard.AI.OpenAI/Clients/AIFiles/AIFilesClient.cs b/Standard.AI.OpenAI/Clients/AIFiles/AIFilesClient.cs index 8399dca6..99b33a65 100644 --- a/Standard.AI.OpenAI/Clients/AIFiles/AIFilesClient.cs +++ b/Standard.AI.OpenAI/Clients/AIFiles/AIFilesClient.cs @@ -98,7 +98,6 @@ public async ValueTask RemoveFileByIdAsync(string fileId) } } - private static AIFileClientDependencyException CreateAIFileClientDependencyException(Xeption innerException) { return new AIFileClientDependencyException( @@ -113,7 +112,6 @@ private static AIFileClientServiceException CreateAIFileClientServiceException(X innerException); } - private static AIFileClientValidationException CreateAIFileClientValidationException(Xeption innerException) { return new AIFileClientValidationException( From 78f7c56011357498fb5fff4e58197bfa3e09ee6e Mon Sep 17 00:00:00 2001 From: Lezune Date: Sun, 9 Jun 2024 16:36:50 -0700 Subject: [PATCH 238/283] Reordered the create methods --- .../Clients/AIModels/AIModelsClient.cs | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/Standard.AI.OpenAI/Clients/AIModels/AIModelsClient.cs b/Standard.AI.OpenAI/Clients/AIModels/AIModelsClient.cs index b052ac0e..c9b9860a 100644 --- a/Standard.AI.OpenAI/Clients/AIModels/AIModelsClient.cs +++ b/Standard.AI.OpenAI/Clients/AIModels/AIModelsClient.cs @@ -71,6 +71,12 @@ public async ValueTask RetrieveAIModelByNameAsync(string aiModelName) } } + private static AIModelClientValidationException CreateAIModelClientValidationException(Xeption innerException) + { + return new AIModelClientValidationException( + message: "AI model client validation error occurred, fix errors and try again.", + innerException); + } private static AIModelClientDependencyException CreateAIModelClientDependencyException(Xeption innerException) { @@ -85,12 +91,5 @@ private static AIModelClientServiceException CreateAIModelClientServiceException message: "AI Model client service error occurred, contact support.", innerException: innerException); } - - private static AIModelClientValidationException CreateAIModelClientValidationException(Xeption innerException) - { - return new AIModelClientValidationException( - message: "AI model client validation error occurred, fix errors and try again.", - innerException); - } } } From fc3c0f7cd57ef6e673770539ae3bf14958432a50 Mon Sep 17 00:00:00 2001 From: Lezune Date: Sun, 9 Jun 2024 16:38:54 -0700 Subject: [PATCH 239/283] Reordered the create methods --- .../Clients/AIFiles/AIFilesClient.cs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/Standard.AI.OpenAI/Clients/AIFiles/AIFilesClient.cs b/Standard.AI.OpenAI/Clients/AIFiles/AIFilesClient.cs index 99b33a65..e2a14dc0 100644 --- a/Standard.AI.OpenAI/Clients/AIFiles/AIFilesClient.cs +++ b/Standard.AI.OpenAI/Clients/AIFiles/AIFilesClient.cs @@ -98,6 +98,13 @@ public async ValueTask RemoveFileByIdAsync(string fileId) } } + private static AIFileClientValidationException CreateAIFileClientValidationException(Xeption innerException) + { + return new AIFileClientValidationException( + message: "AI file client validation error occurred, fix errors and try again.", + innerException); + } + private static AIFileClientDependencyException CreateAIFileClientDependencyException(Xeption innerException) { return new AIFileClientDependencyException( @@ -111,12 +118,5 @@ private static AIFileClientServiceException CreateAIFileClientServiceException(X message: "AI file client service error occurred, contact support.", innerException); } - - private static AIFileClientValidationException CreateAIFileClientValidationException(Xeption innerException) - { - return new AIFileClientValidationException( - message: "AI file client validation error occurred, fix errors and try again.", - innerException); - } } } From d6210e961f417d472b1989fbf31a60b1f266bb32 Mon Sep 17 00:00:00 2001 From: Lezune Date: Sun, 9 Jun 2024 16:51:55 -0700 Subject: [PATCH 240/283] Merged branches and updated ClientFile for ChatCompletions --- .../ChatCompletions/ChatCompletionsClient.cs | 24 ++++++++++++++----- 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/Standard.AI.OpenAI/Clients/ChatCompletions/ChatCompletionsClient.cs b/Standard.AI.OpenAI/Clients/ChatCompletions/ChatCompletionsClient.cs index 9d6f2666..665ab105 100644 --- a/Standard.AI.OpenAI/Clients/ChatCompletions/ChatCompletionsClient.cs +++ b/Standard.AI.OpenAI/Clients/ChatCompletions/ChatCompletionsClient.cs @@ -36,15 +36,13 @@ public async ValueTask SendChatCompletionAsync(ChatCompletion ch } catch (ChatCompletionDependencyException completionDependencyException) { - throw new ChatCompletionClientDependencyException( - message: "Chat completion dependency error occurred, contact support.", - completionDependencyException.InnerException as Xeption); + throw CreateChatCompletionClientDependencyException( + completionDependencyException); } catch (ChatCompletionServiceException completionServiceException) { - throw new ChatCompletionClientServiceException( - message: "Chat completion client service error occurred, contact support.", - completionServiceException.InnerException as Xeption); + throw CreateChatCompletionClientServiceException( + completionServiceException); } } @@ -54,5 +52,19 @@ private static ChatCompletionClientValidationException CreateChatCompletionClien message: "Chat completion client validation error occurred, fix errors and try again.", innerException); } + + private static ChatCompletionClientDependencyException CreateChatCompletionClientDependencyException(Xeption innerException) + { + return new ChatCompletionClientDependencyException( + message: "Chat completion dependency error occurred, contact support.", + innerException); + } + + private static ChatCompletionClientServiceException CreateChatCompletionClientServiceException(Xeption innerException) + { + return new ChatCompletionClientServiceException( + message: "Chat completion client service error occurred, contact support.", + innerException); + } } } From 9d8874847e60242367bd1e3da15e8d8cad4d8be6 Mon Sep 17 00:00:00 2001 From: Lezune Date: Sun, 9 Jun 2024 17:06:59 -0700 Subject: [PATCH 241/283] Added Create methods --- .../Clients/Completions/CompletionsClient.cs | 24 ++++++++++++++----- 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/Standard.AI.OpenAI/Clients/Completions/CompletionsClient.cs b/Standard.AI.OpenAI/Clients/Completions/CompletionsClient.cs index 893d9555..1948cb9f 100644 --- a/Standard.AI.OpenAI/Clients/Completions/CompletionsClient.cs +++ b/Standard.AI.OpenAI/Clients/Completions/CompletionsClient.cs @@ -36,15 +36,13 @@ public async ValueTask PromptCompletionAsync(Completion completion) } catch (CompletionDependencyException completionDependencyException) { - throw new CompletionClientDependencyException( - message: "Completion dependency error occurred, contact support.", - completionDependencyException.InnerException as Xeption); + throw CreateCompletionClientDependencyException( + completionDependencyException); } catch (CompletionServiceException completionServiceException) { - throw new CompletionClientServiceException( - message: "Completion client service error occurred, contact support.", - completionServiceException.InnerException as Xeption); + throw CreateCompletionClientServiceException( + completionServiceException); } } @@ -54,5 +52,19 @@ private static CompletionClientValidationException CreateCompletionClientValidat message: "Completion client validation error occurred, fix errors and try again.", innerException); } + + private static CompletionClientDependencyException CreateCompletionClientDependencyException(Xeption innerException) + { + return new CompletionClientDependencyException( + message: "Completion dependency error occurred, contact support.", + innerException); + } + + private static CompletionClientServiceException CreateCompletionClientServiceException(Xeption innerException) + { + return new CompletionClientServiceException( + message: "Completion client service error occurred, contact support.", + innerException); + } } } From e7e22f4278133403cbfce844d819f58b852bf51a Mon Sep 17 00:00:00 2001 From: Lezune Date: Sun, 9 Jun 2024 17:12:39 -0700 Subject: [PATCH 242/283] Added additional Create methods --- .../Clients/FineTunes/FineTuneClient.cs | 24 ++++++++++++++----- 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/Standard.AI.OpenAI/Clients/FineTunes/FineTuneClient.cs b/Standard.AI.OpenAI/Clients/FineTunes/FineTuneClient.cs index 66a8fda5..e51cd685 100644 --- a/Standard.AI.OpenAI/Clients/FineTunes/FineTuneClient.cs +++ b/Standard.AI.OpenAI/Clients/FineTunes/FineTuneClient.cs @@ -31,9 +31,8 @@ public async ValueTask SubmitFineTuneAsync(FineTune fineTune) } catch (FineTuneDependencyException fineTuneDependencyException) { - throw new FineTuneClientDependencyException( - message: "Fine tune client dependency error occurred, contact support.", - fineTuneDependencyException.InnerException as Xeption); + throw CreateFineTuneClientDependencyException( + fineTuneDependencyException); } catch (FineTuneDependencyValidationException fineTuneDependencyValidationException) { @@ -42,9 +41,8 @@ public async ValueTask SubmitFineTuneAsync(FineTune fineTune) } catch (FineTuneServiceException fineTuneServiceException) { - throw new FineTuneClientServiceException( - message: "Fine tune client service error occurred, contact support.", - fineTuneServiceException.InnerException as Xeption); + throw CreateFineTuneClientServiceException( + fineTuneServiceException); } } @@ -54,5 +52,19 @@ private static FineTuneClientValidationException CreateFineTuneClientValidationE message: "Fine tune client validation error occurred, fix errors and try again.", innerException); } + + private static FineTuneClientDependencyException CreateFineTuneClientDependencyException(Xeption innerException) + { + return new FineTuneClientDependencyException( + message: "Fine tune client dependency error occurred, contact support.", + innerException); + } + + private static FineTuneClientServiceException CreateFineTuneClientServiceException(Xeption innerException) + { + return new FineTuneClientServiceException( + message: "Fine tune client service error occurred, contact support.", + innerException); + } } } From 3ff4dfb891822856e29be12b632de4a7ecb2c64e Mon Sep 17 00:00:00 2001 From: Lezune Date: Sun, 9 Jun 2024 17:20:06 -0700 Subject: [PATCH 243/283] Added additional Create methods --- .../ImageGenerationsClient.cs | 24 ++++++++++++++----- 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/Standard.AI.OpenAI/Clients/ImageGenerations/ImageGenerationsClient.cs b/Standard.AI.OpenAI/Clients/ImageGenerations/ImageGenerationsClient.cs index 89c1ba3f..8c6753b3 100644 --- a/Standard.AI.OpenAI/Clients/ImageGenerations/ImageGenerationsClient.cs +++ b/Standard.AI.OpenAI/Clients/ImageGenerations/ImageGenerationsClient.cs @@ -36,15 +36,13 @@ public async ValueTask GenerateImageAsync(ImageGeneration image } catch (ImageGenerationDependencyException imageGenerationDependencyException) { - throw new ImageGenerationClientDependencyException( - message: "Image generation client dependency error occurred, contact support.", - imageGenerationDependencyException.InnerException as Xeption); + throw CreateImageGenerationClientDependencyException( + imageGenerationDependencyException); } catch (ImageGenerationServiceException imageGenerationServiceException) { - throw new ImageGenerationClientServiceException( - message: "Image generation client service error occurred, contact support.", - imageGenerationServiceException.InnerException as Xeption); + throw CreateImageGenerationClientServiceException( + imageGenerationServiceException); } } @@ -54,5 +52,19 @@ private static ImageGenerationClientValidationException CreateImageGenerationCli message: "Image generation client validation error occurred, fix errors and try again.", innerException); } + + private static ImageGenerationClientDependencyException CreateImageGenerationClientDependencyException(Xeption innerException) + { + return new ImageGenerationClientDependencyException( + message: "Image generation client dependency error occurred, contact support.", + innerException); + } + + private static ImageGenerationClientServiceException CreateImageGenerationClientServiceException(Xeption innerException) + { + return new ImageGenerationClientServiceException( + message: "Image generation client service error occurred, contact support.", + innerException); + } } } \ No newline at end of file From 1b9341be342e575e56920b5c6eddeae2dd6e7a7b Mon Sep 17 00:00:00 2001 From: Lezune Date: Sun, 9 Jun 2024 20:31:57 -0700 Subject: [PATCH 244/283] Added additional Create methods to the Exceptions file and refactored code in the Validations file. --- .../AIFileOrchestrationService.Exceptions.cs | 31 +++++++++++++------ .../AIFileOrchestrationService.Validations.cs | 8 ++--- 2 files changed, 26 insertions(+), 13 deletions(-) diff --git a/Standard.AI.OpenAI/Services/Orchestrations/AIFiles/AIFileOrchestrationService.Exceptions.cs b/Standard.AI.OpenAI/Services/Orchestrations/AIFiles/AIFileOrchestrationService.Exceptions.cs index f119c6dd..bfba5777 100644 --- a/Standard.AI.OpenAI/Services/Orchestrations/AIFiles/AIFileOrchestrationService.Exceptions.cs +++ b/Standard.AI.OpenAI/Services/Orchestrations/AIFiles/AIFileOrchestrationService.Exceptions.cs @@ -117,12 +117,13 @@ private async ValueTask> TryCatch(ReturningAIFilesFu } } - private static AIFileOrchestrationDependencyException CreateAIFileOrchestrationDependencyException(Xeption innerException) + private static AIFileOrchestrationValidationException CreateAIFileOrchestrationValidationException(Xeption innerException) { - return new AIFileOrchestrationDependencyException( - message: "AI File dependency error occurred, contact support.", + return new AIFileOrchestrationValidationException( + message: "AI file validation error occurred, fix errors and try again.", innerException); } + private static AIFileOrchestrationDependencyValidationException CreateAIFileOrchestrationDependencyValidationException(Xeption innerException) { return new AIFileOrchestrationDependencyValidationException( @@ -130,17 +131,17 @@ private static AIFileOrchestrationDependencyValidationException CreateAIFileOrch innerException); } - private static AIFileOrchestrationServiceException CreateAIFileOrchestrationServiceException(Xeption innerException) + private static AIFileOrchestrationDependencyException CreateAIFileOrchestrationDependencyException(Xeption innerException) { - return new AIFileOrchestrationServiceException( - message: "AI File error occurred, contact support.", + return new AIFileOrchestrationDependencyException( + message: "AI File dependency error occurred, contact support.", innerException); } - private static AIFileOrchestrationValidationException CreateAIFileOrchestrationValidationException(Xeption innerException) + private static AIFileOrchestrationServiceException CreateAIFileOrchestrationServiceException(Xeption innerException) { - return new AIFileOrchestrationValidationException( - message: "AI file validation error occurred, fix errors and try again.", + return new AIFileOrchestrationServiceException( + message: "AI File error occurred, contact support.", innerException); } @@ -150,5 +151,17 @@ private static FailedAIFileOrchestrationServiceException CreateFailedAIFileOrche message: "Failed AI file service error occurred, contact support.", innerException); } + + private static NullAIFileOrchestrationException CreateNullAIFileOrchestrationException() + { + return new NullAIFileOrchestrationException( + message: "AI file is null."); + } + + private static InvalidAIFileOrchestrationException CreateInvalidAIFileOrchestrationException() + { + return new InvalidAIFileOrchestrationException( + message: "AI file is invalid."); + } } } diff --git a/Standard.AI.OpenAI/Services/Orchestrations/AIFiles/AIFileOrchestrationService.Validations.cs b/Standard.AI.OpenAI/Services/Orchestrations/AIFiles/AIFileOrchestrationService.Validations.cs index 8ab07f40..0b93c603 100644 --- a/Standard.AI.OpenAI/Services/Orchestrations/AIFiles/AIFileOrchestrationService.Validations.cs +++ b/Standard.AI.OpenAI/Services/Orchestrations/AIFiles/AIFileOrchestrationService.Validations.cs @@ -23,8 +23,7 @@ private static void ValidateAIFileNotNull(AIFile aiFile) { if (aiFile is null) { - throw new NullAIFileOrchestrationException( - message: "AI file is null."); + throw CreateNullAIFileOrchestrationException(); } } @@ -55,8 +54,7 @@ private static void ValidateAIFileIdNotNull(string fileId) private static void Validate(params (dynamic Rule, string Parameter)[] validations) { var invalidAIFileException = - new InvalidAIFileOrchestrationException( - message: "AI file is invalid."); + CreateInvalidAIFileOrchestrationException(); foreach ((dynamic rule, string parameter) in validations) { @@ -70,5 +68,7 @@ private static void Validate(params (dynamic Rule, string Parameter)[] validatio invalidAIFileException.ThrowIfContainsErrors(); } + + } } From 60f1ab1296d2ba07e296556e3992471f385cb743 Mon Sep 17 00:00:00 2001 From: Lezune Date: Sun, 9 Jun 2024 20:52:04 -0700 Subject: [PATCH 245/283] Refactored code and organized Create methods --- .../Foundations/AIModels/AIModelService.Exceptions.cs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/Standard.AI.OpenAI/Services/Foundations/AIModels/AIModelService.Exceptions.cs b/Standard.AI.OpenAI/Services/Foundations/AIModels/AIModelService.Exceptions.cs index 341e268d..b866929d 100644 --- a/Standard.AI.OpenAI/Services/Foundations/AIModels/AIModelService.Exceptions.cs +++ b/Standard.AI.OpenAI/Services/Foundations/AIModels/AIModelService.Exceptions.cs @@ -25,8 +25,7 @@ private async ValueTask TryCatch(ReturningAIModelFunction returningAIMo } catch (InvalidAIModelException invalidAIModelException) { - throw new AIModelValidationException( - message: "AI Model validation error occurred, fix errors and try again.", + throw CreateAIModelValidationException( invalidAIModelException); } catch (HttpResponseUrlNotFoundException httpResponseUrlNotFoundException) @@ -151,6 +150,13 @@ private async ValueTask> TryCatch(ReturningAIModelsFunction } } + private static AIModelValidationException CreateAIModelValidationException(Xeption innerException) + { + return new AIModelValidationException( + message: "AI Model validation error occurred, fix errors and try again.", + innerException); + } + private static AIModelDependencyException CreateAIModelDependencyException(Xeption innerException) { return new AIModelDependencyException( From 2b24494d8cef4154b01e0d58f6a368d812cc0338 Mon Sep 17 00:00:00 2001 From: Lezune Date: Sun, 9 Jun 2024 20:57:02 -0700 Subject: [PATCH 246/283] Resolved error and Reorganized Create methods --- .../AIModels/AIModelService.Exceptions.cs | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/Standard.AI.OpenAI/Services/Foundations/AIModels/AIModelService.Exceptions.cs b/Standard.AI.OpenAI/Services/Foundations/AIModels/AIModelService.Exceptions.cs index a88edb8d..7e20802e 100644 --- a/Standard.AI.OpenAI/Services/Foundations/AIModels/AIModelService.Exceptions.cs +++ b/Standard.AI.OpenAI/Services/Foundations/AIModels/AIModelService.Exceptions.cs @@ -173,16 +173,17 @@ private static AIModelDependencyValidationException CreateAIModelDependencyValid innerException); } - private static AIModelServiceException CreateAIModelServiceException(Xeption innerException) + private static ExcessiveCallAIModelException CreateExcessiveCallAIModelException(Exception innerException) { - return new AIModelServiceException( - message: "AI Model service error occurred, contact support.", + return new ExcessiveCallAIModelException( + message: "Excessive call error occurred, limit your calls.", + innerException); } - private static ExcessiveCallAIModelException CreateExcessiveCallAIModelException(Exception innerException) + private static AIModelServiceException CreateAIModelServiceException(Xeption innerException) { - return new ExcessiveCallAIModelException( - message: "Excessive call error occurred, limit your calls.", + return new AIModelServiceException( + message: "AI Model service error occurred, contact support.", innerException); } } From 7d3871c4e19bc8c7ce46e0fa7c81307f49e4fe2b Mon Sep 17 00:00:00 2001 From: Lezune Date: Sun, 9 Jun 2024 21:30:15 -0700 Subject: [PATCH 247/283] Refactored code --- .../AIModels/AIModelService.Exceptions.cs | 78 ++++++------------- 1 file changed, 24 insertions(+), 54 deletions(-) diff --git a/Standard.AI.OpenAI/Services/Foundations/AIModels/AIModelService.Exceptions.cs b/Standard.AI.OpenAI/Services/Foundations/AIModels/AIModelService.Exceptions.cs index 076b588a..418b0821 100644 --- a/Standard.AI.OpenAI/Services/Foundations/AIModels/AIModelService.Exceptions.cs +++ b/Standard.AI.OpenAI/Services/Foundations/AIModels/AIModelService.Exceptions.cs @@ -31,7 +31,8 @@ private async ValueTask TryCatch(ReturningAIModelFunction returningAIMo catch (HttpResponseUrlNotFoundException httpResponseUrlNotFoundException) { var invalidConfigurationAIModelException = - CreateInvalidConfigurationAIModelException( + new InvalidConfigurationAIModelException( + message: "Invalid AI Model configuration error occurred, contact support.", httpResponseUrlNotFoundException); throw CreateAIModelDependencyException( @@ -40,7 +41,8 @@ private async ValueTask TryCatch(ReturningAIModelFunction returningAIMo catch (HttpResponseUnauthorizedException httpResponseUnauthorizedException) { var unauthorizedAIModelException = - CreateUnauthorizedAIModelException( + new UnauthorizedAIModelException( + message: "Unauthorized AI Model error occurred, fix errors and try again.", httpResponseUnauthorizedException); throw CreateAIModelDependencyException( @@ -49,7 +51,8 @@ private async ValueTask TryCatch(ReturningAIModelFunction returningAIMo catch (HttpResponseForbiddenException httpResponseForbiddenException) { var unauthorizedAIModelException = - CreateUnauthorizedAIModelException( + new UnauthorizedAIModelException( + message: "Unauthorized AI Model error occurred, fix errors and try again.", httpResponseForbiddenException); throw CreateAIModelDependencyException( @@ -78,7 +81,8 @@ private async ValueTask TryCatch(ReturningAIModelFunction returningAIMo catch (HttpResponseTooManyRequestsException httpResponseTooManyRequestsException) { var excessiveCallAIModelException = - CreateExcessiveCallAIModelException( + new ExcessiveCallAIModelException( + message: "Excessive call error occurred, limit your calls.", httpResponseTooManyRequestsException); throw CreateAIModelDependencyValidationException( @@ -87,7 +91,8 @@ private async ValueTask TryCatch(ReturningAIModelFunction returningAIMo catch (HttpResponseException httpResponseException) { var failedServerAIModelException = - CreateFailedServerAIModelException( + new FailedServerAIModelException( + message: "Failed AI Model server error occurred, contact support", httpResponseException); throw CreateAIModelDependencyException( @@ -96,7 +101,8 @@ private async ValueTask TryCatch(ReturningAIModelFunction returningAIMo catch (Exception exception) { var failedAIModelServiceException = - CreateFailedAIModelServiceException( + new FailedAIModelServiceException( + message: "Failed AI Model Service Exception occurred, please contact support for assistance.", exception); throw CreateAIModelServiceException( @@ -113,7 +119,8 @@ private async ValueTask> TryCatch(ReturningAIModelsFunction catch (HttpResponseUrlNotFoundException httpResponseUrlNotFoundException) { var invalidConfigurationAIModelException = - CreateInvalidConfigurationAIModelException( + new InvalidConfigurationAIModelException( + message: "Invalid AI Model configuration error occurred, contact support.", httpResponseUrlNotFoundException); throw CreateAIModelDependencyException( @@ -122,7 +129,8 @@ private async ValueTask> TryCatch(ReturningAIModelsFunction catch (HttpResponseUnauthorizedException httpResponseUnauthorizedException) { var unauthorizedAIModelException = - CreateUnauthorizedAIModelException( + new UnauthorizedAIModelException( + message: "Unauthorized AI Model error occurred, fix errors and try again.", httpResponseUnauthorizedException); throw CreateAIModelDependencyException( @@ -131,7 +139,8 @@ private async ValueTask> TryCatch(ReturningAIModelsFunction catch (HttpResponseForbiddenException httpResponseForbiddenException) { var unauthorizedAIModelException = - CreateUnauthorizedAIModelException( + new UnauthorizedAIModelException( + message: "Unauthorized AI Model error occurred, fix errors and try again.", httpResponseForbiddenException); throw CreateAIModelDependencyException( @@ -140,7 +149,8 @@ private async ValueTask> TryCatch(ReturningAIModelsFunction catch (HttpResponseTooManyRequestsException httpResponseTooManyRequestsException) { var excessiveCallAIModelException = - CreateExcessiveCallAIModelException( + new ExcessiveCallAIModelException( + message: "Excessive call error occurred, limit your calls.", httpResponseTooManyRequestsException); throw CreateAIModelDependencyValidationException( @@ -149,7 +159,8 @@ private async ValueTask> TryCatch(ReturningAIModelsFunction catch (HttpResponseException httpResponseException) { var failedServerAIModelException = - CreateFailedServerAIModelException( + new FailedServerAIModelException( + message: "Failed AI Model server error occurred, contact support", httpResponseException); throw CreateAIModelDependencyException( @@ -158,7 +169,8 @@ private async ValueTask> TryCatch(ReturningAIModelsFunction catch (Exception exception) { var failedAIModelServiceException = - CreateFailedAIModelServiceException( + new FailedAIModelServiceException( + message: "Failed AI Model Service Exception occurred, please contact support for assistance.", exception); throw CreateAIModelServiceException( @@ -166,13 +178,6 @@ private async ValueTask> TryCatch(ReturningAIModelsFunction } } - private static NotFoundAIModelException CreateNotFoundAIModelException(Exception innerException) - { - return new NotFoundAIModelException( - message: "AI Model not found.", - innerException); - } - private static AIModelValidationException CreateAIModelValidationException(Xeption innerException) { return new AIModelValidationException( @@ -180,13 +185,6 @@ private static AIModelValidationException CreateAIModelValidationException(Xepti innerException); } - private static InvalidConfigurationAIModelException CreateInvalidConfigurationAIModelException(Exception innerException) - { - return new InvalidConfigurationAIModelException( - message: "Invalid AI Model configuration error occurred, contact support.", - innerException); - } - private static AIModelDependencyException CreateAIModelDependencyException(Xeption innerException) { return new AIModelDependencyException( @@ -194,13 +192,6 @@ private static AIModelDependencyException CreateAIModelDependencyException(Xepti innerException); } - private static UnauthorizedAIModelException CreateUnauthorizedAIModelException(Exception innerException) - { - return new UnauthorizedAIModelException( - message: "Unauthorized AI Model error occurred, fix errors and try again.", - innerException); - } - private static AIModelDependencyValidationException CreateAIModelDependencyValidationException(Xeption innerException) { return new AIModelDependencyValidationException( @@ -208,27 +199,6 @@ private static AIModelDependencyValidationException CreateAIModelDependencyValid innerException); } - private static ExcessiveCallAIModelException CreateExcessiveCallAIModelException(Exception innerException) - { - return new ExcessiveCallAIModelException( - message: "Excessive call error occurred, limit your calls.", - innerException); - } - - private static FailedServerAIModelException CreateFailedServerAIModelException(Exception innerException) - { - return new FailedServerAIModelException( - message: "Failed AI Model server error occurred, contact support", - innerException); - } - - private static FailedAIModelServiceException CreateFailedAIModelServiceException(Exception innerException) - { - return new FailedAIModelServiceException( - message: "Failed AI Model Service Exception occurred, please contact support for assistance.", - innerException); - } - private static AIModelServiceException CreateAIModelServiceException(Xeption innerException) { return new AIModelServiceException( From dc647bee283e85f61265d995ee3ec02109fefb99 Mon Sep 17 00:00:00 2001 From: Lezune Date: Sun, 9 Jun 2024 21:36:56 -0700 Subject: [PATCH 248/283] Refactored code --- .../AIFileOrchestrationService.Exceptions.cs | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/Standard.AI.OpenAI/Services/Orchestrations/AIFiles/AIFileOrchestrationService.Exceptions.cs b/Standard.AI.OpenAI/Services/Orchestrations/AIFiles/AIFileOrchestrationService.Exceptions.cs index bfba5777..b983f218 100644 --- a/Standard.AI.OpenAI/Services/Orchestrations/AIFiles/AIFileOrchestrationService.Exceptions.cs +++ b/Standard.AI.OpenAI/Services/Orchestrations/AIFiles/AIFileOrchestrationService.Exceptions.cs @@ -77,7 +77,8 @@ private async ValueTask TryCatch(ReturningAIFileFunction returningAIFile catch (Exception exception) { var failedAIFileOrchestrationServiceException = - CreateFailedAIFileOrchestrationServiceException( + new FailedAIFileOrchestrationServiceException( + message: "Failed AI file service error occurred, contact support.", exception); throw CreateAIFileOrchestrationServiceException( @@ -109,7 +110,8 @@ private async ValueTask> TryCatch(ReturningAIFilesFu catch (Exception exception) { var failedAIFileOrchestrationServiceException = - CreateFailedAIFileOrchestrationServiceException( + new FailedAIFileOrchestrationServiceException( + message: "Failed AI file service error occurred, contact support.", exception); throw CreateAIFileOrchestrationServiceException( @@ -145,13 +147,6 @@ private static AIFileOrchestrationServiceException CreateAIFileOrchestrationServ innerException); } - private static FailedAIFileOrchestrationServiceException CreateFailedAIFileOrchestrationServiceException(Exception innerException) - { - return new FailedAIFileOrchestrationServiceException( - message: "Failed AI file service error occurred, contact support.", - innerException); - } - private static NullAIFileOrchestrationException CreateNullAIFileOrchestrationException() { return new NullAIFileOrchestrationException( From 1717dcb4149e470c793426dad277f06409f62d44 Mon Sep 17 00:00:00 2001 From: Lezune Date: Sun, 9 Jun 2024 21:43:00 -0700 Subject: [PATCH 249/283] Refactored Code --- ...strationServiceTests.Validation.RemoveFileByIdAsync.cs | 3 ++- .../AIFileOrchestrationServiceTests.Validations.Upload.cs | 8 +++++--- .../AIFiles/AIFileOrchestrationService.Validations.cs | 3 ++- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/Standard.AI.OpenAI.Tests.Unit/Services/Orchestrations/AIFiles/AIFileOrchestrationServiceTests.Validation.RemoveFileByIdAsync.cs b/Standard.AI.OpenAI.Tests.Unit/Services/Orchestrations/AIFiles/AIFileOrchestrationServiceTests.Validation.RemoveFileByIdAsync.cs index 11f3c6ba..5ae64533 100644 --- a/Standard.AI.OpenAI.Tests.Unit/Services/Orchestrations/AIFiles/AIFileOrchestrationServiceTests.Validation.RemoveFileByIdAsync.cs +++ b/Standard.AI.OpenAI.Tests.Unit/Services/Orchestrations/AIFiles/AIFileOrchestrationServiceTests.Validation.RemoveFileByIdAsync.cs @@ -18,7 +18,8 @@ private async Task ShouldThrowValidationExceptionOnRemoveFileIfFileIdIsInvalid(s { // given var invalidAiFileOrchestrationException = - CreateInvalidAIFileOrchestrationException(); + new InvalidAIFileOrchestrationException( + message: "AI file is invalid."); invalidAiFileOrchestrationException.AddData( key: nameof(AIFile.Response.Id), diff --git a/Standard.AI.OpenAI.Tests.Unit/Services/Orchestrations/AIFiles/AIFileOrchestrationServiceTests.Validations.Upload.cs b/Standard.AI.OpenAI.Tests.Unit/Services/Orchestrations/AIFiles/AIFileOrchestrationServiceTests.Validations.Upload.cs index c184a029..bb22e4c8 100644 --- a/Standard.AI.OpenAI.Tests.Unit/Services/Orchestrations/AIFiles/AIFileOrchestrationServiceTests.Validations.Upload.cs +++ b/Standard.AI.OpenAI.Tests.Unit/Services/Orchestrations/AIFiles/AIFileOrchestrationServiceTests.Validations.Upload.cs @@ -60,8 +60,9 @@ private async Task ShouldThrowValidationExceptionOnUploadIfRequestIsNullAsync() // given var invalidAIFile = new AIFile(); - var invalidAIFileOrchestrationException = - CreateInvalidAIFileOrchestrationException(); + var invalidAIFileOrchestrationException = + new InvalidAIFileOrchestrationException( + message: "AI file is invalid."); invalidAIFileOrchestrationException.AddData( key: nameof(AIFileRequest), @@ -111,7 +112,8 @@ private async Task ShouldThrowValidationExceptionIfRequestIsInvalidAsync( invalidAIFile.Request.Name = invalidName; var invalidAIFileOrchestrationException = - CreateInvalidAIFileOrchestrationException(); + new InvalidAIFileOrchestrationException( + message: "AI file is invalid."); invalidAIFileOrchestrationException.AddData( key: nameof(AIFileRequest.Name), diff --git a/Standard.AI.OpenAI/Services/Orchestrations/AIFiles/AIFileOrchestrationService.Validations.cs b/Standard.AI.OpenAI/Services/Orchestrations/AIFiles/AIFileOrchestrationService.Validations.cs index 0b93c603..607122a3 100644 --- a/Standard.AI.OpenAI/Services/Orchestrations/AIFiles/AIFileOrchestrationService.Validations.cs +++ b/Standard.AI.OpenAI/Services/Orchestrations/AIFiles/AIFileOrchestrationService.Validations.cs @@ -54,7 +54,8 @@ private static void ValidateAIFileIdNotNull(string fileId) private static void Validate(params (dynamic Rule, string Parameter)[] validations) { var invalidAIFileException = - CreateInvalidAIFileOrchestrationException(); + new InvalidAIFileOrchestrationException( + message: "AI file is invalid."); foreach ((dynamic rule, string parameter) in validations) { From 022d3222113609cc9780f1048fb1e6e9facb1cdd Mon Sep 17 00:00:00 2001 From: Lezune Date: Sun, 9 Jun 2024 21:46:39 -0700 Subject: [PATCH 250/283] Refactored code in the Unit Test files to accomadate change in the constructor from InvalidAIFileOrchestrationException class --- .../AIFiles/AIFileOrchestrationServiceTests.cs | 6 ------ 1 file changed, 6 deletions(-) diff --git a/Standard.AI.OpenAI.Tests.Unit/Services/Orchestrations/AIFiles/AIFileOrchestrationServiceTests.cs b/Standard.AI.OpenAI.Tests.Unit/Services/Orchestrations/AIFiles/AIFileOrchestrationServiceTests.cs index 4e6437cf..3b058f87 100644 --- a/Standard.AI.OpenAI.Tests.Unit/Services/Orchestrations/AIFiles/AIFileOrchestrationServiceTests.cs +++ b/Standard.AI.OpenAI.Tests.Unit/Services/Orchestrations/AIFiles/AIFileOrchestrationServiceTests.cs @@ -142,11 +142,5 @@ private static string CreateRandomFileId() return randomId; } - - private static InvalidAIFileOrchestrationException CreateInvalidAIFileOrchestrationException() - { - return new InvalidAIFileOrchestrationException( - message: "AI file is invalid."); - } } } \ No newline at end of file From 3e96d64c08adf6f3b1528a6646883b9e0df67f0f Mon Sep 17 00:00:00 2001 From: Lezune Date: Sun, 9 Jun 2024 21:47:57 -0700 Subject: [PATCH 251/283] Committing changes --- .../AIFiles/Exceptions/InvalidAIFileOrchestrationException.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Standard.AI.OpenAI/Models/Services/Orchestrations/AIFiles/Exceptions/InvalidAIFileOrchestrationException.cs b/Standard.AI.OpenAI/Models/Services/Orchestrations/AIFiles/Exceptions/InvalidAIFileOrchestrationException.cs index 78f72f50..d5a4878a 100644 --- a/Standard.AI.OpenAI/Models/Services/Orchestrations/AIFiles/Exceptions/InvalidAIFileOrchestrationException.cs +++ b/Standard.AI.OpenAI/Models/Services/Orchestrations/AIFiles/Exceptions/InvalidAIFileOrchestrationException.cs @@ -7,7 +7,7 @@ namespace Standard.AI.OpenAI.Models.Services.Orchestrations.AIFiles.Exceptions { public class InvalidAIFileOrchestrationException : Xeption - { + { public InvalidAIFileOrchestrationException(string message) : base(message) { } From 2e2dfe8dae0f8bbcd892673b3de66b49a981ffbe Mon Sep 17 00:00:00 2001 From: Lezune Date: Sun, 9 Jun 2024 23:11:28 -0700 Subject: [PATCH 252/283] Refactored Services/Foundations/LocalFiles/LocalFileService.Exceptions.cs --- .../LocalFiles/LocalFileService.Exceptions.cs | 54 ++++++++----------- 1 file changed, 21 insertions(+), 33 deletions(-) diff --git a/Standard.AI.OpenAI/Services/Foundations/LocalFiles/LocalFileService.Exceptions.cs b/Standard.AI.OpenAI/Services/Foundations/LocalFiles/LocalFileService.Exceptions.cs index cb716b75..ce297677 100644 --- a/Standard.AI.OpenAI/Services/Foundations/LocalFiles/LocalFileService.Exceptions.cs +++ b/Standard.AI.OpenAI/Services/Foundations/LocalFiles/LocalFileService.Exceptions.cs @@ -21,14 +21,13 @@ private Stream TryCatch(ReturningStreamFunction returningStreamFunction) } catch (InvalidLocalFileException invalidFileException) { - throw new LocalFileValidationException( - message: "Local file validation error occurred, fix error and try again.", - invalidFileException); + throw CreateLocalFileValidationException(invalidFileException); } catch (ArgumentException argumentException) { - var invalidFileException = - CreateInvalidLocalFileException( + var invalidFileException = + new InvalidLocalFileException( + message: "Invalid local file error occurred, fix error and try again.", argumentException); throw CreateLocalFileDependencyValidationException( @@ -36,8 +35,9 @@ private Stream TryCatch(ReturningStreamFunction returningStreamFunction) } catch (PathTooLongException pathTooLongException) { - var invalidFileException = - CreateInvalidLocalFileException( + var invalidFileException = + new InvalidLocalFileException( + message: "Invalid local file error occurred, fix error and try again.", pathTooLongException); throw CreateLocalFileDependencyValidationException( @@ -46,7 +46,8 @@ private Stream TryCatch(ReturningStreamFunction returningStreamFunction) catch (FileNotFoundException fileNotFoundException) { var notFoundFileException = - CreateNotFoundLocalFileException( + new NotFoundLocalFileException( + message: "Not found local file error occurred, fix error and try again.", fileNotFoundException); throw CreateLocalFileDependencyValidationException( @@ -55,7 +56,8 @@ private Stream TryCatch(ReturningStreamFunction returningStreamFunction) catch (DirectoryNotFoundException directoryNotFoundException) { var notFoundFileException = - CreateNotFoundLocalFileException( + new NotFoundLocalFileException( + message: "Not found local file error occurred, fix error and try again.", directoryNotFoundException); throw CreateLocalFileDependencyValidationException( @@ -64,7 +66,8 @@ private Stream TryCatch(ReturningStreamFunction returningStreamFunction) catch (IOException ioException) { var failedFileException = - CreateFailedLocalFileDependencyException( + new FailedLocalFileDependencyException( + message: "Failed local file error occurred, contact support.", ioException); throw CreateLocalFileDependencyException( @@ -73,7 +76,8 @@ private Stream TryCatch(ReturningStreamFunction returningStreamFunction) catch (NotSupportedException notSupportedException) { var failedFileException = - CreateFailedLocalFileDependencyException( + new FailedLocalFileDependencyException( + message: "Failed local file error occurred, contact support.", notSupportedException); throw CreateLocalFileDependencyException( @@ -92,27 +96,12 @@ private Stream TryCatch(ReturningStreamFunction returningStreamFunction) } } - private static FailedLocalFileDependencyException CreateFailedLocalFileDependencyException(Exception innerException) - { - return new FailedLocalFileDependencyException( - message: "Failed local file error occurred, contact support.", - innerException); - } - - private static InvalidLocalFileException CreateInvalidLocalFileException(Exception innerException) + private static LocalFileValidationException CreateLocalFileValidationException(Xeption innerException) { - return new InvalidLocalFileException( - message: "Invalid local file error occurred, fix error and try again.", + return new LocalFileValidationException( + message: "Local file validation error occurred, fix error and try again.", innerException); } - - private static LocalFileDependencyException CreateLocalFileDependencyException(Xeption innerException) - { - return new LocalFileDependencyException( - message: "Local file dependency error occurred, contact support.", - innerException); - } - private static LocalFileDependencyValidationException CreateLocalFileDependencyValidationException(Xeption innerException) { return new LocalFileDependencyValidationException( @@ -120,12 +109,11 @@ private static LocalFileDependencyValidationException CreateLocalFileDependencyV innerException); } - private static NotFoundLocalFileException CreateNotFoundLocalFileException(Exception innerException) + private static LocalFileDependencyException CreateLocalFileDependencyException(Xeption innerException) { - return new NotFoundLocalFileException( - message: "Not found local file error occurred, fix error and try again.", + return new LocalFileDependencyException( + message: "Local file dependency error occurred, contact support.", innerException); } - } } From 68a47db54b8fd4a9d756d8be7d33509fd236aed6 Mon Sep 17 00:00:00 2001 From: Lezune Date: Sun, 9 Jun 2024 23:17:09 -0700 Subject: [PATCH 253/283] Added Create method to the Exception file and refactored code. --- .../LocalFiles/LocalFileService.Exceptions.cs | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/Standard.AI.OpenAI/Services/Foundations/LocalFiles/LocalFileService.Exceptions.cs b/Standard.AI.OpenAI/Services/Foundations/LocalFiles/LocalFileService.Exceptions.cs index ce297677..9840df6d 100644 --- a/Standard.AI.OpenAI/Services/Foundations/LocalFiles/LocalFileService.Exceptions.cs +++ b/Standard.AI.OpenAI/Services/Foundations/LocalFiles/LocalFileService.Exceptions.cs @@ -90,9 +90,7 @@ private Stream TryCatch(ReturningStreamFunction returningStreamFunction) message: "Failed local file service error occurred, contact support.", exception); - throw new LocalFileServiceException( - message: "Local file service error occurred, contact support.", - failedLocalFileServiceException); + throw CreateLocalFileServiceException(failedLocalFileServiceException); } } @@ -115,5 +113,12 @@ private static LocalFileDependencyException CreateLocalFileDependencyException(X message: "Local file dependency error occurred, contact support.", innerException); } + + private static LocalFileServiceException CreateLocalFileServiceException(Xeption innerException) + { + return new LocalFileServiceException( + message: "Local file service error occurred, contact support.", + innerException); + } } } From 7e8302629dd1671c8d9d226230b3b238c4cf2e93 Mon Sep 17 00:00:00 2001 From: Lezune Date: Mon, 10 Jun 2024 06:26:01 -0700 Subject: [PATCH 254/283] Resolved merge conflict with users/Lezune/Foundations-Completions-CompletionDependencyValidationException-Update branch --- ...CompletionDependencyValidationException.cs | 6 ----- .../CompletionService.Exceptions.cs | 24 ++++++++++++++++--- 2 files changed, 21 insertions(+), 9 deletions(-) diff --git a/Standard.AI.OpenAI/Models/Services/Foundations/Completions/Exceptions/CompletionDependencyValidationException.cs b/Standard.AI.OpenAI/Models/Services/Foundations/Completions/Exceptions/CompletionDependencyValidationException.cs index 665601a4..f51f5cfc 100644 --- a/Standard.AI.OpenAI/Models/Services/Foundations/Completions/Exceptions/CompletionDependencyValidationException.cs +++ b/Standard.AI.OpenAI/Models/Services/Foundations/Completions/Exceptions/CompletionDependencyValidationException.cs @@ -8,12 +8,6 @@ namespace Standard.AI.OpenAI.Models.Services.Foundations.Completions.Exceptions { public class CompletionDependencyValidationException : Xeption { - public CompletionDependencyValidationException(Xeption innerException) - : base( - message: "Completion dependency validation error occurred, fix errors and try again.", - innerException: innerException) - { } - public CompletionDependencyValidationException(string message, Xeption innerException) : base(message, innerException) { } diff --git a/Standard.AI.OpenAI/Services/Foundations/Completions/CompletionService.Exceptions.cs b/Standard.AI.OpenAI/Services/Foundations/Completions/CompletionService.Exceptions.cs index 93905741..003c8375 100644 --- a/Standard.AI.OpenAI/Services/Foundations/Completions/CompletionService.Exceptions.cs +++ b/Standard.AI.OpenAI/Services/Foundations/Completions/CompletionService.Exceptions.cs @@ -59,14 +59,16 @@ private static async ValueTask TryCatch(ReturningCompletionFunction var notFoundCompletionException = new NotFoundCompletionException(httpResponseNotFoundException); - throw new CompletionDependencyValidationException(notFoundCompletionException); + throw CreateCompletionDependencyValidationException( + notFoundCompletionException); } catch (HttpResponseBadRequestException httpResponseBadRequestException) { var invalidCompletionException = new InvalidCompletionException(httpResponseBadRequestException); - throw new CompletionDependencyValidationException(invalidCompletionException); + throw CreateCompletionDependencyValidationException( + invalidCompletionException); } catch (HttpResponseTooManyRequestsException httpResponseTooManyRequestsException) @@ -74,7 +76,8 @@ private static async ValueTask TryCatch(ReturningCompletionFunction var excessiveCallCompletionException = new ExcessiveCallCompletionException(httpResponseTooManyRequestsException); - throw new CompletionDependencyValidationException(excessiveCallCompletionException); + throw CreateCompletionDependencyValidationException( + excessiveCallCompletionException); } catch (HttpResponseException httpResponseException) { @@ -92,11 +95,26 @@ private static async ValueTask TryCatch(ReturningCompletionFunction throw new CompletionServiceException(failedCompletionServiceException); } } + private static CompletionDependencyException CreateCompletionDependencyException(Xeption innerException) { return new CompletionDependencyException( message: "Completion dependency error occurred, contact support.", innerException); } + + + private static CompletionDependencyValidationException CreateCompletionDependencyValidationException(Xeption innerException) + { + return new CompletionDependencyValidationException( + message: "Completion dependency validation error occurred, fix errors and try again.", + innerException); + } + + + + + + } } From 96b5c0ee2527cbcee641614e7f8c9665436a58e5 Mon Sep 17 00:00:00 2001 From: Lezune Date: Mon, 10 Jun 2024 07:45:11 -0700 Subject: [PATCH 255/283] Reverted Unit Test files to original state and updated method calls to adhere to the changes made to the InvalidAudioTranscriptionException class constructor --- .../AudioTranscriptionServiceTests.Validations.Send.cs | 6 ++++-- .../AudioTranscriptions/AudioTranscriptionServiceTests.cs | 6 ------ .../AudioTranscriptionService.Validations.cs | 5 +++-- 3 files changed, 7 insertions(+), 10 deletions(-) diff --git a/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/AudioTranscriptions/AudioTranscriptionServiceTests.Validations.Send.cs b/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/AudioTranscriptions/AudioTranscriptionServiceTests.Validations.Send.cs index f23d55c6..c9e4ada6 100644 --- a/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/AudioTranscriptions/AudioTranscriptionServiceTests.Validations.Send.cs +++ b/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/AudioTranscriptions/AudioTranscriptionServiceTests.Validations.Send.cs @@ -57,7 +57,8 @@ private async Task ShouldThrowValidationExceptionOnSendIfAudioTranscriptionReque }; var invalidAudioTranscriptionException = - createInvalidAudioTranscriptionException(); + new InvalidAudioTranscriptionException( + message: "Audio transcription is invalid."); invalidAudioTranscriptionException.AddData( key: nameof(AudioTranscription.Request), @@ -105,7 +106,8 @@ private async Task ShouldThrowValidationExceptionOnSendIfAudioTranscriptionReque }; var invalidAudioTranscriptionException = - createInvalidAudioTranscriptionException(); + new InvalidAudioTranscriptionException( + message: "Audio transcription is invalid."); invalidAudioTranscriptionException.AddData( key: nameof(AudioTranscriptionRequest.FileName), diff --git a/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/AudioTranscriptions/AudioTranscriptionServiceTests.cs b/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/AudioTranscriptions/AudioTranscriptionServiceTests.cs index f77cb56a..3ed51b7e 100644 --- a/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/AudioTranscriptions/AudioTranscriptionServiceTests.cs +++ b/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/AudioTranscriptions/AudioTranscriptionServiceTests.cs @@ -105,11 +105,5 @@ private static Filler AudioTranscriptionFiller() return filler; } - - private static InvalidAudioTranscriptionException createInvalidAudioTranscriptionException() - { - return new InvalidAudioTranscriptionException( - message: "Audio transcription is invalid."); - } } } diff --git a/Standard.AI.OpenAI/Services/Foundations/AudioTranscriptions/AudioTranscriptionService.Validations.cs b/Standard.AI.OpenAI/Services/Foundations/AudioTranscriptions/AudioTranscriptionService.Validations.cs index 8d8c0db0..e77d5497 100644 --- a/Standard.AI.OpenAI/Services/Foundations/AudioTranscriptions/AudioTranscriptionService.Validations.cs +++ b/Standard.AI.OpenAI/Services/Foundations/AudioTranscriptions/AudioTranscriptionService.Validations.cs @@ -48,8 +48,9 @@ private static void ValidateAudioTranscriptionIsNotNull(AudioTranscription audio private static void Validate(params (dynamic Rule, string Parameter)[] validations) { - InvalidAudioTranscriptionException invalidAudioTranscriptionException = new InvalidAudioTranscriptionException( - message: "Audio transcription is invalid."); + InvalidAudioTranscriptionException invalidAudioTranscriptionException = + new InvalidAudioTranscriptionException( + message: "Audio transcription is invalid."); foreach ((dynamic rule, string parameter) in validations) { From 06d379bd39aaa9e4ae8a4c2b880483f2a2256e8e Mon Sep 17 00:00:00 2001 From: Lezune Date: Tue, 11 Jun 2024 13:43:12 -0700 Subject: [PATCH 256/283] Refactored code --- .../Foundations/AIModels/AIModelService.Exceptions.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Standard.AI.OpenAI/Services/Foundations/AIModels/AIModelService.Exceptions.cs b/Standard.AI.OpenAI/Services/Foundations/AIModels/AIModelService.Exceptions.cs index 418b0821..3932c200 100644 --- a/Standard.AI.OpenAI/Services/Foundations/AIModels/AIModelService.Exceptions.cs +++ b/Standard.AI.OpenAI/Services/Foundations/AIModels/AIModelService.Exceptions.cs @@ -182,28 +182,28 @@ private static AIModelValidationException CreateAIModelValidationException(Xepti { return new AIModelValidationException( message: "AI Model validation error occurred, fix errors and try again.", - innerException); + innerException: innerException); } private static AIModelDependencyException CreateAIModelDependencyException(Xeption innerException) { return new AIModelDependencyException( message: "AI Model dependency error occurred, contact support.", - innerException); + innerException: innerException); } private static AIModelDependencyValidationException CreateAIModelDependencyValidationException(Xeption innerException) { return new AIModelDependencyValidationException( message: "AI Model dependency validation error occurred, fix errors and try again.", - innerException); + innerException: innerException); } private static AIModelServiceException CreateAIModelServiceException(Xeption innerException) { return new AIModelServiceException( message: "AI Model service error occurred, contact support.", - innerException); + innerException: innerException); } } } \ No newline at end of file From e540d8e5da89139a5047e29b73a23acfc358d76a Mon Sep 17 00:00:00 2001 From: Lezune Date: Tue, 11 Jun 2024 13:51:03 -0700 Subject: [PATCH 257/283] Refactored Code --- .../AudioTranscriptionService.Exceptions.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Standard.AI.OpenAI/Services/Foundations/AudioTranscriptions/AudioTranscriptionService.Exceptions.cs b/Standard.AI.OpenAI/Services/Foundations/AudioTranscriptions/AudioTranscriptionService.Exceptions.cs index 128a34a9..2551f2d9 100644 --- a/Standard.AI.OpenAI/Services/Foundations/AudioTranscriptions/AudioTranscriptionService.Exceptions.cs +++ b/Standard.AI.OpenAI/Services/Foundations/AudioTranscriptions/AudioTranscriptionService.Exceptions.cs @@ -98,28 +98,28 @@ private static AudioTranscriptionValidationException CreateAudioTranscriptionVal { return new AudioTranscriptionValidationException( message: "Audio transcription validation error occurred, fix errors and try again.", - innerException); + innerException: innerException); } private static AudioTranscriptionDependencyException CreateAudioTranscriptionDependencyException(Xeption innerException) { return new AudioTranscriptionDependencyException( message: "Audio transcription dependency error occurred, contact support.", - innerException); + innerException: innerException); } private static AudioTranscriptionDependencyValidationException CreateAudioTranscriptionDependencyValidationException(Xeption innerException) { return new AudioTranscriptionDependencyValidationException( message: "Chat completion dependency validation error occurred, fix errors and try again.", - innerException); + innerException: innerException); } private static AudioTranscriptionServiceException CreateAudioTranscriptionServiceException(Xeption innerException) { return new AudioTranscriptionServiceException( message: "Audio transcription service error occurred, contact support.", - innerException); + innerException: innerException); } } From 946ac0b82caa10f1e59f80301791a22fcebf3db2 Mon Sep 17 00:00:00 2001 From: Lezune Date: Tue, 11 Jun 2024 14:03:58 -0700 Subject: [PATCH 258/283] Refactored Code --- .../ChatCompletions/ChatCompletionService.Exceptions.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Standard.AI.OpenAI/Services/Foundations/ChatCompletions/ChatCompletionService.Exceptions.cs b/Standard.AI.OpenAI/Services/Foundations/ChatCompletions/ChatCompletionService.Exceptions.cs index b56c4abd..ba1b07e3 100644 --- a/Standard.AI.OpenAI/Services/Foundations/ChatCompletions/ChatCompletionService.Exceptions.cs +++ b/Standard.AI.OpenAI/Services/Foundations/ChatCompletions/ChatCompletionService.Exceptions.cs @@ -117,28 +117,28 @@ private static ChatCompletionValidationException CreateChatCompletionValidationE { return new ChatCompletionValidationException( message: "Chat completion validation error occurred, fix errors and try again.", - innerException); + innerException: innerException); } private static ChatCompletionDependencyException CreateChatCompletionDependencyException(Xeption innerException) { return new ChatCompletionDependencyException( message: "Chat completion dependency error occurred, contact support.", - innerException); + innerException: innerException); } private static ChatCompletionDependencyValidationException CreateChatCompletionDependencyValidationException(Xeption innerException) { return new ChatCompletionDependencyValidationException( "Chat completion dependency validation error occurred, fix errors and try again.", - innerException); + innerException: innerException); } private static ChatCompletionServiceException CreateChatCompletionServiceException(Xeption innerException) { return new ChatCompletionServiceException( message: "Chat completion service error occurred, contact support.", - innerException); + innerException: innerException); } private static NullChatCompletionException CreateNullChatCompletionException() From 63f4c011dd7ce792b6c1f98a83e6341305be079b Mon Sep 17 00:00:00 2001 From: Lezune Date: Tue, 11 Jun 2024 14:35:13 -0700 Subject: [PATCH 259/283] Refactored Code --- .../ChatCompletions/ChatCompletionsClient.cs | 19 +++++++++++-------- .../ChatCompletionClientServiceException.cs | 1 - ...ChatCompletionClientValidationException.cs | 1 - 3 files changed, 11 insertions(+), 10 deletions(-) diff --git a/Standard.AI.OpenAI/Clients/ChatCompletions/ChatCompletionsClient.cs b/Standard.AI.OpenAI/Clients/ChatCompletions/ChatCompletionsClient.cs index 665ab105..a81d8a1d 100644 --- a/Standard.AI.OpenAI/Clients/ChatCompletions/ChatCompletionsClient.cs +++ b/Standard.AI.OpenAI/Clients/ChatCompletions/ChatCompletionsClient.cs @@ -37,34 +37,37 @@ public async ValueTask SendChatCompletionAsync(ChatCompletion ch catch (ChatCompletionDependencyException completionDependencyException) { throw CreateChatCompletionClientDependencyException( - completionDependencyException); + completionDependencyException.InnerException as Xeption); } catch (ChatCompletionServiceException completionServiceException) { throw CreateChatCompletionClientServiceException( - completionServiceException); + completionServiceException.InnerException as Xeption); } } - private static ChatCompletionClientValidationException CreateChatCompletionClientValidationException(Xeption innerException) + private static ChatCompletionClientValidationException + CreateChatCompletionClientValidationException(Xeption innerException) { return new ChatCompletionClientValidationException( message: "Chat completion client validation error occurred, fix errors and try again.", - innerException); + innerException: innerException); } - private static ChatCompletionClientDependencyException CreateChatCompletionClientDependencyException(Xeption innerException) + private static ChatCompletionClientDependencyException + CreateChatCompletionClientDependencyException(Xeption innerException) { return new ChatCompletionClientDependencyException( message: "Chat completion dependency error occurred, contact support.", - innerException); + innerException: innerException); } - private static ChatCompletionClientServiceException CreateChatCompletionClientServiceException(Xeption innerException) + private static ChatCompletionClientServiceException + CreateChatCompletionClientServiceException(Xeption innerException) { return new ChatCompletionClientServiceException( message: "Chat completion client service error occurred, contact support.", - innerException); + innerException: innerException); } } } diff --git a/Standard.AI.OpenAI/Models/Clients/ChatCompletions/Exceptions/ChatCompletionClientServiceException.cs b/Standard.AI.OpenAI/Models/Clients/ChatCompletions/Exceptions/ChatCompletionClientServiceException.cs index f98b9a14..392ce18e 100644 --- a/Standard.AI.OpenAI/Models/Clients/ChatCompletions/Exceptions/ChatCompletionClientServiceException.cs +++ b/Standard.AI.OpenAI/Models/Clients/ChatCompletions/Exceptions/ChatCompletionClientServiceException.cs @@ -12,7 +12,6 @@ public class ChatCompletionClientServiceException : Xeption /// This exception is thrown when a service error occurs while using the Chat completion client. /// For example, if there is a problem with the server or any other service failure. /// - public ChatCompletionClientServiceException(string message, Xeption innerException) : base(message, innerException) { } diff --git a/Standard.AI.OpenAI/Models/Clients/ChatCompletions/Exceptions/ChatCompletionClientValidationException.cs b/Standard.AI.OpenAI/Models/Clients/ChatCompletions/Exceptions/ChatCompletionClientValidationException.cs index 8ed43f03..368f01e4 100644 --- a/Standard.AI.OpenAI/Models/Clients/ChatCompletions/Exceptions/ChatCompletionClientValidationException.cs +++ b/Standard.AI.OpenAI/Models/Clients/ChatCompletions/Exceptions/ChatCompletionClientValidationException.cs @@ -12,7 +12,6 @@ public class ChatCompletionClientValidationException : Xeption /// This exception is thrown when a validation error occurs while using the Chat completion client. /// For example, if required data is missing or invalid. /// - public ChatCompletionClientValidationException(string message, Xeption innerException) : base(message, innerException ) { } From 8f770a8589ef4fe0037bab832a9a9b6320aa4924 Mon Sep 17 00:00:00 2001 From: Lezune Date: Tue, 11 Jun 2024 14:40:19 -0700 Subject: [PATCH 260/283] Refactored Code --- .../AudioTranscriptionService.Exceptions.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Standard.AI.OpenAI/Services/Foundations/AudioTranscriptions/AudioTranscriptionService.Exceptions.cs b/Standard.AI.OpenAI/Services/Foundations/AudioTranscriptions/AudioTranscriptionService.Exceptions.cs index 2551f2d9..5be8830f 100644 --- a/Standard.AI.OpenAI/Services/Foundations/AudioTranscriptions/AudioTranscriptionService.Exceptions.cs +++ b/Standard.AI.OpenAI/Services/Foundations/AudioTranscriptions/AudioTranscriptionService.Exceptions.cs @@ -98,28 +98,28 @@ private static AudioTranscriptionValidationException CreateAudioTranscriptionVal { return new AudioTranscriptionValidationException( message: "Audio transcription validation error occurred, fix errors and try again.", - innerException: innerException); + innerException); } private static AudioTranscriptionDependencyException CreateAudioTranscriptionDependencyException(Xeption innerException) { return new AudioTranscriptionDependencyException( message: "Audio transcription dependency error occurred, contact support.", - innerException: innerException); + innerException); } private static AudioTranscriptionDependencyValidationException CreateAudioTranscriptionDependencyValidationException(Xeption innerException) { return new AudioTranscriptionDependencyValidationException( message: "Chat completion dependency validation error occurred, fix errors and try again.", - innerException: innerException); + innerException; } private static AudioTranscriptionServiceException CreateAudioTranscriptionServiceException(Xeption innerException) { return new AudioTranscriptionServiceException( message: "Audio transcription service error occurred, contact support.", - innerException: innerException); + innerException); } } From 2e43e07cc4ff3553990d81b5b8c8405940599162 Mon Sep 17 00:00:00 2001 From: Lezune Date: Tue, 11 Jun 2024 14:49:35 -0700 Subject: [PATCH 261/283] Refactored Code --- .../Clients/ChatCompletions/ChatCompletionsClient.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Standard.AI.OpenAI/Clients/ChatCompletions/ChatCompletionsClient.cs b/Standard.AI.OpenAI/Clients/ChatCompletions/ChatCompletionsClient.cs index a81d8a1d..537fad8d 100644 --- a/Standard.AI.OpenAI/Clients/ChatCompletions/ChatCompletionsClient.cs +++ b/Standard.AI.OpenAI/Clients/ChatCompletions/ChatCompletionsClient.cs @@ -51,7 +51,7 @@ private static ChatCompletionClientValidationException { return new ChatCompletionClientValidationException( message: "Chat completion client validation error occurred, fix errors and try again.", - innerException: innerException); + innerException); } private static ChatCompletionClientDependencyException @@ -59,7 +59,7 @@ private static ChatCompletionClientDependencyException { return new ChatCompletionClientDependencyException( message: "Chat completion dependency error occurred, contact support.", - innerException: innerException); + innerException); } private static ChatCompletionClientServiceException @@ -67,7 +67,7 @@ private static ChatCompletionClientServiceException { return new ChatCompletionClientServiceException( message: "Chat completion client service error occurred, contact support.", - innerException: innerException); + innerException); } } } From 903d0a42e8f4852cc8316df7351be1bc49e30d1c Mon Sep 17 00:00:00 2001 From: Lezune Date: Tue, 11 Jun 2024 14:53:36 -0700 Subject: [PATCH 262/283] Refactored Code --- .../Foundations/AIModels/AIModelService.Exceptions.cs | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/Standard.AI.OpenAI/Services/Foundations/AIModels/AIModelService.Exceptions.cs b/Standard.AI.OpenAI/Services/Foundations/AIModels/AIModelService.Exceptions.cs index 3932c200..611bba68 100644 --- a/Standard.AI.OpenAI/Services/Foundations/AIModels/AIModelService.Exceptions.cs +++ b/Standard.AI.OpenAI/Services/Foundations/AIModels/AIModelService.Exceptions.cs @@ -182,28 +182,29 @@ private static AIModelValidationException CreateAIModelValidationException(Xepti { return new AIModelValidationException( message: "AI Model validation error occurred, fix errors and try again.", - innerException: innerException); + innerException); } private static AIModelDependencyException CreateAIModelDependencyException(Xeption innerException) { return new AIModelDependencyException( message: "AI Model dependency error occurred, contact support.", - innerException: innerException); + innerException); } - private static AIModelDependencyValidationException CreateAIModelDependencyValidationException(Xeption innerException) + private static AIModelDependencyValidationException + CreateAIModelDependencyValidationException(Xeption innerException) { return new AIModelDependencyValidationException( message: "AI Model dependency validation error occurred, fix errors and try again.", - innerException: innerException); + innerException); } private static AIModelServiceException CreateAIModelServiceException(Xeption innerException) { return new AIModelServiceException( message: "AI Model service error occurred, contact support.", - innerException: innerException); + innerException); } } } \ No newline at end of file From 081bb5a7fcc5f78f62b31357fabd79bf6b76e2c6 Mon Sep 17 00:00:00 2001 From: Lezune Date: Tue, 11 Jun 2024 14:57:15 -0700 Subject: [PATCH 263/283] Refactored Code --- .../AudioTranscriptionService.Exceptions.cs | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/Standard.AI.OpenAI/Services/Foundations/AudioTranscriptions/AudioTranscriptionService.Exceptions.cs b/Standard.AI.OpenAI/Services/Foundations/AudioTranscriptions/AudioTranscriptionService.Exceptions.cs index 5be8830f..08bc31aa 100644 --- a/Standard.AI.OpenAI/Services/Foundations/AudioTranscriptions/AudioTranscriptionService.Exceptions.cs +++ b/Standard.AI.OpenAI/Services/Foundations/AudioTranscriptions/AudioTranscriptionService.Exceptions.cs @@ -86,7 +86,8 @@ private static async ValueTask TryCatch( { var failedAudioTranscriptionServiceException = new FailedAudioTranscriptionServiceException( - message: "Failed Audio Transcription Service Exception occurred, please contact support for assistance.", + message: "Failed Audio Transcription Service Exception occurred," + + " please contact support for assistance.", exception); throw CreateAudioTranscriptionServiceException( @@ -94,28 +95,32 @@ private static async ValueTask TryCatch( } } - private static AudioTranscriptionValidationException CreateAudioTranscriptionValidationException(Xeption innerException) + private static AudioTranscriptionValidationException + CreateAudioTranscriptionValidationException(Xeption innerException) { return new AudioTranscriptionValidationException( message: "Audio transcription validation error occurred, fix errors and try again.", innerException); } - private static AudioTranscriptionDependencyException CreateAudioTranscriptionDependencyException(Xeption innerException) + private static AudioTranscriptionDependencyException + CreateAudioTranscriptionDependencyException(Xeption innerException) { return new AudioTranscriptionDependencyException( message: "Audio transcription dependency error occurred, contact support.", innerException); } - private static AudioTranscriptionDependencyValidationException CreateAudioTranscriptionDependencyValidationException(Xeption innerException) + private static AudioTranscriptionDependencyValidationException + CreateAudioTranscriptionDependencyValidationException(Xeption innerException) { return new AudioTranscriptionDependencyValidationException( message: "Chat completion dependency validation error occurred, fix errors and try again.", - innerException; + innerException); } - private static AudioTranscriptionServiceException CreateAudioTranscriptionServiceException(Xeption innerException) + private static AudioTranscriptionServiceException + CreateAudioTranscriptionServiceException(Xeption innerException) { return new AudioTranscriptionServiceException( message: "Audio transcription service error occurred, contact support.", From c14d8e461d502f2312187101b91a23af5d44c1a5 Mon Sep 17 00:00:00 2001 From: Lezune Date: Tue, 11 Jun 2024 15:05:57 -0700 Subject: [PATCH 264/283] Refactored Code --- .../Clients/Completions/CompletionsClient.cs | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/Standard.AI.OpenAI/Clients/Completions/CompletionsClient.cs b/Standard.AI.OpenAI/Clients/Completions/CompletionsClient.cs index 1948cb9f..34d7db6a 100644 --- a/Standard.AI.OpenAI/Clients/Completions/CompletionsClient.cs +++ b/Standard.AI.OpenAI/Clients/Completions/CompletionsClient.cs @@ -37,30 +37,33 @@ public async ValueTask PromptCompletionAsync(Completion completion) catch (CompletionDependencyException completionDependencyException) { throw CreateCompletionClientDependencyException( - completionDependencyException); + completionDependencyException.InnerException as Xeption); } catch (CompletionServiceException completionServiceException) { throw CreateCompletionClientServiceException( - completionServiceException); + completionServiceException.InnerException as Xeption); } } - private static CompletionClientValidationException CreateCompletionClientValidationException(Xeption innerException) + private static CompletionClientValidationException CreateCompletionClientValidationException( + Xeption innerException) { return new CompletionClientValidationException( message: "Completion client validation error occurred, fix errors and try again.", innerException); } - private static CompletionClientDependencyException CreateCompletionClientDependencyException(Xeption innerException) + private static CompletionClientDependencyException CreateCompletionClientDependencyException( + Xeption innerException) { return new CompletionClientDependencyException( message: "Completion dependency error occurred, contact support.", innerException); } - private static CompletionClientServiceException CreateCompletionClientServiceException(Xeption innerException) + private static CompletionClientServiceException CreateCompletionClientServiceException( + Xeption innerException) { return new CompletionClientServiceException( message: "Completion client service error occurred, contact support.", From 6e31908f519b67c98c0a7352dfe926d69b590a0c Mon Sep 17 00:00:00 2001 From: Lezune Date: Tue, 11 Jun 2024 15:07:40 -0700 Subject: [PATCH 265/283] Refactored Code --- .../Clients/ChatCompletions/ChatCompletionsClient.cs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Standard.AI.OpenAI/Clients/ChatCompletions/ChatCompletionsClient.cs b/Standard.AI.OpenAI/Clients/ChatCompletions/ChatCompletionsClient.cs index 537fad8d..84dea669 100644 --- a/Standard.AI.OpenAI/Clients/ChatCompletions/ChatCompletionsClient.cs +++ b/Standard.AI.OpenAI/Clients/ChatCompletions/ChatCompletionsClient.cs @@ -46,24 +46,24 @@ public async ValueTask SendChatCompletionAsync(ChatCompletion ch } } - private static ChatCompletionClientValidationException - CreateChatCompletionClientValidationException(Xeption innerException) + private static ChatCompletionClientValidationException CreateChatCompletionClientValidationException( + Xeption innerException) { return new ChatCompletionClientValidationException( message: "Chat completion client validation error occurred, fix errors and try again.", innerException); } - private static ChatCompletionClientDependencyException - CreateChatCompletionClientDependencyException(Xeption innerException) + private static ChatCompletionClientDependencyException CreateChatCompletionClientDependencyException( + Xeption innerException) { return new ChatCompletionClientDependencyException( message: "Chat completion dependency error occurred, contact support.", innerException); } - private static ChatCompletionClientServiceException - CreateChatCompletionClientServiceException(Xeption innerException) + private static ChatCompletionClientServiceException CreateChatCompletionClientServiceException( + Xeption innerException) { return new ChatCompletionClientServiceException( message: "Chat completion client service error occurred, contact support.", From 3099c3728281b19b1b97095dd3111cf1aaaab759 Mon Sep 17 00:00:00 2001 From: Lezune Date: Tue, 11 Jun 2024 15:12:03 -0700 Subject: [PATCH 266/283] Refactored Code --- Standard.AI.OpenAI/Clients/AIModels/AIModelsClient.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Standard.AI.OpenAI/Clients/AIModels/AIModelsClient.cs b/Standard.AI.OpenAI/Clients/AIModels/AIModelsClient.cs index c9b9860a..1cbad319 100644 --- a/Standard.AI.OpenAI/Clients/AIModels/AIModelsClient.cs +++ b/Standard.AI.OpenAI/Clients/AIModels/AIModelsClient.cs @@ -89,7 +89,7 @@ private static AIModelClientServiceException CreateAIModelClientServiceException { return new AIModelClientServiceException( message: "AI Model client service error occurred, contact support.", - innerException: innerException); + innerException); } } } From c981243fd60c29212f64d17a51ca22f1b684abc2 Mon Sep 17 00:00:00 2001 From: Lezune Date: Tue, 11 Jun 2024 15:16:18 -0700 Subject: [PATCH 267/283] Refactored Code --- .../Clients/FineTunes/FineTuneClient.cs | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/Standard.AI.OpenAI/Clients/FineTunes/FineTuneClient.cs b/Standard.AI.OpenAI/Clients/FineTunes/FineTuneClient.cs index e51cd685..e721bc29 100644 --- a/Standard.AI.OpenAI/Clients/FineTunes/FineTuneClient.cs +++ b/Standard.AI.OpenAI/Clients/FineTunes/FineTuneClient.cs @@ -32,7 +32,7 @@ public async ValueTask SubmitFineTuneAsync(FineTune fineTune) catch (FineTuneDependencyException fineTuneDependencyException) { throw CreateFineTuneClientDependencyException( - fineTuneDependencyException); + fineTuneDependencyException.InnerException as Xeption); } catch (FineTuneDependencyValidationException fineTuneDependencyValidationException) { @@ -42,25 +42,28 @@ public async ValueTask SubmitFineTuneAsync(FineTune fineTune) catch (FineTuneServiceException fineTuneServiceException) { throw CreateFineTuneClientServiceException( - fineTuneServiceException); + fineTuneServiceException.InnerException as Xeption); } } - private static FineTuneClientValidationException CreateFineTuneClientValidationException(Xeption innerException) + private static FineTuneClientValidationException CreateFineTuneClientValidationException( + Xeption innerException) { return new FineTuneClientValidationException( message: "Fine tune client validation error occurred, fix errors and try again.", innerException); } - private static FineTuneClientDependencyException CreateFineTuneClientDependencyException(Xeption innerException) + private static FineTuneClientDependencyException CreateFineTuneClientDependencyException( + Xeption innerException) { return new FineTuneClientDependencyException( message: "Fine tune client dependency error occurred, contact support.", innerException); } - private static FineTuneClientServiceException CreateFineTuneClientServiceException(Xeption innerException) + private static FineTuneClientServiceException CreateFineTuneClientServiceException( + Xeption innerException) { return new FineTuneClientServiceException( message: "Fine tune client service error occurred, contact support.", From 0885ec95d7d14052a279ebbcb3574e3b62eaa230 Mon Sep 17 00:00:00 2001 From: Lezune Date: Tue, 11 Jun 2024 15:18:09 -0700 Subject: [PATCH 268/283] Refactored Code --- .../ImageGenerations/ImageGenerationsClient.cs | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/Standard.AI.OpenAI/Clients/ImageGenerations/ImageGenerationsClient.cs b/Standard.AI.OpenAI/Clients/ImageGenerations/ImageGenerationsClient.cs index 8c6753b3..9e554691 100644 --- a/Standard.AI.OpenAI/Clients/ImageGenerations/ImageGenerationsClient.cs +++ b/Standard.AI.OpenAI/Clients/ImageGenerations/ImageGenerationsClient.cs @@ -37,30 +37,33 @@ public async ValueTask GenerateImageAsync(ImageGeneration image catch (ImageGenerationDependencyException imageGenerationDependencyException) { throw CreateImageGenerationClientDependencyException( - imageGenerationDependencyException); + imageGenerationDependencyException.InnerException as Xeption); } catch (ImageGenerationServiceException imageGenerationServiceException) { throw CreateImageGenerationClientServiceException( - imageGenerationServiceException); + imageGenerationServiceException.InnerException as Xeption); } } - private static ImageGenerationClientValidationException CreateImageGenerationClientValidationException(Xeption innerException) + private static ImageGenerationClientValidationException CreateImageGenerationClientValidationException( + Xeption innerException) { return new ImageGenerationClientValidationException( message: "Image generation client validation error occurred, fix errors and try again.", innerException); } - private static ImageGenerationClientDependencyException CreateImageGenerationClientDependencyException(Xeption innerException) + private static ImageGenerationClientDependencyException CreateImageGenerationClientDependencyException( + Xeption innerException) { return new ImageGenerationClientDependencyException( message: "Image generation client dependency error occurred, contact support.", innerException); } - private static ImageGenerationClientServiceException CreateImageGenerationClientServiceException(Xeption innerException) + private static ImageGenerationClientServiceException CreateImageGenerationClientServiceException( + Xeption innerException) { return new ImageGenerationClientServiceException( message: "Image generation client service error occurred, contact support.", From 0c582192972a1504333e4b7b9a39da1427d431b9 Mon Sep 17 00:00:00 2001 From: Lezune Date: Tue, 11 Jun 2024 15:39:14 -0700 Subject: [PATCH 269/283] Refactored Code --- .../ChatCompletionService.Exceptions.cs | 26 ++++++++++++------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/Standard.AI.OpenAI/Services/Foundations/ChatCompletions/ChatCompletionService.Exceptions.cs b/Standard.AI.OpenAI/Services/Foundations/ChatCompletions/ChatCompletionService.Exceptions.cs index ba1b07e3..69b6afb1 100644 --- a/Standard.AI.OpenAI/Services/Foundations/ChatCompletions/ChatCompletionService.Exceptions.cs +++ b/Standard.AI.OpenAI/Services/Foundations/ChatCompletions/ChatCompletionService.Exceptions.cs @@ -15,7 +15,8 @@ internal partial class ChatCompletionService { private delegate ValueTask ReturningChatCompletionFunction(); - private async ValueTask TryCatch(ReturningChatCompletionFunction returningChatCompletionFunction) + private async ValueTask TryCatch( + ReturningChatCompletionFunction returningChatCompletionFunction) { try { @@ -105,7 +106,8 @@ private async ValueTask TryCatch(ReturningChatCompletionFunction { var failedChatCompletionServiceException = new FailedChatCompletionServiceException( - message: "Failed Chat Completion Service Exception occurred, please contact support for assistance.", + message: "Failed Chat Completion Service Exception occurred, " + + "please contact support for assistance.", exception); throw CreateChatCompletionServiceException( @@ -113,32 +115,36 @@ private async ValueTask TryCatch(ReturningChatCompletionFunction } } - private static ChatCompletionValidationException CreateChatCompletionValidationException(Xeption innerException) + private static ChatCompletionValidationException CreateChatCompletionValidationException( + Xeption innerException) { return new ChatCompletionValidationException( message: "Chat completion validation error occurred, fix errors and try again.", - innerException: innerException); + innerException); } - private static ChatCompletionDependencyException CreateChatCompletionDependencyException(Xeption innerException) + private static ChatCompletionDependencyException CreateChatCompletionDependencyException( + Xeption innerException) { return new ChatCompletionDependencyException( message: "Chat completion dependency error occurred, contact support.", - innerException: innerException); + innerException); } - private static ChatCompletionDependencyValidationException CreateChatCompletionDependencyValidationException(Xeption innerException) + private static ChatCompletionDependencyValidationException CreateChatCompletionDependencyValidationException( + Xeption innerException) { return new ChatCompletionDependencyValidationException( "Chat completion dependency validation error occurred, fix errors and try again.", - innerException: innerException); + innerException); } - private static ChatCompletionServiceException CreateChatCompletionServiceException(Xeption innerException) + private static ChatCompletionServiceException CreateChatCompletionServiceException( + Xeption innerException) { return new ChatCompletionServiceException( message: "Chat completion service error occurred, contact support.", - innerException: innerException); + innerException); } private static NullChatCompletionException CreateNullChatCompletionException() From c75bb41493a6c2e16e1ff44b853973abd5d4a536 Mon Sep 17 00:00:00 2001 From: Lezune Date: Tue, 11 Jun 2024 15:41:30 -0700 Subject: [PATCH 270/283] Refactored Code --- .../Foundations/Completions/CompletionService.Exceptions.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Standard.AI.OpenAI/Services/Foundations/Completions/CompletionService.Exceptions.cs b/Standard.AI.OpenAI/Services/Foundations/Completions/CompletionService.Exceptions.cs index 9ec3a8f4..f1e081d7 100644 --- a/Standard.AI.OpenAI/Services/Foundations/Completions/CompletionService.Exceptions.cs +++ b/Standard.AI.OpenAI/Services/Foundations/Completions/CompletionService.Exceptions.cs @@ -128,7 +128,8 @@ private static CompletionDependencyException CreateCompletionDependencyException innerException); } - private static CompletionDependencyValidationException CreateCompletionDependencyValidationException(Xeption innerException) + private static CompletionDependencyValidationException CreateCompletionDependencyValidationException( + Xeption innerException) { return new CompletionDependencyValidationException( message: "Completion dependency validation error occurred, fix errors and try again.", From b8354bd86769b49e44e1a5c5bfe68e7f920d10db Mon Sep 17 00:00:00 2001 From: Lezune Date: Tue, 11 Jun 2024 15:43:15 -0700 Subject: [PATCH 271/283] Refactored Code --- .../Foundations/FineTunes/FineTuneService.Exceptions.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Standard.AI.OpenAI/Services/Foundations/FineTunes/FineTuneService.Exceptions.cs b/Standard.AI.OpenAI/Services/Foundations/FineTunes/FineTuneService.Exceptions.cs index 87d03d78..f178d476 100644 --- a/Standard.AI.OpenAI/Services/Foundations/FineTunes/FineTuneService.Exceptions.cs +++ b/Standard.AI.OpenAI/Services/Foundations/FineTunes/FineTuneService.Exceptions.cs @@ -117,7 +117,8 @@ private static FineTuneDependencyException CreateFineTuneDependencyException(Xep innerException); } - private static FineTuneDependencyValidationException CreateFineTuneDependencyValidationException(Xeption innerException) + private static FineTuneDependencyValidationException CreateFineTuneDependencyValidationException( + Xeption innerException) { return new FineTuneDependencyValidationException( message: "Fine tune dependency validation error occurred, fix errors and try again", From e473e51165ffd7c6c9ac984ab52ba69102681e75 Mon Sep 17 00:00:00 2001 From: Lezune Date: Tue, 11 Jun 2024 15:47:06 -0700 Subject: [PATCH 272/283] Refactored Code --- .../Foundations/LocalFiles/LocalFileService.Exceptions.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Standard.AI.OpenAI/Services/Foundations/LocalFiles/LocalFileService.Exceptions.cs b/Standard.AI.OpenAI/Services/Foundations/LocalFiles/LocalFileService.Exceptions.cs index 9840df6d..91b94eb0 100644 --- a/Standard.AI.OpenAI/Services/Foundations/LocalFiles/LocalFileService.Exceptions.cs +++ b/Standard.AI.OpenAI/Services/Foundations/LocalFiles/LocalFileService.Exceptions.cs @@ -100,7 +100,8 @@ private static LocalFileValidationException CreateLocalFileValidationException(X message: "Local file validation error occurred, fix error and try again.", innerException); } - private static LocalFileDependencyValidationException CreateLocalFileDependencyValidationException(Xeption innerException) + private static LocalFileDependencyValidationException CreateLocalFileDependencyValidationException( + Xeption innerException) { return new LocalFileDependencyValidationException( message: "Local file dependency validation error occurred, fix the errors and try again.", From 48bf68352d6007f43e16475e3b648ece18dca1f8 Mon Sep 17 00:00:00 2001 From: Lezune Date: Tue, 11 Jun 2024 15:51:20 -0700 Subject: [PATCH 273/283] Refactored Code --- .../AIFileOrchestrationService.Exceptions.cs | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/Standard.AI.OpenAI/Services/Orchestrations/AIFiles/AIFileOrchestrationService.Exceptions.cs b/Standard.AI.OpenAI/Services/Orchestrations/AIFiles/AIFileOrchestrationService.Exceptions.cs index b983f218..84102df0 100644 --- a/Standard.AI.OpenAI/Services/Orchestrations/AIFiles/AIFileOrchestrationService.Exceptions.cs +++ b/Standard.AI.OpenAI/Services/Orchestrations/AIFiles/AIFileOrchestrationService.Exceptions.cs @@ -119,7 +119,8 @@ private async ValueTask> TryCatch(ReturningAIFilesFu } } - private static AIFileOrchestrationValidationException CreateAIFileOrchestrationValidationException(Xeption innerException) + private static AIFileOrchestrationValidationException CreateAIFileOrchestrationValidationException( + Xeption innerException) { return new AIFileOrchestrationValidationException( message: "AI file validation error occurred, fix errors and try again.", @@ -133,14 +134,16 @@ private static AIFileOrchestrationDependencyValidationException CreateAIFileOrch innerException); } - private static AIFileOrchestrationDependencyException CreateAIFileOrchestrationDependencyException(Xeption innerException) + private static AIFileOrchestrationDependencyException CreateAIFileOrchestrationDependencyException( + Xeption innerException) { return new AIFileOrchestrationDependencyException( message: "AI File dependency error occurred, contact support.", innerException); } - private static AIFileOrchestrationServiceException CreateAIFileOrchestrationServiceException(Xeption innerException) + private static AIFileOrchestrationServiceException CreateAIFileOrchestrationServiceException( + Xeption innerException) { return new AIFileOrchestrationServiceException( message: "AI File error occurred, contact support.", @@ -152,11 +155,5 @@ private static NullAIFileOrchestrationException CreateNullAIFileOrchestrationExc return new NullAIFileOrchestrationException( message: "AI file is null."); } - - private static InvalidAIFileOrchestrationException CreateInvalidAIFileOrchestrationException() - { - return new InvalidAIFileOrchestrationException( - message: "AI file is invalid."); - } } } From dbf02456996585f94e5d38826ecc87690428d769 Mon Sep 17 00:00:00 2001 From: Lezune Date: Tue, 11 Jun 2024 17:35:25 -0700 Subject: [PATCH 274/283] Refactored Code --- .../AIFiles/AIFileOrchestrationService.Exceptions.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Standard.AI.OpenAI/Services/Orchestrations/AIFiles/AIFileOrchestrationService.Exceptions.cs b/Standard.AI.OpenAI/Services/Orchestrations/AIFiles/AIFileOrchestrationService.Exceptions.cs index 84102df0..d7d048cd 100644 --- a/Standard.AI.OpenAI/Services/Orchestrations/AIFiles/AIFileOrchestrationService.Exceptions.cs +++ b/Standard.AI.OpenAI/Services/Orchestrations/AIFiles/AIFileOrchestrationService.Exceptions.cs @@ -127,7 +127,8 @@ private static AIFileOrchestrationValidationException CreateAIFileOrchestrationV innerException); } - private static AIFileOrchestrationDependencyValidationException CreateAIFileOrchestrationDependencyValidationException(Xeption innerException) + private static AIFileOrchestrationDependencyValidationException + CreateAIFileOrchestrationDependencyValidationException(Xeption innerException) { return new AIFileOrchestrationDependencyValidationException( message: "AI file dependency validation error occurred, fix errors and try again.", From dcaf76132375aef33c3db3ffe405b507a3867459 Mon Sep 17 00:00:00 2001 From: Lezune Date: Wed, 12 Jun 2024 10:59:29 -0700 Subject: [PATCH 275/283] Removed extra lines --- .../Services/Foundations/AIFiles/AIFileService.Exceptions.cs | 1 - .../Services/Foundations/AIModels/AIModelService.cs | 1 - 2 files changed, 2 deletions(-) diff --git a/Standard.AI.OpenAI/Services/Foundations/AIFiles/AIFileService.Exceptions.cs b/Standard.AI.OpenAI/Services/Foundations/AIFiles/AIFileService.Exceptions.cs index 4b8bf222..3c901b0c 100644 --- a/Standard.AI.OpenAI/Services/Foundations/AIFiles/AIFileService.Exceptions.cs +++ b/Standard.AI.OpenAI/Services/Foundations/AIFiles/AIFileService.Exceptions.cs @@ -137,6 +137,5 @@ private async ValueTask> TryCatch(ReturningAIFilesFu throw new AIFileServiceException(failedAIFileServiceException); } } - } } \ No newline at end of file diff --git a/Standard.AI.OpenAI/Services/Foundations/AIModels/AIModelService.cs b/Standard.AI.OpenAI/Services/Foundations/AIModels/AIModelService.cs index ec2be396..919097ee 100644 --- a/Standard.AI.OpenAI/Services/Foundations/AIModels/AIModelService.cs +++ b/Standard.AI.OpenAI/Services/Foundations/AIModels/AIModelService.cs @@ -78,6 +78,5 @@ private AIModelPermission ConvertToAIModelPermission(ExternalAIModelPermission e IsBlocking = externalAIModelPermission.IsBlocking }; } - } } \ No newline at end of file From 48faec64b9c0edd27a88e1d2560a6c27c8872890 Mon Sep 17 00:00:00 2001 From: Lezune Date: Wed, 12 Jun 2024 11:01:55 -0700 Subject: [PATCH 276/283] Removed extra lines --- .../AIFiles/AIFileOrchestrationService.Validations.cs | 2 -- 1 file changed, 2 deletions(-) diff --git a/Standard.AI.OpenAI/Services/Orchestrations/AIFiles/AIFileOrchestrationService.Validations.cs b/Standard.AI.OpenAI/Services/Orchestrations/AIFiles/AIFileOrchestrationService.Validations.cs index 607122a3..1e5d7886 100644 --- a/Standard.AI.OpenAI/Services/Orchestrations/AIFiles/AIFileOrchestrationService.Validations.cs +++ b/Standard.AI.OpenAI/Services/Orchestrations/AIFiles/AIFileOrchestrationService.Validations.cs @@ -69,7 +69,5 @@ private static void Validate(params (dynamic Rule, string Parameter)[] validatio invalidAIFileException.ThrowIfContainsErrors(); } - - } } From 067cb25414d7383dfb6bb6bc749fad597921383f Mon Sep 17 00:00:00 2001 From: Lezune Date: Wed, 12 Jun 2024 12:06:27 -0700 Subject: [PATCH 277/283] Removed extra line --- .../AudioTranscriptions/AudioTranscriptionService.Exceptions.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/Standard.AI.OpenAI/Services/Foundations/AudioTranscriptions/AudioTranscriptionService.Exceptions.cs b/Standard.AI.OpenAI/Services/Foundations/AudioTranscriptions/AudioTranscriptionService.Exceptions.cs index 08bc31aa..439ef361 100644 --- a/Standard.AI.OpenAI/Services/Foundations/AudioTranscriptions/AudioTranscriptionService.Exceptions.cs +++ b/Standard.AI.OpenAI/Services/Foundations/AudioTranscriptions/AudioTranscriptionService.Exceptions.cs @@ -125,7 +125,6 @@ private static AudioTranscriptionServiceException return new AudioTranscriptionServiceException( message: "Audio transcription service error occurred, contact support.", innerException); - } } } \ No newline at end of file From d18544366fdb8b58fc63236b8f0eb3eeac1e96e6 Mon Sep 17 00:00:00 2001 From: Lezune Date: Wed, 12 Jun 2024 12:58:03 -0700 Subject: [PATCH 278/283] Added line break above return statements. --- .../AudioTranscriptionService.Exceptions.cs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Standard.AI.OpenAI/Services/Foundations/AudioTranscriptions/AudioTranscriptionService.Exceptions.cs b/Standard.AI.OpenAI/Services/Foundations/AudioTranscriptions/AudioTranscriptionService.Exceptions.cs index 439ef361..3058a509 100644 --- a/Standard.AI.OpenAI/Services/Foundations/AudioTranscriptions/AudioTranscriptionService.Exceptions.cs +++ b/Standard.AI.OpenAI/Services/Foundations/AudioTranscriptions/AudioTranscriptionService.Exceptions.cs @@ -98,6 +98,7 @@ private static async ValueTask TryCatch( private static AudioTranscriptionValidationException CreateAudioTranscriptionValidationException(Xeption innerException) { + return new AudioTranscriptionValidationException( message: "Audio transcription validation error occurred, fix errors and try again.", innerException); @@ -106,6 +107,7 @@ private static AudioTranscriptionValidationException private static AudioTranscriptionDependencyException CreateAudioTranscriptionDependencyException(Xeption innerException) { + return new AudioTranscriptionDependencyException( message: "Audio transcription dependency error occurred, contact support.", innerException); @@ -114,6 +116,7 @@ private static AudioTranscriptionDependencyException private static AudioTranscriptionDependencyValidationException CreateAudioTranscriptionDependencyValidationException(Xeption innerException) { + return new AudioTranscriptionDependencyValidationException( message: "Chat completion dependency validation error occurred, fix errors and try again.", innerException); @@ -122,6 +125,7 @@ private static AudioTranscriptionDependencyValidationException private static AudioTranscriptionServiceException CreateAudioTranscriptionServiceException(Xeption innerException) { + return new AudioTranscriptionServiceException( message: "Audio transcription service error occurred, contact support.", innerException); From ebfa48ba2c25c498e0db493dd796cbd81a8f145d Mon Sep 17 00:00:00 2001 From: Lezune Date: Wed, 12 Jun 2024 21:31:26 -0700 Subject: [PATCH 279/283] Removed Extra lines at the end of files and added line break to method declarations larger than 120 characters that needed a break after the return type. --- .../Exceptions/ChatCompletionDependencyException.cs | 2 +- .../ChatCompletionDependencyValidationException.cs | 2 +- .../Exceptions/ChatCompletionValidationException.cs | 2 +- .../Exceptions/ExcessiveCallChatCompletionException.cs | 2 +- .../Exceptions/FailedChatCompletionServiceException.cs | 2 +- .../Exceptions/InvalidChatCompletionException.cs | 2 +- .../InvalidConfigurationChatCompletionException.cs | 2 +- .../Exceptions/NotFoundChatCompletionException.cs | 2 +- .../Exceptions/NullChatCompletionException.cs | 1 - .../Exceptions/UnauthorizedChatCompletionException.cs | 2 +- .../ChatCompletions/ChatCompletionService.Exceptions.cs | 5 +++-- 11 files changed, 12 insertions(+), 12 deletions(-) diff --git a/Standard.AI.OpenAI/Models/Services/Foundations/ChatCompletions/Exceptions/ChatCompletionDependencyException.cs b/Standard.AI.OpenAI/Models/Services/Foundations/ChatCompletions/Exceptions/ChatCompletionDependencyException.cs index 339c5dd2..09edaa15 100644 --- a/Standard.AI.OpenAI/Models/Services/Foundations/ChatCompletions/Exceptions/ChatCompletionDependencyException.cs +++ b/Standard.AI.OpenAI/Models/Services/Foundations/ChatCompletions/Exceptions/ChatCompletionDependencyException.cs @@ -12,4 +12,4 @@ public ChatCompletionDependencyException(string message, Xeption innerException) : base(message, innerException) { } } -} +} \ No newline at end of file diff --git a/Standard.AI.OpenAI/Models/Services/Foundations/ChatCompletions/Exceptions/ChatCompletionDependencyValidationException.cs b/Standard.AI.OpenAI/Models/Services/Foundations/ChatCompletions/Exceptions/ChatCompletionDependencyValidationException.cs index 7b23d6d5..c2df38dd 100644 --- a/Standard.AI.OpenAI/Models/Services/Foundations/ChatCompletions/Exceptions/ChatCompletionDependencyValidationException.cs +++ b/Standard.AI.OpenAI/Models/Services/Foundations/ChatCompletions/Exceptions/ChatCompletionDependencyValidationException.cs @@ -12,4 +12,4 @@ public ChatCompletionDependencyValidationException(string message, Xeption inner : base(message, innerException) { } } -} +} \ No newline at end of file diff --git a/Standard.AI.OpenAI/Models/Services/Foundations/ChatCompletions/Exceptions/ChatCompletionValidationException.cs b/Standard.AI.OpenAI/Models/Services/Foundations/ChatCompletions/Exceptions/ChatCompletionValidationException.cs index ee30f61d..a202d9c7 100644 --- a/Standard.AI.OpenAI/Models/Services/Foundations/ChatCompletions/Exceptions/ChatCompletionValidationException.cs +++ b/Standard.AI.OpenAI/Models/Services/Foundations/ChatCompletions/Exceptions/ChatCompletionValidationException.cs @@ -12,4 +12,4 @@ public ChatCompletionValidationException(string message, Xeption innerException) : base(message, innerException) { } } -} +} \ No newline at end of file diff --git a/Standard.AI.OpenAI/Models/Services/Foundations/ChatCompletions/Exceptions/ExcessiveCallChatCompletionException.cs b/Standard.AI.OpenAI/Models/Services/Foundations/ChatCompletions/Exceptions/ExcessiveCallChatCompletionException.cs index 402fbf81..f1329cae 100644 --- a/Standard.AI.OpenAI/Models/Services/Foundations/ChatCompletions/Exceptions/ExcessiveCallChatCompletionException.cs +++ b/Standard.AI.OpenAI/Models/Services/Foundations/ChatCompletions/Exceptions/ExcessiveCallChatCompletionException.cs @@ -13,4 +13,4 @@ public ExcessiveCallChatCompletionException(string message, Exception innerExcep : base(message, innerException) { } } -} +} \ No newline at end of file diff --git a/Standard.AI.OpenAI/Models/Services/Foundations/ChatCompletions/Exceptions/FailedChatCompletionServiceException.cs b/Standard.AI.OpenAI/Models/Services/Foundations/ChatCompletions/Exceptions/FailedChatCompletionServiceException.cs index dab5bfdb..57cbf7c8 100644 --- a/Standard.AI.OpenAI/Models/Services/Foundations/ChatCompletions/Exceptions/FailedChatCompletionServiceException.cs +++ b/Standard.AI.OpenAI/Models/Services/Foundations/ChatCompletions/Exceptions/FailedChatCompletionServiceException.cs @@ -13,4 +13,4 @@ public FailedChatCompletionServiceException(string message, Exception innerExcep : base(message, innerException) { } } -} +} \ No newline at end of file diff --git a/Standard.AI.OpenAI/Models/Services/Foundations/ChatCompletions/Exceptions/InvalidChatCompletionException.cs b/Standard.AI.OpenAI/Models/Services/Foundations/ChatCompletions/Exceptions/InvalidChatCompletionException.cs index 976a17fc..7a5d4202 100644 --- a/Standard.AI.OpenAI/Models/Services/Foundations/ChatCompletions/Exceptions/InvalidChatCompletionException.cs +++ b/Standard.AI.OpenAI/Models/Services/Foundations/ChatCompletions/Exceptions/InvalidChatCompletionException.cs @@ -16,4 +16,4 @@ public InvalidChatCompletionException(string message, Xeption innerException) : base(message, innerException) { } } -} +} \ No newline at end of file diff --git a/Standard.AI.OpenAI/Models/Services/Foundations/ChatCompletions/Exceptions/InvalidConfigurationChatCompletionException.cs b/Standard.AI.OpenAI/Models/Services/Foundations/ChatCompletions/Exceptions/InvalidConfigurationChatCompletionException.cs index 821eec6d..bdc02c4d 100644 --- a/Standard.AI.OpenAI/Models/Services/Foundations/ChatCompletions/Exceptions/InvalidConfigurationChatCompletionException.cs +++ b/Standard.AI.OpenAI/Models/Services/Foundations/ChatCompletions/Exceptions/InvalidConfigurationChatCompletionException.cs @@ -13,4 +13,4 @@ public InvalidConfigurationChatCompletionException(string message, Exception inn : base(message, innerException) { } } -} +} \ No newline at end of file diff --git a/Standard.AI.OpenAI/Models/Services/Foundations/ChatCompletions/Exceptions/NotFoundChatCompletionException.cs b/Standard.AI.OpenAI/Models/Services/Foundations/ChatCompletions/Exceptions/NotFoundChatCompletionException.cs index 46f1b734..a217fab3 100644 --- a/Standard.AI.OpenAI/Models/Services/Foundations/ChatCompletions/Exceptions/NotFoundChatCompletionException.cs +++ b/Standard.AI.OpenAI/Models/Services/Foundations/ChatCompletions/Exceptions/NotFoundChatCompletionException.cs @@ -13,4 +13,4 @@ public NotFoundChatCompletionException(string message, Exception innerException) : base(message, innerException) { } } -} +} \ No newline at end of file diff --git a/Standard.AI.OpenAI/Models/Services/Foundations/ChatCompletions/Exceptions/NullChatCompletionException.cs b/Standard.AI.OpenAI/Models/Services/Foundations/ChatCompletions/Exceptions/NullChatCompletionException.cs index f850d819..dc545aeb 100644 --- a/Standard.AI.OpenAI/Models/Services/Foundations/ChatCompletions/Exceptions/NullChatCompletionException.cs +++ b/Standard.AI.OpenAI/Models/Services/Foundations/ChatCompletions/Exceptions/NullChatCompletionException.cs @@ -11,7 +11,6 @@ public class NullChatCompletionException : Xeption public NullChatCompletionException(string message) : base(message) { } - public NullChatCompletionException(string message, Xeption innerException) : base(message, innerException) { } diff --git a/Standard.AI.OpenAI/Models/Services/Foundations/ChatCompletions/Exceptions/UnauthorizedChatCompletionException.cs b/Standard.AI.OpenAI/Models/Services/Foundations/ChatCompletions/Exceptions/UnauthorizedChatCompletionException.cs index 5a4185ac..6fd5cb2b 100644 --- a/Standard.AI.OpenAI/Models/Services/Foundations/ChatCompletions/Exceptions/UnauthorizedChatCompletionException.cs +++ b/Standard.AI.OpenAI/Models/Services/Foundations/ChatCompletions/Exceptions/UnauthorizedChatCompletionException.cs @@ -13,4 +13,4 @@ public UnauthorizedChatCompletionException(string message, Exception innerExcept : base(message, innerException) { } } -} +} \ No newline at end of file diff --git a/Standard.AI.OpenAI/Services/Foundations/ChatCompletions/ChatCompletionService.Exceptions.cs b/Standard.AI.OpenAI/Services/Foundations/ChatCompletions/ChatCompletionService.Exceptions.cs index 69b6afb1..68f738ef 100644 --- a/Standard.AI.OpenAI/Services/Foundations/ChatCompletions/ChatCompletionService.Exceptions.cs +++ b/Standard.AI.OpenAI/Services/Foundations/ChatCompletions/ChatCompletionService.Exceptions.cs @@ -131,9 +131,10 @@ private static ChatCompletionDependencyException CreateChatCompletionDependencyE innerException); } - private static ChatCompletionDependencyValidationException CreateChatCompletionDependencyValidationException( - Xeption innerException) + private static ChatCompletionDependencyValidationException + CreateChatCompletionDependencyValidationException(Xeption innerException) { + return new ChatCompletionDependencyValidationException( "Chat completion dependency validation error occurred, fix errors and try again.", innerException); From 79795ef8353a9714f7ae3e0da6987e9a1351bb0c Mon Sep 17 00:00:00 2001 From: Lezune Date: Wed, 12 Jun 2024 21:49:47 -0700 Subject: [PATCH 280/283] Added back the line break in class declaration where there was two or more constructors --- .../ChatCompletions/Exceptions/InvalidChatCompletionException.cs | 1 + .../ChatCompletions/Exceptions/NullChatCompletionException.cs | 1 + 2 files changed, 2 insertions(+) diff --git a/Standard.AI.OpenAI/Models/Services/Foundations/ChatCompletions/Exceptions/InvalidChatCompletionException.cs b/Standard.AI.OpenAI/Models/Services/Foundations/ChatCompletions/Exceptions/InvalidChatCompletionException.cs index 7a5d4202..e7ee130e 100644 --- a/Standard.AI.OpenAI/Models/Services/Foundations/ChatCompletions/Exceptions/InvalidChatCompletionException.cs +++ b/Standard.AI.OpenAI/Models/Services/Foundations/ChatCompletions/Exceptions/InvalidChatCompletionException.cs @@ -12,6 +12,7 @@ public class InvalidChatCompletionException : Xeption public InvalidChatCompletionException(string message) : base(message) { } + public InvalidChatCompletionException(string message, Xeption innerException) : base(message, innerException) { } diff --git a/Standard.AI.OpenAI/Models/Services/Foundations/ChatCompletions/Exceptions/NullChatCompletionException.cs b/Standard.AI.OpenAI/Models/Services/Foundations/ChatCompletions/Exceptions/NullChatCompletionException.cs index dc545aeb..f850d819 100644 --- a/Standard.AI.OpenAI/Models/Services/Foundations/ChatCompletions/Exceptions/NullChatCompletionException.cs +++ b/Standard.AI.OpenAI/Models/Services/Foundations/ChatCompletions/Exceptions/NullChatCompletionException.cs @@ -11,6 +11,7 @@ public class NullChatCompletionException : Xeption public NullChatCompletionException(string message) : base(message) { } + public NullChatCompletionException(string message, Xeption innerException) : base(message, innerException) { } From c3fa328edd14edf27b83c33046ec38b4c2cbc64c Mon Sep 17 00:00:00 2001 From: Lezune Date: Wed, 12 Jun 2024 21:53:57 -0700 Subject: [PATCH 281/283] Added a line break for each method declaration that was longer than 120 characters. Added line break between constructors in class declarations. --- .../ChatCompletions/ChatCompletionService.Exceptions.cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Standard.AI.OpenAI/Services/Foundations/ChatCompletions/ChatCompletionService.Exceptions.cs b/Standard.AI.OpenAI/Services/Foundations/ChatCompletions/ChatCompletionService.Exceptions.cs index 68f738ef..02219996 100644 --- a/Standard.AI.OpenAI/Services/Foundations/ChatCompletions/ChatCompletionService.Exceptions.cs +++ b/Standard.AI.OpenAI/Services/Foundations/ChatCompletions/ChatCompletionService.Exceptions.cs @@ -118,6 +118,7 @@ private async ValueTask TryCatch( private static ChatCompletionValidationException CreateChatCompletionValidationException( Xeption innerException) { + return new ChatCompletionValidationException( message: "Chat completion validation error occurred, fix errors and try again.", innerException); @@ -126,6 +127,7 @@ private static ChatCompletionValidationException CreateChatCompletionValidationE private static ChatCompletionDependencyException CreateChatCompletionDependencyException( Xeption innerException) { + return new ChatCompletionDependencyException( message: "Chat completion dependency error occurred, contact support.", innerException); @@ -143,6 +145,7 @@ private static ChatCompletionDependencyValidationException private static ChatCompletionServiceException CreateChatCompletionServiceException( Xeption innerException) { + return new ChatCompletionServiceException( message: "Chat completion service error occurred, contact support.", innerException); From b9c2df910804fe4013af5de4afee0238e6b4aa34 Mon Sep 17 00:00:00 2001 From: Lezune Date: Wed, 12 Jun 2024 22:20:01 -0700 Subject: [PATCH 282/283] Reverted method call to what is was in previous commit --- .../ChatCompletions/ChatCompletionService.Exceptions.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Standard.AI.OpenAI/Services/Foundations/ChatCompletions/ChatCompletionService.Exceptions.cs b/Standard.AI.OpenAI/Services/Foundations/ChatCompletions/ChatCompletionService.Exceptions.cs index 02219996..6319f84a 100644 --- a/Standard.AI.OpenAI/Services/Foundations/ChatCompletions/ChatCompletionService.Exceptions.cs +++ b/Standard.AI.OpenAI/Services/Foundations/ChatCompletions/ChatCompletionService.Exceptions.cs @@ -133,8 +133,8 @@ private static ChatCompletionDependencyException CreateChatCompletionDependencyE innerException); } - private static ChatCompletionDependencyValidationException - CreateChatCompletionDependencyValidationException(Xeption innerException) + private static ChatCompletionDependencyValidationException CreateChatCompletionDependencyValidationException( + Xeption innerException) { return new ChatCompletionDependencyValidationException( From 8e399f74d0a2c7e2df0564ca442894fdbae6a7ae Mon Sep 17 00:00:00 2001 From: Lezune Date: Wed, 12 Jun 2024 22:29:32 -0700 Subject: [PATCH 283/283] Removed create method in the unit test class and refactored code. --- .../ChatCompletionServiceTests.Validations.Send.cs | 6 ++++-- .../ChatCompletions/ChatCompletionServiceTests.cs | 6 ------ .../ChatCompletions/ChatCompletionService.Exceptions.cs | 4 ---- 3 files changed, 4 insertions(+), 12 deletions(-) diff --git a/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/ChatCompletions/ChatCompletionServiceTests.Validations.Send.cs b/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/ChatCompletions/ChatCompletionServiceTests.Validations.Send.cs index 4add66c6..41b043fa 100644 --- a/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/ChatCompletions/ChatCompletionServiceTests.Validations.Send.cs +++ b/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/ChatCompletions/ChatCompletionServiceTests.Validations.Send.cs @@ -59,7 +59,8 @@ private async Task ShouldThrowValidationExceptionOnSendIfRequestIsNullAsync() invalidChatCompletion.Request = null; var invalidChatCompletionException = - createInvalidChatCompletionException(); + new InvalidChatCompletionException( + message: "Chat completion is invalid."); ; invalidChatCompletionException.AddData( key: nameof(ChatCompletion.Request), @@ -107,7 +108,8 @@ private async Task ShouldThrowValidationExceptionOnSendIfRequestIsInvalidAsync(s }; var invalidChatCompletionException = - createInvalidChatCompletionException(); + new InvalidChatCompletionException( + message: "Chat completion is invalid."); invalidChatCompletionException.AddData( key: nameof(ChatCompletion.Request.Model), diff --git a/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/ChatCompletions/ChatCompletionServiceTests.cs b/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/ChatCompletions/ChatCompletionServiceTests.cs index 4243b7df..07d47adb 100644 --- a/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/ChatCompletions/ChatCompletionServiceTests.cs +++ b/Standard.AI.OpenAI.Tests.Unit/Services/Foundations/ChatCompletions/ChatCompletionServiceTests.cs @@ -156,11 +156,5 @@ private static Filler ChatCompletionFiller() return filler; } - - private static InvalidChatCompletionException createInvalidChatCompletionException() - { - return new InvalidChatCompletionException( - message: "Chat completion is invalid."); - } } } diff --git a/Standard.AI.OpenAI/Services/Foundations/ChatCompletions/ChatCompletionService.Exceptions.cs b/Standard.AI.OpenAI/Services/Foundations/ChatCompletions/ChatCompletionService.Exceptions.cs index 6319f84a..69b6afb1 100644 --- a/Standard.AI.OpenAI/Services/Foundations/ChatCompletions/ChatCompletionService.Exceptions.cs +++ b/Standard.AI.OpenAI/Services/Foundations/ChatCompletions/ChatCompletionService.Exceptions.cs @@ -118,7 +118,6 @@ private async ValueTask TryCatch( private static ChatCompletionValidationException CreateChatCompletionValidationException( Xeption innerException) { - return new ChatCompletionValidationException( message: "Chat completion validation error occurred, fix errors and try again.", innerException); @@ -127,7 +126,6 @@ private static ChatCompletionValidationException CreateChatCompletionValidationE private static ChatCompletionDependencyException CreateChatCompletionDependencyException( Xeption innerException) { - return new ChatCompletionDependencyException( message: "Chat completion dependency error occurred, contact support.", innerException); @@ -136,7 +134,6 @@ private static ChatCompletionDependencyException CreateChatCompletionDependencyE private static ChatCompletionDependencyValidationException CreateChatCompletionDependencyValidationException( Xeption innerException) { - return new ChatCompletionDependencyValidationException( "Chat completion dependency validation error occurred, fix errors and try again.", innerException); @@ -145,7 +142,6 @@ private static ChatCompletionDependencyValidationException CreateChatCompletionD private static ChatCompletionServiceException CreateChatCompletionServiceException( Xeption innerException) { - return new ChatCompletionServiceException( message: "Chat completion service error occurred, contact support.", innerException);