RetryWithFeedbackPolicy

class RetryWithFeedbackPolicy(maxRetries: Int = DEFAULT_MAX_RETRIES, message: String = DEFAULT_MESSAGE) : EmptyResponsePolicy

Re-prompt the LLM with message up to maxRetries times before giving up. After exhaustion returns EmptyResponseAction.Throw so the caller sees the typed exception rather than blank content.

Counter is shared across calls and reset by onNonEmpty. Safe for concurrent use as a Spring singleton.

Constructors

Link copied to clipboard
constructor(maxRetries: Int = DEFAULT_MAX_RETRIES, message: String = DEFAULT_MESSAGE)

Types

Link copied to clipboard
object Companion

Functions

Link copied to clipboard
open override fun handle(): EmptyResponseAction

Handle a blank-text-no-tool-calls response from the LLM.

Link copied to clipboard
open override fun onNonEmpty()

Called whenever the LLM returns a non-blank response, allowing stateful policies to reset internal counters.