Class AssistantToolChoiceOption

  • All Implemented Interfaces:

    
    public final class AssistantToolChoiceOption
    
                        

    Controls which (if any) tool is called by the model. none means the model will not call any tools and instead generates a message. auto is the default value and means the model can pick between generating a message or calling one or more tools. required means the model must call one or more tools before responding to the user. Specifying a particular tool like {"type": "file_search"} or {"type": "function", "function": {"name": "my_function"}} forces the model to call that tool.

    • Constructor Detail

    • Method Detail

      • auto

         final Optional<AssistantToolChoiceOption.Auto> auto()

        none means the model will not call any tools and instead generates a message. auto means the model can pick between generating a message or calling one or more tools. required means the model must call one or more tools before responding to the user.

      • asAuto

         final AssistantToolChoiceOption.Auto asAuto()

        none means the model will not call any tools and instead generates a message. auto means the model can pick between generating a message or calling one or more tools. required means the model must call one or more tools before responding to the user.

      • accept

         final <T extends Any> T accept(AssistantToolChoiceOption.Visitor<T> visitor)

        Maps this instance's current variant to a value of type T using the given visitor.

        Note that this method is not forwards compatible with new variants from the API, unless visitor overrides Visitor.unknown. To handle variants not known to this version of the SDK gracefully, consider overriding Visitor.unknown:

        import com.openai.core.JsonValue;
        import java.util.Optional;
        
        Optional<String> result = assistantToolChoiceOption.accept(new AssistantToolChoiceOption.Visitor<Optional<String>>() {
            @Override
            public Optional<String> visitAuto(Auto auto) {
                return Optional.of(auto.toString());
            }
        
            // ...
        
            @Override
            public Optional<String> unknown(JsonValue json) {
                // Or inspect the `json`.
                return Optional.empty();
            }
        });
      • validate

         final AssistantToolChoiceOption validate()

        Validates that the types of all values in this object match their expected types recursively.

        This method is not forwards compatible with new types from the API for existing fields.

      • ofAuto

         final static AssistantToolChoiceOption ofAuto(AssistantToolChoiceOption.Auto auto)

        none means the model will not call any tools and instead generates a message. auto means the model can pick between generating a message or calling one or more tools. required means the model must call one or more tools before responding to the user.