Normandy.Agents.Turn.Driver.Handlers (normandy v2.2.0)

View Source

The injected side-effecting functions the driver consults per effect.

Normandy.Agents.BaseAgent's validate makes the blank-answer check (a blank chat answer is the :invalid_output Normandy.LLMError) and a chat agent's fallback to its tool round's text. A custom validate makes neither: a blank answer succeeds. The shell (BaseAgent.run/3, stream/3, Turn.Server) marks the run :stop answer_source: :tool_round around any validate, a custom one included, whenever it turns a blank chat_message into a non-blank one.

Summary

Functions

Normandy.Agents.BaseAgent's set: the one Turn.Server (and Turn.Session) uses when :handlers is nil. Build a custom set from it, replacing only what you need

Types

acc()

@type acc() :: term()

t()

@type t() :: %Normandy.Agents.Turn.Driver.Handlers{
  append: (acc(), String.t(), term() -> acc()),
  call_llm: (acc(), Normandy.Agents.Turn.State.t(), map() -> term()),
  compact: (acc(), Normandy.Agents.Turn.State.t(), map() -> {acc(), map()}),
  convert: (acc(), term(), term() -> term()),
  dispatch_tools: (acc(), [term()] -> [term()]),
  emit: (acc(), atom(), map() -> any()),
  guard: (acc(), term() -> any()),
  validate: (acc(), term() -> term())
}

Functions

default()

@spec default() :: t()

Normandy.Agents.BaseAgent's set: the one Turn.Server (and Turn.Session) uses when :handlers is nil. Build a custom set from it, replacing only what you need:

%{Normandy.Agents.Turn.Driver.Handlers.default() | validate: my_validate}