chat

suspend fun ChatModel.chat(prompt: String, system: String? = null, attachments: List<Attachment> = emptyList()): String

Sends prompt as a single user message and returns the text of the answer, for a node that only needs a piece of text from the model. Call ChatModel.chat with a ChatRequest when you need to know whether the answer was cut off.

node("summarize", work = { model.chat("Summarize: ${it.notes}") }) { state, summary ->
state.copy(summary = summary)
}

Parameters

attachments

files that go to the model with prompt, such as images or PDFs.