Imp.LM.Result (Imp v0.5.0)

Copy Markdown View Source

Canonical boundary between LM output and provider metadata.

Most language models return their output value directly. Provider-backed clients may retain transport metadata in a reserved envelope. This module is the only place where that envelope is interpreted.

Summary

Types

metadata()

@type metadata() :: map()

output()

@type output() :: binary() | map() | Imp.Prediction.t()

Functions

metadata(value)

@spec metadata(output()) :: {:ok, metadata()} | {:error, term()}

output(value)

@spec output(output()) :: {:ok, output()} | {:error, term()}

split(value)

@spec split(output()) :: {:ok, output(), metadata()} | {:error, term()}

unwrap(error)

@spec unwrap({:ok, output()} | {:error, term()}) :: {:ok, output()} | {:error, term()}