Behaviour for CouncilEx.AutoCouncil resolution strategies.
A strategy receives the raw prompt plus the parent AutoCouncil and must
return a decision tuple naming a council to run, or an error.
Implementing a custom strategy
defmodule MyApp.AutoCouncil.UserPreference do
@behaviour CouncilEx.AutoCouncil.Strategy
@impl true
def resolve(prompt, %CouncilEx.AutoCouncil{} = auto) do
# ...pick a council based on user prefs in process dict, request ctx, etc.
{:ok, {:static, MyApp.Councils.Default}, "user default"}
end
end
AutoCouncil.new(strategy: {MyApp.AutoCouncil.UserPreference, []})
Summary
Types
@type result() :: {:ok, CouncilEx.AutoCouncil.decision(), reason :: String.t() | nil} | {:ok, CouncilEx.AutoCouncil.decision(), reason :: String.t() | nil, score :: float() | nil, catalog_id :: String.t() | nil} | {:error, term()}
What the strategy returns from resolve/2.
Callbacks
@callback resolve(prompt :: term(), CouncilEx.AutoCouncil.t()) :: result()