79739302

Date: 2025-08-18 22:27:43
Score: 0.5
Natty:
Report link

I think the documentation is yet lacking but when looking at the source code and docs.

(Example for Anthropic)

https://github.com/spring-projects/spring-ai/blob/v1.0.1/auto-configurations/models/spring-ai-autoconfigure-model-anthropic/src/main/java/org/springframework/ai/model/anthropic/autoconfigure/AnthropicChatAutoConfiguration.java

        @Bean
    @ConditionalOnMissingBean
    public AnthropicApi anthropicApi(AnthropicConnectionProperties connectionProperties,
            ObjectProvider<RestClient.Builder> restClientBuilderProvider,
            ObjectProvider<WebClient.Builder> webClientBuilderProvider, ResponseErrorHandler responseErrorHandler) {

        return AnthropicApi.builder()
            .baseUrl(connectionProperties.getBaseUrl())
            .completionsPath(connectionProperties.getCompletionsPath())
            .apiKey(connectionProperties.getApiKey())
            .anthropicVersion(connectionProperties.getVersion())
            .restClientBuilder(restClientBuilderProvider.getIfAvailable(RestClient::builder))
            .webClientBuilder(webClientBuilderProvider.getIfAvailable(WebClient::builder))
            .responseErrorHandler(responseErrorHandler)
            .anthropicBetaFeatures(connectionProperties.getBetaVersion())
            .build();
    }

So either implement a bean of type AnthropicApi (or of the models you are using) or you could try implementing a WebClient.Builder & Rest client.Builder bean (as far as I know, this should overwrite the Auto configurations, but you could face problems due to ordering, I am in no place to try it out right now)

Reasons:
  • Probably link only (1):
  • Long answer (-1):
  • Has code block (-0.5):
  • Low reputation (1):
Posted by: Ramino