# Class SpringAIAutoConfiguration

java.lang.Object
com.google.adk.models.springai.autoconfigure.SpringAIAutoConfiguration

@AutoConfiguration @ConditionalOnClass({SpringAI.class,org.springframework.ai.chat.model.ChatModel.class}) @ConditionalOnProperty(prefix="adk.spring-ai.auto-configuration", name="enabled", havingValue="true", matchIfMissing=true) @EnableConfigurationProperties(SpringAIProperties.class) public class SpringAIAutoConfiguration extends Object
Auto-configuration for Spring AI integration with ADK.

This auto-configuration automatically creates SpringAI beans when Spring AI ChatModel beans are available in the application context. It supports both regular ChatModel and StreamingChatModel instances.

The auto-configuration can be disabled by setting:

    adk.spring-ai.auto-configuration.enabled=false

Example usage in application.properties:

    # OpenAI configuration
    spring.ai.openai.api-key=${OPENAI_API_KEY}
    spring.ai.openai.chat.options.model=gpt-4o-mini
    spring.ai.openai.chat.options.temperature=0.7

    # ADK Spring AI configuration
    adk.spring-ai.default-model=gpt-4o-mini
    adk.spring-ai.validation.enabled=true

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `SpringAIAutoConfiguration()`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `SpringAIEmbedding`
  `springAIEmbedding(org.springframework.ai.embedding.EmbeddingModel embeddingModel, SpringAIProperties properties)`
  Creates a SpringAIEmbedding bean when EmbeddingModel is available.
  `SpringAI`
  `springAIWithBothModels(org.springframework.ai.chat.model.ChatModel chatModel, org.springframework.ai.chat.model.StreamingChatModel streamingChatModel, SpringAIProperties properties)`
  Creates a SpringAI bean when both ChatModel and StreamingChatModel are available.
  `SpringAI`
  `springAIWithChatModel(org.springframework.ai.chat.model.ChatModel chatModel, SpringAIProperties properties)`
  Creates a SpringAI bean when only ChatModel is available.
  `SpringAI`
  `springAIWithStreamingModel(org.springframework.ai.chat.model.StreamingChatModel streamingChatModel, SpringAIProperties properties)`
  Creates a SpringAI bean when only StreamingChatModel is available.

  ### Methods inherited from class Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Constructor Details

  - ### SpringAIAutoConfiguration

    public SpringAIAutoConfiguration()

- ## Method Details

  - ### springAIWithBothModels

    @Bean @Primary @ConditionalOnMissingBean(SpringAI.class) @ConditionalOnBean({org.springframework.ai.chat.model.ChatModel.class,org.springframework.ai.chat.model.StreamingChatModel.class}) public SpringAI springAIWithBothModels(org.springframework.ai.chat.model.ChatModel chatModel, org.springframework.ai.chat.model.StreamingChatModel streamingChatModel, SpringAIProperties properties)
    Creates a SpringAI bean when both ChatModel and StreamingChatModel are available.
    Parameters:
      `chatModel` - the Spring AI ChatModel
      `streamingChatModel` - the Spring AI StreamingChatModel
      `properties` - the ADK Spring AI properties
    Returns:
      configured SpringAI instance

  - ### springAIWithChatModel

    @Bean @ConditionalOnMissingBean(SpringAI.class) @ConditionalOnBean(org.springframework.ai.chat.model.ChatModel.class) public SpringAI springAIWithChatModel(org.springframework.ai.chat.model.ChatModel chatModel, SpringAIProperties properties)
    Creates a SpringAI bean when only ChatModel is available.
    Parameters:
      `chatModel` - the Spring AI ChatModel
      `properties` - the ADK Spring AI properties
    Returns:
      configured SpringAI instance

  - ### springAIWithStreamingModel

    @Bean @ConditionalOnMissingBean({SpringAI.class,org.springframework.ai.chat.model.ChatModel.class}) @ConditionalOnBean(org.springframework.ai.chat.model.StreamingChatModel.class) public SpringAI springAIWithStreamingModel(org.springframework.ai.chat.model.StreamingChatModel streamingChatModel, SpringAIProperties properties)
    Creates a SpringAI bean when only StreamingChatModel is available.
    Parameters:
      `streamingChatModel` - the Spring AI StreamingChatModel
      `properties` - the ADK Spring AI properties
    Returns:
      configured SpringAI instance

  - ### springAIEmbedding

    @Bean @ConditionalOnMissingBean(SpringAIEmbedding.class) @ConditionalOnBean(org.springframework.ai.embedding.EmbeddingModel.class) public SpringAIEmbedding springAIEmbedding(org.springframework.ai.embedding.EmbeddingModel embeddingModel, SpringAIProperties properties)
    Creates a SpringAIEmbedding bean when EmbeddingModel is available.
    Parameters:
      `embeddingModel` - the Spring AI EmbeddingModel
      `properties` - the ADK Spring AI properties
    Returns:
      configured SpringAIEmbedding instance