Package com.google.genkit.ai
Class GenerateActionOptions
java.lang.Object
com.google.genkit.ai.GenerateActionOptions
High-level options for the generate action, representing the generate request before
model and tool resolution. This is the Java equivalent of the JS
GenerateActionOptions
type.
This type is used by:
- The
/util/generateaction (Dev UI) - The
wrapGeneratemiddleware hook
Unlike ModelRequest, which is the low-level resolved request sent to a model,
this class retains high-level information such as the model name as a string and tool names as
string references. This allows wrapGenerate middleware to modify these values before
resolution occurs (e.g., swapping the model, adding/removing tools by name, changing output
format).
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetDocs()getModel()getTools()voidsetConfig(GenerationConfig config) voidvoidsetMaxTurns(Integer maxTurns) voidsetMessages(List<Message> messages) voidvoidsetOutput(OutputConfig output) voidsetResources(List<String> resources) voidsetReturnToolRequests(Boolean returnToolRequests) voidsetStepName(String stepName) voidsetToolChoice(String toolChoice) voidwithMessages(List<Message> newMessages) Returns a newGenerateActionOptionswith the given messages, preserving all other fields.Returns a newGenerateActionOptionswith the given model name, preserving all other fields.
-
Constructor Details
-
GenerateActionOptions
public GenerateActionOptions()Default constructor for JSON deserialization.
-
-
Method Details
-
withMessages
Returns a newGenerateActionOptionswith the given messages, preserving all other fields. This is used in the tool loop to advance the conversation without mutating the original.- Parameters:
newMessages- the updated message list- Returns:
- a new options instance
-
withModel
Returns a newGenerateActionOptionswith the given model name, preserving all other fields.- Parameters:
newModel- the model name- Returns:
- a new options instance
-
getModel
-
setModel
-
getMessages
-
setMessages
-
getTools
-
setTools
-
getResources
-
setResources
-
getToolChoice
-
setToolChoice
-
getConfig
-
setConfig
-
getOutput
-
setOutput
-
getDocs
-
setDocs
-
getReturnToolRequests
-
setReturnToolRequests
-
getMaxTurns
-
setMaxTurns
-
getStepName
-
setStepName
-