OutputConverter

interface OutputConverter<T>

Output converter abstraction for parsing LLM output. Framework-agnostic interface that can be implemented by Spring AI converters or others.

Parameters

T

the output type

Functions

Link copied to clipboard
abstract fun convert(source: String): T?

Convert the LLM output string to the target type.

Link copied to clipboard
abstract fun getFormat(): String?

Get the format instructions to include in the prompt. Returns null if no format instructions are needed (e.g., for String output).