chat

suspend fun ChatModel.chat(prompt: String, system: String? = null): 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)
}