Dsxir.CallContext (dsxir v0.1.0)

Copy Markdown

Value type handed to call_plugs. Carries the call-site information a plug needs to make an :ok | {:halt, reason} decision before the predictor's forward/4 runs.

Plugs are plain functions of arity 1:

plug_fn :: (%Dsxir.CallContext{} -> :ok | {:halt, reason :: term()})

Plugs see the resolved metadata (Dsxir.Settings.resolve(:metadata) merged at the wrapper) so tenant identity, request id, and any custom keys are available without going back through settings.

Summary

Functions

Build a t() from fields. Raises if any of the :predictor, :signature, :inputs, or :program keys are missing.

Types

t()

@type t() :: %Dsxir.CallContext{
  inputs: map(),
  metadata: map(),
  opts: keyword(),
  predictor: atom(),
  program: Dsxir.Program.t(),
  signature: module()
}

Functions

new(fields)

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

Build a t() from fields. Raises if any of the :predictor, :signature, :inputs, or :program keys are missing.