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

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

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

# ChatMessage

[common]\
data class [ChatMessage](index.md)(val role: [String](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html), val content: [String](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html), val images: [List](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-list/index.html)&lt;[ByteArray](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-byte-array/index.html)&gt; = emptyList(), val toolCalls: [List](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-list/index.html)&lt;[ToolCall](../ToolCall/index.md)&gt; = emptyList(), val toolCallId: [String](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html) = &quot;&quot;, val name: [String](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html) = &quot;&quot;)

One turn of a conversation. [role](role.md) is `system`, `user` or `assistant`; [content](content.md) the text; [images](images.md) the encoded image files (PNG or JPEG bytes) the turn carries, decoded by the library and placed in the turn where the model's template puts them. A model that takes no images refuses a turn with one, and a request carrying more than [Capabilities.maxImagesPerRequest](../Capabilities/maxImagesPerRequest.md) across its turns is refused; either request ends in [GenerationListener.onError](../GenerationListener/onError.md). An assistant turn that called tools carries them as [toolCalls](toolCalls.md); a tool's result is a [ROLE_TOOL](Companion/ROLE_TOOL.md) turn naming the call it answers ([toolCallId](toolCallId.md)).

## Constructors

| | |
|---|---|
| [ChatMessage](ChatMessage.md) | [common]<br>constructor(role: [String](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html), content: [String](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html), images: [List](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-list/index.html)&lt;[ByteArray](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-byte-array/index.html)&gt; = emptyList(), toolCalls: [List](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-list/index.html)&lt;[ToolCall](../ToolCall/index.md)&gt; = emptyList(), toolCallId: [String](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html) = &quot;&quot;, name: [String](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html) = &quot;&quot;) |

## Types

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

## Properties

| Name | Summary |
|---|---|
| [content](content.md) | [common]<br>val [content](content.md): [String](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html) |
| [images](images.md) | [common]<br>val [images](images.md): [List](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-list/index.html)&lt;[ByteArray](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-byte-array/index.html)&gt; |
| [name](name.md) | [common]<br>val [name](name.md): [String](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html)<br>On a tool turn, the tool's name when known. |
| [role](role.md) | [common]<br>val [role](role.md): [String](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html) |
| [toolCallId](toolCallId.md) | [common]<br>val [toolCallId](toolCallId.md): [String](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html)<br>On a tool turn, the id of the call this result answers. |
| [toolCalls](toolCalls.md) | [common]<br>val [toolCalls](toolCalls.md): [List](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-list/index.html)&lt;[ToolCall](../ToolCall/index.md)&gt;<br>The calls an assistant turn made ([ChatSession](../ChatSession/index.md) records them); empty on every other turn. |