Class OkHttpClientBuilder

java.lang.Object
dev.langchain4j.http.client.okhttp.OkHttpClientBuilder
All Implemented Interfaces:
HttpClientBuilder

public class OkHttpClientBuilder extends Object implements HttpClientBuilder
  • Constructor Details

    • OkHttpClientBuilder

      public OkHttpClientBuilder()
  • Method Details

    • okHttpClientBuilder

      public okhttp3.OkHttpClient.Builder okHttpClientBuilder()
    • okHttpClientBuilder

      public OkHttpClientBuilder okHttpClientBuilder(okhttp3.OkHttpClient.Builder okHttpClientBuilder)
    • connectTimeout

      public Duration connectTimeout()
      Specified by:
      connectTimeout in interface HttpClientBuilder
    • connectTimeout

      public OkHttpClientBuilder connectTimeout(Duration connectTimeout)
      Specified by:
      connectTimeout in interface HttpClientBuilder
    • readTimeout

      public Duration readTimeout()
      Specified by:
      readTimeout in interface HttpClientBuilder
    • readTimeout

      public OkHttpClientBuilder readTimeout(Duration readTimeout)
      Specified by:
      readTimeout in interface HttpClientBuilder
    • streamingBufferSize

      @Experimental public Integer streamingBufferSize()
      Returns:
      the bounded back-pressure buffer size used by stream(...), or null for the default.
      Since:
      1.20.0
    • streamingBufferSize

      @Experimental public OkHttpClientBuilder streamingBufferSize(Integer streamingBufferSize)
      Sets the size of the bounded back-pressure buffer used by the streaming (stream) path. Server-sent events are relayed to the subscriber through this buffer; if the subscriber consumes slower than the server produces and the buffer overflows, the stream terminates with an error.

      The default is 16384.

      Parameters:
      streamingBufferSize - the buffer size; must be greater than zero
      Returns:
      the builder instance
      Since:
      1.20.0
    • build

      public OkHttpClient build()
      Specified by:
      build in interface HttpClientBuilder