Spectre.Inference.ProviderEvent (Spectre v0.3.2)

Copy Markdown View Source

Normalized event emitted by a streaming provider adapter.

Delta payloads are binary fragments. They may end inside a UTF-8 codepoint; the stream session reassembles and validates the bounded trailing bytes before exposing text to a consumer.

Summary

Types

t()

@type t() :: %Spectre.Inference.ProviderEvent{
  cursor: term(),
  kind: term(),
  metadata: term(),
  payload: term(),
  provider_request_id: term(),
  provider_sequence: term(),
  usage: term(),
  usage_quality: term()
}

Functions

completed(response, opts \\ [])

@spec completed(
  Spectre.Inference.Response.t() | String.t() | map(),
  keyword()
) :: t()

delta(text, opts \\ [])

@spec delta(
  binary(),
  keyword()
) :: t()

new(kind, opts \\ [])

@spec new(
  atom(),
  keyword()
) :: t()