Class ResumeOptions

java.lang.Object
com.google.genkit.ai.ResumeOptions

public class ResumeOptions extends Object
Options for resuming after an interrupt.

When generation is interrupted by a tool, you can resume by providing responses to the interrupted tool requests or by restarting them with new inputs.

Example usage:


 // Respond to an interrupt
 ResumeOptions resume = ResumeOptions.builder().respond(interrupt.respond("user confirmed")).build();

 // Restart an interrupt with new input
 ResumeOptions resume = ResumeOptions.builder().restart(interrupt.restart(null, newInput)).build();
 
  • Constructor Details

    • ResumeOptions

      public ResumeOptions()
      Default constructor.
  • Method Details

    • getRespond

      public List<ToolResponse> getRespond()
      Gets the tool responses for interrupted requests.
      Returns:
      the tool responses
    • setRespond

      public void setRespond(List<ToolResponse> respond)
      Sets the tool responses for interrupted requests.
      Parameters:
      respond - the tool responses
    • getRestart

      public List<ToolRequest> getRestart()
      Gets the tool requests to restart.
      Returns:
      the tool requests to restart
    • setRestart

      public void setRestart(List<ToolRequest> restart)
      Sets the tool requests to restart.
      Parameters:
      restart - the tool requests to restart
    • builder

      public static ResumeOptions.Builder builder()
      Creates a new builder.
      Returns:
      a new builder