interceptBeforeLLMCall

fun <TFeature : Any> interceptBeforeLLMCall(feature: AIAgentFeature<*, TFeature>, featureImpl: TFeature, handle: suspend TFeature.(prompt: Prompt) -> Unit)(source)

Intercepts LLM calls before they are made to modify or log the prompt.

Parameters

handle

The handler that processes before-LLM-call events

Example:

pipeline.interceptBeforeLLMCall(MyFeature, myFeatureImpl) { prompt ->
logger.info("About to make LLM call with prompt: ${prompt.messages.last().content}")
}