LLMError

represents an error from an LLM operation.

  • Transport: the HTTP request failed, carrying http-client's ClientError, which says at which stage and whether another attempt could help
  • Config: the request never left, because the provider or the operation is not one this library can perform
  • Decode: the provider answered, but the body is not valid for its schema
  • Api: provider returned an error response (HTTP status, error type, message)

Api

instantiate

(Fn [Int, String, String] LLMError)

creates a Api.

Config

instantiate

(Fn [String] LLMError)

creates a Config.

Decode

instantiate

(Fn [String] LLMError)

creates a Decode.

Transport

instantiate

(Fn [ClientError] LLMError)

creates a Transport.

copy

instantiate

(Fn [(Ref LLMError a)] LLMError)

copies a LLMError.

delete

instantiate

(Fn [LLMError] ())

deletes a LLMError. This should usually not be called manually.

delivered?

defn

(Fn [(Ref LLMError a)] Bool)

                        (delivered? e)
                    

whether the provider received the request before the failure.

true means a retry repeats work the provider has already done, which for a generation endpoint is a second billed call. A caller doing something that is not idempotent should check this before retrying, even when retryable? says another attempt could succeed.

get-tag

instantiate

(Fn [(Ref LLMError a)] Int)

Gets the tag from a LLMError.

prn

instantiate

(Fn [(Ref LLMError a)] String)

converts a LLMError to a string.

str

defn

(Fn [(Ref LLMError a)] String)

                        (str e)
                    

formats an LLMError as a human-readable string.