---
title: "Processor"
sidebar_label: "Processor"
description: "Kotlin binding reference: Processor."
---

<!-- Generated by tools/api_reference/generate_api_docs.py. Do not edit. -->

//[clika-runtime](../../../index.md)/[io.clika.runtime](../index.md)/[Processor](index.md)

# Processor

[common]\
class [Processor](index.md)

A model directory's preprocessors as one composite: the tokenizer and the one media processor (image, audio or video) its files describe; a missing piece leaves its slot empty rather than failing the load. Each accessor hands out a standalone handle sharing the composite's instance, valid after the composite is closed; an empty slot fails with `NOT_FOUND`, so check the `has` properties first. `AutoCloseable`.

```kotlin
Processor.fromHuggingface("/path/to/model").use { composite ->
    val tokenizer = composite.tokenizer()
    if (composite.hasImageProcessor) composite.imageProcessor().use { /* ... */}
}
```

## Types

| Name | Summary |
|---|---|
| [Companion](Companion/index.md) | [common]<br>object [Companion](Companion/index.md) |

## Properties

| Name | Summary |
|---|---|
| [hasAudioProcessor](hasAudioProcessor.md) | [common]<br>val [hasAudioProcessor](hasAudioProcessor.md): [Boolean](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html)<br>True when an audio processor is present. |
| [hasImageProcessor](hasImageProcessor.md) | [common]<br>val [hasImageProcessor](hasImageProcessor.md): [Boolean](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html)<br>True when an image processor is present. |
| [hasTokenizer](hasTokenizer.md) | [common]<br>val [hasTokenizer](hasTokenizer.md): [Boolean](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html)<br>True when the model directory shipped a tokenizer. |
| [hasVideoProcessor](hasVideoProcessor.md) | [common]<br>val [hasVideoProcessor](hasVideoProcessor.md): [Boolean](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html)<br>True when a video processor is present. |

## Functions

| Name | Summary |
|---|---|
| [audioProcessor](audioProcessor.md) | [common]<br>fun [audioProcessor](audioProcessor.md)(): [AudioProcessor](../AudioProcessor/index.md)<br>The audio processor; fails with `NOT_FOUND` when the slot is empty. |
| [close](close.md) | [common]<br>open fun [close](close.md)() |
| [imageProcessor](imageProcessor.md) | [common]<br>fun [imageProcessor](imageProcessor.md)(): [ImageProcessor](../ImageProcessor/index.md)<br>The image processor; fails with `NOT_FOUND` when the slot is empty. |
| [tokenizer](tokenizer.md) | [common]<br>fun [tokenizer](tokenizer.md)(): [Tokenizer](../Tokenizer/index.md)<br>The tokenizer the model directory shipped, with the special ids its configuration names. |
| [videoProcessor](videoProcessor.md) | [common]<br>fun [videoProcessor](videoProcessor.md)(): [VideoProcessor](../VideoProcessor/index.md)<br>The video processor; fails with `NOT_FOUND` when the slot is empty. |