Oi. Step
(oi v0.7.0)
Copy Markdown
Lightweight declarative syntax layer on top of Orchid.Step /
OrchidSymbiont.Step. Provides a simple API and exposes
__node_spec__/0 for topology integration.
Pure step
defmodule MyApp.Steps.Upcase do
use Oi.Step, name: :upcase
manifest(
inputs: [:text],
outputs: [result: :string]
)
routine text, opts do
report(opts, 100, "Reached!")
text |> String.upcase() |> ok()
end
endSymbiont step
defmodule MyApp.Steps.Predict do
use Oi.Step, name: :predict, symbiont?: true
manifest(
inputs: [:features],
outputs: [prediction: :tensor],
models: [:encoder, :predictor],
heavy?: true
)
routine features, models, opts do
{:ok, {enc}} = OrchidSymbiont.call(models.encoder, {:infer, features})
ok(enc)
end
endok / err — Rust-style result constructors
routine text, opts do
case validate(text) do
{:ok, v} -> ok(v)
{:error, e} -> err(e)
end
end- Single output:
ok(value)→{:ok, %Orchid.Param{}} - Multi-output:
ok({a, b})/ok([a, b])→{:ok, [%Param{}, %Param{}]}
Summary
Functions
Wraps reason as {:error, reason}.
Declare step metadata. Must be called before routine.
Wraps value as {:ok, Param | [Param]}.
Define execution logic, expands to run/2 (pure) or run_with_model/3
(symbiont).
Functions
Wraps reason as {:error, reason}.
Declare step metadata. Must be called before routine.
:inputs— input port names (atoms):outputs— keyword list,port_name => param_type:models— model names for symbiont steps (required whensymbiont?):heavy?— boolean, defaultfalse
Wraps value as {:ok, Param | [Param]}.
Define execution logic, expands to run/2 (pure) or run_with_model/3
(symbiont).
Auto-unwraps input Params:
- Single input
routine text, opts→ payload bound directly - Multi-input
routine [a, b], opts→ list unwrap - Multi-input
routine {a, b}, opts→ tuple unwrap
Symbiont models bound to handler map (e.g. models.encoder).