Dsxir.Module (dsxir v0.1.0)

Copy Markdown

Declarative user-program shell.

defmodule MyApp.MeetingNotes do
  use Dsxir.Module

  predictor :answer, Dsxir.Predictor.Predict, signature: MyApp.AnswerQuestion

  def forward(prog, %{question: q}) do
    {prog, pred} = call(prog, :answer, %{question: q})
    {prog, pred}
  end
end

Inside forward/2, call(prog, :name, inputs) dispatches through Dsxir.Module.Runtime. Predictor names referenced in call/3 must be declared via the predictor entity above; the compile-time verifier catches typos. Non-literal predictor names (variables, dynamic dispatch) bypass the static check and are validated at runtime.

Options

  • :extensions (list of module that adopts Spark.Dsl.Extension) - A list of DSL extensions to add to the Spark.Dsl

  • :otp_app (atom/0) - The otp_app to use for any application configurable options

  • :fragments (list of module/0) - Fragments to include in the Spark.Dsl. See the fragments guide for more.

Summary

Functions

call(prog, name, inputs)

(macro)

call(prog, name, inputs, opts)

(macro)