GenerateTypedContentRequest

class GenerateTypedContentRequest<T : Any>


A request to generate typed content.

This is an experimental feature.

Summary

Public companion functions

GenerateTypedContentRequest.Builder<T>
<T : Any> builder(
    generateContentRequest: GenerateContentRequest,
    outputClass: KClass<T>
)

Public properties

GenerateContentRequest

the underlying GenerateContentRequest that contains the input and configuration for generation.

Boolean

Whether to include input schema in prompt.

KClass<T>

the target class type to which the model will generate.

Public companion functions

builder

fun <T : Any> builder(
    generateContentRequest: GenerateContentRequest,
    outputClass: KClass<T>
): GenerateTypedContentRequest.Builder<T>

Public properties

generateContentRequest

val generateContentRequestGenerateContentRequest

the underlying GenerateContentRequest that contains the input and configuration for generation.

includeSchemaInPrompt

val includeSchemaInPromptBoolean

Whether to include input schema in prompt. Default to true.

outputClass

val outputClassKClass<T>

the target class type to which the model will generate. This class must be annotated with @Generable, otherwise a GenAiException with GenAiException.ErrorCode.STRUCTURED_OUTPUT_REQUEST_ERROR will be thrown during inference. Refer to Generable for more details on requirements for the annotated class.