Both generateText
and generateStream
accept an optional second parameter with generation options:
temperature
(number): Controls randomness of output. Higher values = more creative, lower values = more focused. Maximum value is 2.0
maxTokens
(number): Maximum number of tokens in the responsetopK
(number): Limits sampling to top K most likely tokenstopP
(number): Nucleus sampling threshold (cannot be used with topK). Maximum value is 1.0
.schema
(ZodObject): Zod schema for structured outputYou cannot specify both topK
and topP
simultaneously