File tree Expand file tree Collapse file tree 1 file changed +2
-2
lines changed
x-pack/plugin/inference/src/main/java/org/elasticsearch/xpack/inference/external/http/retry Expand file tree Collapse file tree 1 file changed +2
-2
lines changed Original file line number Diff line number Diff line change @@ -179,7 +179,7 @@ protected UnifiedChatCompletionException buildChatCompletionError(
179179 Supplier <Class <? extends ErrorResponse >> errorResponseClassSupplier ,
180180 ChatCompletionErrorBuilder chatCompletionErrorBuilder
181181 ) {
182- if (errorResponseClassSupplier .get ().isInstance (errorResponse )) {
182+ if (errorResponse . errorStructureFound () && errorResponseClassSupplier .get ().isInstance (errorResponse )) {
183183 return chatCompletionErrorBuilder .buildProviderSpecificChatCompletionError (errorResponse , errorMessage , restStatus );
184184 } else {
185185 return buildDefaultChatCompletionError (errorResponse , errorMessage , restStatus );
@@ -233,7 +233,7 @@ protected UnifiedChatCompletionException buildMidStreamChatCompletionError(
233233 // Extract the error response from the message using the provided method
234234 var errorResponse = midStreamErrorExtractor .apply (message );
235235 // Check if the error response matches the expected type
236- if (errorResponseClassSupplier .get ().isInstance (errorResponse )) {
236+ if (errorResponse . errorStructureFound () && errorResponseClassSupplier .get ().isInstance (errorResponse )) {
237237 // If it matches, we can build a custom mid-stream error exception
238238 return specificErrorBuilder .apply (inferenceEntityId , errorResponse );
239239 } else if (e != null ) {
You can’t perform that action at this time.
0 commit comments