Class SpringAiAnthropicHttpClient.Builder
java.lang.Object
org.springframework.ai.anthropic.http.okhttp.SpringAiAnthropicHttpClient.Builder
- Enclosing class:
- SpringAiAnthropicHttpClient
Builder for
SpringAiAnthropicHttpClient. Mirrors the upstream
com.anthropic.client.okhttp.OkHttpClient.Builder surface, with two
additional optional inputs: an ObservationRegistry (defaults to
ObservationRegistry.NOOP) and a MeterRegistry (optional; when
supplied, OkHttp connection-pool gauges are bound to it).-
Method Summary
Modifier and TypeMethodDescriptionbackend(com.anthropic.backends.Backend backend) build()dispatcherExecutorService(@Nullable ExecutorService dispatcherExecutorService) Sets the executor used by the OkHttp dispatcher.hostnameVerifier(@Nullable HostnameVerifier hostnameVerifier) keepAliveDuration(@Nullable Duration keepAliveDuration) maxIdleConnections(@Nullable Integer maxIdleConnections) meterRegistry(@Nullable io.micrometer.core.instrument.MeterRegistry meterRegistry) Registers a meter registry to bind OkHttp connection-pool gauges (active/idle connections).Tags applied to the connection-pool gauges registered with theMeterRegistry.observationRegistry(io.micrometer.observation.ObservationRegistry observationRegistry) Registers the Micrometer observation registry used by the OkHttp interceptor.proxyAuthenticator(@Nullable com.anthropic.core.http.ProxyAuthenticator proxyAuthenticator) sslSocketFactory(@Nullable SSLSocketFactory sslSocketFactory) timeout(com.anthropic.core.Timeout timeout) trustManager(@Nullable X509TrustManager trustManager)
-
Method Details
-
timeout
-
timeout
-
proxy
-
backend
-
proxyAuthenticator
public SpringAiAnthropicHttpClient.Builder proxyAuthenticator(@Nullable com.anthropic.core.http.ProxyAuthenticator proxyAuthenticator) -
maxIdleConnections
-
keepAliveDuration
-
dispatcherExecutorService
public SpringAiAnthropicHttpClient.Builder dispatcherExecutorService(@Nullable ExecutorService dispatcherExecutorService) Sets the executor used by the OkHttp dispatcher. When supplied, the caller owns the executor's lifecycle —SpringAiAnthropicHttpClient.close()will not shut it down. When null, an internal default is created and closed with the client. -
sslSocketFactory
public SpringAiAnthropicHttpClient.Builder sslSocketFactory(@Nullable SSLSocketFactory sslSocketFactory) -
trustManager
-
hostnameVerifier
public SpringAiAnthropicHttpClient.Builder hostnameVerifier(@Nullable HostnameVerifier hostnameVerifier) -
observationRegistry
public SpringAiAnthropicHttpClient.Builder observationRegistry(io.micrometer.observation.ObservationRegistry observationRegistry) Registers the Micrometer observation registry used by the OkHttp interceptor. Defaults toObservationRegistry.NOOP, which makes the interceptor a no-op — no metric/span overhead in environments that don't wire observability. -
meterRegistry
public SpringAiAnthropicHttpClient.Builder meterRegistry(@Nullable io.micrometer.core.instrument.MeterRegistry meterRegistry) Registers a meter registry to bind OkHttp connection-pool gauges (active/idle connections). Optional; when omitted, no pool gauges are registered. -
meterTags
public SpringAiAnthropicHttpClient.Builder meterTags(Iterable<io.micrometer.core.instrument.Tag> meterTags) Tags applied to the connection-pool gauges registered with theMeterRegistry. Useful for distinguishing multiple clients writing pool metrics into the same registry (e.g. a sync and an async client sharing a registry). Has no effect when no meter registry is set. -
build
-