Class ToolCallingAutoConfiguration
java.lang.Object
org.springframework.ai.model.tool.autoconfigure.ToolCallingAutoConfiguration
- All Implemented Interfaces:
org.springframework.beans.factory.config.BeanFactoryPostProcessor,org.springframework.beans.factory.support.BeanDefinitionRegistryPostProcessor
@AutoConfiguration
@ConditionalOnClass(ChatModel.class)
@EnableConfigurationProperties(ToolCallingProperties.class)
public class ToolCallingAutoConfiguration
extends Object
implements org.springframework.beans.factory.support.BeanDefinitionRegistryPostProcessor
Auto-configuration for common tool calling features of
ChatModel.- Since:
- 1.0.0
- Author:
- Thomas Vitale, Christian Tzolov, Daniel Garnier-Moiroux
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidpostProcessBeanDefinitionRegistry(org.springframework.beans.factory.support.BeanDefinitionRegistry registry) WrapToolCallbackProviderbeans that are not MCP-related into a named bean, which will be picked up by thetoolCallbackResolver(org.springframework.context.support.GenericApplicationContext, java.util.List<org.springframework.ai.tool.ToolCallback>, java.util.List<org.springframework.ai.tool.ToolCallbackProvider>).Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.springframework.beans.factory.support.BeanDefinitionRegistryPostProcessor
postProcessBeanFactory
-
Constructor Details
-
ToolCallingAutoConfiguration
public ToolCallingAutoConfiguration()
-
-
Method Details
-
postProcessBeanDefinitionRegistry
public void postProcessBeanDefinitionRegistry(org.springframework.beans.factory.support.BeanDefinitionRegistry registry) throws org.springframework.beans.BeansException WrapToolCallbackProviderbeans that are not MCP-related into a named bean, which will be picked up by thetoolCallbackResolver(org.springframework.context.support.GenericApplicationContext, java.util.List<org.springframework.ai.tool.ToolCallback>, java.util.List<org.springframework.ai.tool.ToolCallbackProvider>).MCP providers must be excluded, because they may depend on a
ChatClientto do sampling. The chat client, in turn, depends on aToolCallbackResolver. To do the detection, we depend on the exposed bean type. If a bean uses a factory method which returns aToolCallbackProvider, which is an MCP provider under the hood, it will be included in the list.- Specified by:
postProcessBeanDefinitionRegistryin interfaceorg.springframework.beans.factory.support.BeanDefinitionRegistryPostProcessor- Throws:
org.springframework.beans.BeansException
-