Skip to content

Commit c9a5629

Browse files
author
stlc-bot
committed
feat(parse): add option to include hidden PPTX slides (#27938)
Stainless-Generated-From: c695bb8c1c6d1f05bc8d6608c874d059ba4f5d36
1 parent 4c89f1e commit c9a5629

7 files changed

Lines changed: 150 additions & 8 deletions

File tree

‎llama-cloud-core/src/main/kotlin/ai/llamaindex/llamacloud/models/configurations/ParseV2Parameters.kt‎

Lines changed: 70 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2448,20 +2448,33 @@ private constructor(
24482448
class Presentation
24492449
@JsonCreator(mode = JsonCreator.Mode.DISABLED)
24502450
private constructor(
2451+
private val includeHiddenSlides: JsonField<Boolean>,
24512452
private val outOfBoundsContent: JsonField<Boolean>,
24522453
private val skipEmbeddedData: JsonField<Boolean>,
24532454
private val additionalProperties: MutableMap<String, JsonValue>,
24542455
) {
24552456

24562457
@JsonCreator
24572458
private constructor(
2459+
@JsonProperty("include_hidden_slides")
2460+
@ExcludeMissing
2461+
includeHiddenSlides: JsonField<Boolean> = JsonMissing.of(),
24582462
@JsonProperty("out_of_bounds_content")
24592463
@ExcludeMissing
24602464
outOfBoundsContent: JsonField<Boolean> = JsonMissing.of(),
24612465
@JsonProperty("skip_embedded_data")
24622466
@ExcludeMissing
24632467
skipEmbeddedData: JsonField<Boolean> = JsonMissing.of(),
2464-
) : this(outOfBoundsContent, skipEmbeddedData, mutableMapOf())
2468+
) : this(includeHiddenSlides, outOfBoundsContent, skipEmbeddedData, mutableMapOf())
2469+
2470+
/**
2471+
* Include hidden PPTX slides in the output. Omitted or false skips hidden slides.
2472+
*
2473+
* @throws LlamaCloudInvalidDataException if the JSON field has an unexpected type (e.g.
2474+
* if the server responded with an unexpected value).
2475+
*/
2476+
fun includeHiddenSlides(): Optional<Boolean> =
2477+
includeHiddenSlides.getOptional("include_hidden_slides")
24652478

24662479
/**
24672480
* Extract content positioned outside the visible slide area. Some presentations have
@@ -2483,6 +2496,16 @@ private constructor(
24832496
fun skipEmbeddedData(): Optional<Boolean> =
24842497
skipEmbeddedData.getOptional("skip_embedded_data")
24852498

2499+
/**
2500+
* Returns the raw JSON value of [includeHiddenSlides].
2501+
*
2502+
* Unlike [includeHiddenSlides], this method doesn't throw if the JSON field has an
2503+
* unexpected type.
2504+
*/
2505+
@JsonProperty("include_hidden_slides")
2506+
@ExcludeMissing
2507+
fun _includeHiddenSlides(): JsonField<Boolean> = includeHiddenSlides
2508+
24862509
/**
24872510
* Returns the raw JSON value of [outOfBoundsContent].
24882511
*
@@ -2524,17 +2547,51 @@ private constructor(
25242547
/** A builder for [Presentation]. */
25252548
class Builder internal constructor() {
25262549

2550+
private var includeHiddenSlides: JsonField<Boolean> = JsonMissing.of()
25272551
private var outOfBoundsContent: JsonField<Boolean> = JsonMissing.of()
25282552
private var skipEmbeddedData: JsonField<Boolean> = JsonMissing.of()
25292553
private var additionalProperties: MutableMap<String, JsonValue> = mutableMapOf()
25302554

25312555
@JvmSynthetic
25322556
internal fun from(presentation: Presentation) = apply {
2557+
includeHiddenSlides = presentation.includeHiddenSlides
25332558
outOfBoundsContent = presentation.outOfBoundsContent
25342559
skipEmbeddedData = presentation.skipEmbeddedData
25352560
additionalProperties = presentation.additionalProperties.toMutableMap()
25362561
}
25372562

2563+
/**
2564+
* Include hidden PPTX slides in the output. Omitted or false skips hidden slides.
2565+
*/
2566+
fun includeHiddenSlides(includeHiddenSlides: Boolean?) =
2567+
includeHiddenSlides(JsonField.ofNullable(includeHiddenSlides))
2568+
2569+
/**
2570+
* Alias for [Builder.includeHiddenSlides].
2571+
*
2572+
* This unboxed primitive overload exists for backwards compatibility.
2573+
*/
2574+
fun includeHiddenSlides(includeHiddenSlides: Boolean) =
2575+
includeHiddenSlides(includeHiddenSlides as Boolean?)
2576+
2577+
/**
2578+
* Alias for calling [Builder.includeHiddenSlides] with
2579+
* `includeHiddenSlides.orElse(null)`.
2580+
*/
2581+
fun includeHiddenSlides(includeHiddenSlides: Optional<Boolean>) =
2582+
includeHiddenSlides(includeHiddenSlides.getOrNull())
2583+
2584+
/**
2585+
* Sets [Builder.includeHiddenSlides] to an arbitrary JSON value.
2586+
*
2587+
* You should usually call [Builder.includeHiddenSlides] with a well-typed [Boolean]
2588+
* value instead. This method is primarily for setting the field to an undocumented
2589+
* or not yet supported value.
2590+
*/
2591+
fun includeHiddenSlides(includeHiddenSlides: JsonField<Boolean>) = apply {
2592+
this.includeHiddenSlides = includeHiddenSlides
2593+
}
2594+
25382595
/**
25392596
* Extract content positioned outside the visible slide area. Some presentations
25402597
* have hidden notes or content that extends beyond slide boundaries
@@ -2630,6 +2687,7 @@ private constructor(
26302687
*/
26312688
fun build(): Presentation =
26322689
Presentation(
2690+
includeHiddenSlides,
26332691
outOfBoundsContent,
26342692
skipEmbeddedData,
26352693
additionalProperties.toMutableMap(),
@@ -2653,6 +2711,7 @@ private constructor(
26532711
return@apply
26542712
}
26552713

2714+
includeHiddenSlides()
26562715
outOfBoundsContent()
26572716
skipEmbeddedData()
26582717
validated = true
@@ -2674,7 +2733,8 @@ private constructor(
26742733
*/
26752734
@JvmSynthetic
26762735
internal fun validity(): Int =
2677-
(if (outOfBoundsContent.asKnown().isPresent) 1 else 0) +
2736+
(if (includeHiddenSlides.asKnown().isPresent) 1 else 0) +
2737+
(if (outOfBoundsContent.asKnown().isPresent) 1 else 0) +
26782738
(if (skipEmbeddedData.asKnown().isPresent) 1 else 0)
26792739

26802740
override fun equals(other: Any?): Boolean {
@@ -2683,19 +2743,25 @@ private constructor(
26832743
}
26842744

26852745
return other is Presentation &&
2746+
includeHiddenSlides == other.includeHiddenSlides &&
26862747
outOfBoundsContent == other.outOfBoundsContent &&
26872748
skipEmbeddedData == other.skipEmbeddedData &&
26882749
additionalProperties == other.additionalProperties
26892750
}
26902751

26912752
private val hashCode: Int by lazy {
2692-
Objects.hash(outOfBoundsContent, skipEmbeddedData, additionalProperties)
2753+
Objects.hash(
2754+
includeHiddenSlides,
2755+
outOfBoundsContent,
2756+
skipEmbeddedData,
2757+
additionalProperties,
2758+
)
26932759
}
26942760

26952761
override fun hashCode(): Int = hashCode
26962762

26972763
override fun toString() =
2698-
"Presentation{outOfBoundsContent=$outOfBoundsContent, skipEmbeddedData=$skipEmbeddedData, additionalProperties=$additionalProperties}"
2764+
"Presentation{includeHiddenSlides=$includeHiddenSlides, outOfBoundsContent=$outOfBoundsContent, skipEmbeddedData=$skipEmbeddedData, additionalProperties=$additionalProperties}"
26992765
}
27002766

27012767
/** Spreadsheet parsing options (applies to .xlsx, .xls, .csv, .ods files) */

‎llama-cloud-core/src/main/kotlin/ai/llamaindex/llamacloud/models/parsing/ParsingCreateParams.kt‎

Lines changed: 70 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3653,20 +3653,33 @@ private constructor(
36533653
class Presentation
36543654
@JsonCreator(mode = JsonCreator.Mode.DISABLED)
36553655
private constructor(
3656+
private val includeHiddenSlides: JsonField<Boolean>,
36563657
private val outOfBoundsContent: JsonField<Boolean>,
36573658
private val skipEmbeddedData: JsonField<Boolean>,
36583659
private val additionalProperties: MutableMap<String, JsonValue>,
36593660
) {
36603661

36613662
@JsonCreator
36623663
private constructor(
3664+
@JsonProperty("include_hidden_slides")
3665+
@ExcludeMissing
3666+
includeHiddenSlides: JsonField<Boolean> = JsonMissing.of(),
36633667
@JsonProperty("out_of_bounds_content")
36643668
@ExcludeMissing
36653669
outOfBoundsContent: JsonField<Boolean> = JsonMissing.of(),
36663670
@JsonProperty("skip_embedded_data")
36673671
@ExcludeMissing
36683672
skipEmbeddedData: JsonField<Boolean> = JsonMissing.of(),
3669-
) : this(outOfBoundsContent, skipEmbeddedData, mutableMapOf())
3673+
) : this(includeHiddenSlides, outOfBoundsContent, skipEmbeddedData, mutableMapOf())
3674+
3675+
/**
3676+
* Include hidden PPTX slides in the output. Omitted or false skips hidden slides.
3677+
*
3678+
* @throws LlamaCloudInvalidDataException if the JSON field has an unexpected type (e.g.
3679+
* if the server responded with an unexpected value).
3680+
*/
3681+
fun includeHiddenSlides(): Optional<Boolean> =
3682+
includeHiddenSlides.getOptional("include_hidden_slides")
36703683

36713684
/**
36723685
* Extract content positioned outside the visible slide area. Some presentations have
@@ -3688,6 +3701,16 @@ private constructor(
36883701
fun skipEmbeddedData(): Optional<Boolean> =
36893702
skipEmbeddedData.getOptional("skip_embedded_data")
36903703

3704+
/**
3705+
* Returns the raw JSON value of [includeHiddenSlides].
3706+
*
3707+
* Unlike [includeHiddenSlides], this method doesn't throw if the JSON field has an
3708+
* unexpected type.
3709+
*/
3710+
@JsonProperty("include_hidden_slides")
3711+
@ExcludeMissing
3712+
fun _includeHiddenSlides(): JsonField<Boolean> = includeHiddenSlides
3713+
36913714
/**
36923715
* Returns the raw JSON value of [outOfBoundsContent].
36933716
*
@@ -3729,17 +3752,51 @@ private constructor(
37293752
/** A builder for [Presentation]. */
37303753
class Builder internal constructor() {
37313754

3755+
private var includeHiddenSlides: JsonField<Boolean> = JsonMissing.of()
37323756
private var outOfBoundsContent: JsonField<Boolean> = JsonMissing.of()
37333757
private var skipEmbeddedData: JsonField<Boolean> = JsonMissing.of()
37343758
private var additionalProperties: MutableMap<String, JsonValue> = mutableMapOf()
37353759

37363760
@JvmSynthetic
37373761
internal fun from(presentation: Presentation) = apply {
3762+
includeHiddenSlides = presentation.includeHiddenSlides
37383763
outOfBoundsContent = presentation.outOfBoundsContent
37393764
skipEmbeddedData = presentation.skipEmbeddedData
37403765
additionalProperties = presentation.additionalProperties.toMutableMap()
37413766
}
37423767

3768+
/**
3769+
* Include hidden PPTX slides in the output. Omitted or false skips hidden slides.
3770+
*/
3771+
fun includeHiddenSlides(includeHiddenSlides: Boolean?) =
3772+
includeHiddenSlides(JsonField.ofNullable(includeHiddenSlides))
3773+
3774+
/**
3775+
* Alias for [Builder.includeHiddenSlides].
3776+
*
3777+
* This unboxed primitive overload exists for backwards compatibility.
3778+
*/
3779+
fun includeHiddenSlides(includeHiddenSlides: Boolean) =
3780+
includeHiddenSlides(includeHiddenSlides as Boolean?)
3781+
3782+
/**
3783+
* Alias for calling [Builder.includeHiddenSlides] with
3784+
* `includeHiddenSlides.orElse(null)`.
3785+
*/
3786+
fun includeHiddenSlides(includeHiddenSlides: Optional<Boolean>) =
3787+
includeHiddenSlides(includeHiddenSlides.getOrNull())
3788+
3789+
/**
3790+
* Sets [Builder.includeHiddenSlides] to an arbitrary JSON value.
3791+
*
3792+
* You should usually call [Builder.includeHiddenSlides] with a well-typed [Boolean]
3793+
* value instead. This method is primarily for setting the field to an undocumented
3794+
* or not yet supported value.
3795+
*/
3796+
fun includeHiddenSlides(includeHiddenSlides: JsonField<Boolean>) = apply {
3797+
this.includeHiddenSlides = includeHiddenSlides
3798+
}
3799+
37433800
/**
37443801
* Extract content positioned outside the visible slide area. Some presentations
37453802
* have hidden notes or content that extends beyond slide boundaries
@@ -3835,6 +3892,7 @@ private constructor(
38353892
*/
38363893
fun build(): Presentation =
38373894
Presentation(
3895+
includeHiddenSlides,
38383896
outOfBoundsContent,
38393897
skipEmbeddedData,
38403898
additionalProperties.toMutableMap(),
@@ -3858,6 +3916,7 @@ private constructor(
38583916
return@apply
38593917
}
38603918

3919+
includeHiddenSlides()
38613920
outOfBoundsContent()
38623921
skipEmbeddedData()
38633922
validated = true
@@ -3879,7 +3938,8 @@ private constructor(
38793938
*/
38803939
@JvmSynthetic
38813940
internal fun validity(): Int =
3882-
(if (outOfBoundsContent.asKnown().isPresent) 1 else 0) +
3941+
(if (includeHiddenSlides.asKnown().isPresent) 1 else 0) +
3942+
(if (outOfBoundsContent.asKnown().isPresent) 1 else 0) +
38833943
(if (skipEmbeddedData.asKnown().isPresent) 1 else 0)
38843944

38853945
override fun equals(other: Any?): Boolean {
@@ -3888,19 +3948,25 @@ private constructor(
38883948
}
38893949

38903950
return other is Presentation &&
3951+
includeHiddenSlides == other.includeHiddenSlides &&
38913952
outOfBoundsContent == other.outOfBoundsContent &&
38923953
skipEmbeddedData == other.skipEmbeddedData &&
38933954
additionalProperties == other.additionalProperties
38943955
}
38953956

38963957
private val hashCode: Int by lazy {
3897-
Objects.hash(outOfBoundsContent, skipEmbeddedData, additionalProperties)
3958+
Objects.hash(
3959+
includeHiddenSlides,
3960+
outOfBoundsContent,
3961+
skipEmbeddedData,
3962+
additionalProperties,
3963+
)
38983964
}
38993965

39003966
override fun hashCode(): Int = hashCode
39013967

39023968
override fun toString() =
3903-
"Presentation{outOfBoundsContent=$outOfBoundsContent, skipEmbeddedData=$skipEmbeddedData, additionalProperties=$additionalProperties}"
3969+
"Presentation{includeHiddenSlides=$includeHiddenSlides, outOfBoundsContent=$outOfBoundsContent, skipEmbeddedData=$skipEmbeddedData, additionalProperties=$additionalProperties}"
39043970
}
39053971

39063972
/** Spreadsheet parsing options (applies to .xlsx, .xls, .csv, .ods files) */

‎llama-cloud-core/src/test/kotlin/ai/llamaindex/llamacloud/models/configurations/ParseV2ParametersTest.kt‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ internal class ParseV2ParametersTest {
4949
.pdf(JsonValue.from(mapOf<String, Any>()))
5050
.presentation(
5151
ParseV2Parameters.InputOptions.Presentation.builder()
52+
.includeHiddenSlides(true)
5253
.outOfBoundsContent(true)
5354
.skipEmbeddedData(true)
5455
.build()
@@ -338,6 +339,7 @@ internal class ParseV2ParametersTest {
338339
.pdf(JsonValue.from(mapOf<String, Any>()))
339340
.presentation(
340341
ParseV2Parameters.InputOptions.Presentation.builder()
342+
.includeHiddenSlides(true)
341343
.outOfBoundsContent(true)
342344
.skipEmbeddedData(true)
343345
.build()
@@ -627,6 +629,7 @@ internal class ParseV2ParametersTest {
627629
.pdf(JsonValue.from(mapOf<String, Any>()))
628630
.presentation(
629631
ParseV2Parameters.InputOptions.Presentation.builder()
632+
.includeHiddenSlides(true)
630633
.outOfBoundsContent(true)
631634
.skipEmbeddedData(true)
632635
.build()

‎llama-cloud-core/src/test/kotlin/ai/llamaindex/llamacloud/models/parsing/ParsingCreateParamsTest.kt‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ internal class ParsingCreateParamsTest {
5151
.pdf(JsonValue.from(mapOf<String, Any>()))
5252
.presentation(
5353
ParsingCreateParams.InputOptions.Presentation.builder()
54+
.includeHiddenSlides(true)
5455
.outOfBoundsContent(true)
5556
.skipEmbeddedData(true)
5657
.build()
@@ -349,6 +350,7 @@ internal class ParsingCreateParamsTest {
349350
.pdf(JsonValue.from(mapOf<String, Any>()))
350351
.presentation(
351352
ParsingCreateParams.InputOptions.Presentation.builder()
353+
.includeHiddenSlides(true)
352354
.outOfBoundsContent(true)
353355
.skipEmbeddedData(true)
354356
.build()
@@ -679,6 +681,7 @@ internal class ParsingCreateParamsTest {
679681
.pdf(JsonValue.from(mapOf<String, Any>()))
680682
.presentation(
681683
ParsingCreateParams.InputOptions.Presentation.builder()
684+
.includeHiddenSlides(true)
682685
.outOfBoundsContent(true)
683686
.skipEmbeddedData(true)
684687
.build()
@@ -982,6 +985,7 @@ internal class ParsingCreateParamsTest {
982985
.pdf(JsonValue.from(mapOf<String, Any>()))
983986
.presentation(
984987
ParsingCreateParams.InputOptions.Presentation.builder()
988+
.includeHiddenSlides(true)
985989
.outOfBoundsContent(true)
986990
.skipEmbeddedData(true)
987991
.build()

‎llama-cloud-core/src/test/kotlin/ai/llamaindex/llamacloud/services/ServiceParamsTest.kt‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,7 @@ internal class ServiceParamsTest {
108108
.pdf(JsonValue.from(mapOf<String, Any>()))
109109
.presentation(
110110
ParsingCreateParams.InputOptions.Presentation.builder()
111+
.includeHiddenSlides(true)
111112
.outOfBoundsContent(true)
112113
.skipEmbeddedData(true)
113114
.build()

‎llama-cloud-core/src/test/kotlin/ai/llamaindex/llamacloud/services/async/ParsingServiceAsyncTest.kt‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ internal class ParsingServiceAsyncTest {
6262
.pdf(JsonValue.from(mapOf<String, Any>()))
6363
.presentation(
6464
ParsingCreateParams.InputOptions.Presentation.builder()
65+
.includeHiddenSlides(true)
6566
.outOfBoundsContent(true)
6667
.skipEmbeddedData(true)
6768
.build()

‎llama-cloud-core/src/test/kotlin/ai/llamaindex/llamacloud/services/blocking/ParsingServiceTest.kt‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ internal class ParsingServiceTest {
6262
.pdf(JsonValue.from(mapOf<String, Any>()))
6363
.presentation(
6464
ParsingCreateParams.InputOptions.Presentation.builder()
65+
.includeHiddenSlides(true)
6566
.outOfBoundsContent(true)
6667
.skipEmbeddedData(true)
6768
.build()

0 commit comments

Comments
 (0)