From 3101401d9476a3736bc7e64fae7e4480732a83f2 Mon Sep 17 00:00:00 2001 From: Lezune Date: Thu, 30 May 2024 01:50:57 -0700 Subject: [PATCH 01/24] 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 02/24] 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 03/24] 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 04/24] 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 05/24] 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 06/24] 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 07/24] 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 08/24] 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 09/24] 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 10/24] 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 11/24] 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 1d4a1e3803599fd62c7d73776031b163e864ca2a Mon Sep 17 00:00:00 2001 From: Lezune Date: Fri, 31 May 2024 04:23:12 -0700 Subject: [PATCH 12/24] 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 13/24] 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 14/24] 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 15/24] 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 16/24] 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 a1f3b529f1f0724ff24c226e77b7d7a9d417dca6 Mon Sep 17 00:00:00 2001 From: Lezune Date: Thu, 6 Jun 2024 08:56:48 -0700 Subject: [PATCH 17/24] 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 18/24] 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 19/24] 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 20/24] 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 21/24] 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 22/24] 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 23/24] 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 b8354bd86769b49e44e1a5c5bfe68e7f920d10db Mon Sep 17 00:00:00 2001 From: Lezune Date: Tue, 11 Jun 2024 15:43:15 -0700 Subject: [PATCH 24/24] 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",