diff --git a/.github/workflows/stlc-promote.yml b/.github/workflows/stlc-promote.yml index 0f9770c..fd59332 100644 --- a/.github/workflows/stlc-promote.yml +++ b/.github/workflows/stlc-promote.yml @@ -13,8 +13,18 @@ jobs: if: github.repository == 'run-llama/llamacloud-prod-java' env: PRODUCTION_REPO: run-llama/llama-parse-java - GH_TOKEN: ${{ secrets.PRODUCTION_REPO_TOKEN }} steps: + - name: Generate production-repo token (CI_BOT GitHub App) + id: prod-token + uses: actions/create-github-app-token@v1 + with: + app-id: ${{ secrets.CI_BOT_APP_ID }} + private-key: ${{ secrets.CI_BOT_PRIVATE_KEY }} + owner: run-llama + repositories: llama-parse-java + permission-contents: write + permission-pull-requests: write + - name: Check out staging uses: actions/checkout@v6 with: @@ -22,6 +32,8 @@ jobs: persist-credentials: false - name: Fetch production main + env: + GH_TOKEN: ${{ steps.prod-token.outputs.token }} run: | git remote add production \ "https://x-access-token:${GH_TOKEN}@github.com/${PRODUCTION_REPO}.git" @@ -54,6 +66,8 @@ jobs: - name: Open or update the release PR on production if: steps.diff.outputs.synced == 'false' + env: + GH_TOKEN: ${{ steps.prod-token.outputs.token }} run: | EXISTING_PR=$(gh pr list \ --repo "${PRODUCTION_REPO}" \ diff --git a/.github/workflows/stlc-sync-from-production.yml b/.github/workflows/stlc-sync-from-production.yml index 05b8f27..5f2a363 100644 --- a/.github/workflows/stlc-sync-from-production.yml +++ b/.github/workflows/stlc-sync-from-production.yml @@ -21,16 +21,27 @@ jobs: if: github.repository == 'run-llama/llamacloud-prod-java' env: PRODUCTION_REPO: run-llama/llama-parse-java - PRODUCTION_REPO_TOKEN: ${{ secrets.PRODUCTION_REPO_TOKEN }} # The built-in token writes the branch + PR on this (staging) repo. GH_TOKEN: ${{ github.token }} steps: + - name: Generate production-repo token (CI_BOT GitHub App, read-only) + id: prod-token + uses: actions/create-github-app-token@v1 + with: + app-id: ${{ secrets.CI_BOT_APP_ID }} + private-key: ${{ secrets.CI_BOT_PRIVATE_KEY }} + owner: run-llama + repositories: llama-parse-java + permission-contents: read + - name: Check out staging uses: actions/checkout@v6 with: fetch-depth: 0 - name: Fetch production main + env: + PRODUCTION_REPO_TOKEN: ${{ steps.prod-token.outputs.token }} run: | git remote add production \ "https://x-access-token:${PRODUCTION_REPO_TOKEN}@github.com/${PRODUCTION_REPO}.git" diff --git a/README.md b/README.md index 7f75910..206d7f3 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ [![Maven Central](https://img.shields.io/maven-central/v/ai.llamaindex.llamacloud/llama-cloud)](https://central.sonatype.com/artifact/ai.llamaindex.llamacloud/llama-cloud/1.3.0) -[![javadoc](https://javadoc.io/badge2/ai.llamaindex.llamacloud/llama-cloud/1.3.0/javadoc.svg)](https://javadoc.io/doc/ai.llamaindex.llamacloud/llama-cloud/1.2.0) +[![javadoc](https://javadoc.io/badge2/ai.llamaindex.llamacloud/llama-cloud/1.3.0/javadoc.svg)](https://javadoc.io/doc/ai.llamaindex.llamacloud/llama-cloud/1.3.0) diff --git a/llama-cloud-core/src/main/kotlin/ai/llamaindex/llamacloud/models/beta/sheets/SheetsParsingConfig.kt b/llama-cloud-core/src/main/kotlin/ai/llamaindex/llamacloud/models/beta/sheets/SheetsParsingConfig.kt index 00b017a..917c401 100644 --- a/llama-cloud-core/src/main/kotlin/ai/llamaindex/llamacloud/models/beta/sheets/SheetsParsingConfig.kt +++ b/llama-cloud-core/src/main/kotlin/ai/llamaindex/llamacloud/models/beta/sheets/SheetsParsingConfig.kt @@ -30,6 +30,7 @@ private constructor( private val sheetNames: JsonField>, private val specialization: JsonField, private val tableMergeSensitivity: JsonField, + private val tier: JsonField, private val useExperimentalProcessing: JsonField, private val additionalProperties: MutableMap, ) { @@ -57,6 +58,7 @@ private constructor( @JsonProperty("table_merge_sensitivity") @ExcludeMissing tableMergeSensitivity: JsonField = JsonMissing.of(), + @JsonProperty("tier") @ExcludeMissing tier: JsonField = JsonMissing.of(), @JsonProperty("use_experimental_processing") @ExcludeMissing useExperimentalProcessing: JsonField = JsonMissing.of(), @@ -68,6 +70,7 @@ private constructor( sheetNames, specialization, tableMergeSensitivity, + tier, useExperimentalProcessing, mutableMapOf(), ) @@ -90,7 +93,8 @@ private constructor( flattenHierarchicalTables.getOptional("flatten_hierarchical_tables") /** - * Whether to generate additional metadata (title, description) for each extracted region. + * Deprecated: controlled by `tier`. Whether to generate additional metadata (title, + * description) for each extracted region. Honored only on `agentic`. * * @throws LlamaCloudInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). @@ -116,9 +120,10 @@ private constructor( fun sheetNames(): Optional> = sheetNames.getOptional("sheet_names") /** - * Optional specialization mode for domain-specific extraction. Supported values: - * 'financial-standard', 'financial-enhanced', 'financial-precise'. Default None uses the - * general-purpose pipeline. + * Deprecated: controlled by `tier`. Optional specialization mode for domain-specific + * extraction. Supported values: 'financial-standard', 'financial-enhanced', + * 'financial-precise'. Default None uses the general-purpose pipeline. Honored only on + * `agentic`. * * @throws LlamaCloudInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). @@ -126,9 +131,8 @@ private constructor( fun specialization(): Optional = specialization.getOptional("specialization") /** - * Influences how likely similar-looking regions are merged into a single table. Useful for - * spreadsheets that either have sparse tables (strong merging) or many distinct tables close - * together (weak merging). + * Deprecated: controlled by `tier`. Influences how likely similar-looking regions are merged + * into a single table. Honored only on `agentic`. * * @throws LlamaCloudInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). @@ -137,7 +141,16 @@ private constructor( tableMergeSensitivity.getOptional("table_merge_sensitivity") /** - * Enables experimental processing. Accuracy may be impacted. + * Spreadsheet extraction tier. `cost_effective` uses the rule-based/ML-only pipeline; `agentic` + * uses the full pipeline. + * + * @throws LlamaCloudInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun tier(): Optional = tier.getOptional("tier") + + /** + * Deprecated: controlled by `tier`. Enables experimental processing. Honored only on `agentic`. * * @throws LlamaCloudInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). @@ -212,6 +225,13 @@ private constructor( @ExcludeMissing fun _tableMergeSensitivity(): JsonField = tableMergeSensitivity + /** + * Returns the raw JSON value of [tier]. + * + * Unlike [tier], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("tier") @ExcludeMissing fun _tier(): JsonField = tier + /** * Returns the raw JSON value of [useExperimentalProcessing]. * @@ -250,6 +270,7 @@ private constructor( private var sheetNames: JsonField>? = null private var specialization: JsonField = JsonMissing.of() private var tableMergeSensitivity: JsonField = JsonMissing.of() + private var tier: JsonField = JsonMissing.of() private var useExperimentalProcessing: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @@ -262,6 +283,7 @@ private constructor( sheetNames = sheetsParsingConfig.sheetNames.map { it.toMutableList() } specialization = sheetsParsingConfig.specialization tableMergeSensitivity = sheetsParsingConfig.tableMergeSensitivity + tier = sheetsParsingConfig.tier useExperimentalProcessing = sheetsParsingConfig.useExperimentalProcessing additionalProperties = sheetsParsingConfig.additionalProperties.toMutableMap() } @@ -304,7 +326,8 @@ private constructor( } /** - * Whether to generate additional metadata (title, description) for each extracted region. + * Deprecated: controlled by `tier`. Whether to generate additional metadata (title, + * description) for each extracted region. Honored only on `agentic`. */ fun generateAdditionalMetadata(generateAdditionalMetadata: Boolean) = generateAdditionalMetadata(JsonField.of(generateAdditionalMetadata)) @@ -367,9 +390,10 @@ private constructor( } /** - * Optional specialization mode for domain-specific extraction. Supported values: - * 'financial-standard', 'financial-enhanced', 'financial-precise'. Default None uses the - * general-purpose pipeline. + * Deprecated: controlled by `tier`. Optional specialization mode for domain-specific + * extraction. Supported values: 'financial-standard', 'financial-enhanced', + * 'financial-precise'. Default None uses the general-purpose pipeline. Honored only on + * `agentic`. */ fun specialization(specialization: String?) = specialization(JsonField.ofNullable(specialization)) @@ -390,9 +414,8 @@ private constructor( } /** - * Influences how likely similar-looking regions are merged into a single table. Useful for - * spreadsheets that either have sparse tables (strong merging) or many distinct tables - * close together (weak merging). + * Deprecated: controlled by `tier`. Influences how likely similar-looking regions are + * merged into a single table. Honored only on `agentic`. */ fun tableMergeSensitivity(tableMergeSensitivity: TableMergeSensitivity) = tableMergeSensitivity(JsonField.of(tableMergeSensitivity)) @@ -408,7 +431,24 @@ private constructor( this.tableMergeSensitivity = tableMergeSensitivity } - /** Enables experimental processing. Accuracy may be impacted. */ + /** + * Spreadsheet extraction tier. `cost_effective` uses the rule-based/ML-only pipeline; + * `agentic` uses the full pipeline. + */ + fun tier(tier: Tier) = tier(JsonField.of(tier)) + + /** + * Sets [Builder.tier] to an arbitrary JSON value. + * + * You should usually call [Builder.tier] with a well-typed [Tier] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ + fun tier(tier: JsonField) = apply { this.tier = tier } + + /** + * Deprecated: controlled by `tier`. Enables experimental processing. Honored only on + * `agentic`. + */ fun useExperimentalProcessing(useExperimentalProcessing: Boolean) = useExperimentalProcessing(JsonField.of(useExperimentalProcessing)) @@ -456,6 +496,7 @@ private constructor( (sheetNames ?: JsonMissing.of()).map { it.toImmutable() }, specialization, tableMergeSensitivity, + tier, useExperimentalProcessing, additionalProperties.toMutableMap(), ) @@ -483,6 +524,7 @@ private constructor( sheetNames() specialization() tableMergeSensitivity().ifPresent { it.validate() } + tier().ifPresent { it.validate() } useExperimentalProcessing() validated = true } @@ -509,12 +551,12 @@ private constructor( (sheetNames.asKnown().getOrNull()?.size ?: 0) + (if (specialization.asKnown().isPresent) 1 else 0) + (tableMergeSensitivity.asKnown().getOrNull()?.validity() ?: 0) + + (tier.asKnown().getOrNull()?.validity() ?: 0) + (if (useExperimentalProcessing.asKnown().isPresent) 1 else 0) /** - * Influences how likely similar-looking regions are merged into a single table. Useful for - * spreadsheets that either have sparse tables (strong merging) or many distinct tables close - * together (weak merging). + * Deprecated: controlled by `tier`. Influences how likely similar-looking regions are merged + * into a single table. Honored only on `agentic`. */ class TableMergeSensitivity @JsonCreator @@ -659,6 +701,146 @@ private constructor( override fun toString() = value.toString() } + /** + * Spreadsheet extraction tier. `cost_effective` uses the rule-based/ML-only pipeline; `agentic` + * uses the full pipeline. + */ + class Tier @JsonCreator private constructor(private val value: JsonField) : Enum { + + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that doesn't + * match any known member, and you want to know that value. For example, if the SDK is on an + * older version than the API, then the API may respond with new members that the SDK is + * unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + + companion object { + + @JvmField val AGENTIC = of("agentic") + + @JvmField val COST_EFFECTIVE = of("cost_effective") + + @JvmStatic fun of(value: String) = Tier(JsonField.of(value)) + } + + /** An enum containing [Tier]'s known values. */ + enum class Known { + AGENTIC, + COST_EFFECTIVE, + } + + /** + * An enum containing [Tier]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [Tier] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, if the + * SDK is on an older version than the API, then the API may respond with new members that + * the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + AGENTIC, + COST_EFFECTIVE, + /** An enum member indicating that [Tier] was instantiated with an unknown value. */ + _UNKNOWN, + } + + /** + * Returns an enum member corresponding to this class instance's value, or [Value._UNKNOWN] + * if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if you want + * to throw for the unknown case. + */ + fun value(): Value = + when (this) { + AGENTIC -> Value.AGENTIC + COST_EFFECTIVE -> Value.COST_EFFECTIVE + else -> Value._UNKNOWN + } + + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and don't + * want to throw for the unknown case. + * + * @throws LlamaCloudInvalidDataException if this class instance's value is a not a known + * member. + */ + fun known(): Known = + when (this) { + AGENTIC -> Known.AGENTIC + COST_EFFECTIVE -> Known.COST_EFFECTIVE + else -> throw LlamaCloudInvalidDataException("Unknown Tier: $value") + } + + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for debugging + * and generally doesn't throw. + * + * @throws LlamaCloudInvalidDataException if this class instance's value does not have the + * expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + LlamaCloudInvalidDataException("Value is not a String") + } + + private var validated: Boolean = false + + /** + * 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. + * + * @throws LlamaCloudInvalidDataException if any value type in this object doesn't match its + * expected type. + */ + fun validate(): Tier = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: LlamaCloudInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Tier && value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -672,6 +854,7 @@ private constructor( sheetNames == other.sheetNames && specialization == other.specialization && tableMergeSensitivity == other.tableMergeSensitivity && + tier == other.tier && useExperimentalProcessing == other.useExperimentalProcessing && additionalProperties == other.additionalProperties } @@ -685,6 +868,7 @@ private constructor( sheetNames, specialization, tableMergeSensitivity, + tier, useExperimentalProcessing, additionalProperties, ) @@ -693,5 +877,5 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "SheetsParsingConfig{extractionRange=$extractionRange, flattenHierarchicalTables=$flattenHierarchicalTables, generateAdditionalMetadata=$generateAdditionalMetadata, includeHiddenCells=$includeHiddenCells, sheetNames=$sheetNames, specialization=$specialization, tableMergeSensitivity=$tableMergeSensitivity, useExperimentalProcessing=$useExperimentalProcessing, additionalProperties=$additionalProperties}" + "SheetsParsingConfig{extractionRange=$extractionRange, flattenHierarchicalTables=$flattenHierarchicalTables, generateAdditionalMetadata=$generateAdditionalMetadata, includeHiddenCells=$includeHiddenCells, sheetNames=$sheetNames, specialization=$specialization, tableMergeSensitivity=$tableMergeSensitivity, tier=$tier, useExperimentalProcessing=$useExperimentalProcessing, additionalProperties=$additionalProperties}" } diff --git a/llama-cloud-core/src/main/kotlin/ai/llamaindex/llamacloud/models/configurations/ConfigurationCreate.kt b/llama-cloud-core/src/main/kotlin/ai/llamaindex/llamacloud/models/configurations/ConfigurationCreate.kt index 95db317..0e7c2d7 100644 --- a/llama-cloud-core/src/main/kotlin/ai/llamaindex/llamacloud/models/configurations/ConfigurationCreate.kt +++ b/llama-cloud-core/src/main/kotlin/ai/llamaindex/llamacloud/models/configurations/ConfigurationCreate.kt @@ -666,6 +666,7 @@ private constructor( private val sheetNames: JsonField>, private val specialization: JsonField, private val tableMergeSensitivity: JsonField, + private val tier: JsonField, private val useExperimentalProcessing: JsonField, private val additionalProperties: MutableMap, ) { @@ -696,6 +697,7 @@ private constructor( @JsonProperty("table_merge_sensitivity") @ExcludeMissing tableMergeSensitivity: JsonField = JsonMissing.of(), + @JsonProperty("tier") @ExcludeMissing tier: JsonField = JsonMissing.of(), @JsonProperty("use_experimental_processing") @ExcludeMissing useExperimentalProcessing: JsonField = JsonMissing.of(), @@ -708,6 +710,7 @@ private constructor( sheetNames, specialization, tableMergeSensitivity, + tier, useExperimentalProcessing, mutableMapOf(), ) @@ -747,8 +750,8 @@ private constructor( flattenHierarchicalTables.getOptional("flatten_hierarchical_tables") /** - * Whether to generate additional metadata (title, description) for each extracted - * region. + * Deprecated: controlled by `tier`. Whether to generate additional metadata (title, + * description) for each extracted region. Honored only on `agentic`. * * @throws LlamaCloudInvalidDataException if the JSON field has an unexpected type (e.g. * if the server responded with an unexpected value). @@ -775,9 +778,10 @@ private constructor( fun sheetNames(): Optional> = sheetNames.getOptional("sheet_names") /** - * Optional specialization mode for domain-specific extraction. Supported values: - * 'financial-standard', 'financial-enhanced', 'financial-precise'. Default None uses - * the general-purpose pipeline. + * Deprecated: controlled by `tier`. Optional specialization mode for domain-specific + * extraction. Supported values: 'financial-standard', 'financial-enhanced', + * 'financial-precise'. Default None uses the general-purpose pipeline. Honored only on + * `agentic`. * * @throws LlamaCloudInvalidDataException if the JSON field has an unexpected type (e.g. * if the server responded with an unexpected value). @@ -785,9 +789,8 @@ private constructor( fun specialization(): Optional = specialization.getOptional("specialization") /** - * Influences how likely similar-looking regions are merged into a single table. Useful - * for spreadsheets that either have sparse tables (strong merging) or many distinct - * tables close together (weak merging). + * Deprecated: controlled by `tier`. Influences how likely similar-looking regions are + * merged into a single table. Honored only on `agentic`. * * @throws LlamaCloudInvalidDataException if the JSON field has an unexpected type (e.g. * if the server responded with an unexpected value). @@ -796,7 +799,17 @@ private constructor( tableMergeSensitivity.getOptional("table_merge_sensitivity") /** - * Enables experimental processing. Accuracy may be impacted. + * Spreadsheet extraction tier. `cost_effective` uses the rule-based/ML-only pipeline; + * `agentic` uses the full pipeline. + * + * @throws LlamaCloudInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ + fun tier(): Optional = tier.getOptional("tier") + + /** + * Deprecated: controlled by `tier`. Enables experimental processing. Honored only on + * `agentic`. * * @throws LlamaCloudInvalidDataException if the JSON field has an unexpected type (e.g. * if the server responded with an unexpected value). @@ -874,6 +887,13 @@ private constructor( @ExcludeMissing fun _tableMergeSensitivity(): JsonField = tableMergeSensitivity + /** + * Returns the raw JSON value of [tier]. + * + * Unlike [tier], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("tier") @ExcludeMissing fun _tier(): JsonField = tier + /** * Returns the raw JSON value of [useExperimentalProcessing]. * @@ -914,6 +934,7 @@ private constructor( private var specialization: JsonField = JsonMissing.of() private var tableMergeSensitivity: JsonField = JsonMissing.of() + private var tier: JsonField = JsonMissing.of() private var useExperimentalProcessing: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @@ -927,6 +948,7 @@ private constructor( sheetNames = spreadsheetV1.sheetNames.map { it.toMutableList() } specialization = spreadsheetV1.specialization tableMergeSensitivity = spreadsheetV1.tableMergeSensitivity + tier = spreadsheetV1.tier useExperimentalProcessing = spreadsheetV1.useExperimentalProcessing additionalProperties = spreadsheetV1.additionalProperties.toMutableMap() } @@ -988,8 +1010,8 @@ private constructor( } /** - * Whether to generate additional metadata (title, description) for each extracted - * region. + * Deprecated: controlled by `tier`. Whether to generate additional metadata (title, + * description) for each extracted region. Honored only on `agentic`. */ fun generateAdditionalMetadata(generateAdditionalMetadata: Boolean) = generateAdditionalMetadata(JsonField.of(generateAdditionalMetadata)) @@ -1056,9 +1078,10 @@ private constructor( } /** - * Optional specialization mode for domain-specific extraction. Supported values: - * 'financial-standard', 'financial-enhanced', 'financial-precise'. Default None - * uses the general-purpose pipeline. + * Deprecated: controlled by `tier`. Optional specialization mode for + * domain-specific extraction. Supported values: 'financial-standard', + * 'financial-enhanced', 'financial-precise'. Default None uses the general-purpose + * pipeline. Honored only on `agentic`. */ fun specialization(specialization: String?) = specialization(JsonField.ofNullable(specialization)) @@ -1081,9 +1104,8 @@ private constructor( } /** - * Influences how likely similar-looking regions are merged into a single table. - * Useful for spreadsheets that either have sparse tables (strong merging) or many - * distinct tables close together (weak merging). + * Deprecated: controlled by `tier`. Influences how likely similar-looking regions + * are merged into a single table. Honored only on `agentic`. */ fun tableMergeSensitivity(tableMergeSensitivity: TableMergeSensitivity) = tableMergeSensitivity(JsonField.of(tableMergeSensitivity)) @@ -1100,7 +1122,25 @@ private constructor( this.tableMergeSensitivity = tableMergeSensitivity } - /** Enables experimental processing. Accuracy may be impacted. */ + /** + * Spreadsheet extraction tier. `cost_effective` uses the rule-based/ML-only + * pipeline; `agentic` uses the full pipeline. + */ + fun tier(tier: Tier) = tier(JsonField.of(tier)) + + /** + * Sets [Builder.tier] to an arbitrary JSON value. + * + * You should usually call [Builder.tier] with a well-typed [Tier] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun tier(tier: JsonField) = apply { this.tier = tier } + + /** + * Deprecated: controlled by `tier`. Enables experimental processing. Honored only + * on `agentic`. + */ fun useExperimentalProcessing(useExperimentalProcessing: Boolean) = useExperimentalProcessing(JsonField.of(useExperimentalProcessing)) @@ -1153,6 +1193,7 @@ private constructor( (sheetNames ?: JsonMissing.of()).map { it.toImmutable() }, specialization, tableMergeSensitivity, + tier, useExperimentalProcessing, additionalProperties.toMutableMap(), ) @@ -1189,6 +1230,7 @@ private constructor( sheetNames() specialization() tableMergeSensitivity().ifPresent { it.validate() } + tier().ifPresent { it.validate() } useExperimentalProcessing() validated = true } @@ -1217,12 +1259,12 @@ private constructor( (sheetNames.asKnown().getOrNull()?.size ?: 0) + (if (specialization.asKnown().isPresent) 1 else 0) + (tableMergeSensitivity.asKnown().getOrNull()?.validity() ?: 0) + + (tier.asKnown().getOrNull()?.validity() ?: 0) + (if (useExperimentalProcessing.asKnown().isPresent) 1 else 0) /** - * Influences how likely similar-looking regions are merged into a single table. Useful - * for spreadsheets that either have sparse tables (strong merging) or many distinct - * tables close together (weak merging). + * Deprecated: controlled by `tier`. Influences how likely similar-looking regions are + * merged into a single table. Honored only on `agentic`. */ class TableMergeSensitivity @JsonCreator @@ -1371,6 +1413,150 @@ private constructor( override fun toString() = value.toString() } + /** + * Spreadsheet extraction tier. `cost_effective` uses the rule-based/ML-only pipeline; + * `agentic` uses the full pipeline. + */ + class Tier @JsonCreator private constructor(private val value: JsonField) : + Enum { + + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that + * doesn't match any known member, and you want to know that value. For example, if + * the SDK is on an older version than the API, then the API may respond with new + * members that the SDK is unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + + companion object { + + @JvmField val AGENTIC = of("agentic") + + @JvmField val COST_EFFECTIVE = of("cost_effective") + + @JvmStatic fun of(value: String) = Tier(JsonField.of(value)) + } + + /** An enum containing [Tier]'s known values. */ + enum class Known { + AGENTIC, + COST_EFFECTIVE, + } + + /** + * An enum containing [Tier]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [Tier] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, + * if the SDK is on an older version than the API, then the API may respond with + * new members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + AGENTIC, + COST_EFFECTIVE, + /** + * An enum member indicating that [Tier] was instantiated with an unknown value. + */ + _UNKNOWN, + } + + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if + * you want to throw for the unknown case. + */ + fun value(): Value = + when (this) { + AGENTIC -> Value.AGENTIC + COST_EFFECTIVE -> Value.COST_EFFECTIVE + else -> Value._UNKNOWN + } + + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and + * don't want to throw for the unknown case. + * + * @throws LlamaCloudInvalidDataException if this class instance's value is a not a + * known member. + */ + fun known(): Known = + when (this) { + AGENTIC -> Known.AGENTIC + COST_EFFECTIVE -> Known.COST_EFFECTIVE + else -> throw LlamaCloudInvalidDataException("Unknown Tier: $value") + } + + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for + * debugging and generally doesn't throw. + * + * @throws LlamaCloudInvalidDataException if this class instance's value does not + * have the expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + LlamaCloudInvalidDataException("Value is not a String") + } + + private var validated: Boolean = false + + /** + * 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. + * + * @throws LlamaCloudInvalidDataException if any value type in this object doesn't + * match its expected type. + */ + fun validate(): Tier = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: LlamaCloudInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Tier && value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -1385,6 +1571,7 @@ private constructor( sheetNames == other.sheetNames && specialization == other.specialization && tableMergeSensitivity == other.tableMergeSensitivity && + tier == other.tier && useExperimentalProcessing == other.useExperimentalProcessing && additionalProperties == other.additionalProperties } @@ -1399,6 +1586,7 @@ private constructor( sheetNames, specialization, tableMergeSensitivity, + tier, useExperimentalProcessing, additionalProperties, ) @@ -1407,7 +1595,7 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "SpreadsheetV1{productType=$productType, extractionRange=$extractionRange, flattenHierarchicalTables=$flattenHierarchicalTables, generateAdditionalMetadata=$generateAdditionalMetadata, includeHiddenCells=$includeHiddenCells, sheetNames=$sheetNames, specialization=$specialization, tableMergeSensitivity=$tableMergeSensitivity, useExperimentalProcessing=$useExperimentalProcessing, additionalProperties=$additionalProperties}" + "SpreadsheetV1{productType=$productType, extractionRange=$extractionRange, flattenHierarchicalTables=$flattenHierarchicalTables, generateAdditionalMetadata=$generateAdditionalMetadata, includeHiddenCells=$includeHiddenCells, sheetNames=$sheetNames, specialization=$specialization, tableMergeSensitivity=$tableMergeSensitivity, tier=$tier, useExperimentalProcessing=$useExperimentalProcessing, additionalProperties=$additionalProperties}" } } diff --git a/llama-cloud-core/src/main/kotlin/ai/llamaindex/llamacloud/models/configurations/ConfigurationResponse.kt b/llama-cloud-core/src/main/kotlin/ai/llamaindex/llamacloud/models/configurations/ConfigurationResponse.kt index f1ffb73..1de4be8 100644 --- a/llama-cloud-core/src/main/kotlin/ai/llamaindex/llamacloud/models/configurations/ConfigurationResponse.kt +++ b/llama-cloud-core/src/main/kotlin/ai/llamaindex/llamacloud/models/configurations/ConfigurationResponse.kt @@ -861,6 +861,7 @@ private constructor( private val sheetNames: JsonField>, private val specialization: JsonField, private val tableMergeSensitivity: JsonField, + private val tier: JsonField, private val useExperimentalProcessing: JsonField, private val additionalProperties: MutableMap, ) { @@ -891,6 +892,7 @@ private constructor( @JsonProperty("table_merge_sensitivity") @ExcludeMissing tableMergeSensitivity: JsonField = JsonMissing.of(), + @JsonProperty("tier") @ExcludeMissing tier: JsonField = JsonMissing.of(), @JsonProperty("use_experimental_processing") @ExcludeMissing useExperimentalProcessing: JsonField = JsonMissing.of(), @@ -903,6 +905,7 @@ private constructor( sheetNames, specialization, tableMergeSensitivity, + tier, useExperimentalProcessing, mutableMapOf(), ) @@ -942,8 +945,8 @@ private constructor( flattenHierarchicalTables.getOptional("flatten_hierarchical_tables") /** - * Whether to generate additional metadata (title, description) for each extracted - * region. + * Deprecated: controlled by `tier`. Whether to generate additional metadata (title, + * description) for each extracted region. Honored only on `agentic`. * * @throws LlamaCloudInvalidDataException if the JSON field has an unexpected type (e.g. * if the server responded with an unexpected value). @@ -970,9 +973,10 @@ private constructor( fun sheetNames(): Optional> = sheetNames.getOptional("sheet_names") /** - * Optional specialization mode for domain-specific extraction. Supported values: - * 'financial-standard', 'financial-enhanced', 'financial-precise'. Default None uses - * the general-purpose pipeline. + * Deprecated: controlled by `tier`. Optional specialization mode for domain-specific + * extraction. Supported values: 'financial-standard', 'financial-enhanced', + * 'financial-precise'. Default None uses the general-purpose pipeline. Honored only on + * `agentic`. * * @throws LlamaCloudInvalidDataException if the JSON field has an unexpected type (e.g. * if the server responded with an unexpected value). @@ -980,9 +984,8 @@ private constructor( fun specialization(): Optional = specialization.getOptional("specialization") /** - * Influences how likely similar-looking regions are merged into a single table. Useful - * for spreadsheets that either have sparse tables (strong merging) or many distinct - * tables close together (weak merging). + * Deprecated: controlled by `tier`. Influences how likely similar-looking regions are + * merged into a single table. Honored only on `agentic`. * * @throws LlamaCloudInvalidDataException if the JSON field has an unexpected type (e.g. * if the server responded with an unexpected value). @@ -991,7 +994,17 @@ private constructor( tableMergeSensitivity.getOptional("table_merge_sensitivity") /** - * Enables experimental processing. Accuracy may be impacted. + * Spreadsheet extraction tier. `cost_effective` uses the rule-based/ML-only pipeline; + * `agentic` uses the full pipeline. + * + * @throws LlamaCloudInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ + fun tier(): Optional = tier.getOptional("tier") + + /** + * Deprecated: controlled by `tier`. Enables experimental processing. Honored only on + * `agentic`. * * @throws LlamaCloudInvalidDataException if the JSON field has an unexpected type (e.g. * if the server responded with an unexpected value). @@ -1069,6 +1082,13 @@ private constructor( @ExcludeMissing fun _tableMergeSensitivity(): JsonField = tableMergeSensitivity + /** + * Returns the raw JSON value of [tier]. + * + * Unlike [tier], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("tier") @ExcludeMissing fun _tier(): JsonField = tier + /** * Returns the raw JSON value of [useExperimentalProcessing]. * @@ -1109,6 +1129,7 @@ private constructor( private var specialization: JsonField = JsonMissing.of() private var tableMergeSensitivity: JsonField = JsonMissing.of() + private var tier: JsonField = JsonMissing.of() private var useExperimentalProcessing: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @@ -1122,6 +1143,7 @@ private constructor( sheetNames = spreadsheetV1.sheetNames.map { it.toMutableList() } specialization = spreadsheetV1.specialization tableMergeSensitivity = spreadsheetV1.tableMergeSensitivity + tier = spreadsheetV1.tier useExperimentalProcessing = spreadsheetV1.useExperimentalProcessing additionalProperties = spreadsheetV1.additionalProperties.toMutableMap() } @@ -1183,8 +1205,8 @@ private constructor( } /** - * Whether to generate additional metadata (title, description) for each extracted - * region. + * Deprecated: controlled by `tier`. Whether to generate additional metadata (title, + * description) for each extracted region. Honored only on `agentic`. */ fun generateAdditionalMetadata(generateAdditionalMetadata: Boolean) = generateAdditionalMetadata(JsonField.of(generateAdditionalMetadata)) @@ -1251,9 +1273,10 @@ private constructor( } /** - * Optional specialization mode for domain-specific extraction. Supported values: - * 'financial-standard', 'financial-enhanced', 'financial-precise'. Default None - * uses the general-purpose pipeline. + * Deprecated: controlled by `tier`. Optional specialization mode for + * domain-specific extraction. Supported values: 'financial-standard', + * 'financial-enhanced', 'financial-precise'. Default None uses the general-purpose + * pipeline. Honored only on `agentic`. */ fun specialization(specialization: String?) = specialization(JsonField.ofNullable(specialization)) @@ -1276,9 +1299,8 @@ private constructor( } /** - * Influences how likely similar-looking regions are merged into a single table. - * Useful for spreadsheets that either have sparse tables (strong merging) or many - * distinct tables close together (weak merging). + * Deprecated: controlled by `tier`. Influences how likely similar-looking regions + * are merged into a single table. Honored only on `agentic`. */ fun tableMergeSensitivity(tableMergeSensitivity: TableMergeSensitivity) = tableMergeSensitivity(JsonField.of(tableMergeSensitivity)) @@ -1295,7 +1317,25 @@ private constructor( this.tableMergeSensitivity = tableMergeSensitivity } - /** Enables experimental processing. Accuracy may be impacted. */ + /** + * Spreadsheet extraction tier. `cost_effective` uses the rule-based/ML-only + * pipeline; `agentic` uses the full pipeline. + */ + fun tier(tier: Tier) = tier(JsonField.of(tier)) + + /** + * Sets [Builder.tier] to an arbitrary JSON value. + * + * You should usually call [Builder.tier] with a well-typed [Tier] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun tier(tier: JsonField) = apply { this.tier = tier } + + /** + * Deprecated: controlled by `tier`. Enables experimental processing. Honored only + * on `agentic`. + */ fun useExperimentalProcessing(useExperimentalProcessing: Boolean) = useExperimentalProcessing(JsonField.of(useExperimentalProcessing)) @@ -1348,6 +1388,7 @@ private constructor( (sheetNames ?: JsonMissing.of()).map { it.toImmutable() }, specialization, tableMergeSensitivity, + tier, useExperimentalProcessing, additionalProperties.toMutableMap(), ) @@ -1384,6 +1425,7 @@ private constructor( sheetNames() specialization() tableMergeSensitivity().ifPresent { it.validate() } + tier().ifPresent { it.validate() } useExperimentalProcessing() validated = true } @@ -1412,12 +1454,12 @@ private constructor( (sheetNames.asKnown().getOrNull()?.size ?: 0) + (if (specialization.asKnown().isPresent) 1 else 0) + (tableMergeSensitivity.asKnown().getOrNull()?.validity() ?: 0) + + (tier.asKnown().getOrNull()?.validity() ?: 0) + (if (useExperimentalProcessing.asKnown().isPresent) 1 else 0) /** - * Influences how likely similar-looking regions are merged into a single table. Useful - * for spreadsheets that either have sparse tables (strong merging) or many distinct - * tables close together (weak merging). + * Deprecated: controlled by `tier`. Influences how likely similar-looking regions are + * merged into a single table. Honored only on `agentic`. */ class TableMergeSensitivity @JsonCreator @@ -1566,6 +1608,150 @@ private constructor( override fun toString() = value.toString() } + /** + * Spreadsheet extraction tier. `cost_effective` uses the rule-based/ML-only pipeline; + * `agentic` uses the full pipeline. + */ + class Tier @JsonCreator private constructor(private val value: JsonField) : + Enum { + + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that + * doesn't match any known member, and you want to know that value. For example, if + * the SDK is on an older version than the API, then the API may respond with new + * members that the SDK is unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + + companion object { + + @JvmField val AGENTIC = of("agentic") + + @JvmField val COST_EFFECTIVE = of("cost_effective") + + @JvmStatic fun of(value: String) = Tier(JsonField.of(value)) + } + + /** An enum containing [Tier]'s known values. */ + enum class Known { + AGENTIC, + COST_EFFECTIVE, + } + + /** + * An enum containing [Tier]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [Tier] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, + * if the SDK is on an older version than the API, then the API may respond with + * new members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + AGENTIC, + COST_EFFECTIVE, + /** + * An enum member indicating that [Tier] was instantiated with an unknown value. + */ + _UNKNOWN, + } + + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if + * you want to throw for the unknown case. + */ + fun value(): Value = + when (this) { + AGENTIC -> Value.AGENTIC + COST_EFFECTIVE -> Value.COST_EFFECTIVE + else -> Value._UNKNOWN + } + + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and + * don't want to throw for the unknown case. + * + * @throws LlamaCloudInvalidDataException if this class instance's value is a not a + * known member. + */ + fun known(): Known = + when (this) { + AGENTIC -> Known.AGENTIC + COST_EFFECTIVE -> Known.COST_EFFECTIVE + else -> throw LlamaCloudInvalidDataException("Unknown Tier: $value") + } + + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for + * debugging and generally doesn't throw. + * + * @throws LlamaCloudInvalidDataException if this class instance's value does not + * have the expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + LlamaCloudInvalidDataException("Value is not a String") + } + + private var validated: Boolean = false + + /** + * 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. + * + * @throws LlamaCloudInvalidDataException if any value type in this object doesn't + * match its expected type. + */ + fun validate(): Tier = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: LlamaCloudInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Tier && value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -1580,6 +1766,7 @@ private constructor( sheetNames == other.sheetNames && specialization == other.specialization && tableMergeSensitivity == other.tableMergeSensitivity && + tier == other.tier && useExperimentalProcessing == other.useExperimentalProcessing && additionalProperties == other.additionalProperties } @@ -1594,6 +1781,7 @@ private constructor( sheetNames, specialization, tableMergeSensitivity, + tier, useExperimentalProcessing, additionalProperties, ) @@ -1602,7 +1790,7 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "SpreadsheetV1{productType=$productType, extractionRange=$extractionRange, flattenHierarchicalTables=$flattenHierarchicalTables, generateAdditionalMetadata=$generateAdditionalMetadata, includeHiddenCells=$includeHiddenCells, sheetNames=$sheetNames, specialization=$specialization, tableMergeSensitivity=$tableMergeSensitivity, useExperimentalProcessing=$useExperimentalProcessing, additionalProperties=$additionalProperties}" + "SpreadsheetV1{productType=$productType, extractionRange=$extractionRange, flattenHierarchicalTables=$flattenHierarchicalTables, generateAdditionalMetadata=$generateAdditionalMetadata, includeHiddenCells=$includeHiddenCells, sheetNames=$sheetNames, specialization=$specialization, tableMergeSensitivity=$tableMergeSensitivity, tier=$tier, useExperimentalProcessing=$useExperimentalProcessing, additionalProperties=$additionalProperties}" } } diff --git a/llama-cloud-core/src/main/kotlin/ai/llamaindex/llamacloud/models/configurations/ConfigurationUpdateParams.kt b/llama-cloud-core/src/main/kotlin/ai/llamaindex/llamacloud/models/configurations/ConfigurationUpdateParams.kt index 950434d..730cb38 100644 --- a/llama-cloud-core/src/main/kotlin/ai/llamaindex/llamacloud/models/configurations/ConfigurationUpdateParams.kt +++ b/llama-cloud-core/src/main/kotlin/ai/llamaindex/llamacloud/models/configurations/ConfigurationUpdateParams.kt @@ -1027,6 +1027,7 @@ private constructor( private val sheetNames: JsonField>, private val specialization: JsonField, private val tableMergeSensitivity: JsonField, + private val tier: JsonField, private val useExperimentalProcessing: JsonField, private val additionalProperties: MutableMap, ) { @@ -1057,6 +1058,7 @@ private constructor( @JsonProperty("table_merge_sensitivity") @ExcludeMissing tableMergeSensitivity: JsonField = JsonMissing.of(), + @JsonProperty("tier") @ExcludeMissing tier: JsonField = JsonMissing.of(), @JsonProperty("use_experimental_processing") @ExcludeMissing useExperimentalProcessing: JsonField = JsonMissing.of(), @@ -1069,6 +1071,7 @@ private constructor( sheetNames, specialization, tableMergeSensitivity, + tier, useExperimentalProcessing, mutableMapOf(), ) @@ -1108,8 +1111,8 @@ private constructor( flattenHierarchicalTables.getOptional("flatten_hierarchical_tables") /** - * Whether to generate additional metadata (title, description) for each extracted - * region. + * Deprecated: controlled by `tier`. Whether to generate additional metadata (title, + * description) for each extracted region. Honored only on `agentic`. * * @throws LlamaCloudInvalidDataException if the JSON field has an unexpected type (e.g. * if the server responded with an unexpected value). @@ -1136,9 +1139,10 @@ private constructor( fun sheetNames(): Optional> = sheetNames.getOptional("sheet_names") /** - * Optional specialization mode for domain-specific extraction. Supported values: - * 'financial-standard', 'financial-enhanced', 'financial-precise'. Default None uses - * the general-purpose pipeline. + * Deprecated: controlled by `tier`. Optional specialization mode for domain-specific + * extraction. Supported values: 'financial-standard', 'financial-enhanced', + * 'financial-precise'. Default None uses the general-purpose pipeline. Honored only on + * `agentic`. * * @throws LlamaCloudInvalidDataException if the JSON field has an unexpected type (e.g. * if the server responded with an unexpected value). @@ -1146,9 +1150,8 @@ private constructor( fun specialization(): Optional = specialization.getOptional("specialization") /** - * Influences how likely similar-looking regions are merged into a single table. Useful - * for spreadsheets that either have sparse tables (strong merging) or many distinct - * tables close together (weak merging). + * Deprecated: controlled by `tier`. Influences how likely similar-looking regions are + * merged into a single table. Honored only on `agentic`. * * @throws LlamaCloudInvalidDataException if the JSON field has an unexpected type (e.g. * if the server responded with an unexpected value). @@ -1157,7 +1160,17 @@ private constructor( tableMergeSensitivity.getOptional("table_merge_sensitivity") /** - * Enables experimental processing. Accuracy may be impacted. + * Spreadsheet extraction tier. `cost_effective` uses the rule-based/ML-only pipeline; + * `agentic` uses the full pipeline. + * + * @throws LlamaCloudInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ + fun tier(): Optional = tier.getOptional("tier") + + /** + * Deprecated: controlled by `tier`. Enables experimental processing. Honored only on + * `agentic`. * * @throws LlamaCloudInvalidDataException if the JSON field has an unexpected type (e.g. * if the server responded with an unexpected value). @@ -1235,6 +1248,13 @@ private constructor( @ExcludeMissing fun _tableMergeSensitivity(): JsonField = tableMergeSensitivity + /** + * Returns the raw JSON value of [tier]. + * + * Unlike [tier], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("tier") @ExcludeMissing fun _tier(): JsonField = tier + /** * Returns the raw JSON value of [useExperimentalProcessing]. * @@ -1275,6 +1295,7 @@ private constructor( private var specialization: JsonField = JsonMissing.of() private var tableMergeSensitivity: JsonField = JsonMissing.of() + private var tier: JsonField = JsonMissing.of() private var useExperimentalProcessing: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @@ -1288,6 +1309,7 @@ private constructor( sheetNames = spreadsheetV1.sheetNames.map { it.toMutableList() } specialization = spreadsheetV1.specialization tableMergeSensitivity = spreadsheetV1.tableMergeSensitivity + tier = spreadsheetV1.tier useExperimentalProcessing = spreadsheetV1.useExperimentalProcessing additionalProperties = spreadsheetV1.additionalProperties.toMutableMap() } @@ -1349,8 +1371,8 @@ private constructor( } /** - * Whether to generate additional metadata (title, description) for each extracted - * region. + * Deprecated: controlled by `tier`. Whether to generate additional metadata (title, + * description) for each extracted region. Honored only on `agentic`. */ fun generateAdditionalMetadata(generateAdditionalMetadata: Boolean) = generateAdditionalMetadata(JsonField.of(generateAdditionalMetadata)) @@ -1417,9 +1439,10 @@ private constructor( } /** - * Optional specialization mode for domain-specific extraction. Supported values: - * 'financial-standard', 'financial-enhanced', 'financial-precise'. Default None - * uses the general-purpose pipeline. + * Deprecated: controlled by `tier`. Optional specialization mode for + * domain-specific extraction. Supported values: 'financial-standard', + * 'financial-enhanced', 'financial-precise'. Default None uses the general-purpose + * pipeline. Honored only on `agentic`. */ fun specialization(specialization: String?) = specialization(JsonField.ofNullable(specialization)) @@ -1442,9 +1465,8 @@ private constructor( } /** - * Influences how likely similar-looking regions are merged into a single table. - * Useful for spreadsheets that either have sparse tables (strong merging) or many - * distinct tables close together (weak merging). + * Deprecated: controlled by `tier`. Influences how likely similar-looking regions + * are merged into a single table. Honored only on `agentic`. */ fun tableMergeSensitivity(tableMergeSensitivity: TableMergeSensitivity) = tableMergeSensitivity(JsonField.of(tableMergeSensitivity)) @@ -1461,7 +1483,25 @@ private constructor( this.tableMergeSensitivity = tableMergeSensitivity } - /** Enables experimental processing. Accuracy may be impacted. */ + /** + * Spreadsheet extraction tier. `cost_effective` uses the rule-based/ML-only + * pipeline; `agentic` uses the full pipeline. + */ + fun tier(tier: Tier) = tier(JsonField.of(tier)) + + /** + * Sets [Builder.tier] to an arbitrary JSON value. + * + * You should usually call [Builder.tier] with a well-typed [Tier] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun tier(tier: JsonField) = apply { this.tier = tier } + + /** + * Deprecated: controlled by `tier`. Enables experimental processing. Honored only + * on `agentic`. + */ fun useExperimentalProcessing(useExperimentalProcessing: Boolean) = useExperimentalProcessing(JsonField.of(useExperimentalProcessing)) @@ -1514,6 +1554,7 @@ private constructor( (sheetNames ?: JsonMissing.of()).map { it.toImmutable() }, specialization, tableMergeSensitivity, + tier, useExperimentalProcessing, additionalProperties.toMutableMap(), ) @@ -1550,6 +1591,7 @@ private constructor( sheetNames() specialization() tableMergeSensitivity().ifPresent { it.validate() } + tier().ifPresent { it.validate() } useExperimentalProcessing() validated = true } @@ -1578,12 +1620,12 @@ private constructor( (sheetNames.asKnown().getOrNull()?.size ?: 0) + (if (specialization.asKnown().isPresent) 1 else 0) + (tableMergeSensitivity.asKnown().getOrNull()?.validity() ?: 0) + + (tier.asKnown().getOrNull()?.validity() ?: 0) + (if (useExperimentalProcessing.asKnown().isPresent) 1 else 0) /** - * Influences how likely similar-looking regions are merged into a single table. Useful - * for spreadsheets that either have sparse tables (strong merging) or many distinct - * tables close together (weak merging). + * Deprecated: controlled by `tier`. Influences how likely similar-looking regions are + * merged into a single table. Honored only on `agentic`. */ class TableMergeSensitivity @JsonCreator @@ -1732,6 +1774,150 @@ private constructor( override fun toString() = value.toString() } + /** + * Spreadsheet extraction tier. `cost_effective` uses the rule-based/ML-only pipeline; + * `agentic` uses the full pipeline. + */ + class Tier @JsonCreator private constructor(private val value: JsonField) : + Enum { + + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that + * doesn't match any known member, and you want to know that value. For example, if + * the SDK is on an older version than the API, then the API may respond with new + * members that the SDK is unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + + companion object { + + @JvmField val AGENTIC = of("agentic") + + @JvmField val COST_EFFECTIVE = of("cost_effective") + + @JvmStatic fun of(value: String) = Tier(JsonField.of(value)) + } + + /** An enum containing [Tier]'s known values. */ + enum class Known { + AGENTIC, + COST_EFFECTIVE, + } + + /** + * An enum containing [Tier]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [Tier] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, + * if the SDK is on an older version than the API, then the API may respond with + * new members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + AGENTIC, + COST_EFFECTIVE, + /** + * An enum member indicating that [Tier] was instantiated with an unknown value. + */ + _UNKNOWN, + } + + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if + * you want to throw for the unknown case. + */ + fun value(): Value = + when (this) { + AGENTIC -> Value.AGENTIC + COST_EFFECTIVE -> Value.COST_EFFECTIVE + else -> Value._UNKNOWN + } + + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and + * don't want to throw for the unknown case. + * + * @throws LlamaCloudInvalidDataException if this class instance's value is a not a + * known member. + */ + fun known(): Known = + when (this) { + AGENTIC -> Known.AGENTIC + COST_EFFECTIVE -> Known.COST_EFFECTIVE + else -> throw LlamaCloudInvalidDataException("Unknown Tier: $value") + } + + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for + * debugging and generally doesn't throw. + * + * @throws LlamaCloudInvalidDataException if this class instance's value does not + * have the expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + LlamaCloudInvalidDataException("Value is not a String") + } + + private var validated: Boolean = false + + /** + * 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. + * + * @throws LlamaCloudInvalidDataException if any value type in this object doesn't + * match its expected type. + */ + fun validate(): Tier = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: LlamaCloudInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Tier && value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -1746,6 +1932,7 @@ private constructor( sheetNames == other.sheetNames && specialization == other.specialization && tableMergeSensitivity == other.tableMergeSensitivity && + tier == other.tier && useExperimentalProcessing == other.useExperimentalProcessing && additionalProperties == other.additionalProperties } @@ -1760,6 +1947,7 @@ private constructor( sheetNames, specialization, tableMergeSensitivity, + tier, useExperimentalProcessing, additionalProperties, ) @@ -1768,7 +1956,7 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "SpreadsheetV1{productType=$productType, extractionRange=$extractionRange, flattenHierarchicalTables=$flattenHierarchicalTables, generateAdditionalMetadata=$generateAdditionalMetadata, includeHiddenCells=$includeHiddenCells, sheetNames=$sheetNames, specialization=$specialization, tableMergeSensitivity=$tableMergeSensitivity, useExperimentalProcessing=$useExperimentalProcessing, additionalProperties=$additionalProperties}" + "SpreadsheetV1{productType=$productType, extractionRange=$extractionRange, flattenHierarchicalTables=$flattenHierarchicalTables, generateAdditionalMetadata=$generateAdditionalMetadata, includeHiddenCells=$includeHiddenCells, sheetNames=$sheetNames, specialization=$specialization, tableMergeSensitivity=$tableMergeSensitivity, tier=$tier, useExperimentalProcessing=$useExperimentalProcessing, additionalProperties=$additionalProperties}" } } diff --git a/llama-cloud-core/src/main/kotlin/ai/llamaindex/llamacloud/models/extract/ExtractJobUsage.kt b/llama-cloud-core/src/main/kotlin/ai/llamaindex/llamacloud/models/extract/ExtractJobUsage.kt index 58e158a..3b00d11 100644 --- a/llama-cloud-core/src/main/kotlin/ai/llamaindex/llamacloud/models/extract/ExtractJobUsage.kt +++ b/llama-cloud-core/src/main/kotlin/ai/llamaindex/llamacloud/models/extract/ExtractJobUsage.kt @@ -20,16 +20,28 @@ import kotlin.jvm.optionals.getOrNull class ExtractJobUsage @JsonCreator(mode = JsonCreator.Mode.DISABLED) private constructor( + private val numPagesBilled: JsonField, private val numPagesExtracted: JsonField, private val additionalProperties: MutableMap, ) { @JsonCreator private constructor( + @JsonProperty("num_pages_billed") + @ExcludeMissing + numPagesBilled: JsonField = JsonMissing.of(), @JsonProperty("num_pages_extracted") @ExcludeMissing - numPagesExtracted: JsonField = JsonMissing.of() - ) : this(numPagesExtracted, mutableMapOf()) + numPagesExtracted: JsonField = JsonMissing.of(), + ) : this(numPagesBilled, numPagesExtracted, mutableMapOf()) + + /** + * Number of effective pages billed + * + * @throws LlamaCloudInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun numPagesBilled(): Optional = numPagesBilled.getOptional("num_pages_billed") /** * Number of pages extracted @@ -39,6 +51,15 @@ private constructor( */ fun numPagesExtracted(): Optional = numPagesExtracted.getOptional("num_pages_extracted") + /** + * Returns the raw JSON value of [numPagesBilled]. + * + * Unlike [numPagesBilled], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("num_pages_billed") + @ExcludeMissing + fun _numPagesBilled(): JsonField = numPagesBilled + /** * Returns the raw JSON value of [numPagesExtracted]. * @@ -70,15 +91,43 @@ private constructor( /** A builder for [ExtractJobUsage]. */ class Builder internal constructor() { + private var numPagesBilled: JsonField = JsonMissing.of() private var numPagesExtracted: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(extractJobUsage: ExtractJobUsage) = apply { + numPagesBilled = extractJobUsage.numPagesBilled numPagesExtracted = extractJobUsage.numPagesExtracted additionalProperties = extractJobUsage.additionalProperties.toMutableMap() } + /** Number of effective pages billed */ + fun numPagesBilled(numPagesBilled: Long?) = + numPagesBilled(JsonField.ofNullable(numPagesBilled)) + + /** + * Alias for [Builder.numPagesBilled]. + * + * This unboxed primitive overload exists for backwards compatibility. + */ + fun numPagesBilled(numPagesBilled: Long) = numPagesBilled(numPagesBilled as Long?) + + /** Alias for calling [Builder.numPagesBilled] with `numPagesBilled.orElse(null)`. */ + fun numPagesBilled(numPagesBilled: Optional) = + numPagesBilled(numPagesBilled.getOrNull()) + + /** + * Sets [Builder.numPagesBilled] to an arbitrary JSON value. + * + * You should usually call [Builder.numPagesBilled] with a well-typed [Long] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun numPagesBilled(numPagesBilled: JsonField) = apply { + this.numPagesBilled = numPagesBilled + } + /** Number of pages extracted */ fun numPagesExtracted(numPagesExtracted: Long?) = numPagesExtracted(JsonField.ofNullable(numPagesExtracted)) @@ -131,7 +180,7 @@ private constructor( * Further updates to this [Builder] will not mutate the returned instance. */ fun build(): ExtractJobUsage = - ExtractJobUsage(numPagesExtracted, additionalProperties.toMutableMap()) + ExtractJobUsage(numPagesBilled, numPagesExtracted, additionalProperties.toMutableMap()) } private var validated: Boolean = false @@ -149,6 +198,7 @@ private constructor( return@apply } + numPagesBilled() numPagesExtracted() validated = true } @@ -167,7 +217,9 @@ private constructor( * Used for best match union deserialization. */ @JvmSynthetic - internal fun validity(): Int = (if (numPagesExtracted.asKnown().isPresent) 1 else 0) + internal fun validity(): Int = + (if (numPagesBilled.asKnown().isPresent) 1 else 0) + + (if (numPagesExtracted.asKnown().isPresent) 1 else 0) override fun equals(other: Any?): Boolean { if (this === other) { @@ -175,14 +227,17 @@ private constructor( } return other is ExtractJobUsage && + numPagesBilled == other.numPagesBilled && numPagesExtracted == other.numPagesExtracted && additionalProperties == other.additionalProperties } - private val hashCode: Int by lazy { Objects.hash(numPagesExtracted, additionalProperties) } + private val hashCode: Int by lazy { + Objects.hash(numPagesBilled, numPagesExtracted, additionalProperties) + } override fun hashCode(): Int = hashCode override fun toString() = - "ExtractJobUsage{numPagesExtracted=$numPagesExtracted, additionalProperties=$additionalProperties}" + "ExtractJobUsage{numPagesBilled=$numPagesBilled, numPagesExtracted=$numPagesExtracted, additionalProperties=$additionalProperties}" } diff --git a/llama-cloud-core/src/test/kotlin/ai/llamaindex/llamacloud/models/beta/sheets/SheetCreateParamsTest.kt b/llama-cloud-core/src/test/kotlin/ai/llamaindex/llamacloud/models/beta/sheets/SheetCreateParamsTest.kt index 30b36e1..cc06e00 100644 --- a/llama-cloud-core/src/test/kotlin/ai/llamaindex/llamacloud/models/beta/sheets/SheetCreateParamsTest.kt +++ b/llama-cloud-core/src/test/kotlin/ai/llamaindex/llamacloud/models/beta/sheets/SheetCreateParamsTest.kt @@ -25,6 +25,7 @@ internal class SheetCreateParamsTest { .addSheetName("string") .specialization("specialization") .tableMergeSensitivity(SheetsParsingConfig.TableMergeSensitivity.STRONG) + .tier(SheetsParsingConfig.Tier.AGENTIC) .useExperimentalProcessing(true) .build() ) @@ -37,6 +38,7 @@ internal class SheetCreateParamsTest { .addSheetName("string") .specialization("specialization") .tableMergeSensitivity(SheetsParsingConfig.TableMergeSensitivity.STRONG) + .tier(SheetsParsingConfig.Tier.AGENTIC) .useExperimentalProcessing(true) .build() ) @@ -78,6 +80,7 @@ internal class SheetCreateParamsTest { .addSheetName("string") .specialization("specialization") .tableMergeSensitivity(SheetsParsingConfig.TableMergeSensitivity.STRONG) + .tier(SheetsParsingConfig.Tier.AGENTIC) .useExperimentalProcessing(true) .build() ) @@ -90,6 +93,7 @@ internal class SheetCreateParamsTest { .addSheetName("string") .specialization("specialization") .tableMergeSensitivity(SheetsParsingConfig.TableMergeSensitivity.STRONG) + .tier(SheetsParsingConfig.Tier.AGENTIC) .useExperimentalProcessing(true) .build() ) @@ -154,6 +158,7 @@ internal class SheetCreateParamsTest { .addSheetName("string") .specialization("specialization") .tableMergeSensitivity(SheetsParsingConfig.TableMergeSensitivity.STRONG) + .tier(SheetsParsingConfig.Tier.AGENTIC) .useExperimentalProcessing(true) .build() ) @@ -166,6 +171,7 @@ internal class SheetCreateParamsTest { .addSheetName("string") .specialization("specialization") .tableMergeSensitivity(SheetsParsingConfig.TableMergeSensitivity.STRONG) + .tier(SheetsParsingConfig.Tier.AGENTIC) .useExperimentalProcessing(true) .build() ) @@ -206,6 +212,7 @@ internal class SheetCreateParamsTest { .addSheetName("string") .specialization("specialization") .tableMergeSensitivity(SheetsParsingConfig.TableMergeSensitivity.STRONG) + .tier(SheetsParsingConfig.Tier.AGENTIC) .useExperimentalProcessing(true) .build() ) @@ -219,6 +226,7 @@ internal class SheetCreateParamsTest { .addSheetName("string") .specialization("specialization") .tableMergeSensitivity(SheetsParsingConfig.TableMergeSensitivity.STRONG) + .tier(SheetsParsingConfig.Tier.AGENTIC) .useExperimentalProcessing(true) .build() ) diff --git a/llama-cloud-core/src/test/kotlin/ai/llamaindex/llamacloud/models/beta/sheets/SheetListPageResponseTest.kt b/llama-cloud-core/src/test/kotlin/ai/llamaindex/llamacloud/models/beta/sheets/SheetListPageResponseTest.kt index d64fe19..270203a 100644 --- a/llama-cloud-core/src/test/kotlin/ai/llamaindex/llamacloud/models/beta/sheets/SheetListPageResponseTest.kt +++ b/llama-cloud-core/src/test/kotlin/ai/llamaindex/llamacloud/models/beta/sheets/SheetListPageResponseTest.kt @@ -30,6 +30,7 @@ internal class SheetListPageResponseTest { .tableMergeSensitivity( SheetsParsingConfig.TableMergeSensitivity.STRONG ) + .tier(SheetsParsingConfig.Tier.AGENTIC) .useExperimentalProcessing(true) .build() ) @@ -50,6 +51,7 @@ internal class SheetListPageResponseTest { .tableMergeSensitivity( SheetsParsingConfig.TableMergeSensitivity.STRONG ) + .tier(SheetsParsingConfig.Tier.AGENTIC) .useExperimentalProcessing(true) .build() ) @@ -157,6 +159,7 @@ internal class SheetListPageResponseTest { .addSheetName("string") .specialization("specialization") .tableMergeSensitivity(SheetsParsingConfig.TableMergeSensitivity.STRONG) + .tier(SheetsParsingConfig.Tier.AGENTIC) .useExperimentalProcessing(true) .build() ) @@ -175,6 +178,7 @@ internal class SheetListPageResponseTest { .addSheetName("string") .specialization("specialization") .tableMergeSensitivity(SheetsParsingConfig.TableMergeSensitivity.STRONG) + .tier(SheetsParsingConfig.Tier.AGENTIC) .useExperimentalProcessing(true) .build() ) @@ -288,6 +292,7 @@ internal class SheetListPageResponseTest { .tableMergeSensitivity( SheetsParsingConfig.TableMergeSensitivity.STRONG ) + .tier(SheetsParsingConfig.Tier.AGENTIC) .useExperimentalProcessing(true) .build() ) @@ -308,6 +313,7 @@ internal class SheetListPageResponseTest { .tableMergeSensitivity( SheetsParsingConfig.TableMergeSensitivity.STRONG ) + .tier(SheetsParsingConfig.Tier.AGENTIC) .useExperimentalProcessing(true) .build() ) diff --git a/llama-cloud-core/src/test/kotlin/ai/llamaindex/llamacloud/models/beta/sheets/SheetsJobTest.kt b/llama-cloud-core/src/test/kotlin/ai/llamaindex/llamacloud/models/beta/sheets/SheetsJobTest.kt index d10761c..9a724af 100644 --- a/llama-cloud-core/src/test/kotlin/ai/llamaindex/llamacloud/models/beta/sheets/SheetsJobTest.kt +++ b/llama-cloud-core/src/test/kotlin/ai/llamaindex/llamacloud/models/beta/sheets/SheetsJobTest.kt @@ -27,6 +27,7 @@ internal class SheetsJobTest { .addSheetName("string") .specialization("specialization") .tableMergeSensitivity(SheetsParsingConfig.TableMergeSensitivity.STRONG) + .tier(SheetsParsingConfig.Tier.AGENTIC) .useExperimentalProcessing(true) .build() ) @@ -45,6 +46,7 @@ internal class SheetsJobTest { .addSheetName("string") .specialization("specialization") .tableMergeSensitivity(SheetsParsingConfig.TableMergeSensitivity.STRONG) + .tier(SheetsParsingConfig.Tier.AGENTIC) .useExperimentalProcessing(true) .build() ) @@ -140,6 +142,7 @@ internal class SheetsJobTest { .addSheetName("string") .specialization("specialization") .tableMergeSensitivity(SheetsParsingConfig.TableMergeSensitivity.STRONG) + .tier(SheetsParsingConfig.Tier.AGENTIC) .useExperimentalProcessing(true) .build() ) @@ -159,6 +162,7 @@ internal class SheetsJobTest { .addSheetName("string") .specialization("specialization") .tableMergeSensitivity(SheetsParsingConfig.TableMergeSensitivity.STRONG) + .tier(SheetsParsingConfig.Tier.AGENTIC) .useExperimentalProcessing(true) .build() ) @@ -260,6 +264,7 @@ internal class SheetsJobTest { .addSheetName("string") .specialization("specialization") .tableMergeSensitivity(SheetsParsingConfig.TableMergeSensitivity.STRONG) + .tier(SheetsParsingConfig.Tier.AGENTIC) .useExperimentalProcessing(true) .build() ) @@ -278,6 +283,7 @@ internal class SheetsJobTest { .addSheetName("string") .specialization("specialization") .tableMergeSensitivity(SheetsParsingConfig.TableMergeSensitivity.STRONG) + .tier(SheetsParsingConfig.Tier.AGENTIC) .useExperimentalProcessing(true) .build() ) diff --git a/llama-cloud-core/src/test/kotlin/ai/llamaindex/llamacloud/models/beta/sheets/SheetsParsingConfigTest.kt b/llama-cloud-core/src/test/kotlin/ai/llamaindex/llamacloud/models/beta/sheets/SheetsParsingConfigTest.kt index f28cd49..1524262 100644 --- a/llama-cloud-core/src/test/kotlin/ai/llamaindex/llamacloud/models/beta/sheets/SheetsParsingConfigTest.kt +++ b/llama-cloud-core/src/test/kotlin/ai/llamaindex/llamacloud/models/beta/sheets/SheetsParsingConfigTest.kt @@ -21,6 +21,7 @@ internal class SheetsParsingConfigTest { .addSheetName("string") .specialization("specialization") .tableMergeSensitivity(SheetsParsingConfig.TableMergeSensitivity.STRONG) + .tier(SheetsParsingConfig.Tier.AGENTIC) .useExperimentalProcessing(true) .build() @@ -32,6 +33,7 @@ internal class SheetsParsingConfigTest { assertThat(sheetsParsingConfig.specialization()).contains("specialization") assertThat(sheetsParsingConfig.tableMergeSensitivity()) .contains(SheetsParsingConfig.TableMergeSensitivity.STRONG) + assertThat(sheetsParsingConfig.tier()).contains(SheetsParsingConfig.Tier.AGENTIC) assertThat(sheetsParsingConfig.useExperimentalProcessing()).contains(true) } @@ -47,6 +49,7 @@ internal class SheetsParsingConfigTest { .addSheetName("string") .specialization("specialization") .tableMergeSensitivity(SheetsParsingConfig.TableMergeSensitivity.STRONG) + .tier(SheetsParsingConfig.Tier.AGENTIC) .useExperimentalProcessing(true) .build() diff --git a/llama-cloud-core/src/test/kotlin/ai/llamaindex/llamacloud/models/extract/ExtractJobUsageTest.kt b/llama-cloud-core/src/test/kotlin/ai/llamaindex/llamacloud/models/extract/ExtractJobUsageTest.kt index 5667e78..ddbb952 100644 --- a/llama-cloud-core/src/test/kotlin/ai/llamaindex/llamacloud/models/extract/ExtractJobUsageTest.kt +++ b/llama-cloud-core/src/test/kotlin/ai/llamaindex/llamacloud/models/extract/ExtractJobUsageTest.kt @@ -11,15 +11,18 @@ internal class ExtractJobUsageTest { @Test fun create() { - val extractJobUsage = ExtractJobUsage.builder().numPagesExtracted(0L).build() + val extractJobUsage = + ExtractJobUsage.builder().numPagesBilled(0L).numPagesExtracted(0L).build() + assertThat(extractJobUsage.numPagesBilled()).contains(0L) assertThat(extractJobUsage.numPagesExtracted()).contains(0L) } @Test fun roundtrip() { val jsonMapper = jsonMapper() - val extractJobUsage = ExtractJobUsage.builder().numPagesExtracted(0L).build() + val extractJobUsage = + ExtractJobUsage.builder().numPagesBilled(0L).numPagesExtracted(0L).build() val roundtrippedExtractJobUsage = jsonMapper.readValue( diff --git a/llama-cloud-core/src/test/kotlin/ai/llamaindex/llamacloud/models/extract/ExtractV2JobQueryResponseTest.kt b/llama-cloud-core/src/test/kotlin/ai/llamaindex/llamacloud/models/extract/ExtractV2JobQueryResponseTest.kt index 6d82598..f173e80 100644 --- a/llama-cloud-core/src/test/kotlin/ai/llamaindex/llamacloud/models/extract/ExtractV2JobQueryResponseTest.kt +++ b/llama-cloud-core/src/test/kotlin/ai/llamaindex/llamacloud/models/extract/ExtractV2JobQueryResponseTest.kt @@ -139,7 +139,12 @@ internal class ExtractV2JobQueryResponseTest { ) .metadata( ExtractV2Job.Metadata.builder() - .usage(ExtractJobUsage.builder().numPagesExtracted(0L).build()) + .usage( + ExtractJobUsage.builder() + .numPagesBilled(0L) + .numPagesExtracted(0L) + .build() + ) .build() ) .build() @@ -273,7 +278,12 @@ internal class ExtractV2JobQueryResponseTest { ) .metadata( ExtractV2Job.Metadata.builder() - .usage(ExtractJobUsage.builder().numPagesExtracted(0L).build()) + .usage( + ExtractJobUsage.builder() + .numPagesBilled(0L) + .numPagesExtracted(0L) + .build() + ) .build() ) .build() @@ -411,7 +421,12 @@ internal class ExtractV2JobQueryResponseTest { ) .metadata( ExtractV2Job.Metadata.builder() - .usage(ExtractJobUsage.builder().numPagesExtracted(0L).build()) + .usage( + ExtractJobUsage.builder() + .numPagesBilled(0L) + .numPagesExtracted(0L) + .build() + ) .build() ) .build() diff --git a/llama-cloud-core/src/test/kotlin/ai/llamaindex/llamacloud/models/extract/ExtractV2JobTest.kt b/llama-cloud-core/src/test/kotlin/ai/llamaindex/llamacloud/models/extract/ExtractV2JobTest.kt index 49ceab6..56010f2 100644 --- a/llama-cloud-core/src/test/kotlin/ai/llamaindex/llamacloud/models/extract/ExtractV2JobTest.kt +++ b/llama-cloud-core/src/test/kotlin/ai/llamaindex/llamacloud/models/extract/ExtractV2JobTest.kt @@ -131,7 +131,12 @@ internal class ExtractV2JobTest { ) .metadata( ExtractV2Job.Metadata.builder() - .usage(ExtractJobUsage.builder().numPagesExtracted(0L).build()) + .usage( + ExtractJobUsage.builder() + .numPagesBilled(0L) + .numPagesExtracted(0L) + .build() + ) .build() ) .build() @@ -261,7 +266,9 @@ internal class ExtractV2JobTest { assertThat(extractV2Job.metadata()) .contains( ExtractV2Job.Metadata.builder() - .usage(ExtractJobUsage.builder().numPagesExtracted(0L).build()) + .usage( + ExtractJobUsage.builder().numPagesBilled(0L).numPagesExtracted(0L).build() + ) .build() ) } @@ -387,7 +394,12 @@ internal class ExtractV2JobTest { ) .metadata( ExtractV2Job.Metadata.builder() - .usage(ExtractJobUsage.builder().numPagesExtracted(0L).build()) + .usage( + ExtractJobUsage.builder() + .numPagesBilled(0L) + .numPagesExtracted(0L) + .build() + ) .build() ) .build() diff --git a/llama-cloud-core/src/test/kotlin/ai/llamaindex/llamacloud/models/sheets/SheetCreateParamsTest.kt b/llama-cloud-core/src/test/kotlin/ai/llamaindex/llamacloud/models/sheets/SheetCreateParamsTest.kt index 1afbabd..aa25ebb 100644 --- a/llama-cloud-core/src/test/kotlin/ai/llamaindex/llamacloud/models/sheets/SheetCreateParamsTest.kt +++ b/llama-cloud-core/src/test/kotlin/ai/llamaindex/llamacloud/models/sheets/SheetCreateParamsTest.kt @@ -26,6 +26,7 @@ internal class SheetCreateParamsTest { .addSheetName("string") .specialization("specialization") .tableMergeSensitivity(SheetsParsingConfig.TableMergeSensitivity.STRONG) + .tier(SheetsParsingConfig.Tier.AGENTIC) .useExperimentalProcessing(true) .build() ) @@ -38,6 +39,7 @@ internal class SheetCreateParamsTest { .addSheetName("string") .specialization("specialization") .tableMergeSensitivity(SheetsParsingConfig.TableMergeSensitivity.STRONG) + .tier(SheetsParsingConfig.Tier.AGENTIC) .useExperimentalProcessing(true) .build() ) @@ -79,6 +81,7 @@ internal class SheetCreateParamsTest { .addSheetName("string") .specialization("specialization") .tableMergeSensitivity(SheetsParsingConfig.TableMergeSensitivity.STRONG) + .tier(SheetsParsingConfig.Tier.AGENTIC) .useExperimentalProcessing(true) .build() ) @@ -91,6 +94,7 @@ internal class SheetCreateParamsTest { .addSheetName("string") .specialization("specialization") .tableMergeSensitivity(SheetsParsingConfig.TableMergeSensitivity.STRONG) + .tier(SheetsParsingConfig.Tier.AGENTIC) .useExperimentalProcessing(true) .build() ) @@ -155,6 +159,7 @@ internal class SheetCreateParamsTest { .addSheetName("string") .specialization("specialization") .tableMergeSensitivity(SheetsParsingConfig.TableMergeSensitivity.STRONG) + .tier(SheetsParsingConfig.Tier.AGENTIC) .useExperimentalProcessing(true) .build() ) @@ -167,6 +172,7 @@ internal class SheetCreateParamsTest { .addSheetName("string") .specialization("specialization") .tableMergeSensitivity(SheetsParsingConfig.TableMergeSensitivity.STRONG) + .tier(SheetsParsingConfig.Tier.AGENTIC) .useExperimentalProcessing(true) .build() ) @@ -207,6 +213,7 @@ internal class SheetCreateParamsTest { .addSheetName("string") .specialization("specialization") .tableMergeSensitivity(SheetsParsingConfig.TableMergeSensitivity.STRONG) + .tier(SheetsParsingConfig.Tier.AGENTIC) .useExperimentalProcessing(true) .build() ) @@ -220,6 +227,7 @@ internal class SheetCreateParamsTest { .addSheetName("string") .specialization("specialization") .tableMergeSensitivity(SheetsParsingConfig.TableMergeSensitivity.STRONG) + .tier(SheetsParsingConfig.Tier.AGENTIC) .useExperimentalProcessing(true) .build() ) diff --git a/llama-cloud-core/src/test/kotlin/ai/llamaindex/llamacloud/models/sheets/SheetListPageResponseTest.kt b/llama-cloud-core/src/test/kotlin/ai/llamaindex/llamacloud/models/sheets/SheetListPageResponseTest.kt index 4493d51..13091cf 100644 --- a/llama-cloud-core/src/test/kotlin/ai/llamaindex/llamacloud/models/sheets/SheetListPageResponseTest.kt +++ b/llama-cloud-core/src/test/kotlin/ai/llamaindex/llamacloud/models/sheets/SheetListPageResponseTest.kt @@ -32,6 +32,7 @@ internal class SheetListPageResponseTest { .tableMergeSensitivity( SheetsParsingConfig.TableMergeSensitivity.STRONG ) + .tier(SheetsParsingConfig.Tier.AGENTIC) .useExperimentalProcessing(true) .build() ) @@ -52,6 +53,7 @@ internal class SheetListPageResponseTest { .tableMergeSensitivity( SheetsParsingConfig.TableMergeSensitivity.STRONG ) + .tier(SheetsParsingConfig.Tier.AGENTIC) .useExperimentalProcessing(true) .build() ) @@ -159,6 +161,7 @@ internal class SheetListPageResponseTest { .addSheetName("string") .specialization("specialization") .tableMergeSensitivity(SheetsParsingConfig.TableMergeSensitivity.STRONG) + .tier(SheetsParsingConfig.Tier.AGENTIC) .useExperimentalProcessing(true) .build() ) @@ -177,6 +180,7 @@ internal class SheetListPageResponseTest { .addSheetName("string") .specialization("specialization") .tableMergeSensitivity(SheetsParsingConfig.TableMergeSensitivity.STRONG) + .tier(SheetsParsingConfig.Tier.AGENTIC) .useExperimentalProcessing(true) .build() ) @@ -290,6 +294,7 @@ internal class SheetListPageResponseTest { .tableMergeSensitivity( SheetsParsingConfig.TableMergeSensitivity.STRONG ) + .tier(SheetsParsingConfig.Tier.AGENTIC) .useExperimentalProcessing(true) .build() ) @@ -310,6 +315,7 @@ internal class SheetListPageResponseTest { .tableMergeSensitivity( SheetsParsingConfig.TableMergeSensitivity.STRONG ) + .tier(SheetsParsingConfig.Tier.AGENTIC) .useExperimentalProcessing(true) .build() ) diff --git a/llama-cloud-core/src/test/kotlin/ai/llamaindex/llamacloud/services/async/SheetServiceAsyncTest.kt b/llama-cloud-core/src/test/kotlin/ai/llamaindex/llamacloud/services/async/SheetServiceAsyncTest.kt index 1c5e151..c7dea39 100644 --- a/llama-cloud-core/src/test/kotlin/ai/llamaindex/llamacloud/services/async/SheetServiceAsyncTest.kt +++ b/llama-cloud-core/src/test/kotlin/ai/llamaindex/llamacloud/services/async/SheetServiceAsyncTest.kt @@ -35,6 +35,7 @@ internal class SheetServiceAsyncTest { .addSheetName("string") .specialization("specialization") .tableMergeSensitivity(SheetsParsingConfig.TableMergeSensitivity.STRONG) + .tier(SheetsParsingConfig.Tier.AGENTIC) .useExperimentalProcessing(true) .build() ) @@ -47,6 +48,7 @@ internal class SheetServiceAsyncTest { .addSheetName("string") .specialization("specialization") .tableMergeSensitivity(SheetsParsingConfig.TableMergeSensitivity.STRONG) + .tier(SheetsParsingConfig.Tier.AGENTIC) .useExperimentalProcessing(true) .build() ) diff --git a/llama-cloud-core/src/test/kotlin/ai/llamaindex/llamacloud/services/async/beta/SheetServiceAsyncTest.kt b/llama-cloud-core/src/test/kotlin/ai/llamaindex/llamacloud/services/async/beta/SheetServiceAsyncTest.kt index 8c03c5b..728ccde 100644 --- a/llama-cloud-core/src/test/kotlin/ai/llamaindex/llamacloud/services/async/beta/SheetServiceAsyncTest.kt +++ b/llama-cloud-core/src/test/kotlin/ai/llamaindex/llamacloud/services/async/beta/SheetServiceAsyncTest.kt @@ -35,6 +35,7 @@ internal class SheetServiceAsyncTest { .addSheetName("string") .specialization("specialization") .tableMergeSensitivity(SheetsParsingConfig.TableMergeSensitivity.STRONG) + .tier(SheetsParsingConfig.Tier.AGENTIC) .useExperimentalProcessing(true) .build() ) @@ -47,6 +48,7 @@ internal class SheetServiceAsyncTest { .addSheetName("string") .specialization("specialization") .tableMergeSensitivity(SheetsParsingConfig.TableMergeSensitivity.STRONG) + .tier(SheetsParsingConfig.Tier.AGENTIC) .useExperimentalProcessing(true) .build() ) diff --git a/llama-cloud-core/src/test/kotlin/ai/llamaindex/llamacloud/services/blocking/SheetServiceTest.kt b/llama-cloud-core/src/test/kotlin/ai/llamaindex/llamacloud/services/blocking/SheetServiceTest.kt index 2d653a3..b9a3201 100644 --- a/llama-cloud-core/src/test/kotlin/ai/llamaindex/llamacloud/services/blocking/SheetServiceTest.kt +++ b/llama-cloud-core/src/test/kotlin/ai/llamaindex/llamacloud/services/blocking/SheetServiceTest.kt @@ -35,6 +35,7 @@ internal class SheetServiceTest { .addSheetName("string") .specialization("specialization") .tableMergeSensitivity(SheetsParsingConfig.TableMergeSensitivity.STRONG) + .tier(SheetsParsingConfig.Tier.AGENTIC) .useExperimentalProcessing(true) .build() ) @@ -47,6 +48,7 @@ internal class SheetServiceTest { .addSheetName("string") .specialization("specialization") .tableMergeSensitivity(SheetsParsingConfig.TableMergeSensitivity.STRONG) + .tier(SheetsParsingConfig.Tier.AGENTIC) .useExperimentalProcessing(true) .build() ) diff --git a/llama-cloud-core/src/test/kotlin/ai/llamaindex/llamacloud/services/blocking/beta/SheetServiceTest.kt b/llama-cloud-core/src/test/kotlin/ai/llamaindex/llamacloud/services/blocking/beta/SheetServiceTest.kt index 84a3473..42cbc4f 100644 --- a/llama-cloud-core/src/test/kotlin/ai/llamaindex/llamacloud/services/blocking/beta/SheetServiceTest.kt +++ b/llama-cloud-core/src/test/kotlin/ai/llamaindex/llamacloud/services/blocking/beta/SheetServiceTest.kt @@ -35,6 +35,7 @@ internal class SheetServiceTest { .addSheetName("string") .specialization("specialization") .tableMergeSensitivity(SheetsParsingConfig.TableMergeSensitivity.STRONG) + .tier(SheetsParsingConfig.Tier.AGENTIC) .useExperimentalProcessing(true) .build() ) @@ -47,6 +48,7 @@ internal class SheetServiceTest { .addSheetName("string") .specialization("specialization") .tableMergeSensitivity(SheetsParsingConfig.TableMergeSensitivity.STRONG) + .tier(SheetsParsingConfig.Tier.AGENTIC) .useExperimentalProcessing(true) .build() )