Package com.google.genkit.ai
Class GenerateOptions<T>
java.lang.Object
com.google.genkit.ai.GenerateOptions<T>
- Type Parameters:
T- the output type for structured output (use Void if not using typed output)
Options for text generation requests.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classBuilder for GenerateOptions. -
Constructor Summary
ConstructorsConstructorDescriptionGenerateOptions(String model, String prompt, List<Message> messages, List<Document> docs, String system, List<Tool<?, ?>> tools, Object toolChoice, OutputConfig output, GenerationConfig config, Map<String, Object> context, Integer maxTurns, ResumeOptions resume, Class<T> outputClass) Creates new GenerateOptions. -
Method Summary
Modifier and TypeMethodDescriptionstatic <T> GenerateOptions.Builder<T> builder()Creates a builder for GenerateOptions.Gets the generation configuration.Gets the additional context.getDocs()Gets the documents for context.Gets the maximum conversation turns.Gets the conversation messages.getModel()Gets the model name.Gets the output configuration.Gets the output class for structured output.Gets the text prompt.Gets the resume options for continuing after an interrupt.Gets the system prompt.Gets the tool choice strategy.getTools()Gets the available tools.Converts these options to a ModelRequest.
-
Constructor Details
-
GenerateOptions
public GenerateOptions(String model, String prompt, List<Message> messages, List<Document> docs, String system, List<Tool<?, ?>> tools, Object toolChoice, OutputConfig output, GenerationConfig config, Map<String, Object> context, Integer maxTurns, ResumeOptions resume, Class<T> outputClass) Creates new GenerateOptions.- Parameters:
model- the model nameprompt- simple text promptmessages- conversation messagesdocs- documents for contextsystem- system prompttools- available toolstoolChoice- tool selection strategyoutput- output configurationconfig- generation configurationcontext- additional contextmaxTurns- maximum conversation turnsresume- options for resuming after an interruptoutputClass- the output class for structured output
-
-
Method Details
-
builder
Creates a builder for GenerateOptions.- Type Parameters:
T- the output type- Returns:
- a new builder
-
getModel
Gets the model name.- Returns:
- the model name
-
getPrompt
Gets the text prompt.- Returns:
- the prompt
-
getMessages
Gets the conversation messages.- Returns:
- the messages
-
getDocs
Gets the documents for context.- Returns:
- the documents
-
getSystem
Gets the system prompt.- Returns:
- the system prompt
-
getTools
Gets the available tools.- Returns:
- the tools
-
getToolChoice
Gets the tool choice strategy.- Returns:
- the tool choice
-
getOutput
Gets the output configuration.- Returns:
- the output config
-
getConfig
Gets the generation configuration.- Returns:
- the config
-
getContext
Gets the additional context.- Returns:
- the context
-
getMaxTurns
Gets the maximum conversation turns.- Returns:
- the max turns
-
getResume
Gets the resume options for continuing after an interrupt.- Returns:
- the resume options, or null if not resuming
-
toModelRequest
Converts these options to a ModelRequest.- Returns:
- a ModelRequest
-
getOutputClass
Gets the output class for structured output.- Returns:
- the output class, or null if not using typed output
-