Liking cljdoc? Tell your friends :D

litellm.errors

Comprehensive error handling for LiteLLM-clj

This namespace provides:

  • Namespaced error types for clear categorization
  • Rich error data structures with context
  • Error predicates for pattern matching
  • Retry and recoverability analysis
Comprehensive error handling for LiteLLM-clj

This namespace provides:
- Namespaced error types for clear categorization
- Rich error data structures with context
- Error predicates for pattern matching
- Retry and recoverability analysis
raw docstring

all-error-typesclj

source

authentication-errorclj

(authentication-error provider
                      message
                      &
                      {:keys [http-status provider-code] :as opts})

API key invalid or missing

API key invalid or missing
sourceraw docstring

authentication-error?clj

(authentication-error? ex)
source

authorization-errorclj

(authorization-error provider
                     message
                     &
                     {:keys [http-status provider-code resource] :as opts})

API key valid but lacks permissions

API key valid but lacks permissions
sourceraw docstring

chunk->exceptionclj

(chunk->exception chunk)

Convert an error chunk to an exception

Convert an error chunk to an exception
sourceraw docstring

client-error?clj

(client-error? ex)

Check if error is a client/configuration error

Check if error is a client/configuration error
sourceraw docstring

client-errorsclj

source

connection-errorclj

(connection-error provider message & {:keys [cause request-id] :as opts})

Network connectivity issues

Network connectivity issues
sourceraw docstring

content-filterclj

(content-filter provider message & {:keys [provider-code filter-type] :as opts})

Content filtered by provider safety systems

Content filtered by provider safety systems
sourceraw docstring

error-chunk?clj

(error-chunk? chunk)

Check if a streaming chunk is an error chunk

Check if a streaming chunk is an error chunk
sourceraw docstring

error-detailsclj

(error-details ex)

Get detailed error information as a map

Get detailed error information as a map
sourceraw docstring

error-summaryclj

(error-summary ex)

Create a human-readable error summary

Create a human-readable error summary
sourceraw docstring

error-type?clj

(error-type? ex error-type)

Check if exception matches a specific error type

Check if exception matches a specific error type
sourceraw docstring

get-error-categoryclj

(get-error-category ex)

Get human-readable error category

Get human-readable error category
sourceraw docstring

http-status->errorclj

(http-status->error status
                    provider
                    message
                    &
                    {:keys [provider-code retry-after request-id body]
                     :as opts})

Map HTTP status code to appropriate error constructor

Map HTTP status code to appropriate error constructor
sourceraw docstring

internal-errorclj

(internal-error message & {:keys [cause stack-trace] :as opts})

Unexpected litellm bug

Unexpected litellm bug
sourceraw docstring

invalid-configclj

(invalid-config message & {:keys [config errors] :as opts})

Configuration validation failed

Configuration validation failed
sourceraw docstring

invalid-requestclj

(invalid-request message & {:keys [request errors] :as opts})

Request validation failed - missing required fields or invalid types

Request validation failed - missing required fields or invalid types
sourceraw docstring

invalid-responseclj

(invalid-response provider
                  message
                  &
                  {:keys [response validation-errors] :as opts})

Response doesn't match expected schema

Response doesn't match expected schema
sourceraw docstring

litellm-error?clj

(litellm-error? ex)

Check if exception is a litellm error

Check if exception is a litellm error
sourceraw docstring

model-not-foundclj

(model-not-found provider
                 model
                 &
                 {:keys [http-status provider-code available-models] :as opts})

Model doesn't exist for provider

Model doesn't exist for provider
sourceraw docstring

model-not-found-error?clj

(model-not-found-error? ex)
source

provider-errorclj

(provider-error provider
                message
                &
                {:keys [http-status provider-code request-id recoverable?]
                 :as opts})

Generic provider-side error

Generic provider-side error
sourceraw docstring

provider-error?clj

(provider-error? ex)

Check if error is a provider/network error

Check if error is a provider/network error
sourceraw docstring

provider-errorsclj

source

provider-not-foundclj

(provider-not-found provider & {:keys [available-providers] :as opts})

Requested provider doesn't exist

Requested provider doesn't exist
sourceraw docstring

quota-exceededclj

(quota-exceeded provider
                message
                &
                {:keys [http-status provider-code quota-type reset-at]
                 :as opts})

Account quota exhausted

Account quota exhausted
sourceraw docstring

rate-limitclj

(rate-limit provider
            message
            &
            {:keys [http-status provider-code retry-after request-id] :as opts})

Rate limit hit - usually recoverable with backoff

Rate limit hit - usually recoverable with backoff
sourceraw docstring

rate-limit-error?clj

(rate-limit-error? ex)
source

recoverable?clj

(recoverable? ex)

Check if error is recoverable (retry might succeed)

Check if error is recoverable (retry might succeed)
sourceraw docstring

resource-exhaustedclj

(resource-exhausted message
                    &
                    {:keys [resource-type current-usage limit] :as opts})

Thread pool or channel buffer full

Thread pool or channel buffer full
sourceraw docstring

response-error?clj

(response-error? ex)

Check if error is a response error

Check if error is a response error
sourceraw docstring

response-errorsclj

source

retry-delayclj

(retry-delay ex retry-count)

Calculate retry delay in milliseconds based on error type and retry count

Calculate retry delay in milliseconds based on error type and retry count
sourceraw docstring

server-errorclj

(server-error provider
              message
              &
              {:keys [http-status provider-code request-id] :as opts})

Provider's server error (500, 502, 503)

Provider's server error (500, 502, 503)
sourceraw docstring

should-retry?clj

(should-retry? ex
               &
               {:keys [max-retries current-retry]
                :or {max-retries 3 current-retry 0}})

Determine if error should be retried based on type and recoverability

Determine if error should be retried based on type and recoverability
sourceraw docstring

streaming-errorclj

(streaming-error provider
                 message
                 &
                 {:keys [recoverable? chunk-number cause] :as opts})

Error during streaming operation

Error during streaming operation
sourceraw docstring

streaming-error-chunkclj

(streaming-error-chunk
  provider
  message
  &
  {:keys [error-type http-status provider-code recoverable? chunk-number cause]
   :or {error-type :litellm/streaming-error recoverable? false}})

Create an error chunk for placing on streaming channels

Create an error chunk for placing on streaming channels
sourceraw docstring

streaming-error?clj

(streaming-error? ex)
source

system-error?clj

(system-error? ex)

Check if error is a system error

Check if error is a system error
sourceraw docstring

system-errorsclj

source

timeout-errorclj

(timeout-error provider message & {:keys [timeout-ms request-id] :as opts})

Request timeout

Request timeout
sourceraw docstring

timeout-error?clj

(timeout-error? ex)
source

unsupported-featureclj

(unsupported-feature provider feature & {:keys [message] :as opts})

Feature not supported by provider

Feature not supported by provider
sourceraw docstring

wrap-http-errorsclj

(wrap-http-errors provider-name f)

Wrap HTTP calls to convert hato exceptions to litellm errors. Preserves HTTP response details when available.

Wrap HTTP calls to convert hato exceptions to litellm errors.
Preserves HTTP response details when available.
sourceraw docstring

cljdoc builds & hosts documentation for Clojure/Script libraries

Keyboard shortcuts
Ctrl+kJump to recent docs
Move to previous article
Move to next article
Ctrl+/Jump to the search field
× close