TypeSafe.Response (typesafe_ex v0.1.0)

Copy Markdown View Source

The result of TypeSafe.system_one/4.

  • answers - one answer per question, under the same key the question used. With atom keys you can write response.answers.team.choice.
  • model - the versioned model that answered, such as "jev-1.13.0", even when the request named an alias like "jev-latest". Log it next to anything you store, so a threshold can be traced to the model it was tuned on.
  • usage - %{input_tokens: n, output_tokens: n}. Only input tokens are billed.
  • request_id - the x-typesafe-request-id header, for support requests.
  • body - the decoded JSON body, for fields this client does not know yet.

Summary

Types

answer()

t()

@type t() :: %TypeSafe.Response{
  answers: %{required(atom() | String.t()) => answer()},
  body: map(),
  model: String.t(),
  request_id: String.t() | nil,
  usage: %{input_tokens: non_neg_integer(), output_tokens: non_neg_integer()}
}