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

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

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

# chat

[common]\
fun [chat](chat.md)(messages: [List](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-list/index.html)&lt;[ChatMessage](../ChatMessage/index.md)&gt;, config: [GenerationConfig](../GenerationConfig/index.md), listener: [GenerationListener](../GenerationListener/index.md)): [GenerationHandle](../GenerationHandle/index.md)

Stream a reply to [messages](chat.md) under [config](chat.md). Returns at once; the worker runs the request and calls [listener](chat.md) on its thread. A second [chat](chat.md) while one runs waits for the first to end. After [close](close.md) the listener receives [GenerationListener.onError](../GenerationListener/onError.md) and nothing else.