LlmClassifier

class LlmClassifier @JvmOverloads constructor(val model: Model, val generateContentConfig: GenerateContentConfig? = null) : Classifier

Answers typed questions with any Model through structured output: the model is asked for a probability for every option and constrained to a JSON schema built from the questions, so it can only answer with the given labels. The probabilities are the model's stated values rather than token log-probabilities, so check their calibration with evals before relying on a threshold.

Constructors

Link copied to clipboard
constructor(model: Model, generateContentConfig: GenerateContentConfig? = null)

Types

Link copied to clipboard
class Builder

Fluent builder for LlmClassifier, provided primarily for Java callers. Any property left unset falls back to the same default as the constructor.

Link copied to clipboard
object Companion

Properties

Link copied to clipboard

Generation settings such as temperature; it must not set the system instruction or response schema, and its response MIME type is replaced with JSON.

Link copied to clipboard

The model that answers every request.

Link copied to clipboard
open override val name: String

The provider's model name, such as "jev-latest" or "gemini-3.8-flash".

Functions

Link copied to clipboard
open suspend override fun classify(request: ClassifierRequest): ClassifierResponse

Asks the model every question in request in one structured-output call. Choice and Score probabilities are clamped at 0 and normalized to sum to 1; a Binary probability must lie in [0, 1].