Reads the failure classes callers act on, through the wrappers Imp puts around an error.
An LM error reaches a caller directly ({:error, %Imp.LMError{}}), from
a client that raised ({:lm_failed, client, exception}), or inside the
Imp.Predict.ReActV2.StepError of a turn that got no model response. These
functions accept any of them, with or without the {:error, _} around it.
Summary
Functions
Whether the provider refused the request because its input is longer than the model accepts.
Whether sending the same request again may succeed.
Functions
Whether the provider refused the request because its input is longer than the model accepts.
iex> Imp.Errors.context_window_exceeded?(%Imp.LMError{status: 400, context_window_exceeded: true})
true
iex> Imp.Errors.context_window_exceeded?({:error, %Imp.LMError{status: 500}})
false
Whether sending the same request again may succeed.
iex> Imp.Errors.retryable?(%Imp.LMError{status: 429, retryable: true})
true
iex> Imp.Errors.retryable?({:error, %Imp.LMError{status: 400}})
false
iex> Imp.Errors.retryable?(%Imp.AdapterParseError{kind: :malformed})
false