ee.carlrobert.llm.client.azure.AzureApiResponseError Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of llm-client Show documentation
Show all versions of llm-client Show documentation
Java http client wrapped around the OkHttp3 library
package ee.carlrobert.llm.client.azure;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty;
import ee.carlrobert.llm.client.openai.completion.BaseApiResponseError;
import ee.carlrobert.llm.client.openai.completion.ErrorDetails;
@JsonIgnoreProperties(ignoreUnknown = true)
public class AzureApiResponseError implements BaseApiResponseError {
private final int statusCode;
private final String message;
@JsonCreator(mode = JsonCreator.Mode.PROPERTIES)
public AzureApiResponseError(
@JsonProperty("error") ErrorDetails error,
@JsonProperty("statusCode") int statusCode,
@JsonProperty("message") String message) {
if (error != null) {
this.statusCode = Integer.getInteger(error.getCode(), 0);
this.message = error.getMessage();
} else {
this.statusCode = statusCode;
this.message = message;
}
}
public int getStatusCode() {
return statusCode;
}
public String getMessage() {
return message;
}
@Override
public ErrorDetails getError() {
return new ErrorDetails(message);
}
}