Class DefaultChatClient.DefaultEntityParamSpec
java.lang.Object
org.springframework.ai.chat.client.DefaultChatClient.DefaultEntityParamSpec
- All Implemented Interfaces:
ChatClient.EntityParamSpec
- Enclosing class:
- DefaultChatClient
public static class DefaultChatClient.DefaultEntityParamSpec
extends Object
implements ChatClient.EntityParamSpec
Default implementation of
ChatClient.EntityParamSpec.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanbooleanDelivers the JSON schema to the AI provider as an API-level constraint rather than appending it as prompt text.Validates the model's JSON response against the entity schema and retries with the error feedback on failure, up tomaxRepeatAttemptstimes (default: 3).
-
Constructor Details
-
DefaultEntityParamSpec
public DefaultEntityParamSpec()
-
-
Method Details
-
isEnableNative
public boolean isEnableNative() -
isValidated
public boolean isValidated() -
useProviderStructuredOutput
Description copied from interface:ChatClient.EntityParamSpecDelivers the JSON schema to the AI provider as an API-level constraint rather than appending it as prompt text. Has no effect if the underlyingChatModeldoes not supportStructuredOutputChatOptions.Not enabled by default because native structured output support varies across models and providers. Known limitations:
- Ollama: models with a built-in reasoning/thinking mode (e.g.
qwen3:8b,qwen3.5:9b) may return plain text instead of JSON, causing deserialization failures. UseChatClient.EntityParamSpec.validateSchema()alongside this option for automatic retry, or switch to a non-reasoning model such asllama3.1:latest. - OpenAI: the Structured Outputs API does not accept a top-level JSON
array schema. Requesting a
List<T>with this option enabled will fail. Wrap the list in a container record or use the default prompt-based approach instead.
- Specified by:
useProviderStructuredOutputin interfaceChatClient.EntityParamSpec
- Ollama: models with a built-in reasoning/thinking mode (e.g.
-
validateSchema
Description copied from interface:ChatClient.EntityParamSpecValidates the model's JSON response against the entity schema and retries with the error feedback on failure, up tomaxRepeatAttemptstimes (default: 3). Streaming is not supported.- Specified by:
validateSchemain interfaceChatClient.EntityParamSpec
-