JsonSchema

Definition of a data type.

These types can be objects, but also primitives and arrays. Represents a select subset of an JsonSchema object.

Note: While optional, including a description field in your JsonSchema is strongly encouraged. The more information the model has about what it's expected to generate, the better the results.

Note for Structured Output:

  • For on-device and hybrid inference (ONLY_ON_DEVICE, PREFER_ON_DEVICE, and PREFER_IN_CLOUD): Requires using the @Generable annotation on a data class. Manual schemas are not supported.

  • For cloud-only inference (ONLY_IN_CLOUD): Supports both @Generable annotations (recommended) and manual schemas.

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard
Link copied to clipboard
val clazz: KClass<T>
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
val items: JsonSchema<*>?
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

Functions

Link copied to clipboard
fun getSerializer(): KSerializer<T>