ObservedClassificationService

@ApiStatus.Experimental
class ObservedClassificationService constructor(delegate: ClassificationService, observationRegistry: <Error class: unknown class> = ObservationRegistry.NOOP) : ClassificationService

Opt-in observations for classification, with the delegate's metadata and model family preserved. Each call emits embabel.ai.classification with fixed operation and outcome tags and validates the selected category against the request. Provider observations inherit the open call scope. Payloads, model identifiers and raw exceptions are never added to these observations or debug logs. Operational failures and thrown exceptions record a fixed, stackless error marker with no cause. The original exception is rethrown unchanged; the wrapper never changes thread interruption state. Non-fatal observation lifecycle exceptions use bounded diagnostics when logging is available and never replace service behavior. JVM error types propagate.

Constructors

Link copied to clipboard
constructor(delegate: ClassificationService, observationRegistry: <Error class: unknown class> = ObservationRegistry.NOOP)

Properties

Link copied to clipboard
open override val name: String

Name of the LLM, such as "gpt-3.5-turbo"

Link copied to clipboard
open override val provider: String

Name of the provider, such as "OpenAI"

Link copied to clipboard
open override val type: ModelType

Functions

Link copied to clipboard

Classify text using only the request's category domain, returning evidence rather than routing policy.

open override fun classify(input: String, spec: ClassificationSpec): ClassificationResult

Classifies text with a spec. Same as calling classify with ClassificationRequest.of(input, spec).

Link copied to clipboard
open override fun infoString(verbose: Boolean?, indent: Int): String
Link copied to clipboard

Copy public model identity into pure metadata before serialization. This snapshot contains no live client, credentials, or implementation discriminator. Serializing the live service itself is outside this contract; use this method even when the service is viewed as ModelMetadata.