Class GenAI.Builder

java.lang.Object
com.google.genai.gaos.GenAI.Builder
Enclosing class:
GenAI

public static class GenAI.Builder extends Object
The Builder class allows the configuration of a new instance of the SDK.
  • Method Details

    • client

      public GenAI.Builder client(HTTPClient client)
      Allows the default HTTP client to be overridden with a custom implementation.
      Parameters:
      client - The HTTP client to use for all requests.
      Returns:
      The builder instance.
    • security

      public GenAI.Builder security(Security security)
      Configures the SDK to use the provided security details.
      Parameters:
      security - The security details to use for all requests. Can be null.
      Returns:
      The builder instance.
    • securitySource

      public GenAI.Builder securitySource(SecuritySource securitySource)
      Configures the SDK to use a custom security source.
      Parameters:
      securitySource - The security source to use for all requests.
      Returns:
      The builder instance.
    • serverURL

      public GenAI.Builder serverURL(String serverUrl)
      Overrides the default server URL.
      Parameters:
      serverUrl - The server URL to use for all requests.
      Returns:
      The builder instance.
    • serverURL

      public GenAI.Builder serverURL(String serverUrl, Map<String,String> params)
      Overrides the default server URL with a templated URL populated with the provided parameters.
      Parameters:
      serverUrl - The server URL to use for all requests.
      params - The parameters to use when templating the URL.
      Returns:
      The builder instance.
    • serverIndex

      public GenAI.Builder serverIndex(int serverIdx)
      Overrides the default server by index.
      Parameters:
      serverIdx - The server to use for all requests.
      Returns:
      The builder instance.
    • retryConfig

      public GenAI.Builder retryConfig(RetryConfig retryConfig)
      Overrides the default configuration for retries
      Parameters:
      retryConfig - The retry configuration to use for all requests.
      Returns:
      The builder instance.
    • asyncRetryScheduler

      public GenAI.Builder asyncRetryScheduler(ScheduledExecutorService retryScheduler)
      Configures the SDK to use a custom ScheduledExecutorService for async retries.
      Parameters:
      retryScheduler - The ScheduledExecutorService to use.
      Returns:
      The builder instance.
    • enableHTTPDebugLogging

      public GenAI.Builder enableHTTPDebugLogging(boolean enabled)
      Enables debug logging for HTTP requests and responses, including JSON body content.

      Convenience method that calls HTTPClient.enableDebugLogging(boolean). SpeakeasyHTTPClient honors this setting. If you are using a custom HTTP client, it is up to the custom client to honor this setting.

      Parameters:
      enabled - Whether to enable debug logging.
      Returns:
      The builder instance.
    • apiVersion

      public GenAI.Builder apiVersion(String apiVersion)
      Allows setting the apiVersion parameter for all supported operations.
      Parameters:
      apiVersion - The value to set.
      Returns:
      The builder instance.
    • userProject

      public GenAI.Builder userProject(String userProject)
      Allows setting the userProject parameter for all supported operations.
      Parameters:
      userProject - The value to set.
      Returns:
      The builder instance.
    • build

      public GenAI build()
      Builds a new instance of the SDK.
      Returns:
      The SDK instance.