Package com.google.genkit.ai
Class GenerateOptions.Builder<T>
java.lang.Object
com.google.genkit.ai.GenerateOptions.Builder<T>
- Type Parameters:
T- the output type for structured output
- Enclosing class:
GenerateOptions<T>
Builder for GenerateOptions.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbuild()config(GenerationConfig config) output(OutputConfig output) <U> GenerateOptions.Builder<U> outputClass(Class<U> outputClass) Sets the output class for typed structured output.resume(ResumeOptions resume) Sets the resume options for continuing after an interrupt.toolChoice(Object toolChoice)
-
Constructor Details
-
Builder
public Builder()
-
-
Method Details
-
model
-
prompt
-
messages
-
docs
-
system
-
tools
-
toolChoice
-
output
-
outputClass
Sets the output class for typed structured output.When set, the schema is automatically generated from the class. Use
@JsonPropertyDescriptionto add descriptions to fields:public class MenuItem { @JsonPropertyDescription("The name of the menu item") private String name; @JsonPropertyDescription("The estimated number of calories") private int calories; } // Usage: MenuItem item = genkit.generate(GenerateOptions.<MenuItem>builder().model("openai/gpt-4o-mini") .prompt("Suggest a menu item").outputClass(MenuItem.class).build());- Parameters:
outputClass- the output class- Returns:
- this builder
-
config
-
context
-
maxTurns
-
resume
Sets the resume options for continuing after an interrupt.- Parameters:
resume- the resume options- Returns:
- this builder
-
build
-