StreamingJacksonOutputConverter

Streaming output converter that extends FilteringJacksonOutputConverter to support JSONL format.

This converter enables streaming LLM responses by:

  • Converting JSONL (JSON Lines) input to reactive Flux streams of typed objects

  • Supporting mixed content streams with both objects and thinking content via StreamingEvent

  • Inheriting JSON schema injection and property filtering capabilities from parent FilteringJacksonOutputConverter

  • Providing instructions to LLMs for proper JSONL output formatting

Use cases:

  • Streaming lists of objects from LLM responses in real-time

  • Processing LLM reasoning (thinking) alongside structured outputs

  • Real-time agent progress monitoring and incremental results

The converter requests JSONL format from LLMs and parses each line as a separate JSON object, emitting them as reactive stream events as they become available.

Constructors

Link copied to clipboard
constructor(clazz: Class<T>, objectMapper: <Error class: unknown class>, fieldFilter: Predicate<Field> = Predicate { true }, thinkingEnabled: Boolean = true)
constructor(typeReference: <Error class: unknown class><T>, objectMapper: <Error class: unknown class>, fieldFilter: Predicate<Field> = Predicate { true }, thinkingEnabled: Boolean = true)

Properties

Link copied to clipboard
val objectMapper: <Error class: unknown class>

Functions

Link copied to clipboard
open fun convert(text: String): T
Link copied to clipboard
fun convertStream(jsonlContent: String): <Error class: unknown class><T>

Convert streaming JSONL text to a Flux of typed objects. Each line should be a valid JSON object matching the schema. Uses resilient error handling - logs warnings for null conversions but continues processing other lines.

Link copied to clipboard
fun convertStreamWithThinking(text: String): <Error class: unknown class><<Error class: unknown class><T>>

Convert streaming text with thinking blocks into StreamingEvent objects. Supports both object lines and thinking blocks. Uses resilient error handling - logs warnings for individual line failures but continues processing.

Link copied to clipboard
open override fun getFormat(): String

Override format to request JSONL instead of single JSON. Inherits schema injection from parent but modifies instructions for streaming.

Link copied to clipboard
open override fun getJsonSchema(): String