Class InferenceChunkingSettings.Builder
- All Implemented Interfaces:
WithJson<InferenceChunkingSettings.Builder>,ObjectBuilder<InferenceChunkingSettings>
- Enclosing class:
- InferenceChunkingSettings
InferenceChunkingSettings.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbuild()Builds aInferenceChunkingSettings.maxChunkSize(Integer value) The maximum size of a chunk in words.The number of overlapping words for chunks.protected InferenceChunkingSettings.Builderself()sentenceOverlap(Integer value) The number of overlapping sentences for chunks.separatorGroup(String value) Only applicable to therecursivestrategy and required when using it.separators(String value, String... values) Only applicable to therecursivestrategy and required when using it.separators(List<String> list) Only applicable to therecursivestrategy and required when using it.The chunking strategy:sentence,word,noneorrecursive.Methods inherited from class co.elastic.clients.util.WithJsonObjectBuilderBase
withJsonMethods inherited from class co.elastic.clients.util.ObjectBuilderBase
_checkSingleUse, _listAdd, _listAddAll, _mapPut, _mapPutAll
-
Constructor Details
-
Builder
public Builder()
-
-
Method Details
-
maxChunkSize
The maximum size of a chunk in words. This value cannot be lower than20(forsentencestrategy) or10(forwordstrategy). This value should not exceed the window size for the associated model.API name:
max_chunk_size -
overlap
The number of overlapping words for chunks. It is applicable only to awordchunking strategy. This value cannot be higher than half themax_chunk_sizevalue.API name:
overlap -
sentenceOverlap
The number of overlapping sentences for chunks. It is applicable only for asentencechunking strategy. It can be either1or0.API name:
sentence_overlap -
separatorGroup
Only applicable to therecursivestrategy and required when using it.Sets a predefined list of separators in the saved chunking settings based on the selected text type. Values can be
markdownorplaintext.Using this parameter is an alternative to manually specifying a custom
separatorslist.API name:
separator_group -
separators
Only applicable to therecursivestrategy and required when using it.A list of strings used as possible split points when chunking text.
Each string can be a plain string or a regular expression (regex) pattern. The system tries each separator in order to split the text, starting from the first item in the list.
After splitting, it attempts to recombine smaller pieces into larger chunks that stay within the
max_chunk_sizelimit, to reduce the total number of chunks generated.API name:
separatorsAdds all elements of
listtoseparators. -
separators
Only applicable to therecursivestrategy and required when using it.A list of strings used as possible split points when chunking text.
Each string can be a plain string or a regular expression (regex) pattern. The system tries each separator in order to split the text, starting from the first item in the list.
After splitting, it attempts to recombine smaller pieces into larger chunks that stay within the
max_chunk_sizelimit, to reduce the total number of chunks generated.API name:
separatorsAdds one or more values to
separators. -
strategy
The chunking strategy:sentence,word,noneorrecursive.- If
strategyis set torecursive, you must also specify:
max_chunk_size- either
separatorsorseparator_group
Learn more about different chunking strategies in the linked documentation.
API name:
strategy - If
-
self
- Specified by:
selfin classWithJsonObjectBuilderBase<InferenceChunkingSettings.Builder>
-
build
Builds aInferenceChunkingSettings.- Specified by:
buildin interfaceObjectBuilder<InferenceChunkingSettings>- Throws:
NullPointerException- if some of the required fields are null.
-