Class AdvisorParams
java.lang.Object
org.springframework.ai.chat.client.AdvisorParams
Configuration options for the ChatClient request.
Preset advisors parameters that can be passed as configuration options to the Advisor
context.
- Author:
- Christian Tzolov
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Consumer<ChatClient.AdvisorSpec>Advisor parameter that enables provider-native structured output for allentity()calls on a prompt. -
Method Summary
Modifier and TypeMethodDescriptionstatic Consumer<ChatClient.AdvisorSpec>toolCallAdvisorAutoRegister(boolean enabled) Deprecated, for removal: This API element is subject to removal in a future version.static Consumer<ChatClient.AdvisorSpec>toolCallingAdvisorAutoRegister(boolean enabled) Controls whether aToolCallingAdvisoris automatically added to the chain.
-
Field Details
-
ENABLE_NATIVE_STRUCTURED_OUTPUT
Advisor parameter that enables provider-native structured output for allentity()calls on a prompt. When set, the JSON schema is delivered to the AI provider as an API-level constraint rather than appended as prompt text.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. - OpenAI: the Structured Outputs API does not accept a top-level JSON
array schema. Requesting a
List<T>will fail; wrap the list in a container record or use the default prompt-based approach instead.
For per-call control prefer
ChatClient.EntityParamSpec.useProviderStructuredOutput(). - Ollama: models with a built-in reasoning/thinking mode (e.g.
-
-
Method Details
-
toolCallingAdvisorAutoRegister
Controls whether aToolCallingAdvisoris automatically added to the chain. Auto-registration is enabled by default so that tools injected at runtime by another advisor are handled correctly even when no static tools are configured. No explicitToolAdvisormust be present. Passfalseto opt out:client.prompt() .tools(myTool) .advisors(AdvisorParams.toolCallingAdvisorAutoRegister(false)) .call(); -
toolCallAdvisorAutoRegister
@Deprecated(since="2.0.0", forRemoval=true) public static Consumer<ChatClient.AdvisorSpec> toolCallAdvisorAutoRegister(boolean enabled) Deprecated, for removal: This API element is subject to removal in a future version.since 2.0.0 in favor oftoolCallingAdvisorAutoRegister(boolean).
-
toolCallingAdvisorAutoRegister(boolean).