Class FileChunkingStrategyParam
-
- All Implemented Interfaces:
public final class FileChunkingStrategyParamThe chunking strategy used to chunk the file(s). If not set, will use the
autostrategy. Only applicable iffile_idsis non-empty.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public interfaceFileChunkingStrategyParam.VisitorAn interface that defines how to map each variant of FileChunkingStrategyParam to a value of type T.
-
Method Summary
Modifier and Type Method Description final Optional<AutoFileChunkingStrategyParam>auto()The default strategy. final Optional<StaticFileChunkingStrategyObjectParam>static_()Customize your own chunking strategy by setting chunk size and chunk overlap. final BooleanisAuto()final BooleanisStatic()final AutoFileChunkingStrategyParamasAuto()The default strategy. final StaticFileChunkingStrategyObjectParamasStatic()Customize your own chunking strategy by setting chunk size and chunk overlap. final Optional<JsonValue>_json()final <T extends Any> Taccept(FileChunkingStrategyParam.Visitor<T> visitor)Maps this instance's current variant to a value of type T using the given visitor. final FileChunkingStrategyParamvalidate()Validates that the types of all values in this object match their expected types recursively. final BooleanisValid()Booleanequals(Object other)IntegerhashCode()StringtoString()final static FileChunkingStrategyParamofAuto(AutoFileChunkingStrategyParam auto)The default strategy. final static FileChunkingStrategyParamofStatic(StaticFileChunkingStrategyObjectParam static_)Customize your own chunking strategy by setting chunk size and chunk overlap. -
-
Method Detail
-
auto
final Optional<AutoFileChunkingStrategyParam> auto()
The default strategy. This strategy currently uses a
max_chunk_size_tokensof800andchunk_overlap_tokensof400.
-
static_
final Optional<StaticFileChunkingStrategyObjectParam> static_()
Customize your own chunking strategy by setting chunk size and chunk overlap.
-
asAuto
final AutoFileChunkingStrategyParam asAuto()
The default strategy. This strategy currently uses a
max_chunk_size_tokensof800andchunk_overlap_tokensof400.
-
asStatic
final StaticFileChunkingStrategyObjectParam asStatic()
Customize your own chunking strategy by setting chunk size and chunk overlap.
-
accept
final <T extends Any> T accept(FileChunkingStrategyParam.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 = fileChunkingStrategyParam.accept(new FileChunkingStrategyParam.Visitor<Optional<String>>() { @Override public Optional<String> visitAuto(AutoFileChunkingStrategyParam auto) { return Optional.of(auto.toString()); } // ... @Override public Optional<String> unknown(JsonValue json) { // Or inspect the `json`. return Optional.empty(); } });
-
validate
final FileChunkingStrategyParam 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 FileChunkingStrategyParam ofAuto(AutoFileChunkingStrategyParam auto)
The default strategy. This strategy currently uses a
max_chunk_size_tokensof800andchunk_overlap_tokensof400.
-
ofStatic
final static FileChunkingStrategyParam ofStatic(StaticFileChunkingStrategyObjectParam static_)
Customize your own chunking strategy by setting chunk size and chunk overlap.
-
-
-
-