diff --git a/.fern/metadata.json b/.fern/metadata.json index 57faac3..573862c 100644 --- a/.fern/metadata.json +++ b/.fern/metadata.json @@ -18,6 +18,6 @@ "testImplementation org.mockito:mockito-inline:4.11.0" ] }, - "originGitCommit": "094c36681badc82afeb39a2c91a716461a5a0bd2", - "sdkVersion": "1.17.0" + "originGitCommit": "a5c1143a7b724689db7c5e4cee897834882c9d69", + "sdkVersion": "1.18.0" } \ No newline at end of file diff --git a/.fern/replay.lock b/.fern/replay.lock index 59c0dae..b4fe821 100644 --- a/.fern/replay.lock +++ b/.fern/replay.lock @@ -12,5 +12,11 @@ generations: cli_version: unknown generator_versions: fernapi/fern-java-sdk: 3.34.8 -current_generation: 4bfa1695c5fdc3aaa796c53d117df0c43484a3a8 + - commit_sha: cb33baf0976726bbd6feeceee5856bb63a0c02ae + tree_hash: 31fac53e01deabcb9616babf3b4b48803a8ab7c9 + timestamp: 2026-07-29T22:25:41.724Z + cli_version: unknown + generator_versions: + fernapi/fern-java-sdk: 3.34.8 +current_generation: cb33baf0976726bbd6feeceee5856bb63a0c02ae patches: [] diff --git a/build.gradle b/build.gradle index 78077a1..c5db996 100644 --- a/build.gradle +++ b/build.gradle @@ -50,7 +50,7 @@ java { group = 'ai.extend' -version = '1.17.0' +version = '1.18.0' jar { dependsOn(":generatePomFileForMavenPublication") @@ -81,7 +81,7 @@ publishing { maven(MavenPublication) { groupId = 'ai.extend' artifactId = 'extend-java-sdk' - version = '1.17.0' + version = '1.18.0' from components.java pom { name = 'Extend.ai' diff --git a/reference.md b/reference.md index b1b9fff..f6b0daa 100644 --- a/reference.md +++ b/reference.md @@ -6713,7 +6713,9 @@ Example: `"invoice"`
-Run a workflow with a file. A workflow is a sequence of steps that process files and data in a specific order to achieve a desired outcome. +Run a workflow. A workflow is a sequence of steps that process files and data in a specific order to achieve a desired outcome. + +Pass `file` for a single document, or `package` to process 2-50 files together as one package in a single run. Exactly one of `file` or `package` must be provided. The request returns immediately with a `PROCESSING` status. Use webhooks or poll the Get Workflow Run endpoint for results.
@@ -6771,7 +6773,15 @@ client.workflowRuns().create(
-**file:** `WorkflowRunsCreateRequestFile` — The file to be processed. Supported file types can be found [here](https://docs.extend.ai/2026-02-09/general/supported-file-types). Files can be provided as a URL, an Extend file ID, or raw text. If you wish to process more at a time, consider using the [Batch Run Workflow](https://docs.extend.ai/2026-02-09/api-reference/endpoints/workflow/batch-create-workflow-runs) endpoint. +**file:** `Optional` — The file to be processed. Supported file types can be found [here](https://docs.extend.ai/2026-02-09/general/supported-file-types). Files can be provided as a URL, an Extend file ID, or raw text. Mutually exclusive with `package` — provide one or the other. If you wish to process many files as independent runs, consider using the [Batch Run Workflow](https://docs.extend.ai/2026-02-09/api-reference/endpoints/workflow/batch-create-workflow-runs) endpoint. + +
+
+ +
+
+ +**package_:** `Optional` — A set of 2–50 files to process together in a single workflow run. Mutually exclusive with `file` — provide one or the other.
@@ -6779,7 +6789,7 @@ client.workflowRuns().create(
-**outputs:** `Optional>` — Predetermined outputs to be used for the workflow run. Generally not recommended for most use cases, however, can be useful in cases of overriding a classification in a workflow, or a subset of extraction fields when data is known. +**outputs:** `Optional>` — Predetermined outputs to be used for the workflow run. Generally not recommended for most use cases, however, can be useful in cases of overriding a classification in a workflow, or a subset of extraction fields when data is known. Not supported on package runs — a package run produces a single merged result across all files and cannot accept pre-supplied per-processor outputs.
diff --git a/src/main/java/ai/extend/core/ClientOptions.java b/src/main/java/ai/extend/core/ClientOptions.java index 43e09a5..4d1b8f6 100644 --- a/src/main/java/ai/extend/core/ClientOptions.java +++ b/src/main/java/ai/extend/core/ClientOptions.java @@ -35,10 +35,10 @@ private ClientOptions( this.headers.putAll(headers); this.headers.putAll(new HashMap() { { - put("User-Agent", "ai.extend:extend-java-sdk/1.17.0"); + put("User-Agent", "ai.extend:extend-java-sdk/1.18.0"); put("X-Fern-Language", "JAVA"); put("X-Fern-SDK-Name", "com.extendconfig.fern:api-sdk"); - put("X-Fern-SDK-Version", "1.17.0"); + put("X-Fern-SDK-Version", "1.18.0"); } }); this.headerSuppliers = headerSuppliers; diff --git a/src/main/java/ai/extend/resources/workflowruns/AsyncRawWorkflowRunsClient.java b/src/main/java/ai/extend/resources/workflowruns/AsyncRawWorkflowRunsClient.java index 8218d71..2b712fb 100644 --- a/src/main/java/ai/extend/resources/workflowruns/AsyncRawWorkflowRunsClient.java +++ b/src/main/java/ai/extend/resources/workflowruns/AsyncRawWorkflowRunsClient.java @@ -210,7 +210,8 @@ public void onFailure(@NotNull Call call, @NotNull IOException e) { } /** - * Run a workflow with a file. A workflow is a sequence of steps that process files and data in a specific order to achieve a desired outcome. + * Run a workflow. A workflow is a sequence of steps that process files and data in a specific order to achieve a desired outcome. + *

Pass file for a single document, or package to process 2-50 files together as one package in a single run. Exactly one of file or package must be provided.

*

The request returns immediately with a PROCESSING status. Use webhooks or poll the Get Workflow Run endpoint for results.

*/ public CompletableFuture> create(WorkflowRunsCreateRequest request) { @@ -218,7 +219,8 @@ public CompletableFuture> create(Workf } /** - * Run a workflow with a file. A workflow is a sequence of steps that process files and data in a specific order to achieve a desired outcome. + * Run a workflow. A workflow is a sequence of steps that process files and data in a specific order to achieve a desired outcome. + *

Pass file for a single document, or package to process 2-50 files together as one package in a single run. Exactly one of file or package must be provided.

*

The request returns immediately with a PROCESSING status. Use webhooks or poll the Get Workflow Run endpoint for results.

*/ public CompletableFuture> create( diff --git a/src/main/java/ai/extend/resources/workflowruns/AsyncWorkflowRunsClient.java b/src/main/java/ai/extend/resources/workflowruns/AsyncWorkflowRunsClient.java index 260d58a..fb865ec 100644 --- a/src/main/java/ai/extend/resources/workflowruns/AsyncWorkflowRunsClient.java +++ b/src/main/java/ai/extend/resources/workflowruns/AsyncWorkflowRunsClient.java @@ -65,7 +65,8 @@ public CompletableFuture list( } /** - * Run a workflow with a file. A workflow is a sequence of steps that process files and data in a specific order to achieve a desired outcome. + * Run a workflow. A workflow is a sequence of steps that process files and data in a specific order to achieve a desired outcome. + *

Pass file for a single document, or package to process 2-50 files together as one package in a single run. Exactly one of file or package must be provided.

*

The request returns immediately with a PROCESSING status. Use webhooks or poll the Get Workflow Run endpoint for results.

*/ public CompletableFuture create(WorkflowRunsCreateRequest request) { @@ -73,7 +74,8 @@ public CompletableFuture create(WorkflowRunsCreateRequest request) } /** - * Run a workflow with a file. A workflow is a sequence of steps that process files and data in a specific order to achieve a desired outcome. + * Run a workflow. A workflow is a sequence of steps that process files and data in a specific order to achieve a desired outcome. + *

Pass file for a single document, or package to process 2-50 files together as one package in a single run. Exactly one of file or package must be provided.

*

The request returns immediately with a PROCESSING status. Use webhooks or poll the Get Workflow Run endpoint for results.

*/ public CompletableFuture create(WorkflowRunsCreateRequest request, RequestOptions requestOptions) { diff --git a/src/main/java/ai/extend/resources/workflowruns/RawWorkflowRunsClient.java b/src/main/java/ai/extend/resources/workflowruns/RawWorkflowRunsClient.java index 478d185..9ed0b6c 100644 --- a/src/main/java/ai/extend/resources/workflowruns/RawWorkflowRunsClient.java +++ b/src/main/java/ai/extend/resources/workflowruns/RawWorkflowRunsClient.java @@ -175,7 +175,8 @@ public ExtendClientBaseHttpResponse list( } /** - * Run a workflow with a file. A workflow is a sequence of steps that process files and data in a specific order to achieve a desired outcome. + * Run a workflow. A workflow is a sequence of steps that process files and data in a specific order to achieve a desired outcome. + *

Pass file for a single document, or package to process 2-50 files together as one package in a single run. Exactly one of file or package must be provided.

*

The request returns immediately with a PROCESSING status. Use webhooks or poll the Get Workflow Run endpoint for results.

*/ public ExtendClientBaseHttpResponse create(WorkflowRunsCreateRequest request) { @@ -183,7 +184,8 @@ public ExtendClientBaseHttpResponse create(WorkflowRunsCreateReques } /** - * Run a workflow with a file. A workflow is a sequence of steps that process files and data in a specific order to achieve a desired outcome. + * Run a workflow. A workflow is a sequence of steps that process files and data in a specific order to achieve a desired outcome. + *

Pass file for a single document, or package to process 2-50 files together as one package in a single run. Exactly one of file or package must be provided.

*

The request returns immediately with a PROCESSING status. Use webhooks or poll the Get Workflow Run endpoint for results.

*/ public ExtendClientBaseHttpResponse create( diff --git a/src/main/java/ai/extend/resources/workflowruns/WorkflowRunsClient.java b/src/main/java/ai/extend/resources/workflowruns/WorkflowRunsClient.java index e859a13..116a42c 100644 --- a/src/main/java/ai/extend/resources/workflowruns/WorkflowRunsClient.java +++ b/src/main/java/ai/extend/resources/workflowruns/WorkflowRunsClient.java @@ -63,7 +63,8 @@ public WorkflowRunsListResponse list(WorkflowRunsListRequest request, RequestOpt } /** - * Run a workflow with a file. A workflow is a sequence of steps that process files and data in a specific order to achieve a desired outcome. + * Run a workflow. A workflow is a sequence of steps that process files and data in a specific order to achieve a desired outcome. + *

Pass file for a single document, or package to process 2-50 files together as one package in a single run. Exactly one of file or package must be provided.

*

The request returns immediately with a PROCESSING status. Use webhooks or poll the Get Workflow Run endpoint for results.

*/ public WorkflowRun create(WorkflowRunsCreateRequest request) { @@ -71,7 +72,8 @@ public WorkflowRun create(WorkflowRunsCreateRequest request) { } /** - * Run a workflow with a file. A workflow is a sequence of steps that process files and data in a specific order to achieve a desired outcome. + * Run a workflow. A workflow is a sequence of steps that process files and data in a specific order to achieve a desired outcome. + *

Pass file for a single document, or package to process 2-50 files together as one package in a single run. Exactly one of file or package must be provided.

*

The request returns immediately with a PROCESSING status. Use webhooks or poll the Get Workflow Run endpoint for results.

*/ public WorkflowRun create(WorkflowRunsCreateRequest request, RequestOptions requestOptions) { diff --git a/src/main/java/ai/extend/resources/workflowruns/requests/WorkflowRunsCreateRequest.java b/src/main/java/ai/extend/resources/workflowruns/requests/WorkflowRunsCreateRequest.java index 1530f0c..ae497bd 100644 --- a/src/main/java/ai/extend/resources/workflowruns/requests/WorkflowRunsCreateRequest.java +++ b/src/main/java/ai/extend/resources/workflowruns/requests/WorkflowRunsCreateRequest.java @@ -7,6 +7,7 @@ import ai.extend.resources.workflowruns.types.WorkflowRunsCreateRequestFile; import ai.extend.resources.workflowruns.types.WorkflowRunsCreateRequestOutputsItem; import ai.extend.types.WorkflowReference; +import ai.extend.types.WorkflowRunPackage; import com.fasterxml.jackson.annotation.JsonAnyGetter; import com.fasterxml.jackson.annotation.JsonAnySetter; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; @@ -27,7 +28,9 @@ public final class WorkflowRunsCreateRequest { private final WorkflowReference workflow; - private final WorkflowRunsCreateRequestFile file; + private final Optional file; + + private final Optional package_; private final Optional> outputs; @@ -41,7 +44,8 @@ public final class WorkflowRunsCreateRequest { private WorkflowRunsCreateRequest( WorkflowReference workflow, - WorkflowRunsCreateRequestFile file, + Optional file, + Optional package_, Optional> outputs, Optional priority, Optional> metadata, @@ -49,6 +53,7 @@ private WorkflowRunsCreateRequest( Map additionalProperties) { this.workflow = workflow; this.file = file; + this.package_ = package_; this.outputs = outputs; this.priority = priority; this.metadata = metadata; @@ -62,15 +67,23 @@ public WorkflowReference getWorkflow() { } /** - * @return The file to be processed. Supported file types can be found here. Files can be provided as a URL, an Extend file ID, or raw text. If you wish to process more at a time, consider using the Batch Run Workflow endpoint. + * @return The file to be processed. Supported file types can be found here. Files can be provided as a URL, an Extend file ID, or raw text. Mutually exclusive with package — provide one or the other. If you wish to process many files as independent runs, consider using the Batch Run Workflow endpoint. */ @JsonProperty("file") - public WorkflowRunsCreateRequestFile getFile() { + public Optional getFile() { return file; } /** - * @return Predetermined outputs to be used for the workflow run. Generally not recommended for most use cases, however, can be useful in cases of overriding a classification in a workflow, or a subset of extraction fields when data is known. + * @return A set of 2–50 files to process together in a single workflow run. Mutually exclusive with file — provide one or the other. + */ + @JsonProperty("package") + public Optional getPackage() { + return package_; + } + + /** + * @return Predetermined outputs to be used for the workflow run. Generally not recommended for most use cases, however, can be useful in cases of overriding a classification in a workflow, or a subset of extraction fields when data is known. Not supported on package runs — a package run produces a single merged result across all files and cannot accept pre-supplied per-processor outputs. */ @JsonProperty("outputs") public Optional> getOutputs() { @@ -106,6 +119,7 @@ public Map getAdditionalProperties() { private boolean equalTo(WorkflowRunsCreateRequest other) { return workflow.equals(other.workflow) && file.equals(other.file) + && package_.equals(other.package_) && outputs.equals(other.outputs) && priority.equals(other.priority) && metadata.equals(other.metadata) @@ -114,7 +128,8 @@ private boolean equalTo(WorkflowRunsCreateRequest other) { @java.lang.Override public int hashCode() { - return Objects.hash(this.workflow, this.file, this.outputs, this.priority, this.metadata, this.secrets); + return Objects.hash( + this.workflow, this.file, this.package_, this.outputs, this.priority, this.metadata, this.secrets); } @java.lang.Override @@ -127,23 +142,30 @@ public static WorkflowStage builder() { } public interface WorkflowStage { - FileStage workflow(@NotNull WorkflowReference workflow); + _FinalStage workflow(@NotNull WorkflowReference workflow); Builder from(WorkflowRunsCreateRequest other); } - public interface FileStage { + public interface _FinalStage { + WorkflowRunsCreateRequest build(); + /** - *

The file to be processed. Supported file types can be found here. Files can be provided as a URL, an Extend file ID, or raw text. If you wish to process more at a time, consider using the Batch Run Workflow endpoint.

+ *

The file to be processed. Supported file types can be found here. Files can be provided as a URL, an Extend file ID, or raw text. Mutually exclusive with package — provide one or the other. If you wish to process many files as independent runs, consider using the Batch Run Workflow endpoint.

*/ - _FinalStage file(@NotNull WorkflowRunsCreateRequestFile file); - } + _FinalStage file(Optional file); - public interface _FinalStage { - WorkflowRunsCreateRequest build(); + _FinalStage file(WorkflowRunsCreateRequestFile file); + + /** + *

A set of 2–50 files to process together in a single workflow run. Mutually exclusive with file — provide one or the other.

+ */ + _FinalStage package_(Optional package_); + + _FinalStage package_(WorkflowRunPackage package_); /** - *

Predetermined outputs to be used for the workflow run. Generally not recommended for most use cases, however, can be useful in cases of overriding a classification in a workflow, or a subset of extraction fields when data is known.

+ *

Predetermined outputs to be used for the workflow run. Generally not recommended for most use cases, however, can be useful in cases of overriding a classification in a workflow, or a subset of extraction fields when data is known. Not supported on package runs — a package run produces a single merged result across all files and cannot accept pre-supplied per-processor outputs.

*/ _FinalStage outputs(Optional> outputs); @@ -163,11 +185,9 @@ public interface _FinalStage { } @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder implements WorkflowStage, FileStage, _FinalStage { + public static final class Builder implements WorkflowStage, _FinalStage { private WorkflowReference workflow; - private WorkflowRunsCreateRequestFile file; - private Optional> secrets = Optional.empty(); private Optional> metadata = Optional.empty(); @@ -176,6 +196,10 @@ public static final class Builder implements WorkflowStage, FileStage, _FinalSta private Optional> outputs = Optional.empty(); + private Optional package_ = Optional.empty(); + + private Optional file = Optional.empty(); + @JsonAnySetter private Map additionalProperties = new HashMap<>(); @@ -185,6 +209,7 @@ private Builder() {} public Builder from(WorkflowRunsCreateRequest other) { workflow(other.getWorkflow()); file(other.getFile()); + package_(other.getPackage()); outputs(other.getOutputs()); priority(other.getPriority()); metadata(other.getMetadata()); @@ -194,23 +219,11 @@ public Builder from(WorkflowRunsCreateRequest other) { @java.lang.Override @JsonSetter("workflow") - public FileStage workflow(@NotNull WorkflowReference workflow) { + public _FinalStage workflow(@NotNull WorkflowReference workflow) { this.workflow = Objects.requireNonNull(workflow, "workflow must not be null"); return this; } - /** - *

The file to be processed. Supported file types can be found here. Files can be provided as a URL, an Extend file ID, or raw text. If you wish to process more at a time, consider using the Batch Run Workflow endpoint.

- *

The file to be processed. Supported file types can be found here. Files can be provided as a URL, an Extend file ID, or raw text. If you wish to process more at a time, consider using the Batch Run Workflow endpoint.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - @JsonSetter("file") - public _FinalStage file(@NotNull WorkflowRunsCreateRequestFile file) { - this.file = Objects.requireNonNull(file, "file must not be null"); - return this; - } - @java.lang.Override public _FinalStage secrets(Map secrets) { this.secrets = Optional.ofNullable(secrets); @@ -251,7 +264,7 @@ public _FinalStage priority(Optional priority) { } /** - *

Predetermined outputs to be used for the workflow run. Generally not recommended for most use cases, however, can be useful in cases of overriding a classification in a workflow, or a subset of extraction fields when data is known.

+ *

Predetermined outputs to be used for the workflow run. Generally not recommended for most use cases, however, can be useful in cases of overriding a classification in a workflow, or a subset of extraction fields when data is known. Not supported on package runs — a package run produces a single merged result across all files and cannot accept pre-supplied per-processor outputs.

* @return Reference to {@code this} so that method calls can be chained together. */ @java.lang.Override @@ -261,7 +274,7 @@ public _FinalStage outputs(List outputs) { } /** - *

Predetermined outputs to be used for the workflow run. Generally not recommended for most use cases, however, can be useful in cases of overriding a classification in a workflow, or a subset of extraction fields when data is known.

+ *

Predetermined outputs to be used for the workflow run. Generally not recommended for most use cases, however, can be useful in cases of overriding a classification in a workflow, or a subset of extraction fields when data is known. Not supported on package runs — a package run produces a single merged result across all files and cannot accept pre-supplied per-processor outputs.

*/ @java.lang.Override @JsonSetter(value = "outputs", nulls = Nulls.SKIP) @@ -270,10 +283,50 @@ public _FinalStage outputs(Optional> return this; } + /** + *

A set of 2–50 files to process together in a single workflow run. Mutually exclusive with file — provide one or the other.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage package_(WorkflowRunPackage package_) { + this.package_ = Optional.ofNullable(package_); + return this; + } + + /** + *

A set of 2–50 files to process together in a single workflow run. Mutually exclusive with file — provide one or the other.

+ */ + @java.lang.Override + @JsonSetter(value = "package", nulls = Nulls.SKIP) + public _FinalStage package_(Optional package_) { + this.package_ = package_; + return this; + } + + /** + *

The file to be processed. Supported file types can be found here. Files can be provided as a URL, an Extend file ID, or raw text. Mutually exclusive with package — provide one or the other. If you wish to process many files as independent runs, consider using the Batch Run Workflow endpoint.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage file(WorkflowRunsCreateRequestFile file) { + this.file = Optional.ofNullable(file); + return this; + } + + /** + *

The file to be processed. Supported file types can be found here. Files can be provided as a URL, an Extend file ID, or raw text. Mutually exclusive with package — provide one or the other. If you wish to process many files as independent runs, consider using the Batch Run Workflow endpoint.

+ */ + @java.lang.Override + @JsonSetter(value = "file", nulls = Nulls.SKIP) + public _FinalStage file(Optional file) { + this.file = file; + return this; + } + @java.lang.Override public WorkflowRunsCreateRequest build() { return new WorkflowRunsCreateRequest( - workflow, file, outputs, priority, metadata, secrets, additionalProperties); + workflow, file, package_, outputs, priority, metadata, secrets, additionalProperties); } } } diff --git a/src/main/java/ai/extend/types/BlockMetadata.java b/src/main/java/ai/extend/types/BlockMetadata.java index 6c90a97..95311b5 100644 --- a/src/main/java/ai/extend/types/BlockMetadata.java +++ b/src/main/java/ai/extend/types/BlockMetadata.java @@ -27,8 +27,6 @@ public final class BlockMetadata { private final Optional sheet; - private final Optional textDirection; - private final Optional minOcrConfidence; private final Optional avgOcrConfidence; @@ -38,13 +36,11 @@ public final class BlockMetadata { private BlockMetadata( Optional page, Optional sheet, - Optional textDirection, Optional minOcrConfidence, Optional avgOcrConfidence, Map additionalProperties) { this.page = page; this.sheet = sheet; - this.textDirection = textDirection; this.minOcrConfidence = minOcrConfidence; this.avgOcrConfidence = avgOcrConfidence; this.additionalProperties = additionalProperties; @@ -66,14 +62,6 @@ public Optional getSheet() { return sheet; } - /** - * @return Text direction for this block's content ("ltr" for left-to-right, "rtl" for right-to-left). - */ - @JsonProperty("textDirection") - public Optional getTextDirection() { - return textDirection; - } - /** * @return Lowest per-word OCR confidence across words in this block, or null when word-level confidence is unavailable. */ @@ -122,14 +110,13 @@ public Map getAdditionalProperties() { private boolean equalTo(BlockMetadata other) { return page.equals(other.page) && sheet.equals(other.sheet) - && textDirection.equals(other.textDirection) && minOcrConfidence.equals(other.minOcrConfidence) && avgOcrConfidence.equals(other.avgOcrConfidence); } @java.lang.Override public int hashCode() { - return Objects.hash(this.page, this.sheet, this.textDirection, this.minOcrConfidence, this.avgOcrConfidence); + return Objects.hash(this.page, this.sheet, this.minOcrConfidence, this.avgOcrConfidence); } @java.lang.Override @@ -147,8 +134,6 @@ public static final class Builder { private Optional sheet = Optional.empty(); - private Optional textDirection = Optional.empty(); - private Optional minOcrConfidence = Optional.empty(); private Optional avgOcrConfidence = Optional.empty(); @@ -161,7 +146,6 @@ private Builder() {} public Builder from(BlockMetadata other) { page(other.getPage()); sheet(other.getSheet()); - textDirection(other.getTextDirection()); minOcrConfidence(other.getMinOcrConfidence()); avgOcrConfidence(other.getAvgOcrConfidence()); return this; @@ -195,20 +179,6 @@ public Builder sheet(BlockMetadataSheet sheet) { return this; } - /** - *

Text direction for this block's content ("ltr" for left-to-right, "rtl" for right-to-left).

- */ - @JsonSetter(value = "textDirection", nulls = Nulls.SKIP) - public Builder textDirection(Optional textDirection) { - this.textDirection = textDirection; - return this; - } - - public Builder textDirection(BlockMetadataTextDirection textDirection) { - this.textDirection = Optional.ofNullable(textDirection); - return this; - } - /** *

Lowest per-word OCR confidence across words in this block, or null when word-level confidence is unavailable.

*/ @@ -260,8 +230,7 @@ public Builder avgOcrConfidence(Nullable avgOcrConfidence) { } public BlockMetadata build() { - return new BlockMetadata( - page, sheet, textDirection, minOcrConfidence, avgOcrConfidence, additionalProperties); + return new BlockMetadata(page, sheet, minOcrConfidence, avgOcrConfidence, additionalProperties); } } } diff --git a/src/main/java/ai/extend/types/BlockMetadataTextDirection.java b/src/main/java/ai/extend/types/BlockMetadataTextDirection.java deleted file mode 100644 index 081fc0e..0000000 --- a/src/main/java/ai/extend/types/BlockMetadataTextDirection.java +++ /dev/null @@ -1,84 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ -package ai.extend.types; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; - -public final class BlockMetadataTextDirection { - public static final BlockMetadataTextDirection LTR = new BlockMetadataTextDirection(Value.LTR, "ltr"); - - public static final BlockMetadataTextDirection RTL = new BlockMetadataTextDirection(Value.RTL, "rtl"); - - private final Value value; - - private final String string; - - BlockMetadataTextDirection(Value value, String string) { - this.value = value; - this.string = string; - } - - public Value getEnumValue() { - return value; - } - - @java.lang.Override - @JsonValue - public String toString() { - return this.string; - } - - @java.lang.Override - public boolean equals(Object other) { - return (this == other) - || (other instanceof BlockMetadataTextDirection - && this.string.equals(((BlockMetadataTextDirection) other).string)); - } - - @java.lang.Override - public int hashCode() { - return this.string.hashCode(); - } - - public T visit(Visitor visitor) { - switch (value) { - case LTR: - return visitor.visitLtr(); - case RTL: - return visitor.visitRtl(); - case UNKNOWN: - default: - return visitor.visitUnknown(string); - } - } - - @JsonCreator(mode = JsonCreator.Mode.DELEGATING) - public static BlockMetadataTextDirection valueOf(String value) { - switch (value) { - case "ltr": - return LTR; - case "rtl": - return RTL; - default: - return new BlockMetadataTextDirection(Value.UNKNOWN, value); - } - } - - public enum Value { - LTR, - - RTL, - - UNKNOWN - } - - public interface Visitor { - T visitLtr(); - - T visitRtl(); - - T visitUnknown(String unknownType); - } -} diff --git a/src/main/java/ai/extend/types/ClassificationMetric.java b/src/main/java/ai/extend/types/ClassificationMetric.java new file mode 100644 index 0000000..47a4804 --- /dev/null +++ b/src/main/java/ai/extend/types/ClassificationMetric.java @@ -0,0 +1,255 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package ai.extend.types; + +import ai.extend.core.ObjectMappers; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ClassificationMetric.Builder.class) +public final class ClassificationMetric { + private final Optional countExpected; + + private final Optional countPredicted; + + private final Optional countCorrect; + + private final Optional precision; + + private final Optional recall; + + private final Optional f1; + + private final Map additionalProperties; + + private ClassificationMetric( + Optional countExpected, + Optional countPredicted, + Optional countCorrect, + Optional precision, + Optional recall, + Optional f1, + Map additionalProperties) { + this.countExpected = countExpected; + this.countPredicted = countPredicted; + this.countCorrect = countCorrect; + this.precision = precision; + this.recall = recall; + this.f1 = f1; + this.additionalProperties = additionalProperties; + } + + /** + * @return The number of files whose expected classification was this class. + */ + @JsonProperty("countExpected") + public Optional getCountExpected() { + return countExpected; + } + + /** + * @return The number of files the model classified as this class. + */ + @JsonProperty("countPredicted") + public Optional getCountPredicted() { + return countPredicted; + } + + /** + * @return The number of files correctly classified as this class. + */ + @JsonProperty("countCorrect") + public Optional getCountCorrect() { + return countCorrect; + } + + /** + * @return countCorrect / countPredicted for this class. + */ + @JsonProperty("precision") + public Optional getPrecision() { + return precision; + } + + /** + * @return countCorrect / countExpected for this class. + */ + @JsonProperty("recall") + public Optional getRecall() { + return recall; + } + + /** + * @return Harmonic mean of precision and recall. + */ + @JsonProperty("f1") + public Optional getF1() { + return f1; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ClassificationMetric && equalTo((ClassificationMetric) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ClassificationMetric other) { + return countExpected.equals(other.countExpected) + && countPredicted.equals(other.countPredicted) + && countCorrect.equals(other.countCorrect) + && precision.equals(other.precision) + && recall.equals(other.recall) + && f1.equals(other.f1); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.countExpected, this.countPredicted, this.countCorrect, this.precision, this.recall, this.f1); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional countExpected = Optional.empty(); + + private Optional countPredicted = Optional.empty(); + + private Optional countCorrect = Optional.empty(); + + private Optional precision = Optional.empty(); + + private Optional recall = Optional.empty(); + + private Optional f1 = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(ClassificationMetric other) { + countExpected(other.getCountExpected()); + countPredicted(other.getCountPredicted()); + countCorrect(other.getCountCorrect()); + precision(other.getPrecision()); + recall(other.getRecall()); + f1(other.getF1()); + return this; + } + + /** + *

The number of files whose expected classification was this class.

+ */ + @JsonSetter(value = "countExpected", nulls = Nulls.SKIP) + public Builder countExpected(Optional countExpected) { + this.countExpected = countExpected; + return this; + } + + public Builder countExpected(Double countExpected) { + this.countExpected = Optional.ofNullable(countExpected); + return this; + } + + /** + *

The number of files the model classified as this class.

+ */ + @JsonSetter(value = "countPredicted", nulls = Nulls.SKIP) + public Builder countPredicted(Optional countPredicted) { + this.countPredicted = countPredicted; + return this; + } + + public Builder countPredicted(Double countPredicted) { + this.countPredicted = Optional.ofNullable(countPredicted); + return this; + } + + /** + *

The number of files correctly classified as this class.

+ */ + @JsonSetter(value = "countCorrect", nulls = Nulls.SKIP) + public Builder countCorrect(Optional countCorrect) { + this.countCorrect = countCorrect; + return this; + } + + public Builder countCorrect(Double countCorrect) { + this.countCorrect = Optional.ofNullable(countCorrect); + return this; + } + + /** + *

countCorrect / countPredicted for this class.

+ */ + @JsonSetter(value = "precision", nulls = Nulls.SKIP) + public Builder precision(Optional precision) { + this.precision = precision; + return this; + } + + public Builder precision(Double precision) { + this.precision = Optional.ofNullable(precision); + return this; + } + + /** + *

countCorrect / countExpected for this class.

+ */ + @JsonSetter(value = "recall", nulls = Nulls.SKIP) + public Builder recall(Optional recall) { + this.recall = recall; + return this; + } + + public Builder recall(Double recall) { + this.recall = Optional.ofNullable(recall); + return this; + } + + /** + *

Harmonic mean of precision and recall.

+ */ + @JsonSetter(value = "f1", nulls = Nulls.SKIP) + public Builder f1(Optional f1) { + this.f1 = f1; + return this; + } + + public Builder f1(Double f1) { + this.f1 = Optional.ofNullable(f1); + return this; + } + + public ClassificationMetric build() { + return new ClassificationMetric( + countExpected, countPredicted, countCorrect, precision, recall, f1, additionalProperties); + } + } +} diff --git a/src/main/java/ai/extend/types/ClassifierVersion.java b/src/main/java/ai/extend/types/ClassifierVersion.java index 2cd3df0..174fb90 100644 --- a/src/main/java/ai/extend/types/ClassifierVersion.java +++ b/src/main/java/ai/extend/types/ClassifierVersion.java @@ -37,6 +37,8 @@ public final class ClassifierVersion { private final OffsetDateTime createdAt; + private final Optional createdBy; + private final Map additionalProperties; private ClassifierVersion( @@ -46,6 +48,7 @@ private ClassifierVersion( ClassifyConfig config, String classifierId, OffsetDateTime createdAt, + Optional createdBy, Map additionalProperties) { this.id = id; this.description = description; @@ -53,6 +56,7 @@ private ClassifierVersion( this.config = config; this.classifierId = classifierId; this.createdAt = createdAt; + this.createdBy = createdBy; this.additionalProperties = additionalProperties; } @@ -116,12 +120,26 @@ public OffsetDateTime getCreatedAt() { return createdAt; } + @JsonIgnore + public Optional getCreatedBy() { + if (createdBy == null) { + return Optional.empty(); + } + return createdBy; + } + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) @JsonProperty("description") private Optional _getDescription() { return description; } + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("createdBy") + private Optional _getCreatedBy() { + return createdBy; + } + @java.lang.Override public boolean equals(Object other) { if (this == other) return true; @@ -139,12 +157,20 @@ private boolean equalTo(ClassifierVersion other) { && version.equals(other.version) && config.equals(other.config) && classifierId.equals(other.classifierId) - && createdAt.equals(other.createdAt); + && createdAt.equals(other.createdAt) + && createdBy.equals(other.createdBy); } @java.lang.Override public int hashCode() { - return Objects.hash(this.id, this.description, this.version, this.config, this.classifierId, this.createdAt); + return Objects.hash( + this.id, + this.description, + this.version, + this.config, + this.classifierId, + this.createdAt, + this.createdBy); } @java.lang.Override @@ -205,6 +231,12 @@ public interface _FinalStage { _FinalStage description(String description); _FinalStage description(Nullable description); + + _FinalStage createdBy(Optional createdBy); + + _FinalStage createdBy(CreatedBy createdBy); + + _FinalStage createdBy(Nullable createdBy); } @JsonIgnoreProperties(ignoreUnknown = true) @@ -220,6 +252,8 @@ public static final class Builder private OffsetDateTime createdAt; + private Optional createdBy = Optional.empty(); + private Optional description = Optional.empty(); @JsonAnySetter @@ -235,6 +269,7 @@ public Builder from(ClassifierVersion other) { config(other.getConfig()); classifierId(other.getClassifierId()); createdAt(other.getCreatedAt()); + createdBy(other.getCreatedBy()); return this; } @@ -299,6 +334,31 @@ public _FinalStage createdAt(@NotNull OffsetDateTime createdAt) { return this; } + @java.lang.Override + public _FinalStage createdBy(Nullable createdBy) { + if (createdBy.isNull()) { + this.createdBy = null; + } else if (createdBy.isEmpty()) { + this.createdBy = Optional.empty(); + } else { + this.createdBy = Optional.of(createdBy.get()); + } + return this; + } + + @java.lang.Override + public _FinalStage createdBy(CreatedBy createdBy) { + this.createdBy = Optional.ofNullable(createdBy); + return this; + } + + @java.lang.Override + @JsonSetter(value = "createdBy", nulls = Nulls.SKIP) + public _FinalStage createdBy(Optional createdBy) { + this.createdBy = createdBy; + return this; + } + /** *

A description of this version of the classifier.

*

Example: "Added new document types for Q4 processing"

@@ -341,7 +401,7 @@ public _FinalStage description(Optional description) { @java.lang.Override public ClassifierVersion build() { return new ClassifierVersion( - id, description, version, config, classifierId, createdAt, additionalProperties); + id, description, version, config, classifierId, createdAt, createdBy, additionalProperties); } } } diff --git a/src/main/java/ai/extend/types/ClassifierVersionSummary.java b/src/main/java/ai/extend/types/ClassifierVersionSummary.java index f2e3444..ee1c2dc 100644 --- a/src/main/java/ai/extend/types/ClassifierVersionSummary.java +++ b/src/main/java/ai/extend/types/ClassifierVersionSummary.java @@ -35,6 +35,8 @@ public final class ClassifierVersionSummary { private final OffsetDateTime createdAt; + private final Optional createdBy; + private final Map additionalProperties; private ClassifierVersionSummary( @@ -43,12 +45,14 @@ private ClassifierVersionSummary( String version, String classifierId, OffsetDateTime createdAt, + Optional createdBy, Map additionalProperties) { this.id = id; this.description = description; this.version = version; this.classifierId = classifierId; this.createdAt = createdAt; + this.createdBy = createdBy; this.additionalProperties = additionalProperties; } @@ -104,12 +108,26 @@ public OffsetDateTime getCreatedAt() { return createdAt; } + @JsonIgnore + public Optional getCreatedBy() { + if (createdBy == null) { + return Optional.empty(); + } + return createdBy; + } + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) @JsonProperty("description") private Optional _getDescription() { return description; } + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("createdBy") + private Optional _getCreatedBy() { + return createdBy; + } + @java.lang.Override public boolean equals(Object other) { if (this == other) return true; @@ -126,12 +144,13 @@ private boolean equalTo(ClassifierVersionSummary other) { && description.equals(other.description) && version.equals(other.version) && classifierId.equals(other.classifierId) - && createdAt.equals(other.createdAt); + && createdAt.equals(other.createdAt) + && createdBy.equals(other.createdBy); } @java.lang.Override public int hashCode() { - return Objects.hash(this.id, this.description, this.version, this.classifierId, this.createdAt); + return Objects.hash(this.id, this.description, this.version, this.classifierId, this.createdAt, this.createdBy); } @java.lang.Override @@ -185,6 +204,12 @@ public interface _FinalStage { _FinalStage description(String description); _FinalStage description(Nullable description); + + _FinalStage createdBy(Optional createdBy); + + _FinalStage createdBy(CreatedBy createdBy); + + _FinalStage createdBy(Nullable createdBy); } @JsonIgnoreProperties(ignoreUnknown = true) @@ -197,6 +222,8 @@ public static final class Builder implements IdStage, VersionStage, ClassifierId private OffsetDateTime createdAt; + private Optional createdBy = Optional.empty(); + private Optional description = Optional.empty(); @JsonAnySetter @@ -211,6 +238,7 @@ public Builder from(ClassifierVersionSummary other) { version(other.getVersion()); classifierId(other.getClassifierId()); createdAt(other.getCreatedAt()); + createdBy(other.getCreatedBy()); return this; } @@ -263,6 +291,31 @@ public _FinalStage createdAt(@NotNull OffsetDateTime createdAt) { return this; } + @java.lang.Override + public _FinalStage createdBy(Nullable createdBy) { + if (createdBy.isNull()) { + this.createdBy = null; + } else if (createdBy.isEmpty()) { + this.createdBy = Optional.empty(); + } else { + this.createdBy = Optional.of(createdBy.get()); + } + return this; + } + + @java.lang.Override + public _FinalStage createdBy(CreatedBy createdBy) { + this.createdBy = Optional.ofNullable(createdBy); + return this; + } + + @java.lang.Override + @JsonSetter(value = "createdBy", nulls = Nulls.SKIP) + public _FinalStage createdBy(Optional createdBy) { + this.createdBy = createdBy; + return this; + } + /** *

A description of this version of the classifier.

*

Example: "Added new document types for Q4 processing"

@@ -305,7 +358,7 @@ public _FinalStage description(Optional description) { @java.lang.Override public ClassifierVersionSummary build() { return new ClassifierVersionSummary( - id, description, version, classifierId, createdAt, additionalProperties); + id, description, version, classifierId, createdAt, createdBy, additionalProperties); } } } diff --git a/src/main/java/ai/extend/types/ClassifyEvaluationSetRunMetrics.java b/src/main/java/ai/extend/types/ClassifyEvaluationSetRunMetrics.java new file mode 100644 index 0000000..64ad018 --- /dev/null +++ b/src/main/java/ai/extend/types/ClassifyEvaluationSetRunMetrics.java @@ -0,0 +1,435 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package ai.extend.types; + +import ai.extend.core.ObjectMappers; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ClassifyEvaluationSetRunMetrics.Builder.class) +public final class ClassifyEvaluationSetRunMetrics implements IEvaluationSetRunMetricsBase { + private final Optional numFilesTotal; + + private final Optional numFilesProcessed; + + private final Optional numFiles; + + private final Optional numPages; + + private final Optional meanLatencyMs; + + private final Optional p50LatencyMs; + + private final Optional p90LatencyMs; + + private final Optional p95LatencyMs; + + private final Optional p99LatencyMs; + + private final Optional accuracy; + + private final Optional> classificationMetrics; + + private final Map additionalProperties; + + private ClassifyEvaluationSetRunMetrics( + Optional numFilesTotal, + Optional numFilesProcessed, + Optional numFiles, + Optional numPages, + Optional meanLatencyMs, + Optional p50LatencyMs, + Optional p90LatencyMs, + Optional p95LatencyMs, + Optional p99LatencyMs, + Optional accuracy, + Optional> classificationMetrics, + Map additionalProperties) { + this.numFilesTotal = numFilesTotal; + this.numFilesProcessed = numFilesProcessed; + this.numFiles = numFiles; + this.numPages = numPages; + this.meanLatencyMs = meanLatencyMs; + this.p50LatencyMs = p50LatencyMs; + this.p90LatencyMs = p90LatencyMs; + this.p95LatencyMs = p95LatencyMs; + this.p99LatencyMs = p99LatencyMs; + this.accuracy = accuracy; + this.classificationMetrics = classificationMetrics; + this.additionalProperties = additionalProperties; + } + + /** + * @return The total number of files that will be processed in this evaluation set run. + */ + @JsonProperty("numFilesTotal") + @java.lang.Override + public Optional getNumFilesTotal() { + return numFilesTotal; + } + + /** + * @return The number of files that have finished processing. + */ + @JsonProperty("numFilesProcessed") + @java.lang.Override + public Optional getNumFilesProcessed() { + return numFilesProcessed; + } + + /** + * @return Deprecated. Use numFilesProcessed instead. + */ + @JsonProperty("numFiles") + @java.lang.Override + public Optional getNumFiles() { + return numFiles; + } + + /** + * @return The total number of pages processed across the completed files. + */ + @JsonProperty("numPages") + @java.lang.Override + public Optional getNumPages() { + return numPages; + } + + /** + * @return Mean per-file latency in milliseconds. + */ + @JsonProperty("meanLatencyMs") + @java.lang.Override + public Optional getMeanLatencyMs() { + return meanLatencyMs; + } + + /** + * @return 50th percentile per-file latency in milliseconds. + */ + @JsonProperty("p50LatencyMs") + @java.lang.Override + public Optional getP50LatencyMs() { + return p50LatencyMs; + } + + /** + * @return 90th percentile per-file latency in milliseconds. + */ + @JsonProperty("p90LatencyMs") + @java.lang.Override + public Optional getP90LatencyMs() { + return p90LatencyMs; + } + + /** + * @return 95th percentile per-file latency in milliseconds. + */ + @JsonProperty("p95LatencyMs") + @java.lang.Override + public Optional getP95LatencyMs() { + return p95LatencyMs; + } + + /** + * @return 99th percentile per-file latency in milliseconds. + */ + @JsonProperty("p99LatencyMs") + @java.lang.Override + public Optional getP99LatencyMs() { + return p99LatencyMs; + } + + /** + * @return Overall accuracy across the evaluation set, computed as the share of files whose predicted class matched the expected class. + */ + @JsonProperty("accuracy") + public Optional getAccuracy() { + return accuracy; + } + + /** + * @return Per-class precision, recall, and F1. Keys are the classifier's classification types as defined in the classifier configuration. + */ + @JsonProperty("classificationMetrics") + public Optional> getClassificationMetrics() { + return classificationMetrics; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ClassifyEvaluationSetRunMetrics && equalTo((ClassifyEvaluationSetRunMetrics) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ClassifyEvaluationSetRunMetrics other) { + return numFilesTotal.equals(other.numFilesTotal) + && numFilesProcessed.equals(other.numFilesProcessed) + && numFiles.equals(other.numFiles) + && numPages.equals(other.numPages) + && meanLatencyMs.equals(other.meanLatencyMs) + && p50LatencyMs.equals(other.p50LatencyMs) + && p90LatencyMs.equals(other.p90LatencyMs) + && p95LatencyMs.equals(other.p95LatencyMs) + && p99LatencyMs.equals(other.p99LatencyMs) + && accuracy.equals(other.accuracy) + && classificationMetrics.equals(other.classificationMetrics); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.numFilesTotal, + this.numFilesProcessed, + this.numFiles, + this.numPages, + this.meanLatencyMs, + this.p50LatencyMs, + this.p90LatencyMs, + this.p95LatencyMs, + this.p99LatencyMs, + this.accuracy, + this.classificationMetrics); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional numFilesTotal = Optional.empty(); + + private Optional numFilesProcessed = Optional.empty(); + + private Optional numFiles = Optional.empty(); + + private Optional numPages = Optional.empty(); + + private Optional meanLatencyMs = Optional.empty(); + + private Optional p50LatencyMs = Optional.empty(); + + private Optional p90LatencyMs = Optional.empty(); + + private Optional p95LatencyMs = Optional.empty(); + + private Optional p99LatencyMs = Optional.empty(); + + private Optional accuracy = Optional.empty(); + + private Optional> classificationMetrics = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(ClassifyEvaluationSetRunMetrics other) { + numFilesTotal(other.getNumFilesTotal()); + numFilesProcessed(other.getNumFilesProcessed()); + numFiles(other.getNumFiles()); + numPages(other.getNumPages()); + meanLatencyMs(other.getMeanLatencyMs()); + p50LatencyMs(other.getP50LatencyMs()); + p90LatencyMs(other.getP90LatencyMs()); + p95LatencyMs(other.getP95LatencyMs()); + p99LatencyMs(other.getP99LatencyMs()); + accuracy(other.getAccuracy()); + classificationMetrics(other.getClassificationMetrics()); + return this; + } + + /** + *

The total number of files that will be processed in this evaluation set run.

+ */ + @JsonSetter(value = "numFilesTotal", nulls = Nulls.SKIP) + public Builder numFilesTotal(Optional numFilesTotal) { + this.numFilesTotal = numFilesTotal; + return this; + } + + public Builder numFilesTotal(Double numFilesTotal) { + this.numFilesTotal = Optional.ofNullable(numFilesTotal); + return this; + } + + /** + *

The number of files that have finished processing.

+ */ + @JsonSetter(value = "numFilesProcessed", nulls = Nulls.SKIP) + public Builder numFilesProcessed(Optional numFilesProcessed) { + this.numFilesProcessed = numFilesProcessed; + return this; + } + + public Builder numFilesProcessed(Double numFilesProcessed) { + this.numFilesProcessed = Optional.ofNullable(numFilesProcessed); + return this; + } + + /** + *

Deprecated. Use numFilesProcessed instead.

+ */ + @JsonSetter(value = "numFiles", nulls = Nulls.SKIP) + public Builder numFiles(Optional numFiles) { + this.numFiles = numFiles; + return this; + } + + public Builder numFiles(Double numFiles) { + this.numFiles = Optional.ofNullable(numFiles); + return this; + } + + /** + *

The total number of pages processed across the completed files.

+ */ + @JsonSetter(value = "numPages", nulls = Nulls.SKIP) + public Builder numPages(Optional numPages) { + this.numPages = numPages; + return this; + } + + public Builder numPages(Double numPages) { + this.numPages = Optional.ofNullable(numPages); + return this; + } + + /** + *

Mean per-file latency in milliseconds.

+ */ + @JsonSetter(value = "meanLatencyMs", nulls = Nulls.SKIP) + public Builder meanLatencyMs(Optional meanLatencyMs) { + this.meanLatencyMs = meanLatencyMs; + return this; + } + + public Builder meanLatencyMs(Double meanLatencyMs) { + this.meanLatencyMs = Optional.ofNullable(meanLatencyMs); + return this; + } + + /** + *

50th percentile per-file latency in milliseconds.

+ */ + @JsonSetter(value = "p50LatencyMs", nulls = Nulls.SKIP) + public Builder p50LatencyMs(Optional p50LatencyMs) { + this.p50LatencyMs = p50LatencyMs; + return this; + } + + public Builder p50LatencyMs(Double p50LatencyMs) { + this.p50LatencyMs = Optional.ofNullable(p50LatencyMs); + return this; + } + + /** + *

90th percentile per-file latency in milliseconds.

+ */ + @JsonSetter(value = "p90LatencyMs", nulls = Nulls.SKIP) + public Builder p90LatencyMs(Optional p90LatencyMs) { + this.p90LatencyMs = p90LatencyMs; + return this; + } + + public Builder p90LatencyMs(Double p90LatencyMs) { + this.p90LatencyMs = Optional.ofNullable(p90LatencyMs); + return this; + } + + /** + *

95th percentile per-file latency in milliseconds.

+ */ + @JsonSetter(value = "p95LatencyMs", nulls = Nulls.SKIP) + public Builder p95LatencyMs(Optional p95LatencyMs) { + this.p95LatencyMs = p95LatencyMs; + return this; + } + + public Builder p95LatencyMs(Double p95LatencyMs) { + this.p95LatencyMs = Optional.ofNullable(p95LatencyMs); + return this; + } + + /** + *

99th percentile per-file latency in milliseconds.

+ */ + @JsonSetter(value = "p99LatencyMs", nulls = Nulls.SKIP) + public Builder p99LatencyMs(Optional p99LatencyMs) { + this.p99LatencyMs = p99LatencyMs; + return this; + } + + public Builder p99LatencyMs(Double p99LatencyMs) { + this.p99LatencyMs = Optional.ofNullable(p99LatencyMs); + return this; + } + + /** + *

Overall accuracy across the evaluation set, computed as the share of files whose predicted class matched the expected class.

+ */ + @JsonSetter(value = "accuracy", nulls = Nulls.SKIP) + public Builder accuracy(Optional accuracy) { + this.accuracy = accuracy; + return this; + } + + public Builder accuracy(Double accuracy) { + this.accuracy = Optional.ofNullable(accuracy); + return this; + } + + /** + *

Per-class precision, recall, and F1. Keys are the classifier's classification types as defined in the classifier configuration.

+ */ + @JsonSetter(value = "classificationMetrics", nulls = Nulls.SKIP) + public Builder classificationMetrics(Optional> classificationMetrics) { + this.classificationMetrics = classificationMetrics; + return this; + } + + public Builder classificationMetrics(Map classificationMetrics) { + this.classificationMetrics = Optional.ofNullable(classificationMetrics); + return this; + } + + public ClassifyEvaluationSetRunMetrics build() { + return new ClassifyEvaluationSetRunMetrics( + numFilesTotal, + numFilesProcessed, + numFiles, + numPages, + meanLatencyMs, + p50LatencyMs, + p90LatencyMs, + p95LatencyMs, + p99LatencyMs, + accuracy, + classificationMetrics, + additionalProperties); + } + } +} diff --git a/src/main/java/ai/extend/types/CreatedBy.java b/src/main/java/ai/extend/types/CreatedBy.java new file mode 100644 index 0000000..bd8e54d --- /dev/null +++ b/src/main/java/ai/extend/types/CreatedBy.java @@ -0,0 +1,203 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package ai.extend.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonUnwrapped; +import com.fasterxml.jackson.annotation.JsonValue; +import java.util.Objects; +import java.util.Optional; + +public final class CreatedBy { + private final Value value; + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + private CreatedBy(Value value) { + this.value = value; + } + + public T visit(Visitor visitor) { + return value.visit(visitor); + } + + public static CreatedBy user(CreatedByUser value) { + return new CreatedBy(new UserValue(value)); + } + + public static CreatedBy apiKey(CreatedByApiKey value) { + return new CreatedBy(new ApiKeyValue(value)); + } + + public boolean isUser() { + return value instanceof UserValue; + } + + public boolean isApiKey() { + return value instanceof ApiKeyValue; + } + + public boolean _isUnknown() { + return value instanceof _UnknownValue; + } + + public Optional getUser() { + if (isUser()) { + return Optional.of(((UserValue) value).value); + } + return Optional.empty(); + } + + public Optional getApiKey() { + if (isApiKey()) { + return Optional.of(((ApiKeyValue) value).value); + } + return Optional.empty(); + } + + public Optional _getUnknown() { + if (_isUnknown()) { + return Optional.of(((_UnknownValue) value).value); + } + return Optional.empty(); + } + + @JsonValue + private Value getValue() { + return this.value; + } + + public interface Visitor { + T visitUser(CreatedByUser user); + + T visitApiKey(CreatedByApiKey apiKey); + + T _visitUnknown(Object unknownType); + } + + @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, property = "type", visible = true, defaultImpl = _UnknownValue.class) + @JsonSubTypes({@JsonSubTypes.Type(UserValue.class), @JsonSubTypes.Type(ApiKeyValue.class)}) + @JsonIgnoreProperties(ignoreUnknown = true) + private interface Value { + T visit(Visitor visitor); + } + + @JsonTypeName("user") + @JsonIgnoreProperties("type") + private static final class UserValue implements Value { + @JsonUnwrapped + private CreatedByUser value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private UserValue() {} + + private UserValue(CreatedByUser value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitUser(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof UserValue && equalTo((UserValue) other); + } + + private boolean equalTo(UserValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "CreatedBy{" + "value: " + value + "}"; + } + } + + @JsonTypeName("api_key") + @JsonIgnoreProperties("type") + private static final class ApiKeyValue implements Value { + @JsonUnwrapped + private CreatedByApiKey value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private ApiKeyValue() {} + + private ApiKeyValue(CreatedByApiKey value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitApiKey(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ApiKeyValue && equalTo((ApiKeyValue) other); + } + + private boolean equalTo(ApiKeyValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "CreatedBy{" + "value: " + value + "}"; + } + } + + @JsonIgnoreProperties("type") + private static final class _UnknownValue implements Value { + private String type; + + @JsonValue + private Object value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private _UnknownValue(@JsonProperty("value") Object value) {} + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor._visitUnknown(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof _UnknownValue && equalTo((_UnknownValue) other); + } + + private boolean equalTo(_UnknownValue other) { + return type.equals(other.type) && value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.type, this.value); + } + + @java.lang.Override + public String toString() { + return "CreatedBy{" + "type: " + type + ", value: " + value + "}"; + } + } +} diff --git a/src/main/java/ai/extend/types/CreatedByApiKey.java b/src/main/java/ai/extend/types/CreatedByApiKey.java new file mode 100644 index 0000000..942bd49 --- /dev/null +++ b/src/main/java/ai/extend/types/CreatedByApiKey.java @@ -0,0 +1,113 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package ai.extend.types; + +import ai.extend.core.ObjectMappers; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CreatedByApiKey.Builder.class) +public final class CreatedByApiKey { + private final String name; + + private final Map additionalProperties; + + private CreatedByApiKey(String name, Map additionalProperties) { + this.name = name; + this.additionalProperties = additionalProperties; + } + + /** + * @return The name of the API key that created the resource. + */ + @JsonProperty("name") + public String getName() { + return name; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CreatedByApiKey && equalTo((CreatedByApiKey) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CreatedByApiKey other) { + return name.equals(other.name); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.name); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static NameStage builder() { + return new Builder(); + } + + public interface NameStage { + /** + *

The name of the API key that created the resource.

+ */ + _FinalStage name(@NotNull String name); + + Builder from(CreatedByApiKey other); + } + + public interface _FinalStage { + CreatedByApiKey build(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements NameStage, _FinalStage { + private String name; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(CreatedByApiKey other) { + name(other.getName()); + return this; + } + + /** + *

The name of the API key that created the resource.

+ *

The name of the API key that created the resource.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("name") + public _FinalStage name(@NotNull String name) { + this.name = Objects.requireNonNull(name, "name must not be null"); + return this; + } + + @java.lang.Override + public CreatedByApiKey build() { + return new CreatedByApiKey(name, additionalProperties); + } + } +} diff --git a/src/main/java/ai/extend/types/CreatedByUser.java b/src/main/java/ai/extend/types/CreatedByUser.java new file mode 100644 index 0000000..67c29bd --- /dev/null +++ b/src/main/java/ai/extend/types/CreatedByUser.java @@ -0,0 +1,113 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package ai.extend.types; + +import ai.extend.core.ObjectMappers; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CreatedByUser.Builder.class) +public final class CreatedByUser { + private final String email; + + private final Map additionalProperties; + + private CreatedByUser(String email, Map additionalProperties) { + this.email = email; + this.additionalProperties = additionalProperties; + } + + /** + * @return The email address of the user who created the resource. + */ + @JsonProperty("email") + public String getEmail() { + return email; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CreatedByUser && equalTo((CreatedByUser) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CreatedByUser other) { + return email.equals(other.email); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.email); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static EmailStage builder() { + return new Builder(); + } + + public interface EmailStage { + /** + *

The email address of the user who created the resource.

+ */ + _FinalStage email(@NotNull String email); + + Builder from(CreatedByUser other); + } + + public interface _FinalStage { + CreatedByUser build(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements EmailStage, _FinalStage { + private String email; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(CreatedByUser other) { + email(other.getEmail()); + return this; + } + + /** + *

The email address of the user who created the resource.

+ *

The email address of the user who created the resource.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("email") + public _FinalStage email(@NotNull String email) { + this.email = Objects.requireNonNull(email, "email must not be null"); + return this; + } + + @java.lang.Override + public CreatedByUser build() { + return new CreatedByUser(email, additionalProperties); + } + } +} diff --git a/src/main/java/ai/extend/types/EvaluationSet.java b/src/main/java/ai/extend/types/EvaluationSet.java index a265054..0d3159a 100644 --- a/src/main/java/ai/extend/types/EvaluationSet.java +++ b/src/main/java/ai/extend/types/EvaluationSet.java @@ -3,18 +3,23 @@ */ package ai.extend.types; +import ai.extend.core.Nullable; +import ai.extend.core.NullableNonemptyFilter; import ai.extend.core.ObjectMappers; import com.fasterxml.jackson.annotation.JsonAnyGetter; import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; import java.time.OffsetDateTime; import java.util.HashMap; import java.util.Map; import java.util.Objects; +import java.util.Optional; import org.jetbrains.annotations.NotNull; @JsonInclude(JsonInclude.Include.NON_ABSENT) @@ -32,6 +37,8 @@ public final class EvaluationSet { private final OffsetDateTime updatedAt; + private final Optional createdBy; + private final Map additionalProperties; private EvaluationSet( @@ -41,6 +48,7 @@ private EvaluationSet( EvaluationSetEntity entity, OffsetDateTime createdAt, OffsetDateTime updatedAt, + Optional createdBy, Map additionalProperties) { this.id = id; this.name = name; @@ -48,6 +56,7 @@ private EvaluationSet( this.entity = entity; this.createdAt = createdAt; this.updatedAt = updatedAt; + this.createdBy = createdBy; this.additionalProperties = additionalProperties; } @@ -104,6 +113,20 @@ public OffsetDateTime getUpdatedAt() { return updatedAt; } + @JsonIgnore + public Optional getCreatedBy() { + if (createdBy == null) { + return Optional.empty(); + } + return createdBy; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("createdBy") + private Optional _getCreatedBy() { + return createdBy; + } + @java.lang.Override public boolean equals(Object other) { if (this == other) return true; @@ -121,12 +144,14 @@ private boolean equalTo(EvaluationSet other) { && description.equals(other.description) && entity.equals(other.entity) && createdAt.equals(other.createdAt) - && updatedAt.equals(other.updatedAt); + && updatedAt.equals(other.updatedAt) + && createdBy.equals(other.createdBy); } @java.lang.Override public int hashCode() { - return Objects.hash(this.id, this.name, this.description, this.entity, this.createdAt, this.updatedAt); + return Objects.hash( + this.id, this.name, this.description, this.entity, this.createdAt, this.updatedAt, this.createdBy); } @java.lang.Override @@ -181,6 +206,12 @@ public interface UpdatedAtStage { public interface _FinalStage { EvaluationSet build(); + + _FinalStage createdBy(Optional createdBy); + + _FinalStage createdBy(CreatedBy createdBy); + + _FinalStage createdBy(Nullable createdBy); } @JsonIgnoreProperties(ignoreUnknown = true) @@ -198,6 +229,8 @@ public static final class Builder private OffsetDateTime updatedAt; + private Optional createdBy = Optional.empty(); + @JsonAnySetter private Map additionalProperties = new HashMap<>(); @@ -211,6 +244,7 @@ public Builder from(EvaluationSet other) { entity(other.getEntity()); createdAt(other.getCreatedAt()); updatedAt(other.getUpdatedAt()); + createdBy(other.getCreatedBy()); return this; } @@ -282,9 +316,35 @@ public _FinalStage updatedAt(@NotNull OffsetDateTime updatedAt) { return this; } + @java.lang.Override + public _FinalStage createdBy(Nullable createdBy) { + if (createdBy.isNull()) { + this.createdBy = null; + } else if (createdBy.isEmpty()) { + this.createdBy = Optional.empty(); + } else { + this.createdBy = Optional.of(createdBy.get()); + } + return this; + } + + @java.lang.Override + public _FinalStage createdBy(CreatedBy createdBy) { + this.createdBy = Optional.ofNullable(createdBy); + return this; + } + + @java.lang.Override + @JsonSetter(value = "createdBy", nulls = Nulls.SKIP) + public _FinalStage createdBy(Optional createdBy) { + this.createdBy = createdBy; + return this; + } + @java.lang.Override public EvaluationSet build() { - return new EvaluationSet(id, name, description, entity, createdAt, updatedAt, additionalProperties); + return new EvaluationSet( + id, name, description, entity, createdAt, updatedAt, createdBy, additionalProperties); } } } diff --git a/src/main/java/ai/extend/types/EvaluationSetItem.java b/src/main/java/ai/extend/types/EvaluationSetItem.java index 95a7785..d5724a7 100644 --- a/src/main/java/ai/extend/types/EvaluationSetItem.java +++ b/src/main/java/ai/extend/types/EvaluationSetItem.java @@ -3,17 +3,22 @@ */ package ai.extend.types; +import ai.extend.core.Nullable; +import ai.extend.core.NullableNonemptyFilter; import ai.extend.core.ObjectMappers; import com.fasterxml.jackson.annotation.JsonAnyGetter; import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; import java.util.HashMap; import java.util.Map; import java.util.Objects; +import java.util.Optional; import org.jetbrains.annotations.NotNull; @JsonInclude(JsonInclude.Include.NON_ABSENT) @@ -27,6 +32,8 @@ public final class EvaluationSetItem { private final ProvidedProcessorOutput expectedOutput; + private final Optional createdBy; + private final Map additionalProperties; private EvaluationSetItem( @@ -34,11 +41,13 @@ private EvaluationSetItem( String evaluationSetId, FileSummary file, ProvidedProcessorOutput expectedOutput, + Optional createdBy, Map additionalProperties) { this.id = id; this.evaluationSetId = evaluationSetId; this.file = file; this.expectedOutput = expectedOutput; + this.createdBy = createdBy; this.additionalProperties = additionalProperties; } @@ -84,6 +93,20 @@ public ProvidedProcessorOutput getExpectedOutput() { return expectedOutput; } + @JsonIgnore + public Optional getCreatedBy() { + if (createdBy == null) { + return Optional.empty(); + } + return createdBy; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("createdBy") + private Optional _getCreatedBy() { + return createdBy; + } + @java.lang.Override public boolean equals(Object other) { if (this == other) return true; @@ -99,12 +122,13 @@ private boolean equalTo(EvaluationSetItem other) { return id.equals(other.id) && evaluationSetId.equals(other.evaluationSetId) && file.equals(other.file) - && expectedOutput.equals(other.expectedOutput); + && expectedOutput.equals(other.expectedOutput) + && createdBy.equals(other.createdBy); } @java.lang.Override public int hashCode() { - return Objects.hash(this.id, this.evaluationSetId, this.file, this.expectedOutput); + return Objects.hash(this.id, this.evaluationSetId, this.file, this.expectedOutput, this.createdBy); } @java.lang.Override @@ -150,6 +174,12 @@ public interface ExpectedOutputStage { public interface _FinalStage { EvaluationSetItem build(); + + _FinalStage createdBy(Optional createdBy); + + _FinalStage createdBy(CreatedBy createdBy); + + _FinalStage createdBy(Nullable createdBy); } @JsonIgnoreProperties(ignoreUnknown = true) @@ -163,6 +193,8 @@ public static final class Builder private ProvidedProcessorOutput expectedOutput; + private Optional createdBy = Optional.empty(); + @JsonAnySetter private Map additionalProperties = new HashMap<>(); @@ -174,6 +206,7 @@ public Builder from(EvaluationSetItem other) { evaluationSetId(other.getEvaluationSetId()); file(other.getFile()); expectedOutput(other.getExpectedOutput()); + createdBy(other.getCreatedBy()); return this; } @@ -229,9 +262,34 @@ public _FinalStage expectedOutput(@NotNull ProvidedProcessorOutput expectedOutpu return this; } + @java.lang.Override + public _FinalStage createdBy(Nullable createdBy) { + if (createdBy.isNull()) { + this.createdBy = null; + } else if (createdBy.isEmpty()) { + this.createdBy = Optional.empty(); + } else { + this.createdBy = Optional.of(createdBy.get()); + } + return this; + } + + @java.lang.Override + public _FinalStage createdBy(CreatedBy createdBy) { + this.createdBy = Optional.ofNullable(createdBy); + return this; + } + + @java.lang.Override + @JsonSetter(value = "createdBy", nulls = Nulls.SKIP) + public _FinalStage createdBy(Optional createdBy) { + this.createdBy = createdBy; + return this; + } + @java.lang.Override public EvaluationSetItem build() { - return new EvaluationSetItem(id, evaluationSetId, file, expectedOutput, additionalProperties); + return new EvaluationSetItem(id, evaluationSetId, file, expectedOutput, createdBy, additionalProperties); } } } diff --git a/src/main/java/ai/extend/types/EvaluationSetItemSummary.java b/src/main/java/ai/extend/types/EvaluationSetItemSummary.java index 31d7179..f96c235 100644 --- a/src/main/java/ai/extend/types/EvaluationSetItemSummary.java +++ b/src/main/java/ai/extend/types/EvaluationSetItemSummary.java @@ -3,17 +3,22 @@ */ package ai.extend.types; +import ai.extend.core.Nullable; +import ai.extend.core.NullableNonemptyFilter; import ai.extend.core.ObjectMappers; import com.fasterxml.jackson.annotation.JsonAnyGetter; import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; import java.util.HashMap; import java.util.Map; import java.util.Objects; +import java.util.Optional; import org.jetbrains.annotations.NotNull; @JsonInclude(JsonInclude.Include.NON_ABSENT) @@ -23,11 +28,15 @@ public final class EvaluationSetItemSummary { private final FileSummary file; + private final Optional createdBy; + private final Map additionalProperties; - private EvaluationSetItemSummary(String id, FileSummary file, Map additionalProperties) { + private EvaluationSetItemSummary( + String id, FileSummary file, Optional createdBy, Map additionalProperties) { this.id = id; this.file = file; + this.createdBy = createdBy; this.additionalProperties = additionalProperties; } @@ -56,6 +65,20 @@ public FileSummary getFile() { return file; } + @JsonIgnore + public Optional getCreatedBy() { + if (createdBy == null) { + return Optional.empty(); + } + return createdBy; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("createdBy") + private Optional _getCreatedBy() { + return createdBy; + } + @java.lang.Override public boolean equals(Object other) { if (this == other) return true; @@ -68,12 +91,12 @@ public Map getAdditionalProperties() { } private boolean equalTo(EvaluationSetItemSummary other) { - return id.equals(other.id) && file.equals(other.file); + return id.equals(other.id) && file.equals(other.file) && createdBy.equals(other.createdBy); } @java.lang.Override public int hashCode() { - return Objects.hash(this.id, this.file); + return Objects.hash(this.id, this.file, this.createdBy); } @java.lang.Override @@ -104,6 +127,12 @@ public interface FileStage { public interface _FinalStage { EvaluationSetItemSummary build(); + + _FinalStage createdBy(Optional createdBy); + + _FinalStage createdBy(CreatedBy createdBy); + + _FinalStage createdBy(Nullable createdBy); } @JsonIgnoreProperties(ignoreUnknown = true) @@ -112,6 +141,8 @@ public static final class Builder implements IdStage, FileStage, _FinalStage { private FileSummary file; + private Optional createdBy = Optional.empty(); + @JsonAnySetter private Map additionalProperties = new HashMap<>(); @@ -121,6 +152,7 @@ private Builder() {} public Builder from(EvaluationSetItemSummary other) { id(other.getId()); file(other.getFile()); + createdBy(other.getCreatedBy()); return this; } @@ -150,9 +182,34 @@ public _FinalStage file(@NotNull FileSummary file) { return this; } + @java.lang.Override + public _FinalStage createdBy(Nullable createdBy) { + if (createdBy.isNull()) { + this.createdBy = null; + } else if (createdBy.isEmpty()) { + this.createdBy = Optional.empty(); + } else { + this.createdBy = Optional.of(createdBy.get()); + } + return this; + } + + @java.lang.Override + public _FinalStage createdBy(CreatedBy createdBy) { + this.createdBy = Optional.ofNullable(createdBy); + return this; + } + + @java.lang.Override + @JsonSetter(value = "createdBy", nulls = Nulls.SKIP) + public _FinalStage createdBy(Optional createdBy) { + this.createdBy = createdBy; + return this; + } + @java.lang.Override public EvaluationSetItemSummary build() { - return new EvaluationSetItemSummary(id, file, additionalProperties); + return new EvaluationSetItemSummary(id, file, createdBy, additionalProperties); } } } diff --git a/src/main/java/ai/extend/types/EvaluationSetRun.java b/src/main/java/ai/extend/types/EvaluationSetRun.java index 71f20c4..5c8d712 100644 --- a/src/main/java/ai/extend/types/EvaluationSetRun.java +++ b/src/main/java/ai/extend/types/EvaluationSetRun.java @@ -105,6 +105,9 @@ public EvaluationSetRunEntityVersion getEntityVersion() { return entityVersion; } + /** + * @return Metrics for the evaluation set run. The shape depends on the entity type. + */ @JsonProperty("metrics") public EvaluationSetRunMetrics getMetrics() { return metrics; @@ -212,6 +215,9 @@ public interface EntityVersionStage { } public interface MetricsStage { + /** + *

Metrics for the evaluation set run. The shape depends on the entity type.

+ */ StatusStage metrics(@NotNull EvaluationSetRunMetrics metrics); } @@ -339,6 +345,11 @@ public MetricsStage entityVersion(@NotNull EvaluationSetRunEntityVersion entityV return this; } + /** + *

Metrics for the evaluation set run. The shape depends on the entity type.

+ *

Metrics for the evaluation set run. The shape depends on the entity type.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ @java.lang.Override @JsonSetter("metrics") public StatusStage metrics(@NotNull EvaluationSetRunMetrics metrics) { diff --git a/src/main/java/ai/extend/types/EvaluationSetRunFieldMetric.java b/src/main/java/ai/extend/types/EvaluationSetRunFieldMetric.java new file mode 100644 index 0000000..faf382c --- /dev/null +++ b/src/main/java/ai/extend/types/EvaluationSetRunFieldMetric.java @@ -0,0 +1,224 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package ai.extend.types; + +import ai.extend.core.ObjectMappers; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = EvaluationSetRunFieldMetric.Builder.class) +public final class EvaluationSetRunFieldMetric { + private final Optional countTotal; + + private final Optional countPresent; + + private final Optional countExpected; + + private final Optional countAccurate; + + private final Optional accuracy; + + private final Map additionalProperties; + + private EvaluationSetRunFieldMetric( + Optional countTotal, + Optional countPresent, + Optional countExpected, + Optional countAccurate, + Optional accuracy, + Map additionalProperties) { + this.countTotal = countTotal; + this.countPresent = countPresent; + this.countExpected = countExpected; + this.countAccurate = countAccurate; + this.accuracy = accuracy; + this.additionalProperties = additionalProperties; + } + + /** + * @return The number of runs that included this field in the schema. + */ + @JsonProperty("countTotal") + public Optional getCountTotal() { + return countTotal; + } + + /** + * @return The number of runs where the model produced a non-null value for this field. + */ + @JsonProperty("countPresent") + public Optional getCountPresent() { + return countPresent; + } + + /** + * @return The number of runs where an expected value was provided. + */ + @JsonProperty("countExpected") + public Optional getCountExpected() { + return countExpected; + } + + /** + * @return The number of runs where the extracted value matched the expected value. + */ + @JsonProperty("countAccurate") + public Optional getCountAccurate() { + return countAccurate; + } + + /** + * @return Accuracy for this field, computed as countAccurate / countExpected. Omitted when countExpected is 0. + */ + @JsonProperty("accuracy") + public Optional getAccuracy() { + return accuracy; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof EvaluationSetRunFieldMetric && equalTo((EvaluationSetRunFieldMetric) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(EvaluationSetRunFieldMetric other) { + return countTotal.equals(other.countTotal) + && countPresent.equals(other.countPresent) + && countExpected.equals(other.countExpected) + && countAccurate.equals(other.countAccurate) + && accuracy.equals(other.accuracy); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.countTotal, this.countPresent, this.countExpected, this.countAccurate, this.accuracy); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional countTotal = Optional.empty(); + + private Optional countPresent = Optional.empty(); + + private Optional countExpected = Optional.empty(); + + private Optional countAccurate = Optional.empty(); + + private Optional accuracy = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(EvaluationSetRunFieldMetric other) { + countTotal(other.getCountTotal()); + countPresent(other.getCountPresent()); + countExpected(other.getCountExpected()); + countAccurate(other.getCountAccurate()); + accuracy(other.getAccuracy()); + return this; + } + + /** + *

The number of runs that included this field in the schema.

+ */ + @JsonSetter(value = "countTotal", nulls = Nulls.SKIP) + public Builder countTotal(Optional countTotal) { + this.countTotal = countTotal; + return this; + } + + public Builder countTotal(Double countTotal) { + this.countTotal = Optional.ofNullable(countTotal); + return this; + } + + /** + *

The number of runs where the model produced a non-null value for this field.

+ */ + @JsonSetter(value = "countPresent", nulls = Nulls.SKIP) + public Builder countPresent(Optional countPresent) { + this.countPresent = countPresent; + return this; + } + + public Builder countPresent(Double countPresent) { + this.countPresent = Optional.ofNullable(countPresent); + return this; + } + + /** + *

The number of runs where an expected value was provided.

+ */ + @JsonSetter(value = "countExpected", nulls = Nulls.SKIP) + public Builder countExpected(Optional countExpected) { + this.countExpected = countExpected; + return this; + } + + public Builder countExpected(Double countExpected) { + this.countExpected = Optional.ofNullable(countExpected); + return this; + } + + /** + *

The number of runs where the extracted value matched the expected value.

+ */ + @JsonSetter(value = "countAccurate", nulls = Nulls.SKIP) + public Builder countAccurate(Optional countAccurate) { + this.countAccurate = countAccurate; + return this; + } + + public Builder countAccurate(Double countAccurate) { + this.countAccurate = Optional.ofNullable(countAccurate); + return this; + } + + /** + *

Accuracy for this field, computed as countAccurate / countExpected. Omitted when countExpected is 0.

+ */ + @JsonSetter(value = "accuracy", nulls = Nulls.SKIP) + public Builder accuracy(Optional accuracy) { + this.accuracy = accuracy; + return this; + } + + public Builder accuracy(Double accuracy) { + this.accuracy = Optional.ofNullable(accuracy); + return this; + } + + public EvaluationSetRunFieldMetric build() { + return new EvaluationSetRunFieldMetric( + countTotal, countPresent, countExpected, countAccurate, accuracy, additionalProperties); + } + } +} diff --git a/src/main/java/ai/extend/types/EvaluationSetRunMetrics.java b/src/main/java/ai/extend/types/EvaluationSetRunMetrics.java index 09b541d..0825de2 100644 --- a/src/main/java/ai/extend/types/EvaluationSetRunMetrics.java +++ b/src/main/java/ai/extend/types/EvaluationSetRunMetrics.java @@ -3,128 +3,261 @@ */ package ai.extend.types; -import ai.extend.core.ObjectMappers; -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import java.util.HashMap; -import java.util.Map; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonUnwrapped; +import com.fasterxml.jackson.annotation.JsonValue; import java.util.Objects; import java.util.Optional; -@JsonInclude(JsonInclude.Include.NON_ABSENT) -@JsonDeserialize(builder = EvaluationSetRunMetrics.Builder.class) public final class EvaluationSetRunMetrics { - private final Optional numFiles; + private final Value value; - private final Optional numPages; + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + private EvaluationSetRunMetrics(Value value) { + this.value = value; + } + + public T visit(Visitor visitor) { + return value.visit(visitor); + } + + public static EvaluationSetRunMetrics extract(ExtractEvaluationSetRunMetrics value) { + return new EvaluationSetRunMetrics(new ExtractValue(value)); + } + + public static EvaluationSetRunMetrics classify(ClassifyEvaluationSetRunMetrics value) { + return new EvaluationSetRunMetrics(new ClassifyValue(value)); + } - private final Map additionalProperties; + public static EvaluationSetRunMetrics splitter(SplitterEvaluationSetRunMetrics value) { + return new EvaluationSetRunMetrics(new SplitterValue(value)); + } - private EvaluationSetRunMetrics( - Optional numFiles, Optional numPages, Map additionalProperties) { - this.numFiles = numFiles; - this.numPages = numPages; - this.additionalProperties = additionalProperties; + public boolean isExtract() { + return value instanceof ExtractValue; } - /** - * @return The total number of files processed in this evaluation set run - */ - @JsonProperty("numFiles") - public Optional getNumFiles() { - return numFiles; + public boolean isClassify() { + return value instanceof ClassifyValue; } - /** - * @return The total number of pages processed in this evaluation set run - */ - @JsonProperty("numPages") - public Optional getNumPages() { - return numPages; + public boolean isSplitter() { + return value instanceof SplitterValue; } - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof EvaluationSetRunMetrics && equalTo((EvaluationSetRunMetrics) other); + public boolean _isUnknown() { + return value instanceof _UnknownValue; } - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; + public Optional getExtract() { + if (isExtract()) { + return Optional.of(((ExtractValue) value).value); + } + return Optional.empty(); } - private boolean equalTo(EvaluationSetRunMetrics other) { - return numFiles.equals(other.numFiles) && numPages.equals(other.numPages); + public Optional getClassify() { + if (isClassify()) { + return Optional.of(((ClassifyValue) value).value); + } + return Optional.empty(); } - @java.lang.Override - public int hashCode() { - return Objects.hash(this.numFiles, this.numPages); + public Optional getSplitter() { + if (isSplitter()) { + return Optional.of(((SplitterValue) value).value); + } + return Optional.empty(); } - @java.lang.Override - public String toString() { - return ObjectMappers.stringify(this); + public Optional _getUnknown() { + if (_isUnknown()) { + return Optional.of(((_UnknownValue) value).value); + } + return Optional.empty(); } - public static Builder builder() { - return new Builder(); + @JsonValue + private Value getValue() { + return this.value; } + public interface Visitor { + T visitExtract(ExtractEvaluationSetRunMetrics extract); + + T visitClassify(ClassifyEvaluationSetRunMetrics classify); + + T visitSplitter(SplitterEvaluationSetRunMetrics splitter); + + T _visitUnknown(Object unknownType); + } + + @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, property = "type", visible = true, defaultImpl = _UnknownValue.class) + @JsonSubTypes({ + @JsonSubTypes.Type(ExtractValue.class), + @JsonSubTypes.Type(ClassifyValue.class), + @JsonSubTypes.Type(SplitterValue.class) + }) @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder { - private Optional numFiles = Optional.empty(); + private interface Value { + T visit(Visitor visitor); + } + + @JsonTypeName("EXTRACT") + @JsonIgnoreProperties("type") + private static final class ExtractValue implements Value { + @JsonUnwrapped + private ExtractEvaluationSetRunMetrics value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private ExtractValue() {} - private Optional numPages = Optional.empty(); + private ExtractValue(ExtractEvaluationSetRunMetrics value) { + this.value = value; + } - @JsonAnySetter - private Map additionalProperties = new HashMap<>(); + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitExtract(value); + } - private Builder() {} + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ExtractValue && equalTo((ExtractValue) other); + } - public Builder from(EvaluationSetRunMetrics other) { - numFiles(other.getNumFiles()); - numPages(other.getNumPages()); - return this; + private boolean equalTo(ExtractValue other) { + return value.equals(other.value); } - /** - *

The total number of files processed in this evaluation set run

- */ - @JsonSetter(value = "numFiles", nulls = Nulls.SKIP) - public Builder numFiles(Optional numFiles) { - this.numFiles = numFiles; - return this; + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "EvaluationSetRunMetrics{" + "value: " + value + "}"; + } + } + + @JsonTypeName("CLASSIFY") + @JsonIgnoreProperties("type") + private static final class ClassifyValue implements Value { + @JsonUnwrapped + private ClassifyEvaluationSetRunMetrics value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private ClassifyValue() {} + + private ClassifyValue(ClassifyEvaluationSetRunMetrics value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitClassify(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ClassifyValue && equalTo((ClassifyValue) other); + } + + private boolean equalTo(ClassifyValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "EvaluationSetRunMetrics{" + "value: " + value + "}"; + } + } + + @JsonTypeName("SPLITTER") + @JsonIgnoreProperties("type") + private static final class SplitterValue implements Value { + @JsonUnwrapped + private SplitterEvaluationSetRunMetrics value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private SplitterValue() {} + + private SplitterValue(SplitterEvaluationSetRunMetrics value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitSplitter(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof SplitterValue && equalTo((SplitterValue) other); + } + + private boolean equalTo(SplitterValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "EvaluationSetRunMetrics{" + "value: " + value + "}"; + } + } + + @JsonIgnoreProperties("type") + private static final class _UnknownValue implements Value { + private String type; + + @JsonValue + private Object value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private _UnknownValue(@JsonProperty("value") Object value) {} + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor._visitUnknown(value); } - public Builder numFiles(Double numFiles) { - this.numFiles = Optional.ofNullable(numFiles); - return this; + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof _UnknownValue && equalTo((_UnknownValue) other); } - /** - *

The total number of pages processed in this evaluation set run

- */ - @JsonSetter(value = "numPages", nulls = Nulls.SKIP) - public Builder numPages(Optional numPages) { - this.numPages = numPages; - return this; + private boolean equalTo(_UnknownValue other) { + return type.equals(other.type) && value.equals(other.value); } - public Builder numPages(Double numPages) { - this.numPages = Optional.ofNullable(numPages); - return this; + @java.lang.Override + public int hashCode() { + return Objects.hash(this.type, this.value); } - public EvaluationSetRunMetrics build() { - return new EvaluationSetRunMetrics(numFiles, numPages, additionalProperties); + @java.lang.Override + public String toString() { + return "EvaluationSetRunMetrics{" + "type: " + type + ", value: " + value + "}"; } } } diff --git a/src/main/java/ai/extend/types/EvaluationSetRunMetricsBase.java b/src/main/java/ai/extend/types/EvaluationSetRunMetricsBase.java new file mode 100644 index 0000000..c945923 --- /dev/null +++ b/src/main/java/ai/extend/types/EvaluationSetRunMetricsBase.java @@ -0,0 +1,371 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package ai.extend.types; + +import ai.extend.core.ObjectMappers; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = EvaluationSetRunMetricsBase.Builder.class) +public final class EvaluationSetRunMetricsBase implements IEvaluationSetRunMetricsBase { + private final Optional numFilesTotal; + + private final Optional numFilesProcessed; + + private final Optional numFiles; + + private final Optional numPages; + + private final Optional meanLatencyMs; + + private final Optional p50LatencyMs; + + private final Optional p90LatencyMs; + + private final Optional p95LatencyMs; + + private final Optional p99LatencyMs; + + private final Map additionalProperties; + + private EvaluationSetRunMetricsBase( + Optional numFilesTotal, + Optional numFilesProcessed, + Optional numFiles, + Optional numPages, + Optional meanLatencyMs, + Optional p50LatencyMs, + Optional p90LatencyMs, + Optional p95LatencyMs, + Optional p99LatencyMs, + Map additionalProperties) { + this.numFilesTotal = numFilesTotal; + this.numFilesProcessed = numFilesProcessed; + this.numFiles = numFiles; + this.numPages = numPages; + this.meanLatencyMs = meanLatencyMs; + this.p50LatencyMs = p50LatencyMs; + this.p90LatencyMs = p90LatencyMs; + this.p95LatencyMs = p95LatencyMs; + this.p99LatencyMs = p99LatencyMs; + this.additionalProperties = additionalProperties; + } + + /** + * @return The total number of files that will be processed in this evaluation set run. + */ + @JsonProperty("numFilesTotal") + @java.lang.Override + public Optional getNumFilesTotal() { + return numFilesTotal; + } + + /** + * @return The number of files that have finished processing. + */ + @JsonProperty("numFilesProcessed") + @java.lang.Override + public Optional getNumFilesProcessed() { + return numFilesProcessed; + } + + /** + * @return Deprecated. Use numFilesProcessed instead. + */ + @JsonProperty("numFiles") + @java.lang.Override + public Optional getNumFiles() { + return numFiles; + } + + /** + * @return The total number of pages processed across the completed files. + */ + @JsonProperty("numPages") + @java.lang.Override + public Optional getNumPages() { + return numPages; + } + + /** + * @return Mean per-file latency in milliseconds. + */ + @JsonProperty("meanLatencyMs") + @java.lang.Override + public Optional getMeanLatencyMs() { + return meanLatencyMs; + } + + /** + * @return 50th percentile per-file latency in milliseconds. + */ + @JsonProperty("p50LatencyMs") + @java.lang.Override + public Optional getP50LatencyMs() { + return p50LatencyMs; + } + + /** + * @return 90th percentile per-file latency in milliseconds. + */ + @JsonProperty("p90LatencyMs") + @java.lang.Override + public Optional getP90LatencyMs() { + return p90LatencyMs; + } + + /** + * @return 95th percentile per-file latency in milliseconds. + */ + @JsonProperty("p95LatencyMs") + @java.lang.Override + public Optional getP95LatencyMs() { + return p95LatencyMs; + } + + /** + * @return 99th percentile per-file latency in milliseconds. + */ + @JsonProperty("p99LatencyMs") + @java.lang.Override + public Optional getP99LatencyMs() { + return p99LatencyMs; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof EvaluationSetRunMetricsBase && equalTo((EvaluationSetRunMetricsBase) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(EvaluationSetRunMetricsBase other) { + return numFilesTotal.equals(other.numFilesTotal) + && numFilesProcessed.equals(other.numFilesProcessed) + && numFiles.equals(other.numFiles) + && numPages.equals(other.numPages) + && meanLatencyMs.equals(other.meanLatencyMs) + && p50LatencyMs.equals(other.p50LatencyMs) + && p90LatencyMs.equals(other.p90LatencyMs) + && p95LatencyMs.equals(other.p95LatencyMs) + && p99LatencyMs.equals(other.p99LatencyMs); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.numFilesTotal, + this.numFilesProcessed, + this.numFiles, + this.numPages, + this.meanLatencyMs, + this.p50LatencyMs, + this.p90LatencyMs, + this.p95LatencyMs, + this.p99LatencyMs); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional numFilesTotal = Optional.empty(); + + private Optional numFilesProcessed = Optional.empty(); + + private Optional numFiles = Optional.empty(); + + private Optional numPages = Optional.empty(); + + private Optional meanLatencyMs = Optional.empty(); + + private Optional p50LatencyMs = Optional.empty(); + + private Optional p90LatencyMs = Optional.empty(); + + private Optional p95LatencyMs = Optional.empty(); + + private Optional p99LatencyMs = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(EvaluationSetRunMetricsBase other) { + numFilesTotal(other.getNumFilesTotal()); + numFilesProcessed(other.getNumFilesProcessed()); + numFiles(other.getNumFiles()); + numPages(other.getNumPages()); + meanLatencyMs(other.getMeanLatencyMs()); + p50LatencyMs(other.getP50LatencyMs()); + p90LatencyMs(other.getP90LatencyMs()); + p95LatencyMs(other.getP95LatencyMs()); + p99LatencyMs(other.getP99LatencyMs()); + return this; + } + + /** + *

The total number of files that will be processed in this evaluation set run.

+ */ + @JsonSetter(value = "numFilesTotal", nulls = Nulls.SKIP) + public Builder numFilesTotal(Optional numFilesTotal) { + this.numFilesTotal = numFilesTotal; + return this; + } + + public Builder numFilesTotal(Double numFilesTotal) { + this.numFilesTotal = Optional.ofNullable(numFilesTotal); + return this; + } + + /** + *

The number of files that have finished processing.

+ */ + @JsonSetter(value = "numFilesProcessed", nulls = Nulls.SKIP) + public Builder numFilesProcessed(Optional numFilesProcessed) { + this.numFilesProcessed = numFilesProcessed; + return this; + } + + public Builder numFilesProcessed(Double numFilesProcessed) { + this.numFilesProcessed = Optional.ofNullable(numFilesProcessed); + return this; + } + + /** + *

Deprecated. Use numFilesProcessed instead.

+ */ + @JsonSetter(value = "numFiles", nulls = Nulls.SKIP) + public Builder numFiles(Optional numFiles) { + this.numFiles = numFiles; + return this; + } + + public Builder numFiles(Double numFiles) { + this.numFiles = Optional.ofNullable(numFiles); + return this; + } + + /** + *

The total number of pages processed across the completed files.

+ */ + @JsonSetter(value = "numPages", nulls = Nulls.SKIP) + public Builder numPages(Optional numPages) { + this.numPages = numPages; + return this; + } + + public Builder numPages(Double numPages) { + this.numPages = Optional.ofNullable(numPages); + return this; + } + + /** + *

Mean per-file latency in milliseconds.

+ */ + @JsonSetter(value = "meanLatencyMs", nulls = Nulls.SKIP) + public Builder meanLatencyMs(Optional meanLatencyMs) { + this.meanLatencyMs = meanLatencyMs; + return this; + } + + public Builder meanLatencyMs(Double meanLatencyMs) { + this.meanLatencyMs = Optional.ofNullable(meanLatencyMs); + return this; + } + + /** + *

50th percentile per-file latency in milliseconds.

+ */ + @JsonSetter(value = "p50LatencyMs", nulls = Nulls.SKIP) + public Builder p50LatencyMs(Optional p50LatencyMs) { + this.p50LatencyMs = p50LatencyMs; + return this; + } + + public Builder p50LatencyMs(Double p50LatencyMs) { + this.p50LatencyMs = Optional.ofNullable(p50LatencyMs); + return this; + } + + /** + *

90th percentile per-file latency in milliseconds.

+ */ + @JsonSetter(value = "p90LatencyMs", nulls = Nulls.SKIP) + public Builder p90LatencyMs(Optional p90LatencyMs) { + this.p90LatencyMs = p90LatencyMs; + return this; + } + + public Builder p90LatencyMs(Double p90LatencyMs) { + this.p90LatencyMs = Optional.ofNullable(p90LatencyMs); + return this; + } + + /** + *

95th percentile per-file latency in milliseconds.

+ */ + @JsonSetter(value = "p95LatencyMs", nulls = Nulls.SKIP) + public Builder p95LatencyMs(Optional p95LatencyMs) { + this.p95LatencyMs = p95LatencyMs; + return this; + } + + public Builder p95LatencyMs(Double p95LatencyMs) { + this.p95LatencyMs = Optional.ofNullable(p95LatencyMs); + return this; + } + + /** + *

99th percentile per-file latency in milliseconds.

+ */ + @JsonSetter(value = "p99LatencyMs", nulls = Nulls.SKIP) + public Builder p99LatencyMs(Optional p99LatencyMs) { + this.p99LatencyMs = p99LatencyMs; + return this; + } + + public Builder p99LatencyMs(Double p99LatencyMs) { + this.p99LatencyMs = Optional.ofNullable(p99LatencyMs); + return this; + } + + public EvaluationSetRunMetricsBase build() { + return new EvaluationSetRunMetricsBase( + numFilesTotal, + numFilesProcessed, + numFiles, + numPages, + meanLatencyMs, + p50LatencyMs, + p90LatencyMs, + p95LatencyMs, + p99LatencyMs, + additionalProperties); + } + } +} diff --git a/src/main/java/ai/extend/types/ExtractEvaluationSetRunMetrics.java b/src/main/java/ai/extend/types/ExtractEvaluationSetRunMetrics.java new file mode 100644 index 0000000..8d25c1b --- /dev/null +++ b/src/main/java/ai/extend/types/ExtractEvaluationSetRunMetrics.java @@ -0,0 +1,435 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package ai.extend.types; + +import ai.extend.core.ObjectMappers; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ExtractEvaluationSetRunMetrics.Builder.class) +public final class ExtractEvaluationSetRunMetrics implements IEvaluationSetRunMetricsBase { + private final Optional numFilesTotal; + + private final Optional numFilesProcessed; + + private final Optional numFiles; + + private final Optional numPages; + + private final Optional meanLatencyMs; + + private final Optional p50LatencyMs; + + private final Optional p90LatencyMs; + + private final Optional p95LatencyMs; + + private final Optional p99LatencyMs; + + private final Optional accuracy; + + private final Optional> fieldMetrics; + + private final Map additionalProperties; + + private ExtractEvaluationSetRunMetrics( + Optional numFilesTotal, + Optional numFilesProcessed, + Optional numFiles, + Optional numPages, + Optional meanLatencyMs, + Optional p50LatencyMs, + Optional p90LatencyMs, + Optional p95LatencyMs, + Optional p99LatencyMs, + Optional accuracy, + Optional> fieldMetrics, + Map additionalProperties) { + this.numFilesTotal = numFilesTotal; + this.numFilesProcessed = numFilesProcessed; + this.numFiles = numFiles; + this.numPages = numPages; + this.meanLatencyMs = meanLatencyMs; + this.p50LatencyMs = p50LatencyMs; + this.p90LatencyMs = p90LatencyMs; + this.p95LatencyMs = p95LatencyMs; + this.p99LatencyMs = p99LatencyMs; + this.accuracy = accuracy; + this.fieldMetrics = fieldMetrics; + this.additionalProperties = additionalProperties; + } + + /** + * @return The total number of files that will be processed in this evaluation set run. + */ + @JsonProperty("numFilesTotal") + @java.lang.Override + public Optional getNumFilesTotal() { + return numFilesTotal; + } + + /** + * @return The number of files that have finished processing. + */ + @JsonProperty("numFilesProcessed") + @java.lang.Override + public Optional getNumFilesProcessed() { + return numFilesProcessed; + } + + /** + * @return Deprecated. Use numFilesProcessed instead. + */ + @JsonProperty("numFiles") + @java.lang.Override + public Optional getNumFiles() { + return numFiles; + } + + /** + * @return The total number of pages processed across the completed files. + */ + @JsonProperty("numPages") + @java.lang.Override + public Optional getNumPages() { + return numPages; + } + + /** + * @return Mean per-file latency in milliseconds. + */ + @JsonProperty("meanLatencyMs") + @java.lang.Override + public Optional getMeanLatencyMs() { + return meanLatencyMs; + } + + /** + * @return 50th percentile per-file latency in milliseconds. + */ + @JsonProperty("p50LatencyMs") + @java.lang.Override + public Optional getP50LatencyMs() { + return p50LatencyMs; + } + + /** + * @return 90th percentile per-file latency in milliseconds. + */ + @JsonProperty("p90LatencyMs") + @java.lang.Override + public Optional getP90LatencyMs() { + return p90LatencyMs; + } + + /** + * @return 95th percentile per-file latency in milliseconds. + */ + @JsonProperty("p95LatencyMs") + @java.lang.Override + public Optional getP95LatencyMs() { + return p95LatencyMs; + } + + /** + * @return 99th percentile per-file latency in milliseconds. + */ + @JsonProperty("p99LatencyMs") + @java.lang.Override + public Optional getP99LatencyMs() { + return p99LatencyMs; + } + + /** + * @return Aggregate accuracy across every reviewed field in fieldMetrics. + */ + @JsonProperty("accuracy") + public Optional getAccuracy() { + return accuracy; + } + + /** + * @return Per-field accuracy statistics. Keys are the extractor schema's field names — nested fields are flattened to dot-joined paths. See Extraction response format for more on how extractor field paths are structured. + */ + @JsonProperty("fieldMetrics") + public Optional> getFieldMetrics() { + return fieldMetrics; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ExtractEvaluationSetRunMetrics && equalTo((ExtractEvaluationSetRunMetrics) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ExtractEvaluationSetRunMetrics other) { + return numFilesTotal.equals(other.numFilesTotal) + && numFilesProcessed.equals(other.numFilesProcessed) + && numFiles.equals(other.numFiles) + && numPages.equals(other.numPages) + && meanLatencyMs.equals(other.meanLatencyMs) + && p50LatencyMs.equals(other.p50LatencyMs) + && p90LatencyMs.equals(other.p90LatencyMs) + && p95LatencyMs.equals(other.p95LatencyMs) + && p99LatencyMs.equals(other.p99LatencyMs) + && accuracy.equals(other.accuracy) + && fieldMetrics.equals(other.fieldMetrics); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.numFilesTotal, + this.numFilesProcessed, + this.numFiles, + this.numPages, + this.meanLatencyMs, + this.p50LatencyMs, + this.p90LatencyMs, + this.p95LatencyMs, + this.p99LatencyMs, + this.accuracy, + this.fieldMetrics); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional numFilesTotal = Optional.empty(); + + private Optional numFilesProcessed = Optional.empty(); + + private Optional numFiles = Optional.empty(); + + private Optional numPages = Optional.empty(); + + private Optional meanLatencyMs = Optional.empty(); + + private Optional p50LatencyMs = Optional.empty(); + + private Optional p90LatencyMs = Optional.empty(); + + private Optional p95LatencyMs = Optional.empty(); + + private Optional p99LatencyMs = Optional.empty(); + + private Optional accuracy = Optional.empty(); + + private Optional> fieldMetrics = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(ExtractEvaluationSetRunMetrics other) { + numFilesTotal(other.getNumFilesTotal()); + numFilesProcessed(other.getNumFilesProcessed()); + numFiles(other.getNumFiles()); + numPages(other.getNumPages()); + meanLatencyMs(other.getMeanLatencyMs()); + p50LatencyMs(other.getP50LatencyMs()); + p90LatencyMs(other.getP90LatencyMs()); + p95LatencyMs(other.getP95LatencyMs()); + p99LatencyMs(other.getP99LatencyMs()); + accuracy(other.getAccuracy()); + fieldMetrics(other.getFieldMetrics()); + return this; + } + + /** + *

The total number of files that will be processed in this evaluation set run.

+ */ + @JsonSetter(value = "numFilesTotal", nulls = Nulls.SKIP) + public Builder numFilesTotal(Optional numFilesTotal) { + this.numFilesTotal = numFilesTotal; + return this; + } + + public Builder numFilesTotal(Double numFilesTotal) { + this.numFilesTotal = Optional.ofNullable(numFilesTotal); + return this; + } + + /** + *

The number of files that have finished processing.

+ */ + @JsonSetter(value = "numFilesProcessed", nulls = Nulls.SKIP) + public Builder numFilesProcessed(Optional numFilesProcessed) { + this.numFilesProcessed = numFilesProcessed; + return this; + } + + public Builder numFilesProcessed(Double numFilesProcessed) { + this.numFilesProcessed = Optional.ofNullable(numFilesProcessed); + return this; + } + + /** + *

Deprecated. Use numFilesProcessed instead.

+ */ + @JsonSetter(value = "numFiles", nulls = Nulls.SKIP) + public Builder numFiles(Optional numFiles) { + this.numFiles = numFiles; + return this; + } + + public Builder numFiles(Double numFiles) { + this.numFiles = Optional.ofNullable(numFiles); + return this; + } + + /** + *

The total number of pages processed across the completed files.

+ */ + @JsonSetter(value = "numPages", nulls = Nulls.SKIP) + public Builder numPages(Optional numPages) { + this.numPages = numPages; + return this; + } + + public Builder numPages(Double numPages) { + this.numPages = Optional.ofNullable(numPages); + return this; + } + + /** + *

Mean per-file latency in milliseconds.

+ */ + @JsonSetter(value = "meanLatencyMs", nulls = Nulls.SKIP) + public Builder meanLatencyMs(Optional meanLatencyMs) { + this.meanLatencyMs = meanLatencyMs; + return this; + } + + public Builder meanLatencyMs(Double meanLatencyMs) { + this.meanLatencyMs = Optional.ofNullable(meanLatencyMs); + return this; + } + + /** + *

50th percentile per-file latency in milliseconds.

+ */ + @JsonSetter(value = "p50LatencyMs", nulls = Nulls.SKIP) + public Builder p50LatencyMs(Optional p50LatencyMs) { + this.p50LatencyMs = p50LatencyMs; + return this; + } + + public Builder p50LatencyMs(Double p50LatencyMs) { + this.p50LatencyMs = Optional.ofNullable(p50LatencyMs); + return this; + } + + /** + *

90th percentile per-file latency in milliseconds.

+ */ + @JsonSetter(value = "p90LatencyMs", nulls = Nulls.SKIP) + public Builder p90LatencyMs(Optional p90LatencyMs) { + this.p90LatencyMs = p90LatencyMs; + return this; + } + + public Builder p90LatencyMs(Double p90LatencyMs) { + this.p90LatencyMs = Optional.ofNullable(p90LatencyMs); + return this; + } + + /** + *

95th percentile per-file latency in milliseconds.

+ */ + @JsonSetter(value = "p95LatencyMs", nulls = Nulls.SKIP) + public Builder p95LatencyMs(Optional p95LatencyMs) { + this.p95LatencyMs = p95LatencyMs; + return this; + } + + public Builder p95LatencyMs(Double p95LatencyMs) { + this.p95LatencyMs = Optional.ofNullable(p95LatencyMs); + return this; + } + + /** + *

99th percentile per-file latency in milliseconds.

+ */ + @JsonSetter(value = "p99LatencyMs", nulls = Nulls.SKIP) + public Builder p99LatencyMs(Optional p99LatencyMs) { + this.p99LatencyMs = p99LatencyMs; + return this; + } + + public Builder p99LatencyMs(Double p99LatencyMs) { + this.p99LatencyMs = Optional.ofNullable(p99LatencyMs); + return this; + } + + /** + *

Aggregate accuracy across every reviewed field in fieldMetrics.

+ */ + @JsonSetter(value = "accuracy", nulls = Nulls.SKIP) + public Builder accuracy(Optional accuracy) { + this.accuracy = accuracy; + return this; + } + + public Builder accuracy(Double accuracy) { + this.accuracy = Optional.ofNullable(accuracy); + return this; + } + + /** + *

Per-field accuracy statistics. Keys are the extractor schema's field names — nested fields are flattened to dot-joined paths. See Extraction response format for more on how extractor field paths are structured.

+ */ + @JsonSetter(value = "fieldMetrics", nulls = Nulls.SKIP) + public Builder fieldMetrics(Optional> fieldMetrics) { + this.fieldMetrics = fieldMetrics; + return this; + } + + public Builder fieldMetrics(Map fieldMetrics) { + this.fieldMetrics = Optional.ofNullable(fieldMetrics); + return this; + } + + public ExtractEvaluationSetRunMetrics build() { + return new ExtractEvaluationSetRunMetrics( + numFilesTotal, + numFilesProcessed, + numFiles, + numPages, + meanLatencyMs, + p50LatencyMs, + p90LatencyMs, + p95LatencyMs, + p99LatencyMs, + accuracy, + fieldMetrics, + additionalProperties); + } + } +} diff --git a/src/main/java/ai/extend/types/ExtractorVersion.java b/src/main/java/ai/extend/types/ExtractorVersion.java index 3b81431..e2ea458 100644 --- a/src/main/java/ai/extend/types/ExtractorVersion.java +++ b/src/main/java/ai/extend/types/ExtractorVersion.java @@ -37,6 +37,8 @@ public final class ExtractorVersion { private final OffsetDateTime createdAt; + private final Optional createdBy; + private final Map additionalProperties; private ExtractorVersion( @@ -46,6 +48,7 @@ private ExtractorVersion( ExtractConfig config, String extractorId, OffsetDateTime createdAt, + Optional createdBy, Map additionalProperties) { this.id = id; this.description = description; @@ -53,6 +56,7 @@ private ExtractorVersion( this.config = config; this.extractorId = extractorId; this.createdAt = createdAt; + this.createdBy = createdBy; this.additionalProperties = additionalProperties; } @@ -120,12 +124,26 @@ public OffsetDateTime getCreatedAt() { return createdAt; } + @JsonIgnore + public Optional getCreatedBy() { + if (createdBy == null) { + return Optional.empty(); + } + return createdBy; + } + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) @JsonProperty("description") private Optional _getDescription() { return description; } + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("createdBy") + private Optional _getCreatedBy() { + return createdBy; + } + @java.lang.Override public boolean equals(Object other) { if (this == other) return true; @@ -143,12 +161,14 @@ private boolean equalTo(ExtractorVersion other) { && version.equals(other.version) && config.equals(other.config) && extractorId.equals(other.extractorId) - && createdAt.equals(other.createdAt); + && createdAt.equals(other.createdAt) + && createdBy.equals(other.createdBy); } @java.lang.Override public int hashCode() { - return Objects.hash(this.id, this.description, this.version, this.config, this.extractorId, this.createdAt); + return Objects.hash( + this.id, this.description, this.version, this.config, this.extractorId, this.createdAt, this.createdBy); } @java.lang.Override @@ -213,6 +233,12 @@ public interface _FinalStage { _FinalStage description(String description); _FinalStage description(Nullable description); + + _FinalStage createdBy(Optional createdBy); + + _FinalStage createdBy(CreatedBy createdBy); + + _FinalStage createdBy(Nullable createdBy); } @JsonIgnoreProperties(ignoreUnknown = true) @@ -228,6 +254,8 @@ public static final class Builder private OffsetDateTime createdAt; + private Optional createdBy = Optional.empty(); + private Optional description = Optional.empty(); @JsonAnySetter @@ -243,6 +271,7 @@ public Builder from(ExtractorVersion other) { config(other.getConfig()); extractorId(other.getExtractorId()); createdAt(other.getCreatedAt()); + createdBy(other.getCreatedBy()); return this; } @@ -315,6 +344,31 @@ public _FinalStage createdAt(@NotNull OffsetDateTime createdAt) { return this; } + @java.lang.Override + public _FinalStage createdBy(Nullable createdBy) { + if (createdBy.isNull()) { + this.createdBy = null; + } else if (createdBy.isEmpty()) { + this.createdBy = Optional.empty(); + } else { + this.createdBy = Optional.of(createdBy.get()); + } + return this; + } + + @java.lang.Override + public _FinalStage createdBy(CreatedBy createdBy) { + this.createdBy = Optional.ofNullable(createdBy); + return this; + } + + @java.lang.Override + @JsonSetter(value = "createdBy", nulls = Nulls.SKIP) + public _FinalStage createdBy(Optional createdBy) { + this.createdBy = createdBy; + return this; + } + /** *

A description of this version of the extractor.

*

Example: "Updated extraction fields for new invoice format"

@@ -356,7 +410,8 @@ public _FinalStage description(Optional description) { @java.lang.Override public ExtractorVersion build() { - return new ExtractorVersion(id, description, version, config, extractorId, createdAt, additionalProperties); + return new ExtractorVersion( + id, description, version, config, extractorId, createdAt, createdBy, additionalProperties); } } } diff --git a/src/main/java/ai/extend/types/ExtractorVersionSummary.java b/src/main/java/ai/extend/types/ExtractorVersionSummary.java index 62dd212..cadb1ec 100644 --- a/src/main/java/ai/extend/types/ExtractorVersionSummary.java +++ b/src/main/java/ai/extend/types/ExtractorVersionSummary.java @@ -35,6 +35,8 @@ public final class ExtractorVersionSummary { private final OffsetDateTime createdAt; + private final Optional createdBy; + private final Map additionalProperties; private ExtractorVersionSummary( @@ -43,12 +45,14 @@ private ExtractorVersionSummary( String version, String extractorId, OffsetDateTime createdAt, + Optional createdBy, Map additionalProperties) { this.id = id; this.description = description; this.version = version; this.extractorId = extractorId; this.createdAt = createdAt; + this.createdBy = createdBy; this.additionalProperties = additionalProperties; } @@ -104,12 +108,26 @@ public OffsetDateTime getCreatedAt() { return createdAt; } + @JsonIgnore + public Optional getCreatedBy() { + if (createdBy == null) { + return Optional.empty(); + } + return createdBy; + } + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) @JsonProperty("description") private Optional _getDescription() { return description; } + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("createdBy") + private Optional _getCreatedBy() { + return createdBy; + } + @java.lang.Override public boolean equals(Object other) { if (this == other) return true; @@ -126,12 +144,13 @@ private boolean equalTo(ExtractorVersionSummary other) { && description.equals(other.description) && version.equals(other.version) && extractorId.equals(other.extractorId) - && createdAt.equals(other.createdAt); + && createdAt.equals(other.createdAt) + && createdBy.equals(other.createdBy); } @java.lang.Override public int hashCode() { - return Objects.hash(this.id, this.description, this.version, this.extractorId, this.createdAt); + return Objects.hash(this.id, this.description, this.version, this.extractorId, this.createdAt, this.createdBy); } @java.lang.Override @@ -185,6 +204,12 @@ public interface _FinalStage { _FinalStage description(String description); _FinalStage description(Nullable description); + + _FinalStage createdBy(Optional createdBy); + + _FinalStage createdBy(CreatedBy createdBy); + + _FinalStage createdBy(Nullable createdBy); } @JsonIgnoreProperties(ignoreUnknown = true) @@ -197,6 +222,8 @@ public static final class Builder implements IdStage, VersionStage, ExtractorIdS private OffsetDateTime createdAt; + private Optional createdBy = Optional.empty(); + private Optional description = Optional.empty(); @JsonAnySetter @@ -211,6 +238,7 @@ public Builder from(ExtractorVersionSummary other) { version(other.getVersion()); extractorId(other.getExtractorId()); createdAt(other.getCreatedAt()); + createdBy(other.getCreatedBy()); return this; } @@ -263,6 +291,31 @@ public _FinalStage createdAt(@NotNull OffsetDateTime createdAt) { return this; } + @java.lang.Override + public _FinalStage createdBy(Nullable createdBy) { + if (createdBy.isNull()) { + this.createdBy = null; + } else if (createdBy.isEmpty()) { + this.createdBy = Optional.empty(); + } else { + this.createdBy = Optional.of(createdBy.get()); + } + return this; + } + + @java.lang.Override + public _FinalStage createdBy(CreatedBy createdBy) { + this.createdBy = Optional.ofNullable(createdBy); + return this; + } + + @java.lang.Override + @JsonSetter(value = "createdBy", nulls = Nulls.SKIP) + public _FinalStage createdBy(Optional createdBy) { + this.createdBy = createdBy; + return this; + } + /** *

A description of this version of the extractor.

*

Example: "Updated extraction fields for new invoice format"

@@ -304,7 +357,8 @@ public _FinalStage description(Optional description) { @java.lang.Override public ExtractorVersionSummary build() { - return new ExtractorVersionSummary(id, description, version, extractorId, createdAt, additionalProperties); + return new ExtractorVersionSummary( + id, description, version, extractorId, createdAt, createdBy, additionalProperties); } } } diff --git a/src/main/java/ai/extend/types/IEvaluationSetRunMetricsBase.java b/src/main/java/ai/extend/types/IEvaluationSetRunMetricsBase.java new file mode 100644 index 0000000..65a3885 --- /dev/null +++ b/src/main/java/ai/extend/types/IEvaluationSetRunMetricsBase.java @@ -0,0 +1,26 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package ai.extend.types; + +import java.util.Optional; + +public interface IEvaluationSetRunMetricsBase { + Optional getNumFilesTotal(); + + Optional getNumFilesProcessed(); + + Optional getNumFiles(); + + Optional getNumPages(); + + Optional getMeanLatencyMs(); + + Optional getP50LatencyMs(); + + Optional getP90LatencyMs(); + + Optional getP95LatencyMs(); + + Optional getP99LatencyMs(); +} diff --git a/src/main/java/ai/extend/types/SplitterEvaluationSetRunMetrics.java b/src/main/java/ai/extend/types/SplitterEvaluationSetRunMetrics.java new file mode 100644 index 0000000..f22aa13 --- /dev/null +++ b/src/main/java/ai/extend/types/SplitterEvaluationSetRunMetrics.java @@ -0,0 +1,563 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package ai.extend.types; + +import ai.extend.core.ObjectMappers; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = SplitterEvaluationSetRunMetrics.Builder.class) +public final class SplitterEvaluationSetRunMetrics implements IEvaluationSetRunMetricsBase { + private final Optional numFilesTotal; + + private final Optional numFilesProcessed; + + private final Optional numFiles; + + private final Optional numPages; + + private final Optional meanLatencyMs; + + private final Optional p50LatencyMs; + + private final Optional p90LatencyMs; + + private final Optional p95LatencyMs; + + private final Optional p99LatencyMs; + + private final Optional precision; + + private final Optional recall; + + private final Optional f1; + + private final Optional numSplitsExpected; + + private final Optional numSplitsPredicted; + + private final Optional numSplitsCorrect; + + private final Map additionalProperties; + + private SplitterEvaluationSetRunMetrics( + Optional numFilesTotal, + Optional numFilesProcessed, + Optional numFiles, + Optional numPages, + Optional meanLatencyMs, + Optional p50LatencyMs, + Optional p90LatencyMs, + Optional p95LatencyMs, + Optional p99LatencyMs, + Optional precision, + Optional recall, + Optional f1, + Optional numSplitsExpected, + Optional numSplitsPredicted, + Optional numSplitsCorrect, + Map additionalProperties) { + this.numFilesTotal = numFilesTotal; + this.numFilesProcessed = numFilesProcessed; + this.numFiles = numFiles; + this.numPages = numPages; + this.meanLatencyMs = meanLatencyMs; + this.p50LatencyMs = p50LatencyMs; + this.p90LatencyMs = p90LatencyMs; + this.p95LatencyMs = p95LatencyMs; + this.p99LatencyMs = p99LatencyMs; + this.precision = precision; + this.recall = recall; + this.f1 = f1; + this.numSplitsExpected = numSplitsExpected; + this.numSplitsPredicted = numSplitsPredicted; + this.numSplitsCorrect = numSplitsCorrect; + this.additionalProperties = additionalProperties; + } + + /** + * @return The total number of files that will be processed in this evaluation set run. + */ + @JsonProperty("numFilesTotal") + @java.lang.Override + public Optional getNumFilesTotal() { + return numFilesTotal; + } + + /** + * @return The number of files that have finished processing. + */ + @JsonProperty("numFilesProcessed") + @java.lang.Override + public Optional getNumFilesProcessed() { + return numFilesProcessed; + } + + /** + * @return Deprecated. Use numFilesProcessed instead. + */ + @JsonProperty("numFiles") + @java.lang.Override + public Optional getNumFiles() { + return numFiles; + } + + /** + * @return The total number of pages processed across the completed files. + */ + @JsonProperty("numPages") + @java.lang.Override + public Optional getNumPages() { + return numPages; + } + + /** + * @return Mean per-file latency in milliseconds. + */ + @JsonProperty("meanLatencyMs") + @java.lang.Override + public Optional getMeanLatencyMs() { + return meanLatencyMs; + } + + /** + * @return 50th percentile per-file latency in milliseconds. + */ + @JsonProperty("p50LatencyMs") + @java.lang.Override + public Optional getP50LatencyMs() { + return p50LatencyMs; + } + + /** + * @return 90th percentile per-file latency in milliseconds. + */ + @JsonProperty("p90LatencyMs") + @java.lang.Override + public Optional getP90LatencyMs() { + return p90LatencyMs; + } + + /** + * @return 95th percentile per-file latency in milliseconds. + */ + @JsonProperty("p95LatencyMs") + @java.lang.Override + public Optional getP95LatencyMs() { + return p95LatencyMs; + } + + /** + * @return 99th percentile per-file latency in milliseconds. + */ + @JsonProperty("p99LatencyMs") + @java.lang.Override + public Optional getP99LatencyMs() { + return p99LatencyMs; + } + + /** + * @return numSplitsCorrect / numSplitsPredicted. + */ + @JsonProperty("precision") + public Optional getPrecision() { + return precision; + } + + /** + * @return numSplitsCorrect / numSplitsExpected. + */ + @JsonProperty("recall") + public Optional getRecall() { + return recall; + } + + /** + * @return Harmonic mean of precision and recall. + */ + @JsonProperty("f1") + public Optional getF1() { + return f1; + } + + /** + * @return The total number of expected split documents across the evaluation set. + */ + @JsonProperty("numSplitsExpected") + public Optional getNumSplitsExpected() { + return numSplitsExpected; + } + + /** + * @return The total number of split documents the model produced. + */ + @JsonProperty("numSplitsPredicted") + public Optional getNumSplitsPredicted() { + return numSplitsPredicted; + } + + /** + * @return The number of predicted splits that exactly matched an expected split. + */ + @JsonProperty("numSplitsCorrect") + public Optional getNumSplitsCorrect() { + return numSplitsCorrect; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof SplitterEvaluationSetRunMetrics && equalTo((SplitterEvaluationSetRunMetrics) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(SplitterEvaluationSetRunMetrics other) { + return numFilesTotal.equals(other.numFilesTotal) + && numFilesProcessed.equals(other.numFilesProcessed) + && numFiles.equals(other.numFiles) + && numPages.equals(other.numPages) + && meanLatencyMs.equals(other.meanLatencyMs) + && p50LatencyMs.equals(other.p50LatencyMs) + && p90LatencyMs.equals(other.p90LatencyMs) + && p95LatencyMs.equals(other.p95LatencyMs) + && p99LatencyMs.equals(other.p99LatencyMs) + && precision.equals(other.precision) + && recall.equals(other.recall) + && f1.equals(other.f1) + && numSplitsExpected.equals(other.numSplitsExpected) + && numSplitsPredicted.equals(other.numSplitsPredicted) + && numSplitsCorrect.equals(other.numSplitsCorrect); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.numFilesTotal, + this.numFilesProcessed, + this.numFiles, + this.numPages, + this.meanLatencyMs, + this.p50LatencyMs, + this.p90LatencyMs, + this.p95LatencyMs, + this.p99LatencyMs, + this.precision, + this.recall, + this.f1, + this.numSplitsExpected, + this.numSplitsPredicted, + this.numSplitsCorrect); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional numFilesTotal = Optional.empty(); + + private Optional numFilesProcessed = Optional.empty(); + + private Optional numFiles = Optional.empty(); + + private Optional numPages = Optional.empty(); + + private Optional meanLatencyMs = Optional.empty(); + + private Optional p50LatencyMs = Optional.empty(); + + private Optional p90LatencyMs = Optional.empty(); + + private Optional p95LatencyMs = Optional.empty(); + + private Optional p99LatencyMs = Optional.empty(); + + private Optional precision = Optional.empty(); + + private Optional recall = Optional.empty(); + + private Optional f1 = Optional.empty(); + + private Optional numSplitsExpected = Optional.empty(); + + private Optional numSplitsPredicted = Optional.empty(); + + private Optional numSplitsCorrect = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(SplitterEvaluationSetRunMetrics other) { + numFilesTotal(other.getNumFilesTotal()); + numFilesProcessed(other.getNumFilesProcessed()); + numFiles(other.getNumFiles()); + numPages(other.getNumPages()); + meanLatencyMs(other.getMeanLatencyMs()); + p50LatencyMs(other.getP50LatencyMs()); + p90LatencyMs(other.getP90LatencyMs()); + p95LatencyMs(other.getP95LatencyMs()); + p99LatencyMs(other.getP99LatencyMs()); + precision(other.getPrecision()); + recall(other.getRecall()); + f1(other.getF1()); + numSplitsExpected(other.getNumSplitsExpected()); + numSplitsPredicted(other.getNumSplitsPredicted()); + numSplitsCorrect(other.getNumSplitsCorrect()); + return this; + } + + /** + *

The total number of files that will be processed in this evaluation set run.

+ */ + @JsonSetter(value = "numFilesTotal", nulls = Nulls.SKIP) + public Builder numFilesTotal(Optional numFilesTotal) { + this.numFilesTotal = numFilesTotal; + return this; + } + + public Builder numFilesTotal(Double numFilesTotal) { + this.numFilesTotal = Optional.ofNullable(numFilesTotal); + return this; + } + + /** + *

The number of files that have finished processing.

+ */ + @JsonSetter(value = "numFilesProcessed", nulls = Nulls.SKIP) + public Builder numFilesProcessed(Optional numFilesProcessed) { + this.numFilesProcessed = numFilesProcessed; + return this; + } + + public Builder numFilesProcessed(Double numFilesProcessed) { + this.numFilesProcessed = Optional.ofNullable(numFilesProcessed); + return this; + } + + /** + *

Deprecated. Use numFilesProcessed instead.

+ */ + @JsonSetter(value = "numFiles", nulls = Nulls.SKIP) + public Builder numFiles(Optional numFiles) { + this.numFiles = numFiles; + return this; + } + + public Builder numFiles(Double numFiles) { + this.numFiles = Optional.ofNullable(numFiles); + return this; + } + + /** + *

The total number of pages processed across the completed files.

+ */ + @JsonSetter(value = "numPages", nulls = Nulls.SKIP) + public Builder numPages(Optional numPages) { + this.numPages = numPages; + return this; + } + + public Builder numPages(Double numPages) { + this.numPages = Optional.ofNullable(numPages); + return this; + } + + /** + *

Mean per-file latency in milliseconds.

+ */ + @JsonSetter(value = "meanLatencyMs", nulls = Nulls.SKIP) + public Builder meanLatencyMs(Optional meanLatencyMs) { + this.meanLatencyMs = meanLatencyMs; + return this; + } + + public Builder meanLatencyMs(Double meanLatencyMs) { + this.meanLatencyMs = Optional.ofNullable(meanLatencyMs); + return this; + } + + /** + *

50th percentile per-file latency in milliseconds.

+ */ + @JsonSetter(value = "p50LatencyMs", nulls = Nulls.SKIP) + public Builder p50LatencyMs(Optional p50LatencyMs) { + this.p50LatencyMs = p50LatencyMs; + return this; + } + + public Builder p50LatencyMs(Double p50LatencyMs) { + this.p50LatencyMs = Optional.ofNullable(p50LatencyMs); + return this; + } + + /** + *

90th percentile per-file latency in milliseconds.

+ */ + @JsonSetter(value = "p90LatencyMs", nulls = Nulls.SKIP) + public Builder p90LatencyMs(Optional p90LatencyMs) { + this.p90LatencyMs = p90LatencyMs; + return this; + } + + public Builder p90LatencyMs(Double p90LatencyMs) { + this.p90LatencyMs = Optional.ofNullable(p90LatencyMs); + return this; + } + + /** + *

95th percentile per-file latency in milliseconds.

+ */ + @JsonSetter(value = "p95LatencyMs", nulls = Nulls.SKIP) + public Builder p95LatencyMs(Optional p95LatencyMs) { + this.p95LatencyMs = p95LatencyMs; + return this; + } + + public Builder p95LatencyMs(Double p95LatencyMs) { + this.p95LatencyMs = Optional.ofNullable(p95LatencyMs); + return this; + } + + /** + *

99th percentile per-file latency in milliseconds.

+ */ + @JsonSetter(value = "p99LatencyMs", nulls = Nulls.SKIP) + public Builder p99LatencyMs(Optional p99LatencyMs) { + this.p99LatencyMs = p99LatencyMs; + return this; + } + + public Builder p99LatencyMs(Double p99LatencyMs) { + this.p99LatencyMs = Optional.ofNullable(p99LatencyMs); + return this; + } + + /** + *

numSplitsCorrect / numSplitsPredicted.

+ */ + @JsonSetter(value = "precision", nulls = Nulls.SKIP) + public Builder precision(Optional precision) { + this.precision = precision; + return this; + } + + public Builder precision(Double precision) { + this.precision = Optional.ofNullable(precision); + return this; + } + + /** + *

numSplitsCorrect / numSplitsExpected.

+ */ + @JsonSetter(value = "recall", nulls = Nulls.SKIP) + public Builder recall(Optional recall) { + this.recall = recall; + return this; + } + + public Builder recall(Double recall) { + this.recall = Optional.ofNullable(recall); + return this; + } + + /** + *

Harmonic mean of precision and recall.

+ */ + @JsonSetter(value = "f1", nulls = Nulls.SKIP) + public Builder f1(Optional f1) { + this.f1 = f1; + return this; + } + + public Builder f1(Double f1) { + this.f1 = Optional.ofNullable(f1); + return this; + } + + /** + *

The total number of expected split documents across the evaluation set.

+ */ + @JsonSetter(value = "numSplitsExpected", nulls = Nulls.SKIP) + public Builder numSplitsExpected(Optional numSplitsExpected) { + this.numSplitsExpected = numSplitsExpected; + return this; + } + + public Builder numSplitsExpected(Double numSplitsExpected) { + this.numSplitsExpected = Optional.ofNullable(numSplitsExpected); + return this; + } + + /** + *

The total number of split documents the model produced.

+ */ + @JsonSetter(value = "numSplitsPredicted", nulls = Nulls.SKIP) + public Builder numSplitsPredicted(Optional numSplitsPredicted) { + this.numSplitsPredicted = numSplitsPredicted; + return this; + } + + public Builder numSplitsPredicted(Double numSplitsPredicted) { + this.numSplitsPredicted = Optional.ofNullable(numSplitsPredicted); + return this; + } + + /** + *

The number of predicted splits that exactly matched an expected split.

+ */ + @JsonSetter(value = "numSplitsCorrect", nulls = Nulls.SKIP) + public Builder numSplitsCorrect(Optional numSplitsCorrect) { + this.numSplitsCorrect = numSplitsCorrect; + return this; + } + + public Builder numSplitsCorrect(Double numSplitsCorrect) { + this.numSplitsCorrect = Optional.ofNullable(numSplitsCorrect); + return this; + } + + public SplitterEvaluationSetRunMetrics build() { + return new SplitterEvaluationSetRunMetrics( + numFilesTotal, + numFilesProcessed, + numFiles, + numPages, + meanLatencyMs, + p50LatencyMs, + p90LatencyMs, + p95LatencyMs, + p99LatencyMs, + precision, + recall, + f1, + numSplitsExpected, + numSplitsPredicted, + numSplitsCorrect, + additionalProperties); + } + } +} diff --git a/src/main/java/ai/extend/types/SplitterVersion.java b/src/main/java/ai/extend/types/SplitterVersion.java index 0498420..c34a80b 100644 --- a/src/main/java/ai/extend/types/SplitterVersion.java +++ b/src/main/java/ai/extend/types/SplitterVersion.java @@ -37,6 +37,8 @@ public final class SplitterVersion { private final OffsetDateTime createdAt; + private final Optional createdBy; + private final Map additionalProperties; private SplitterVersion( @@ -46,6 +48,7 @@ private SplitterVersion( SplitConfig config, String splitterId, OffsetDateTime createdAt, + Optional createdBy, Map additionalProperties) { this.id = id; this.description = description; @@ -53,6 +56,7 @@ private SplitterVersion( this.config = config; this.splitterId = splitterId; this.createdAt = createdAt; + this.createdBy = createdBy; this.additionalProperties = additionalProperties; } @@ -116,12 +120,26 @@ public OffsetDateTime getCreatedAt() { return createdAt; } + @JsonIgnore + public Optional getCreatedBy() { + if (createdBy == null) { + return Optional.empty(); + } + return createdBy; + } + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) @JsonProperty("description") private Optional _getDescription() { return description; } + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("createdBy") + private Optional _getCreatedBy() { + return createdBy; + } + @java.lang.Override public boolean equals(Object other) { if (this == other) return true; @@ -139,12 +157,14 @@ private boolean equalTo(SplitterVersion other) { && version.equals(other.version) && config.equals(other.config) && splitterId.equals(other.splitterId) - && createdAt.equals(other.createdAt); + && createdAt.equals(other.createdAt) + && createdBy.equals(other.createdBy); } @java.lang.Override public int hashCode() { - return Objects.hash(this.id, this.description, this.version, this.config, this.splitterId, this.createdAt); + return Objects.hash( + this.id, this.description, this.version, this.config, this.splitterId, this.createdAt, this.createdBy); } @java.lang.Override @@ -205,6 +225,12 @@ public interface _FinalStage { _FinalStage description(String description); _FinalStage description(Nullable description); + + _FinalStage createdBy(Optional createdBy); + + _FinalStage createdBy(CreatedBy createdBy); + + _FinalStage createdBy(Nullable createdBy); } @JsonIgnoreProperties(ignoreUnknown = true) @@ -220,6 +246,8 @@ public static final class Builder private OffsetDateTime createdAt; + private Optional createdBy = Optional.empty(); + private Optional description = Optional.empty(); @JsonAnySetter @@ -235,6 +263,7 @@ public Builder from(SplitterVersion other) { config(other.getConfig()); splitterId(other.getSplitterId()); createdAt(other.getCreatedAt()); + createdBy(other.getCreatedBy()); return this; } @@ -299,6 +328,31 @@ public _FinalStage createdAt(@NotNull OffsetDateTime createdAt) { return this; } + @java.lang.Override + public _FinalStage createdBy(Nullable createdBy) { + if (createdBy.isNull()) { + this.createdBy = null; + } else if (createdBy.isEmpty()) { + this.createdBy = Optional.empty(); + } else { + this.createdBy = Optional.of(createdBy.get()); + } + return this; + } + + @java.lang.Override + public _FinalStage createdBy(CreatedBy createdBy) { + this.createdBy = Optional.ofNullable(createdBy); + return this; + } + + @java.lang.Override + @JsonSetter(value = "createdBy", nulls = Nulls.SKIP) + public _FinalStage createdBy(Optional createdBy) { + this.createdBy = createdBy; + return this; + } + /** *

A description of this version of the splitter.

*

Example: "Updated split rules for multi-invoice packets"

@@ -340,7 +394,8 @@ public _FinalStage description(Optional description) { @java.lang.Override public SplitterVersion build() { - return new SplitterVersion(id, description, version, config, splitterId, createdAt, additionalProperties); + return new SplitterVersion( + id, description, version, config, splitterId, createdAt, createdBy, additionalProperties); } } } diff --git a/src/main/java/ai/extend/types/SplitterVersionSummary.java b/src/main/java/ai/extend/types/SplitterVersionSummary.java index d557765..0311476 100644 --- a/src/main/java/ai/extend/types/SplitterVersionSummary.java +++ b/src/main/java/ai/extend/types/SplitterVersionSummary.java @@ -35,6 +35,8 @@ public final class SplitterVersionSummary { private final OffsetDateTime createdAt; + private final Optional createdBy; + private final Map additionalProperties; private SplitterVersionSummary( @@ -43,12 +45,14 @@ private SplitterVersionSummary( String version, String splitterId, OffsetDateTime createdAt, + Optional createdBy, Map additionalProperties) { this.id = id; this.description = description; this.version = version; this.splitterId = splitterId; this.createdAt = createdAt; + this.createdBy = createdBy; this.additionalProperties = additionalProperties; } @@ -104,12 +108,26 @@ public OffsetDateTime getCreatedAt() { return createdAt; } + @JsonIgnore + public Optional getCreatedBy() { + if (createdBy == null) { + return Optional.empty(); + } + return createdBy; + } + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) @JsonProperty("description") private Optional _getDescription() { return description; } + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("createdBy") + private Optional _getCreatedBy() { + return createdBy; + } + @java.lang.Override public boolean equals(Object other) { if (this == other) return true; @@ -126,12 +144,13 @@ private boolean equalTo(SplitterVersionSummary other) { && description.equals(other.description) && version.equals(other.version) && splitterId.equals(other.splitterId) - && createdAt.equals(other.createdAt); + && createdAt.equals(other.createdAt) + && createdBy.equals(other.createdBy); } @java.lang.Override public int hashCode() { - return Objects.hash(this.id, this.description, this.version, this.splitterId, this.createdAt); + return Objects.hash(this.id, this.description, this.version, this.splitterId, this.createdAt, this.createdBy); } @java.lang.Override @@ -185,6 +204,12 @@ public interface _FinalStage { _FinalStage description(String description); _FinalStage description(Nullable description); + + _FinalStage createdBy(Optional createdBy); + + _FinalStage createdBy(CreatedBy createdBy); + + _FinalStage createdBy(Nullable createdBy); } @JsonIgnoreProperties(ignoreUnknown = true) @@ -197,6 +222,8 @@ public static final class Builder implements IdStage, VersionStage, SplitterIdSt private OffsetDateTime createdAt; + private Optional createdBy = Optional.empty(); + private Optional description = Optional.empty(); @JsonAnySetter @@ -211,6 +238,7 @@ public Builder from(SplitterVersionSummary other) { version(other.getVersion()); splitterId(other.getSplitterId()); createdAt(other.getCreatedAt()); + createdBy(other.getCreatedBy()); return this; } @@ -263,6 +291,31 @@ public _FinalStage createdAt(@NotNull OffsetDateTime createdAt) { return this; } + @java.lang.Override + public _FinalStage createdBy(Nullable createdBy) { + if (createdBy.isNull()) { + this.createdBy = null; + } else if (createdBy.isEmpty()) { + this.createdBy = Optional.empty(); + } else { + this.createdBy = Optional.of(createdBy.get()); + } + return this; + } + + @java.lang.Override + public _FinalStage createdBy(CreatedBy createdBy) { + this.createdBy = Optional.ofNullable(createdBy); + return this; + } + + @java.lang.Override + @JsonSetter(value = "createdBy", nulls = Nulls.SKIP) + public _FinalStage createdBy(Optional createdBy) { + this.createdBy = createdBy; + return this; + } + /** *

A description of this version of the splitter.

*

Example: "Updated split rules for multi-invoice packets"

@@ -304,7 +357,8 @@ public _FinalStage description(Optional description) { @java.lang.Override public SplitterVersionSummary build() { - return new SplitterVersionSummary(id, description, version, splitterId, createdAt, additionalProperties); + return new SplitterVersionSummary( + id, description, version, splitterId, createdAt, createdBy, additionalProperties); } } } diff --git a/src/main/java/ai/extend/types/WebhookEndpoint.java b/src/main/java/ai/extend/types/WebhookEndpoint.java index ba24302..5f0b269 100644 --- a/src/main/java/ai/extend/types/WebhookEndpoint.java +++ b/src/main/java/ai/extend/types/WebhookEndpoint.java @@ -43,6 +43,8 @@ public final class WebhookEndpoint { private final OffsetDateTime createdAt; + private final Optional createdBy; + private final Map additionalProperties; private WebhookEndpoint( @@ -54,6 +56,7 @@ private WebhookEndpoint( String apiVersion, Optional advancedOptions, OffsetDateTime createdAt, + Optional createdBy, Map additionalProperties) { this.id = id; this.url = url; @@ -63,6 +66,7 @@ private WebhookEndpoint( this.apiVersion = apiVersion; this.advancedOptions = advancedOptions; this.createdAt = createdAt; + this.createdBy = createdBy; this.additionalProperties = additionalProperties; } @@ -132,12 +136,26 @@ public OffsetDateTime getCreatedAt() { return createdAt; } + @JsonIgnore + public Optional getCreatedBy() { + if (createdBy == null) { + return Optional.empty(); + } + return createdBy; + } + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) @JsonProperty("advancedOptions") private Optional _getAdvancedOptions() { return advancedOptions; } + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("createdBy") + private Optional _getCreatedBy() { + return createdBy; + } + @java.lang.Override public boolean equals(Object other) { if (this == other) return true; @@ -157,7 +175,8 @@ private boolean equalTo(WebhookEndpoint other) { && enabledEvents.equals(other.enabledEvents) && apiVersion.equals(other.apiVersion) && advancedOptions.equals(other.advancedOptions) - && createdAt.equals(other.createdAt); + && createdAt.equals(other.createdAt) + && createdBy.equals(other.createdBy); } @java.lang.Override @@ -170,7 +189,8 @@ public int hashCode() { this.enabledEvents, this.apiVersion, this.advancedOptions, - this.createdAt); + this.createdAt, + this.createdBy); } @java.lang.Override @@ -240,6 +260,12 @@ public interface _FinalStage { _FinalStage advancedOptions(WebhookAdvancedOptions advancedOptions); _FinalStage advancedOptions(Nullable advancedOptions); + + _FinalStage createdBy(Optional createdBy); + + _FinalStage createdBy(CreatedBy createdBy); + + _FinalStage createdBy(Nullable createdBy); } @JsonIgnoreProperties(ignoreUnknown = true) @@ -257,6 +283,8 @@ public static final class Builder private OffsetDateTime createdAt; + private Optional createdBy = Optional.empty(); + private Optional advancedOptions = Optional.empty(); private List enabledEvents = new ArrayList<>(); @@ -276,6 +304,7 @@ public Builder from(WebhookEndpoint other) { apiVersion(other.getApiVersion()); advancedOptions(other.getAdvancedOptions()); createdAt(other.getCreatedAt()); + createdBy(other.getCreatedBy()); return this; } @@ -341,6 +370,31 @@ public _FinalStage createdAt(@NotNull OffsetDateTime createdAt) { return this; } + @java.lang.Override + public _FinalStage createdBy(Nullable createdBy) { + if (createdBy.isNull()) { + this.createdBy = null; + } else if (createdBy.isEmpty()) { + this.createdBy = Optional.empty(); + } else { + this.createdBy = Optional.of(createdBy.get()); + } + return this; + } + + @java.lang.Override + public _FinalStage createdBy(CreatedBy createdBy) { + this.createdBy = Optional.ofNullable(createdBy); + return this; + } + + @java.lang.Override + @JsonSetter(value = "createdBy", nulls = Nulls.SKIP) + public _FinalStage createdBy(Optional createdBy) { + this.createdBy = createdBy; + return this; + } + /** *

Advanced configuration options for the webhook endpoint, including custom headers and payload delivery settings.

* @return Reference to {@code this} so that method calls can be chained together. @@ -415,7 +469,16 @@ public _FinalStage enabledEvents(List enabledEvents) { @java.lang.Override public WebhookEndpoint build() { return new WebhookEndpoint( - id, url, name, status, enabledEvents, apiVersion, advancedOptions, createdAt, additionalProperties); + id, + url, + name, + status, + enabledEvents, + apiVersion, + advancedOptions, + createdAt, + createdBy, + additionalProperties); } } } diff --git a/src/main/java/ai/extend/types/WebhookEndpointCreate.java b/src/main/java/ai/extend/types/WebhookEndpointCreate.java index ef4cb2d..0aa7da7 100644 --- a/src/main/java/ai/extend/types/WebhookEndpointCreate.java +++ b/src/main/java/ai/extend/types/WebhookEndpointCreate.java @@ -45,6 +45,8 @@ public final class WebhookEndpointCreate { private final OffsetDateTime createdAt; + private final Optional createdBy; + private final Map additionalProperties; private WebhookEndpointCreate( @@ -57,6 +59,7 @@ private WebhookEndpointCreate( Optional advancedOptions, String signingSecret, OffsetDateTime createdAt, + Optional createdBy, Map additionalProperties) { this.id = id; this.url = url; @@ -67,6 +70,7 @@ private WebhookEndpointCreate( this.advancedOptions = advancedOptions; this.signingSecret = signingSecret; this.createdAt = createdAt; + this.createdBy = createdBy; this.additionalProperties = additionalProperties; } @@ -145,12 +149,26 @@ public OffsetDateTime getCreatedAt() { return createdAt; } + @JsonIgnore + public Optional getCreatedBy() { + if (createdBy == null) { + return Optional.empty(); + } + return createdBy; + } + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) @JsonProperty("advancedOptions") private Optional _getAdvancedOptions() { return advancedOptions; } + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("createdBy") + private Optional _getCreatedBy() { + return createdBy; + } + @java.lang.Override public boolean equals(Object other) { if (this == other) return true; @@ -171,7 +189,8 @@ private boolean equalTo(WebhookEndpointCreate other) { && apiVersion.equals(other.apiVersion) && advancedOptions.equals(other.advancedOptions) && signingSecret.equals(other.signingSecret) - && createdAt.equals(other.createdAt); + && createdAt.equals(other.createdAt) + && createdBy.equals(other.createdBy); } @java.lang.Override @@ -185,7 +204,8 @@ public int hashCode() { this.apiVersion, this.advancedOptions, this.signingSecret, - this.createdAt); + this.createdAt, + this.createdBy); } @java.lang.Override @@ -263,6 +283,12 @@ public interface _FinalStage { _FinalStage advancedOptions(WebhookAdvancedOptions advancedOptions); _FinalStage advancedOptions(Nullable advancedOptions); + + _FinalStage createdBy(Optional createdBy); + + _FinalStage createdBy(CreatedBy createdBy); + + _FinalStage createdBy(Nullable createdBy); } @JsonIgnoreProperties(ignoreUnknown = true) @@ -289,6 +315,8 @@ public static final class Builder private OffsetDateTime createdAt; + private Optional createdBy = Optional.empty(); + private Optional advancedOptions = Optional.empty(); private List enabledEvents = new ArrayList<>(); @@ -309,6 +337,7 @@ public Builder from(WebhookEndpointCreate other) { advancedOptions(other.getAdvancedOptions()); signingSecret(other.getSigningSecret()); createdAt(other.getCreatedAt()); + createdBy(other.getCreatedBy()); return this; } @@ -388,6 +417,31 @@ public _FinalStage createdAt(@NotNull OffsetDateTime createdAt) { return this; } + @java.lang.Override + public _FinalStage createdBy(Nullable createdBy) { + if (createdBy.isNull()) { + this.createdBy = null; + } else if (createdBy.isEmpty()) { + this.createdBy = Optional.empty(); + } else { + this.createdBy = Optional.of(createdBy.get()); + } + return this; + } + + @java.lang.Override + public _FinalStage createdBy(CreatedBy createdBy) { + this.createdBy = Optional.ofNullable(createdBy); + return this; + } + + @java.lang.Override + @JsonSetter(value = "createdBy", nulls = Nulls.SKIP) + public _FinalStage createdBy(Optional createdBy) { + this.createdBy = createdBy; + return this; + } + /** *

Advanced configuration options for the webhook endpoint, including custom headers and payload delivery settings.

* @return Reference to {@code this} so that method calls can be chained together. @@ -471,6 +525,7 @@ public WebhookEndpointCreate build() { advancedOptions, signingSecret, createdAt, + createdBy, additionalProperties); } } diff --git a/src/main/java/ai/extend/types/Workflow.java b/src/main/java/ai/extend/types/Workflow.java index 28fcedc..c4cca3b 100644 --- a/src/main/java/ai/extend/types/Workflow.java +++ b/src/main/java/ai/extend/types/Workflow.java @@ -3,18 +3,23 @@ */ package ai.extend.types; +import ai.extend.core.Nullable; +import ai.extend.core.NullableNonemptyFilter; import ai.extend.core.ObjectMappers; import com.fasterxml.jackson.annotation.JsonAnyGetter; import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; import java.time.OffsetDateTime; import java.util.HashMap; import java.util.Map; import java.util.Objects; +import java.util.Optional; import org.jetbrains.annotations.NotNull; @JsonInclude(JsonInclude.Include.NON_ABSENT) @@ -30,6 +35,8 @@ public final class Workflow { private final WorkflowVersion draftVersion; + private final Optional createdBy; + private final Map additionalProperties; private Workflow( @@ -38,12 +45,14 @@ private Workflow( OffsetDateTime createdAt, OffsetDateTime updatedAt, WorkflowVersion draftVersion, + Optional createdBy, Map additionalProperties) { this.id = id; this.name = name; this.createdAt = createdAt; this.updatedAt = updatedAt; this.draftVersion = draftVersion; + this.createdBy = createdBy; this.additionalProperties = additionalProperties; } @@ -86,6 +95,20 @@ public WorkflowVersion getDraftVersion() { return draftVersion; } + @JsonIgnore + public Optional getCreatedBy() { + if (createdBy == null) { + return Optional.empty(); + } + return createdBy; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("createdBy") + private Optional _getCreatedBy() { + return createdBy; + } + @java.lang.Override public boolean equals(Object other) { if (this == other) return true; @@ -102,12 +125,13 @@ private boolean equalTo(Workflow other) { && name.equals(other.name) && createdAt.equals(other.createdAt) && updatedAt.equals(other.updatedAt) - && draftVersion.equals(other.draftVersion); + && draftVersion.equals(other.draftVersion) + && createdBy.equals(other.createdBy); } @java.lang.Override public int hashCode() { - return Objects.hash(this.id, this.name, this.createdAt, this.updatedAt, this.draftVersion); + return Objects.hash(this.id, this.name, this.createdAt, this.updatedAt, this.draftVersion, this.createdBy); } @java.lang.Override @@ -149,6 +173,12 @@ public interface DraftVersionStage { public interface _FinalStage { Workflow build(); + + _FinalStage createdBy(Optional createdBy); + + _FinalStage createdBy(CreatedBy createdBy); + + _FinalStage createdBy(Nullable createdBy); } @JsonIgnoreProperties(ignoreUnknown = true) @@ -164,6 +194,8 @@ public static final class Builder private WorkflowVersion draftVersion; + private Optional createdBy = Optional.empty(); + @JsonAnySetter private Map additionalProperties = new HashMap<>(); @@ -176,6 +208,7 @@ public Builder from(Workflow other) { createdAt(other.getCreatedAt()); updatedAt(other.getUpdatedAt()); draftVersion(other.getDraftVersion()); + createdBy(other.getCreatedBy()); return this; } @@ -224,9 +257,34 @@ public _FinalStage draftVersion(@NotNull WorkflowVersion draftVersion) { return this; } + @java.lang.Override + public _FinalStage createdBy(Nullable createdBy) { + if (createdBy.isNull()) { + this.createdBy = null; + } else if (createdBy.isEmpty()) { + this.createdBy = Optional.empty(); + } else { + this.createdBy = Optional.of(createdBy.get()); + } + return this; + } + + @java.lang.Override + public _FinalStage createdBy(CreatedBy createdBy) { + this.createdBy = Optional.ofNullable(createdBy); + return this; + } + + @java.lang.Override + @JsonSetter(value = "createdBy", nulls = Nulls.SKIP) + public _FinalStage createdBy(Optional createdBy) { + this.createdBy = createdBy; + return this; + } + @java.lang.Override public Workflow build() { - return new Workflow(id, name, createdAt, updatedAt, draftVersion, additionalProperties); + return new Workflow(id, name, createdAt, updatedAt, draftVersion, createdBy, additionalProperties); } } } diff --git a/src/main/java/ai/extend/types/WorkflowRunPackage.java b/src/main/java/ai/extend/types/WorkflowRunPackage.java new file mode 100644 index 0000000..a5bca0c --- /dev/null +++ b/src/main/java/ai/extend/types/WorkflowRunPackage.java @@ -0,0 +1,114 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package ai.extend.types; + +import ai.extend.core.ObjectMappers; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = WorkflowRunPackage.Builder.class) +public final class WorkflowRunPackage { + private final List files; + + private final Map additionalProperties; + + private WorkflowRunPackage(List files, Map additionalProperties) { + this.files = files; + this.additionalProperties = additionalProperties; + } + + /** + * @return The files to process, in submission order. Each entry can be a URL or an existing Extend file ID. Raw text and base64 inputs are not supported for package runs. + *

Duplicate file IDs and duplicate URLs are rejected — each file may appear only once. A URL and a file ID are never treated as duplicates of each other, even if they resolve to the same document.

+ */ + @JsonProperty("files") + public List getFiles() { + return files; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof WorkflowRunPackage && equalTo((WorkflowRunPackage) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(WorkflowRunPackage other) { + return files.equals(other.files); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.files); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private List files = new ArrayList<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(WorkflowRunPackage other) { + files(other.getFiles()); + return this; + } + + /** + *

The files to process, in submission order. Each entry can be a URL or an existing Extend file ID. Raw text and base64 inputs are not supported for package runs.

+ *

Duplicate file IDs and duplicate URLs are rejected — each file may appear only once. A URL and a file ID are never treated as duplicates of each other, even if they resolve to the same document.

+ */ + @JsonSetter(value = "files", nulls = Nulls.SKIP) + public Builder files(List files) { + this.files.clear(); + if (files != null) { + this.files.addAll(files); + } + return this; + } + + public Builder addFiles(WorkflowRunPackageFilesItem files) { + this.files.add(files); + return this; + } + + public Builder addAllFiles(List files) { + if (files != null) { + this.files.addAll(files); + } + return this; + } + + public WorkflowRunPackage build() { + return new WorkflowRunPackage(files, additionalProperties); + } + } +} diff --git a/src/main/java/ai/extend/types/WorkflowRunPackageFilesItem.java b/src/main/java/ai/extend/types/WorkflowRunPackageFilesItem.java new file mode 100644 index 0000000..0538832 --- /dev/null +++ b/src/main/java/ai/extend/types/WorkflowRunPackageFilesItem.java @@ -0,0 +1,96 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package ai.extend.types; + +import ai.extend.core.ObjectMappers; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.core.JsonParseException; +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.databind.DeserializationContext; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.fasterxml.jackson.databind.deser.std.StdDeserializer; +import java.io.IOException; +import java.util.Objects; + +@JsonDeserialize(using = WorkflowRunPackageFilesItem.Deserializer.class) +public final class WorkflowRunPackageFilesItem { + private final Object value; + + private final int type; + + private WorkflowRunPackageFilesItem(Object value, int type) { + this.value = value; + this.type = type; + } + + @JsonValue + public Object get() { + return this.value; + } + + @SuppressWarnings("unchecked") + public T visit(Visitor visitor) { + if (this.type == 0) { + return visitor.visit((FileFromUrl) this.value); + } else if (this.type == 1) { + return visitor.visit((FileFromId) this.value); + } + throw new IllegalStateException("Failed to visit value. This should never happen."); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof WorkflowRunPackageFilesItem && equalTo((WorkflowRunPackageFilesItem) other); + } + + private boolean equalTo(WorkflowRunPackageFilesItem other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return this.value.toString(); + } + + public static WorkflowRunPackageFilesItem of(FileFromUrl value) { + return new WorkflowRunPackageFilesItem(value, 0); + } + + public static WorkflowRunPackageFilesItem of(FileFromId value) { + return new WorkflowRunPackageFilesItem(value, 1); + } + + public interface Visitor { + T visit(FileFromUrl value); + + T visit(FileFromId value); + } + + static final class Deserializer extends StdDeserializer { + Deserializer() { + super(WorkflowRunPackageFilesItem.class); + } + + @java.lang.Override + public WorkflowRunPackageFilesItem deserialize(JsonParser p, DeserializationContext context) + throws IOException { + Object value = p.readValueAs(Object.class); + try { + return of(ObjectMappers.JSON_MAPPER.convertValue(value, FileFromUrl.class)); + } catch (RuntimeException e) { + } + try { + return of(ObjectMappers.JSON_MAPPER.convertValue(value, FileFromId.class)); + } catch (RuntimeException e) { + } + throw new JsonParseException(p, "Failed to deserialize"); + } + } +} diff --git a/src/main/java/ai/extend/types/WorkflowSummary.java b/src/main/java/ai/extend/types/WorkflowSummary.java index 7d360dd..04019b9 100644 --- a/src/main/java/ai/extend/types/WorkflowSummary.java +++ b/src/main/java/ai/extend/types/WorkflowSummary.java @@ -3,18 +3,23 @@ */ package ai.extend.types; +import ai.extend.core.Nullable; +import ai.extend.core.NullableNonemptyFilter; import ai.extend.core.ObjectMappers; import com.fasterxml.jackson.annotation.JsonAnyGetter; import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; import java.time.OffsetDateTime; import java.util.HashMap; import java.util.Map; import java.util.Objects; +import java.util.Optional; import org.jetbrains.annotations.NotNull; @JsonInclude(JsonInclude.Include.NON_ABSENT) @@ -28,6 +33,8 @@ public final class WorkflowSummary { private final OffsetDateTime updatedAt; + private final Optional createdBy; + private final Map additionalProperties; private WorkflowSummary( @@ -35,11 +42,13 @@ private WorkflowSummary( String name, OffsetDateTime createdAt, OffsetDateTime updatedAt, + Optional createdBy, Map additionalProperties) { this.id = id; this.name = name; this.createdAt = createdAt; this.updatedAt = updatedAt; + this.createdBy = createdBy; this.additionalProperties = additionalProperties; } @@ -77,6 +86,20 @@ public OffsetDateTime getUpdatedAt() { return updatedAt; } + @JsonIgnore + public Optional getCreatedBy() { + if (createdBy == null) { + return Optional.empty(); + } + return createdBy; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("createdBy") + private Optional _getCreatedBy() { + return createdBy; + } + @java.lang.Override public boolean equals(Object other) { if (this == other) return true; @@ -92,12 +115,13 @@ private boolean equalTo(WorkflowSummary other) { return id.equals(other.id) && name.equals(other.name) && createdAt.equals(other.createdAt) - && updatedAt.equals(other.updatedAt); + && updatedAt.equals(other.updatedAt) + && createdBy.equals(other.createdBy); } @java.lang.Override public int hashCode() { - return Objects.hash(this.id, this.name, this.createdAt, this.updatedAt); + return Objects.hash(this.id, this.name, this.createdAt, this.updatedAt, this.createdBy); } @java.lang.Override @@ -135,6 +159,12 @@ public interface UpdatedAtStage { public interface _FinalStage { WorkflowSummary build(); + + _FinalStage createdBy(Optional createdBy); + + _FinalStage createdBy(CreatedBy createdBy); + + _FinalStage createdBy(Nullable createdBy); } @JsonIgnoreProperties(ignoreUnknown = true) @@ -147,6 +177,8 @@ public static final class Builder implements IdStage, NameStage, CreatedAtStage, private OffsetDateTime updatedAt; + private Optional createdBy = Optional.empty(); + @JsonAnySetter private Map additionalProperties = new HashMap<>(); @@ -158,6 +190,7 @@ public Builder from(WorkflowSummary other) { name(other.getName()); createdAt(other.getCreatedAt()); updatedAt(other.getUpdatedAt()); + createdBy(other.getCreatedBy()); return this; } @@ -199,9 +232,34 @@ public _FinalStage updatedAt(@NotNull OffsetDateTime updatedAt) { return this; } + @java.lang.Override + public _FinalStage createdBy(Nullable createdBy) { + if (createdBy.isNull()) { + this.createdBy = null; + } else if (createdBy.isEmpty()) { + this.createdBy = Optional.empty(); + } else { + this.createdBy = Optional.of(createdBy.get()); + } + return this; + } + + @java.lang.Override + public _FinalStage createdBy(CreatedBy createdBy) { + this.createdBy = Optional.ofNullable(createdBy); + return this; + } + + @java.lang.Override + @JsonSetter(value = "createdBy", nulls = Nulls.SKIP) + public _FinalStage createdBy(Optional createdBy) { + this.createdBy = createdBy; + return this; + } + @java.lang.Override public WorkflowSummary build() { - return new WorkflowSummary(id, name, createdAt, updatedAt, additionalProperties); + return new WorkflowSummary(id, name, createdAt, updatedAt, createdBy, additionalProperties); } } } diff --git a/src/main/java/ai/extend/types/WorkflowVersion.java b/src/main/java/ai/extend/types/WorkflowVersion.java index 0f0c9d6..e5976a7 100644 --- a/src/main/java/ai/extend/types/WorkflowVersion.java +++ b/src/main/java/ai/extend/types/WorkflowVersion.java @@ -37,6 +37,8 @@ public final class WorkflowVersion { private final OffsetDateTime createdAt; + private final Optional createdBy; + private final Map additionalProperties; private WorkflowVersion( @@ -45,12 +47,14 @@ private WorkflowVersion( Optional name, List steps, OffsetDateTime createdAt, + Optional createdBy, Map additionalProperties) { this.id = id; this.version = version; this.name = name; this.steps = steps; this.createdAt = createdAt; + this.createdBy = createdBy; this.additionalProperties = additionalProperties; } @@ -102,12 +106,26 @@ public OffsetDateTime getCreatedAt() { return createdAt; } + @JsonIgnore + public Optional getCreatedBy() { + if (createdBy == null) { + return Optional.empty(); + } + return createdBy; + } + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) @JsonProperty("name") private Optional _getName() { return name; } + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("createdBy") + private Optional _getCreatedBy() { + return createdBy; + } + @java.lang.Override public boolean equals(Object other) { if (this == other) return true; @@ -124,12 +142,13 @@ private boolean equalTo(WorkflowVersion other) { && version.equals(other.version) && name.equals(other.name) && steps.equals(other.steps) - && createdAt.equals(other.createdAt); + && createdAt.equals(other.createdAt) + && createdBy.equals(other.createdBy); } @java.lang.Override public int hashCode() { - return Objects.hash(this.id, this.version, this.name, this.steps, this.createdAt); + return Objects.hash(this.id, this.version, this.name, this.steps, this.createdAt, this.createdBy); } @java.lang.Override @@ -181,6 +200,12 @@ public interface _FinalStage { _FinalStage addSteps(WorkflowStepDefinition steps); _FinalStage addAllSteps(List steps); + + _FinalStage createdBy(Optional createdBy); + + _FinalStage createdBy(CreatedBy createdBy); + + _FinalStage createdBy(Nullable createdBy); } @JsonIgnoreProperties(ignoreUnknown = true) @@ -191,6 +216,8 @@ public static final class Builder implements IdStage, VersionStage, CreatedAtSta private OffsetDateTime createdAt; + private Optional createdBy = Optional.empty(); + private List steps = new ArrayList<>(); private Optional name = Optional.empty(); @@ -207,6 +234,7 @@ public Builder from(WorkflowVersion other) { name(other.getName()); steps(other.getSteps()); createdAt(other.getCreatedAt()); + createdBy(other.getCreatedBy()); return this; } @@ -241,6 +269,31 @@ public _FinalStage createdAt(@NotNull OffsetDateTime createdAt) { return this; } + @java.lang.Override + public _FinalStage createdBy(Nullable createdBy) { + if (createdBy.isNull()) { + this.createdBy = null; + } else if (createdBy.isEmpty()) { + this.createdBy = Optional.empty(); + } else { + this.createdBy = Optional.of(createdBy.get()); + } + return this; + } + + @java.lang.Override + public _FinalStage createdBy(CreatedBy createdBy) { + this.createdBy = Optional.ofNullable(createdBy); + return this; + } + + @java.lang.Override + @JsonSetter(value = "createdBy", nulls = Nulls.SKIP) + public _FinalStage createdBy(Optional createdBy) { + this.createdBy = createdBy; + return this; + } + /** *

The step definitions for this version.

* @return Reference to {@code this} so that method calls can be chained together. @@ -314,7 +367,7 @@ public _FinalStage name(Optional name) { @java.lang.Override public WorkflowVersion build() { - return new WorkflowVersion(id, version, name, steps, createdAt, additionalProperties); + return new WorkflowVersion(id, version, name, steps, createdAt, createdBy, additionalProperties); } } } diff --git a/src/main/java/ai/extend/types/WorkflowVersionSummary.java b/src/main/java/ai/extend/types/WorkflowVersionSummary.java index 3b7e7e7..49bcc2e 100644 --- a/src/main/java/ai/extend/types/WorkflowVersionSummary.java +++ b/src/main/java/ai/extend/types/WorkflowVersionSummary.java @@ -33,6 +33,8 @@ public final class WorkflowVersionSummary { private final OffsetDateTime createdAt; + private final Optional createdBy; + private final Map additionalProperties; private WorkflowVersionSummary( @@ -40,11 +42,13 @@ private WorkflowVersionSummary( String version, Optional name, OffsetDateTime createdAt, + Optional createdBy, Map additionalProperties) { this.id = id; this.version = version; this.name = name; this.createdAt = createdAt; + this.createdBy = createdBy; this.additionalProperties = additionalProperties; } @@ -88,12 +92,26 @@ public OffsetDateTime getCreatedAt() { return createdAt; } + @JsonIgnore + public Optional getCreatedBy() { + if (createdBy == null) { + return Optional.empty(); + } + return createdBy; + } + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) @JsonProperty("name") private Optional _getName() { return name; } + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("createdBy") + private Optional _getCreatedBy() { + return createdBy; + } + @java.lang.Override public boolean equals(Object other) { if (this == other) return true; @@ -109,12 +127,13 @@ private boolean equalTo(WorkflowVersionSummary other) { return id.equals(other.id) && version.equals(other.version) && name.equals(other.name) - && createdAt.equals(other.createdAt); + && createdAt.equals(other.createdAt) + && createdBy.equals(other.createdBy); } @java.lang.Override public int hashCode() { - return Objects.hash(this.id, this.version, this.name, this.createdAt); + return Objects.hash(this.id, this.version, this.name, this.createdAt, this.createdBy); } @java.lang.Override @@ -157,6 +176,12 @@ public interface _FinalStage { _FinalStage name(String name); _FinalStage name(Nullable name); + + _FinalStage createdBy(Optional createdBy); + + _FinalStage createdBy(CreatedBy createdBy); + + _FinalStage createdBy(Nullable createdBy); } @JsonIgnoreProperties(ignoreUnknown = true) @@ -167,6 +192,8 @@ public static final class Builder implements IdStage, VersionStage, CreatedAtSta private OffsetDateTime createdAt; + private Optional createdBy = Optional.empty(); + private Optional name = Optional.empty(); @JsonAnySetter @@ -180,6 +207,7 @@ public Builder from(WorkflowVersionSummary other) { version(other.getVersion()); name(other.getName()); createdAt(other.getCreatedAt()); + createdBy(other.getCreatedBy()); return this; } @@ -214,6 +242,31 @@ public _FinalStage createdAt(@NotNull OffsetDateTime createdAt) { return this; } + @java.lang.Override + public _FinalStage createdBy(Nullable createdBy) { + if (createdBy.isNull()) { + this.createdBy = null; + } else if (createdBy.isEmpty()) { + this.createdBy = Optional.empty(); + } else { + this.createdBy = Optional.of(createdBy.get()); + } + return this; + } + + @java.lang.Override + public _FinalStage createdBy(CreatedBy createdBy) { + this.createdBy = Optional.ofNullable(createdBy); + return this; + } + + @java.lang.Override + @JsonSetter(value = "createdBy", nulls = Nulls.SKIP) + public _FinalStage createdBy(Optional createdBy) { + this.createdBy = createdBy; + return this; + } + /** *

The name of the workflow version.

* @return Reference to {@code this} so that method calls can be chained together. @@ -252,7 +305,7 @@ public _FinalStage name(Optional name) { @java.lang.Override public WorkflowVersionSummary build() { - return new WorkflowVersionSummary(id, version, name, createdAt, additionalProperties); + return new WorkflowVersionSummary(id, version, name, createdAt, createdBy, additionalProperties); } } }