io.cequence.openaiscala.OpenAIScalaClientException.scala Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of openai-scala-core_3 Show documentation
Show all versions of openai-scala-core_3 Show documentation
Core module of OpenAI Scala client
package io.cequence.openaiscala
object Retryable {
def unapply(
t: OpenAIScalaClientException
): Option[OpenAIScalaClientException] = Some(t).filter(apply)
def apply(t: OpenAIScalaClientException): Boolean = t match {
// we retry on these
case _: OpenAIScalaClientTimeoutException => true
case _: OpenAIScalaRateLimitException => true
case _: OpenAIScalaServerErrorException => true
case _: OpenAIScalaEngineOverloadedException => true
// otherwise don't retry
case _ => false
}
}
class OpenAIScalaClientException(
message: String,
cause: Throwable
) extends RuntimeException(message, cause) {
def this(message: String) = this(message, null)
}
class OpenAIScalaClientTimeoutException(
message: String,
cause: Throwable
) extends OpenAIScalaClientException(message, cause) {
def this(message: String) = this(message, null)
}
class OpenAIScalaClientUnknownHostException(
message: String,
cause: Throwable
) extends OpenAIScalaClientException(message, cause) {
def this(message: String) = this(message, null)
}
class OpenAIScalaTokenCountExceededException(
message: String,
cause: Throwable
) extends OpenAIScalaClientException(message, cause) {
def this(message: String) = this(message, null)
}
class OpenAIScalaUnauthorizedException(
message: String,
cause: Throwable
) extends OpenAIScalaClientException(message, cause) {
def this(message: String) = this(message, null)
}
class OpenAIScalaRateLimitException(
message: String,
cause: Throwable
) extends OpenAIScalaClientException(message, cause) {
def this(message: String) = this(message, null)
}
class OpenAIScalaServerErrorException(
message: String,
cause: Throwable
) extends OpenAIScalaClientException(message, cause) {
def this(message: String) = this(message, null)
}
class OpenAIScalaEngineOverloadedException(
message: String,
cause: Throwable
) extends OpenAIScalaClientException(message, cause) {
def this(message: String) = this(message, null)
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy