Class ChatCompletionCreateParams.Stop
-
- All Implemented Interfaces:
public final class ChatCompletionCreateParams.StopNot supported with latest reasoning models
o3ando4-mini.Up to 4 sequences where the API will stop generating further tokens. The returned text will not contain the stop sequence.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public interfaceChatCompletionCreateParams.Stop.VisitorAn interface that defines how to map each variant of Stop to a value of type T.
-
Method Summary
Modifier and Type Method Description final Optional<String>string()final Optional<List<String>>strings()final BooleanisString()final BooleanisStrings()final StringasString()final List<String>asStrings()final Optional<JsonValue>_json()final <T extends Any> Taccept(ChatCompletionCreateParams.Stop.Visitor<T> visitor)Maps this instance's current variant to a value of type T using the given visitor. final ChatCompletionCreateParams.Stopvalidate()Validates that the types of all values in this object match their expected types recursively. final BooleanisValid()Booleanequals(Object other)IntegerhashCode()StringtoString()final static ChatCompletionCreateParams.StopofString(String string)final static ChatCompletionCreateParams.StopofStrings(List<String> strings)-
-
Method Detail
-
accept
final <T extends Any> T accept(ChatCompletionCreateParams.Stop.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 = stop.accept(new Stop.Visitor<Optional<String>>() { @Override public Optional<String> visitString(String string) { return Optional.of(string.toString()); } // ... @Override public Optional<String> unknown(JsonValue json) { // Or inspect the `json`. return Optional.empty(); } });
-
validate
final ChatCompletionCreateParams.Stop 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.
-
ofString
final static ChatCompletionCreateParams.Stop ofString(String string)
-
ofStrings
final static ChatCompletionCreateParams.Stop ofStrings(List<String> strings)
-
-
-
-