Class OpenAiAutoConfiguration

java.lang.Object
org.springframework.ai.autoconfigure.openai.OpenAiAutoConfiguration

@AutoConfiguration(after={org.springframework.boot.autoconfigure.web.client.RestClientAutoConfiguration.class,org.springframework.boot.autoconfigure.web.reactive.function.client.WebClientAutoConfiguration.class,SpringAiRetryAutoConfiguration.class}) @ConditionalOnClass(OpenAiApi.class) @EnableConfigurationProperties({OpenAiConnectionProperties.class,OpenAiChatProperties.class,OpenAiEmbeddingProperties.class,OpenAiImageProperties.class,OpenAiAudioTranscriptionProperties.class,OpenAiAudioSpeechProperties.class,OpenAiModerationProperties.class}) @ImportAutoConfiguration(classes={SpringAiRetryAutoConfiguration.class,org.springframework.boot.autoconfigure.web.client.RestClientAutoConfiguration.class,org.springframework.boot.autoconfigure.web.reactive.function.client.WebClientAutoConfiguration.class}) public class OpenAiAutoConfiguration extends Object
Auto-configuration for OpenAI.
Author:
Christian Tzolov, Stefan Vassilev, Thomas Vitale
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    openAiAudioSpeechClient(OpenAiConnectionProperties commonProperties, OpenAiAudioSpeechProperties speechProperties, org.springframework.retry.support.RetryTemplate retryTemplate, org.springframework.beans.factory.ObjectProvider<org.springframework.web.client.RestClient.Builder> restClientBuilderProvider, org.springframework.beans.factory.ObjectProvider<org.springframework.web.reactive.function.client.WebClient.Builder> webClientBuilderProvider, org.springframework.web.client.ResponseErrorHandler responseErrorHandler)
     
    openAiAudioTranscriptionModel(OpenAiConnectionProperties commonProperties, OpenAiAudioTranscriptionProperties transcriptionProperties, org.springframework.retry.support.RetryTemplate retryTemplate, org.springframework.beans.factory.ObjectProvider<org.springframework.web.client.RestClient.Builder> restClientBuilderProvider, org.springframework.beans.factory.ObjectProvider<org.springframework.web.reactive.function.client.WebClient.Builder> webClientBuilderProvider, org.springframework.web.client.ResponseErrorHandler responseErrorHandler)
     
    openAiChatModel(OpenAiConnectionProperties commonProperties, OpenAiChatProperties chatProperties, org.springframework.beans.factory.ObjectProvider<org.springframework.web.client.RestClient.Builder> restClientBuilderProvider, org.springframework.beans.factory.ObjectProvider<org.springframework.web.reactive.function.client.WebClient.Builder> webClientBuilderProvider, List<FunctionCallback> toolFunctionCallbacks, FunctionCallbackResolver functionCallbackResolver, org.springframework.retry.support.RetryTemplate retryTemplate, org.springframework.web.client.ResponseErrorHandler responseErrorHandler, org.springframework.beans.factory.ObjectProvider<io.micrometer.observation.ObservationRegistry> observationRegistry, org.springframework.beans.factory.ObjectProvider<ChatModelObservationConvention> observationConvention)
     
    openAiEmbeddingModel(OpenAiConnectionProperties commonProperties, OpenAiEmbeddingProperties embeddingProperties, org.springframework.beans.factory.ObjectProvider<org.springframework.web.client.RestClient.Builder> restClientBuilderProvider, org.springframework.beans.factory.ObjectProvider<org.springframework.web.reactive.function.client.WebClient.Builder> webClientBuilderProvider, org.springframework.retry.support.RetryTemplate retryTemplate, org.springframework.web.client.ResponseErrorHandler responseErrorHandler, org.springframework.beans.factory.ObjectProvider<io.micrometer.observation.ObservationRegistry> observationRegistry, org.springframework.beans.factory.ObjectProvider<EmbeddingModelObservationConvention> observationConvention)
     
    openAiImageModel(OpenAiConnectionProperties commonProperties, OpenAiImageProperties imageProperties, org.springframework.beans.factory.ObjectProvider<org.springframework.web.client.RestClient.Builder> restClientBuilderProvider, org.springframework.retry.support.RetryTemplate retryTemplate, org.springframework.web.client.ResponseErrorHandler responseErrorHandler, org.springframework.beans.factory.ObjectProvider<io.micrometer.observation.ObservationRegistry> observationRegistry, org.springframework.beans.factory.ObjectProvider<ImageModelObservationConvention> observationConvention)
     
    openAiModerationClient(OpenAiConnectionProperties commonProperties, OpenAiModerationProperties moderationProperties, org.springframework.retry.support.RetryTemplate retryTemplate, org.springframework.beans.factory.ObjectProvider<org.springframework.web.client.RestClient.Builder> restClientBuilderProvider, org.springframework.web.client.ResponseErrorHandler responseErrorHandler)
     
    springAiFunctionManager(org.springframework.context.ApplicationContext context)
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • OpenAiAutoConfiguration

      public OpenAiAutoConfiguration()
  • Method Details

    • openAiChatModel

      @Bean @ConditionalOnMissingBean @ConditionalOnProperty(prefix="spring.ai.openai.chat", name="enabled", havingValue="true", matchIfMissing=true) public OpenAiChatModel openAiChatModel(OpenAiConnectionProperties commonProperties, OpenAiChatProperties chatProperties, org.springframework.beans.factory.ObjectProvider<org.springframework.web.client.RestClient.Builder> restClientBuilderProvider, org.springframework.beans.factory.ObjectProvider<org.springframework.web.reactive.function.client.WebClient.Builder> webClientBuilderProvider, List<FunctionCallback> toolFunctionCallbacks, FunctionCallbackResolver functionCallbackResolver, org.springframework.retry.support.RetryTemplate retryTemplate, org.springframework.web.client.ResponseErrorHandler responseErrorHandler, org.springframework.beans.factory.ObjectProvider<io.micrometer.observation.ObservationRegistry> observationRegistry, org.springframework.beans.factory.ObjectProvider<ChatModelObservationConvention> observationConvention)
    • openAiEmbeddingModel

      @Bean @ConditionalOnMissingBean @ConditionalOnProperty(prefix="spring.ai.openai.embedding", name="enabled", havingValue="true", matchIfMissing=true) public OpenAiEmbeddingModel openAiEmbeddingModel(OpenAiConnectionProperties commonProperties, OpenAiEmbeddingProperties embeddingProperties, org.springframework.beans.factory.ObjectProvider<org.springframework.web.client.RestClient.Builder> restClientBuilderProvider, org.springframework.beans.factory.ObjectProvider<org.springframework.web.reactive.function.client.WebClient.Builder> webClientBuilderProvider, org.springframework.retry.support.RetryTemplate retryTemplate, org.springframework.web.client.ResponseErrorHandler responseErrorHandler, org.springframework.beans.factory.ObjectProvider<io.micrometer.observation.ObservationRegistry> observationRegistry, org.springframework.beans.factory.ObjectProvider<EmbeddingModelObservationConvention> observationConvention)
    • openAiImageModel

      @Bean @ConditionalOnMissingBean @ConditionalOnProperty(prefix="spring.ai.openai.image", name="enabled", havingValue="true", matchIfMissing=true) public OpenAiImageModel openAiImageModel(OpenAiConnectionProperties commonProperties, OpenAiImageProperties imageProperties, org.springframework.beans.factory.ObjectProvider<org.springframework.web.client.RestClient.Builder> restClientBuilderProvider, org.springframework.retry.support.RetryTemplate retryTemplate, org.springframework.web.client.ResponseErrorHandler responseErrorHandler, org.springframework.beans.factory.ObjectProvider<io.micrometer.observation.ObservationRegistry> observationRegistry, org.springframework.beans.factory.ObjectProvider<ImageModelObservationConvention> observationConvention)
    • openAiAudioTranscriptionModel

      @Bean @ConditionalOnMissingBean @ConditionalOnProperty(prefix="spring.ai.openai.audio.transcription", name="enabled", havingValue="true", matchIfMissing=true) public OpenAiAudioTranscriptionModel openAiAudioTranscriptionModel(OpenAiConnectionProperties commonProperties, OpenAiAudioTranscriptionProperties transcriptionProperties, org.springframework.retry.support.RetryTemplate retryTemplate, org.springframework.beans.factory.ObjectProvider<org.springframework.web.client.RestClient.Builder> restClientBuilderProvider, org.springframework.beans.factory.ObjectProvider<org.springframework.web.reactive.function.client.WebClient.Builder> webClientBuilderProvider, org.springframework.web.client.ResponseErrorHandler responseErrorHandler)
    • openAiModerationClient

      @Bean @ConditionalOnMissingBean public OpenAiModerationModel openAiModerationClient(OpenAiConnectionProperties commonProperties, OpenAiModerationProperties moderationProperties, org.springframework.retry.support.RetryTemplate retryTemplate, org.springframework.beans.factory.ObjectProvider<org.springframework.web.client.RestClient.Builder> restClientBuilderProvider, org.springframework.web.client.ResponseErrorHandler responseErrorHandler)
    • openAiAudioSpeechClient

      @Bean @ConditionalOnMissingBean @ConditionalOnProperty(prefix="spring.ai.openai.audio.speech", name="enabled", havingValue="true", matchIfMissing=true) public OpenAiAudioSpeechModel openAiAudioSpeechClient(OpenAiConnectionProperties commonProperties, OpenAiAudioSpeechProperties speechProperties, org.springframework.retry.support.RetryTemplate retryTemplate, org.springframework.beans.factory.ObjectProvider<org.springframework.web.client.RestClient.Builder> restClientBuilderProvider, org.springframework.beans.factory.ObjectProvider<org.springframework.web.reactive.function.client.WebClient.Builder> webClientBuilderProvider, org.springframework.web.client.ResponseErrorHandler responseErrorHandler)
    • springAiFunctionManager

      @Bean @ConditionalOnMissingBean public FunctionCallbackResolver springAiFunctionManager(org.springframework.context.ApplicationContext context)