Class AnthropicChatOptions.AbstractBuilder<B extends AnthropicChatOptions.AbstractBuilder<B>>

All Implemented Interfaces:
Cloneable, ChatOptions.Builder<B>, StructuredOutputChatOptions.Builder<B>, ToolCallingChatOptions.Builder<B>
Direct Known Subclasses:
AnthropicChatOptions.Builder
Enclosing class:
AnthropicChatOptions

protected abstract static class AnthropicChatOptions.AbstractBuilder<B extends AnthropicChatOptions.AbstractBuilder<B>> extends DefaultToolCallingChatOptions.Builder<B> implements StructuredOutputChatOptions.Builder<B>
  • Constructor Details

    • AbstractBuilder

      protected AbstractBuilder()
  • Method Details

    • clone

      public B clone()
      Specified by:
      clone in interface ChatOptions.Builder<B extends AnthropicChatOptions.AbstractBuilder<B>>
      Overrides:
      clone in class DefaultToolCallingChatOptions.Builder<B extends AnthropicChatOptions.AbstractBuilder<B>>
    • outputSchema

      public B outputSchema(@Nullable String outputSchema)
      Specified by:
      outputSchema in interface StructuredOutputChatOptions.Builder<B extends AnthropicChatOptions.AbstractBuilder<B>>
    • baseUrl

      public B baseUrl(@Nullable String baseUrl)
    • apiKey

      public B apiKey(@Nullable String apiKey)
    • timeout

      public B timeout(@Nullable Duration timeout)
    • maxRetries

      public B maxRetries(@Nullable Integer maxRetries)
    • proxy

      public B proxy(@Nullable Proxy proxy)
    • customHeaders

      public B customHeaders(Map<String,String> customHeaders)
    • model

      public B model(@Nullable com.anthropic.models.messages.Model model)
    • metadata

      public B metadata(@Nullable com.anthropic.models.messages.Metadata metadata)
    • toolChoice

      public B toolChoice(@Nullable com.anthropic.models.messages.ToolChoice toolChoice)
    • thinking

      public B thinking(@Nullable com.anthropic.models.messages.ThinkingConfigParam thinking)
    • thinkingEnabled

      public B thinkingEnabled(long budgetTokens)
      Convenience method to enable thinking with a specific budget in tokens.
      Parameters:
      budgetTokens - the thinking budget (must be >= 1024 and invalid input: '<' maxTokens)
    • thinkingEnabled

      public B thinkingEnabled(long budgetTokens, com.anthropic.models.messages.ThinkingConfigEnabled.Display display)
      Convenience method to enable thinking with a specific budget and display setting.
      Parameters:
      budgetTokens - the thinking budget (must be >= 1024 and invalid input: '<' maxTokens)
      display - controls how thinking content appears in the response (SUMMARIZED or OMITTED)
    • thinkingAdaptive

      public B thinkingAdaptive()
      Convenience method to let Claude adaptively decide whether to think.
    • thinkingAdaptive

      public B thinkingAdaptive(com.anthropic.models.messages.ThinkingConfigAdaptive.Display display)
      Convenience method to let Claude adaptively decide whether to think, with a display setting.
      Parameters:
      display - controls how thinking content appears in the response (SUMMARIZED or OMITTED)
    • thinkingDisabled

      public B thinkingDisabled()
      Convenience method to explicitly disable thinking.
    • disableParallelToolUse

      public B disableParallelToolUse(@Nullable Boolean disableParallelToolUse)
    • citationDocuments

      public B citationDocuments(List<AnthropicCitationDocument> citationDocuments)
    • citationDocuments

      public B citationDocuments(AnthropicCitationDocument... citationDocuments)
    • addCitationDocument

      public B addCitationDocument(AnthropicCitationDocument citationDocument)
    • cacheOptions

      public B cacheOptions(AnthropicCacheOptions cacheOptions)
    • outputConfig

      public B outputConfig(@Nullable com.anthropic.models.messages.OutputConfig outputConfig)
      Sets the output configuration for controlling response format and effort.
      Parameters:
      outputConfig - the output configuration
      Returns:
      this builder
    • effort

      public B effort(com.anthropic.models.messages.OutputConfig.Effort effort)
      Convenience method to set the effort level for the model's response.
      Parameters:
      effort - the desired effort level (LOW, MEDIUM, HIGH, MAX)
      Returns:
      this builder
    • httpHeaders

      public B httpHeaders(Map<String,String> httpHeaders)
    • skillContainer

      public B skillContainer(@Nullable AnthropicSkillContainer skillContainer)
    • webSearchTool

      public B webSearchTool(@Nullable AnthropicWebSearchTool webSearchTool)
      Enables Anthropic's built-in web search tool with the given configuration.
      Parameters:
      webSearchTool - the web search configuration
      Returns:
      this builder
    • serviceTier

      public B serviceTier(@Nullable AnthropicServiceTier serviceTier)
      Sets the service tier for capacity routing.
      Parameters:
      serviceTier - the service tier (AUTO or STANDARD_ONLY)
      Returns:
      this builder
    • skill

      public B skill(String skillIdOrName)
    • skill

      public B skill(String skillIdOrName, String version)
    • skill

      public B skill(AnthropicSkill anthropicSkill)
    • skill

      public B skill(AnthropicSkill anthropicSkill, String version)
    • skill

      public B skill(AnthropicSkillRecord skill)
    • skills

      public B skills(String... skillIds)
    • skills

      public B skills(List<String> skillIds)
    • inferenceGeo

      public B inferenceGeo(@Nullable String inferenceGeo)
      Sets the geographic region for inference processing.
      Parameters:
      inferenceGeo - the region identifier ("us" or "eu")
      Returns:
      this builder
    • combineWith

      public B combineWith(ChatOptions.Builder<?> other)
      Description copied from interface: ChatOptions.Builder
      Mutate this builder by taking all other's values that are non-null, retaining this other values.
      Specified by:
      combineWith in interface ChatOptions.Builder<B extends AnthropicChatOptions.AbstractBuilder<B>>
      Overrides:
      combineWith in class DefaultToolCallingChatOptions.Builder<B extends AnthropicChatOptions.AbstractBuilder<B>>
    • build

      public AnthropicChatOptions build()
      Description copied from interface: ChatOptions.Builder
      Build the ChatOptions.
      Specified by:
      build in interface ChatOptions.Builder<B extends AnthropicChatOptions.AbstractBuilder<B>>
      Specified by:
      build in interface ToolCallingChatOptions.Builder<B extends AnthropicChatOptions.AbstractBuilder<B>>
      Overrides:
      build in class DefaultToolCallingChatOptions.Builder<B extends AnthropicChatOptions.AbstractBuilder<B>>
      Returns:
      the Chat options.