All Downloads are FREE. Search and download functionalities are using the official Maven repository.

ee.carlrobert.llm.client.azure.AzureApiResponseError Maven / Gradle / Ivy

There is a newer version: 0.8.28
Show newest version
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);
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy