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

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

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

# EmbeddingModel

[common]\
class [EmbeddingModel](index.md) : [PreTrainedModel](../PreTrainedModel/index.md)

A text-embedding model: one vector per text, the same length for every text ([Capabilities.embeddingDim](../Capabilities/embeddingDim.md)), so two texts compare by the cosine of their vectors.

Open it with [open](Companion/open.md) from a checkpoint the model library's embedding families claim (a family that declares a vector out of text alone). Hand it texts with [embed](embed.md); the vectors arrive through the listener on the model's own worker thread, one request at a time per model. [close](close.md) frees the weights.

## Types

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

## Properties

| Name | Summary |
|---|---|
| [capabilities](capabilities.md) | [common]<br>val [capabilities](capabilities.md): [Capabilities](../Capabilities/index.md)<br>What the model takes and gives, read when it opened: [Capabilities.embeddingDim](../Capabilities/embeddingDim.md) is the vectors' length. |
| [config](config.md) | [common]<br>open override val [config](config.md): [PretrainedConfig](../PretrainedConfig/index.md)<br>The checkpoint's identity, read when the model opened. |

## Functions

| Name | Summary |
|---|---|
| [close](close.md) | [common]<br>open fun [close](close.md)()<br>Free the model. A running request is canceled first and the call waits for it to return; called from inside a listener callback, the free runs right after that callback's request ends instead. Idempotent. |
| [embed](embed.md) | [common]<br>fun [embed](embed.md)(text: [String](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html), listener: [EmbeddingListener](../EmbeddingListener/index.md)): [EmbeddingHandle](../EmbeddingHandle/index.md)<br>Embed one [text](embed.md): [embed](embed.md) over a list of one.<br>[common]<br>fun [embed](embed.md)(texts: [List](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-list/index.html)&lt;[String](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html)&gt;, listener: [EmbeddingListener](../EmbeddingListener/index.md)): [EmbeddingHandle](../EmbeddingHandle/index.md)<br>Embed [texts](embed.md). Returns at once; the worker runs the request and calls [listener](embed.md) on its thread: [EmbeddingListener.onEmbeddings](../EmbeddingListener/onEmbeddings.md) with one vector per text, in the texts' order, then [EmbeddingListener.onDone](../EmbeddingListener/onDone.md) with the [EmbeddingReport](../EmbeddingReport/index.md). A text longer than the model's window is cut to it. |
| [residency](residency.md) | [common]<br>open override fun [residency](residency.md)(): [ResidencyReport](../ResidencyReport/index.md)<br>What the model holds on each device right now ([ResidencyReport](../ResidencyReport/index.md)); a closed model refuses with [ModelverseException](../ModelverseException/index.md). |