GenerateTypedContentRequest

public final class GenerateTypedContentRequest<T extends Object>


A request to generate typed content.

This is an experimental feature.

Summary

Nested types

public final class GenerateTypedContentRequest.Builder<T extends Object>

Builder for GenerateTypedContentRequest.

Public methods

final @NonNull GenerateContentRequest

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

final boolean

Whether to include input schema in prompt.

final @NonNull KClass<@NonNull T>

the target class type to which the model will generate.

Public methods

getGenerateContentRequest

public final @NonNull GenerateContentRequest getGenerateContentRequest()

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

getIncludeSchemaInPrompt

public final boolean getIncludeSchemaInPrompt()

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

getOutputClass

public final @NonNull KClass<@NonNull T> getOutputClass()

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.