Class RequestRefusedException

All Implemented Interfaces:
Serializable

public final class RequestRefusedException extends PromptExecutionException
Exception thrown when executing a prompt query and the prompt service refuses to process the request, e.g. because violates its usage policies or contains inappropriate content. For example, an LLM service might refuse to process requests that contain hate speech or explicit content.
Since:
8.5.0
See Also:
  • Method Details

    • refusalReason

      public String refusalReason()
      Gets the reason why the request was refused. This can be used to provide more context about the refusal.
      Returns:
      The reason why the request was refused.
    • builder

      public static RequestRefusedException.Builder builder()
      Creates a new builder for RequestRefusedException.
      Returns:
      The new builder.