ToolResponseContentAdapter

Adapts tool response content to meet provider-specific format requirements before the content is sent to the LLM.

Some LLM providers impose constraints on tool response format. For example, Google GenAI requires tool responses (FunctionResponse.response) to be valid JSON objects — plain text causes JsonParseException or silent data loss. Other providers like OpenAI and Anthropic accept plain text as-is.

This interface allows each provider's auto-configuration to supply its own adapter, keeping provider-specific logic out of the shared message conversion infrastructure.

Follows the same pattern as com.embabel.common.ai.model.OptionsConverter — a per-provider strategy plugged in at configuration time.

See also

Inheritors

Types

Link copied to clipboard
object Companion

Functions

Link copied to clipboard
abstract fun adapt(content: String): String

Adapt tool response content for the target LLM provider.