CouncilEx.MemberSpec (CouncilEx v0.1.0)

Copy Markdown View Source

Dispatch helpers that abstract over the two member representations:

  • Module form — an atom referencing a module that use CouncilEx.Member. Static councils declared with the DSL produce these.

  • Dynamic form%CouncilEx.DynamicMember{} struct. Used by runtime-built / DB-restored councils.

RoundExec calls these helpers instead of the member callbacks directly so it works against both kinds without branching.

Summary

Functions

True if the member is a %DynamicMember{} struct.

Resolve the member's output schema.

Resolve the member's tool refs to actual tool modules.

Member's role string.

Render the system prompt for a given (already-transformed) input.

Run the member's input transformer (defaults to identity).

Validate the parsed member output.

Types

t()

@type t() :: module() | CouncilEx.DynamicMember.t()

Functions

dynamic?(arg1)

@spec dynamic?(t()) :: boolean()

True if the member is a %DynamicMember{} struct.

output_schema(mod)

@spec output_schema(t()) :: nil | module() | {:json_schema, map()}

Resolve the member's output schema.

Returns one of:

  • nil — no structured output
  • module() — Ecto schema module (current contract)
  • {:json_schema, map()} — inline JSON Schema (dynamic-form members only)

resolve_tools(refs)

@spec resolve_tools([CouncilEx.DynamicMember.tool_ref()] | nil) :: [module()] | nil

Resolve the member's tool refs to actual tool modules.

Each ref is either a string (registry lookup) or a module atom (used as-is). Returns a list of modules.

role(mod)

@spec role(t()) :: String.t()

Member's role string.

system_prompt(mod, input)

@spec system_prompt(t(), map()) :: String.t()

Render the system prompt for a given (already-transformed) input.

transform_input(mod, input, ctx)

@spec transform_input(t(), map(), CouncilEx.Context.t()) :: map()

Run the member's input transformer (defaults to identity).

validate(mod, output)

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

Validate the parsed member output.