Baton.Flow.LLMAdapter behaviour (Baton v0.27.4)

Copy Markdown View Source

Host extension contract for portable LLM nodes that need domain preparation.

The portable definition still owns prompts, model, schema, and topology. An allow-listed adapter may prepare richer messages, short-circuit a call, and normalize the decoded response without placing host modules in stored data.

Summary

Callbacks

handle_response(data, context, job)

@callback handle_response(data :: term(), context :: term(), job :: Oban.Job.t()) ::
  Baton.LLMStep.step_result()

request(node, job)

@callback request(node :: map(), job :: Oban.Job.t()) ::
  {:ok, [Baton.LLMStep.message()], keyword()}
  | {:ok, [Baton.LLMStep.message()], keyword(), context :: term()}
  | {:done, map()}
  | {:error, term()}
  | {:snooze, pos_integer()}
  | {:cancel, term()}