diff --git a/foundation-models/openai/src/main/java/com/sap/ai/sdk/foundationmodels/openai/OpenAiClient.java b/foundation-models/openai/src/main/java/com/sap/ai/sdk/foundationmodels/openai/OpenAiClient.java index e072ef50..257b55dd 100644 --- a/foundation-models/openai/src/main/java/com/sap/ai/sdk/foundationmodels/openai/OpenAiClient.java +++ b/foundation-models/openai/src/main/java/com/sap/ai/sdk/foundationmodels/openai/OpenAiClient.java @@ -196,7 +196,7 @@ private T executeRequest( final var client = ApacheHttpClient5Accessor.getHttpClient(destination); return client.execute(request, new OpenAiResponseHandler<>(responseType)); } catch (final IOException e) { - throw new OpenAiClientException(e); + throw new OpenAiClientException("Request to OpenAI model failed", e); } } @@ -209,7 +209,7 @@ private Stream streamRequest( return new OpenAiStreamingHandler<>(deltaType) .handleResponse(client.executeOpen(null, request, null)); } catch (final IOException e) { - throw new OpenAiClientException(e); + throw new OpenAiClientException("Request to OpenAI model failed", e); } } } diff --git a/foundation-models/openai/src/main/java/com/sap/ai/sdk/foundationmodels/openai/OpenAiClientException.java b/foundation-models/openai/src/main/java/com/sap/ai/sdk/foundationmodels/openai/OpenAiClientException.java index 18a2aaeb..d61bfa08 100644 --- a/foundation-models/openai/src/main/java/com/sap/ai/sdk/foundationmodels/openai/OpenAiClientException.java +++ b/foundation-models/openai/src/main/java/com/sap/ai/sdk/foundationmodels/openai/OpenAiClientException.java @@ -5,23 +5,8 @@ /** Generic exception for errors occurring when using OpenAI foundation models. */ public class OpenAiClientException extends RuntimeException { - static final String BASE_ERROR_MESSAGE = "Request to OpenAI model failed"; @Serial private static final long serialVersionUID = -7345541120979974432L; - /** Create a new exception with the base message: {@code Request to OpenAI model failed} */ - public OpenAiClientException() { - this(BASE_ERROR_MESSAGE); - } - - /** - * Create a new exception with the base message: {@code Request to OpenAI model failed} - * - * @param e the cause - */ - public OpenAiClientException(@Nonnull final Exception e) { - this(BASE_ERROR_MESSAGE, e); - } - /** * Create a new exception with the given message. *