generate method

Middleware for the top-level generate call.

Wraps the entire generation process, including the tool loop.

next is the function to call to proceed with the generation.

Implementation

Future<GenerateResult> generate(
  GenerateTurnState envelope,
  ActionFnArg<ModelResponseChunk, GenerateActionOptions, void> ctx,
  Future<GenerateResult> Function(
    GenerateTurnState envelope,
    ActionFnArg<ModelResponseChunk, GenerateActionOptions, void> ctx,
  )
  next,
) {
  return next(envelope, ctx);
}