GenAI.StreamHandler.Behaviour behaviour (GenAI Core v0.2.1)

Link to this section Summary

Link to this section Callbacks

Link to this callback

begin_stream(handler, session, context, options)

@callback begin_stream(
  handler :: term(),
  session :: term(),
  context :: term(),
  options :: term()
) ::
  {:ok, {{state :: term(), handler :: term()}, session :: term()}}
  | {:error, reason :: term()}
Link to this callback

handle_event(event, state)

@callback handle_event(event :: term(), state :: term()) ::
  {:cont, state :: term()} | {:halt, state :: term()}