Class SpringAiOpenAiHttpClient.Builder
java.lang.Object
org.springframework.ai.openai.http.okhttp.SpringAiOpenAiHttpClient.Builder
- Enclosing class:
- SpringAiOpenAiHttpClient
Builder for
SpringAiOpenAiHttpClient. Mirrors the upstream
com.openai.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 TypeMethodDescriptionbuild()buildWithInterceptor(okhttp3.Interceptor interceptor) 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.openai.core.http.ProxyAuthenticator proxyAuthenticator) sslSocketFactory(@Nullable SSLSocketFactory sslSocketFactory) timeout(com.openai.core.Timeout timeout) trustManager(@Nullable X509TrustManager trustManager)
-
Method Details
-
timeout
-
timeout
-
proxy
-
proxyAuthenticator
public SpringAiOpenAiHttpClient.Builder proxyAuthenticator(@Nullable com.openai.core.http.ProxyAuthenticator proxyAuthenticator) -
maxIdleConnections
-
keepAliveDuration
-
dispatcherExecutorService
public SpringAiOpenAiHttpClient.Builder dispatcherExecutorService(@Nullable ExecutorService dispatcherExecutorService) Sets the executor used by the OkHttp dispatcher. When supplied, the caller owns the executor's lifecycle —SpringAiOpenAiHttpClient.close()will not shut it down. When null, an internal default is created and closed with the client. -
sslSocketFactory
public SpringAiOpenAiHttpClient.Builder sslSocketFactory(@Nullable SSLSocketFactory sslSocketFactory) -
trustManager
-
hostnameVerifier
public SpringAiOpenAiHttpClient.Builder hostnameVerifier(@Nullable HostnameVerifier hostnameVerifier) -
observationRegistry
public SpringAiOpenAiHttpClient.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 SpringAiOpenAiHttpClient.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 SpringAiOpenAiHttpClient.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
-
buildWithInterceptor
-