Interface AnthropicHttpClientBuilderCustomizer

Functional Interface:
This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

@FunctionalInterface public interface AnthropicHttpClientBuilderCustomizer
Callback for customizing the SpringAiAnthropicHttpClient.Builder used by AnthropicChatModel before the underlying OkHttpClient is built. Implement this interface to register OkHttp interceptors (for example, a Spring Security OAuth2 client-credentials interceptor), swap the dispatcher ExecutorService, or tweak any other OkHttp setting exposed by the builder.
Since:
2.0.0
Author:
Ilayaperumal Gopinathan
  • Method Details

    • customize

      void customize(SpringAiAnthropicHttpClient.Builder builder)
      Customize the SpringAiAnthropicHttpClient.Builder prior to building the underlying OkHttp client.

      This method is called twice per AnthropicChatModel instance — once for the synchronous client and once for the asynchronous client. Implementations must be idempotent; side effects that must fire exactly once (for example, registering an EventListenerFactory or binding external state) should guard against re-execution.

      Parameters:
      builder - the builder to customize