6464public class ChunkingSettings implements JsonpSerializable {
6565 private final String strategy ;
6666
67+ @ Nullable
6768 private final String separatorGroup ;
6869
6970 private final List <String > separators ;
@@ -81,8 +82,8 @@ public class ChunkingSettings implements JsonpSerializable {
8182 private ChunkingSettings (Builder builder ) {
8283
8384 this .strategy = ApiTypeHelper .requireNonNull (builder .strategy , this , "strategy" );
84- this .separatorGroup = ApiTypeHelper . requireNonNull ( builder .separatorGroup , this , "separatorGroup" ) ;
85- this .separators = ApiTypeHelper .unmodifiableRequired (builder .separators , this , "separators" );
85+ this .separatorGroup = builder .separatorGroup ;
86+ this .separators = ApiTypeHelper .unmodifiable (builder .separators );
8687 this .maxChunkSize = ApiTypeHelper .requireNonNull (builder .maxChunkSize , this , "maxChunkSize" , 0 );
8788 this .overlap = builder .overlap ;
8889 this .sentenceOverlap = builder .sentenceOverlap ;
@@ -114,8 +115,8 @@ public final String strategy() {
114115 }
115116
116117 /**
117- * Required - This parameter is only applicable when using the
118- * <code>recursive</code> chunking strategy .
118+ * Only applicable to the <code>recursive</code> strategy and required when
119+ * using it .
119120 * <p>
120121 * Sets a predefined list of separators in the saved chunking settings based on
121122 * the selected text type. Values can be <code>markdown</code> or
@@ -126,13 +127,16 @@ public final String strategy() {
126127 * <p>
127128 * API name: {@code separator_group}
128129 */
130+ @ Nullable
129131 public final String separatorGroup () {
130132 return this .separatorGroup ;
131133 }
132134
133135 /**
134- * Required - A list of strings used as possible split points when chunking text
135- * with the <code>recursive</code> strategy.
136+ * Only applicable to the <code>recursive</code> strategy and required when
137+ * using it.
138+ * <p>
139+ * A list of strings used as possible split points when chunking text.
136140 * <p>
137141 * Each string can be a plain string or a regular expression (regex) pattern.
138142 * The system tries each separator in order to split the text, starting from the
@@ -149,10 +153,10 @@ public final List<String> separators() {
149153 }
150154
151155 /**
152- * Required - The maximum size of a chunk in words. This value cannot be higher
153- * than <code>300 </code> or lower than <code>20 </code> (for
154- * <code>sentence </code> strategy) or <code>10</code> (for <code>word</code>
155- * strategy) .
156+ * Required - The maximum size of a chunk in words. This value cannot be lower
157+ * than <code>20 </code> (for <code>sentence</code> strategy) or <code>10 </code>
158+ * (for <code>word </code> strategy). This value should not exceed the window
159+ * size for the associated model .
156160 * <p>
157161 * API name: {@code max_chunk_size}
158162 */
@@ -198,9 +202,11 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) {
198202 generator .writeKey ("strategy" );
199203 generator .write (this .strategy );
200204
201- generator .writeKey ("separator_group" );
202- generator .write (this .separatorGroup );
205+ if (this .separatorGroup != null ) {
206+ generator .writeKey ("separator_group" );
207+ generator .write (this .separatorGroup );
203208
209+ }
204210 if (ApiTypeHelper .isDefined (this .separators )) {
205211 generator .writeKey ("separators" );
206212 generator .writeStartArray ();
@@ -241,8 +247,10 @@ public String toString() {
241247 public static class Builder extends WithJsonObjectBuilderBase <Builder > implements ObjectBuilder <ChunkingSettings > {
242248 private String strategy ;
243249
250+ @ Nullable
244251 private String separatorGroup ;
245252
253+ @ Nullable
246254 private List <String > separators ;
247255
248256 private Integer maxChunkSize ;
@@ -275,8 +283,8 @@ public final Builder strategy(String value) {
275283 }
276284
277285 /**
278- * Required - This parameter is only applicable when using the
279- * <code>recursive</code> chunking strategy .
286+ * Only applicable to the <code>recursive</code> strategy and required when
287+ * using it .
280288 * <p>
281289 * Sets a predefined list of separators in the saved chunking settings based on
282290 * the selected text type. Values can be <code>markdown</code> or
@@ -287,14 +295,16 @@ public final Builder strategy(String value) {
287295 * <p>
288296 * API name: {@code separator_group}
289297 */
290- public final Builder separatorGroup (String value ) {
298+ public final Builder separatorGroup (@ Nullable String value ) {
291299 this .separatorGroup = value ;
292300 return this ;
293301 }
294302
295303 /**
296- * Required - A list of strings used as possible split points when chunking text
297- * with the <code>recursive</code> strategy.
304+ * Only applicable to the <code>recursive</code> strategy and required when
305+ * using it.
306+ * <p>
307+ * A list of strings used as possible split points when chunking text.
298308 * <p>
299309 * Each string can be a plain string or a regular expression (regex) pattern.
300310 * The system tries each separator in order to split the text, starting from the
@@ -314,8 +324,10 @@ public final Builder separators(List<String> list) {
314324 }
315325
316326 /**
317- * Required - A list of strings used as possible split points when chunking text
318- * with the <code>recursive</code> strategy.
327+ * Only applicable to the <code>recursive</code> strategy and required when
328+ * using it.
329+ * <p>
330+ * A list of strings used as possible split points when chunking text.
319331 * <p>
320332 * Each string can be a plain string or a regular expression (regex) pattern.
321333 * The system tries each separator in order to split the text, starting from the
@@ -335,10 +347,10 @@ public final Builder separators(String value, String... values) {
335347 }
336348
337349 /**
338- * Required - The maximum size of a chunk in words. This value cannot be higher
339- * than <code>300 </code> or lower than <code>20 </code> (for
340- * <code>sentence </code> strategy) or <code>10</code> (for <code>word</code>
341- * strategy) .
350+ * Required - The maximum size of a chunk in words. This value cannot be lower
351+ * than <code>20 </code> (for <code>sentence</code> strategy) or <code>10 </code>
352+ * (for <code>word </code> strategy). This value should not exceed the window
353+ * size for the associated model .
342354 * <p>
343355 * API name: {@code max_chunk_size}
344356 */
0 commit comments