Claudex.Messages.BatchResult (Claudex v0.6.1)

Copy Markdown View Source

One request's outcome in a batch: the custom_id it was submitted with and the result it ended in.

Match on result to handle each outcome:

case result do
  %BatchResult{custom_id: id, result: {:ok, message}} -> store(id, message)
  %BatchResult{result: {:error, error}} -> log(error)
  %BatchResult{result: :canceled} -> :ok
  %BatchResult{result: :expired} -> requeue(result.custom_id)
end

Expired requests aren't billed — those are ones the batch's 24 hours ran out on before they reached the model.

Summary

Types

result()

@type result() ::
  {:ok, Claudex.Message.t()}
  | {:error, Claudex.Error.t()}
  | :canceled
  | :expired

t()

@type t() :: %Claudex.Messages.BatchResult{custom_id: String.t(), result: result()}