springGenerationToKoogResponses

fun springGenerationToKoogResponses(generation: Generation, clock: Clock = kotlin.time.Clock.System, usage: Usage? = null): List<Message.Response>(source)

Converts a Spring AI Generation (from a org.springframework.ai.chat.model.ChatResponse) to a list of Koog Message.Response.

If the generation contains tool calls, each tool call is converted to a Message.Tool.Call. Otherwise, the text content is converted to a Message.Assistant.

Return

a list of Koog response messages

Parameters

generation

the Spring AI generation to convert

clock

the clock to use for creating response metadata timestamps

usage

optional token usage information from the chat response metadata