Class ExtractRun.Builder
- java.lang.Object
-
- ai.extend.types.ExtractRun.Builder
-
- All Implemented Interfaces:
ExtractRun._FinalStage,ExtractRun.ConfigStage,ExtractRun.CreatedAtStage,ExtractRun.DashboardUrlStage,ExtractRun.EditedStage,ExtractRun.IdStage,ExtractRun.ReviewedStage,ExtractRun.StatusStage,ExtractRun.UpdatedAtStage
- Enclosing class:
- ExtractRun
public static final class ExtractRun.Builder extends java.lang.Object implements ExtractRun.IdStage, ExtractRun.StatusStage, ExtractRun.ReviewedStage, ExtractRun.EditedStage, ExtractRun.ConfigStage, ExtractRun.DashboardUrlStage, ExtractRun.CreatedAtStage, ExtractRun.UpdatedAtStage, ExtractRun._FinalStage
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ExtractRunbuild()ExtractRun.DashboardUrlStageconfig(ExtractConfig config)The configuration used for this extract run.ExtractRun.UpdatedAtStagecreatedAt(java.time.OffsetDateTime createdAt)ExtractRun.CreatedAtStagedashboardUrl(java.lang.String dashboardUrl)The URL to view the extract run in the Extend dashboard.ExtractRun.ConfigStageedited(boolean edited)Indicates whether the run results have been edited during review.ExtractRun._FinalStageedits(Nullable<java.util.Map<java.lang.String,java.util.Optional<ExtractOutputEdits>>> edits)Details of edits made during review.ExtractRun._FinalStageedits(java.util.Map<java.lang.String,java.util.Optional<ExtractOutputEdits>> edits)Details of edits made during review.ExtractRun._FinalStageedits(java.util.Optional<java.util.Map<java.lang.String,java.util.Optional<ExtractOutputEdits>>> edits)Details of edits made during review.ExtractRun._FinalStageextractor(Nullable<ExtractorSummary> extractor)The extractor that was used for this run.ExtractRun._FinalStageextractor(ExtractorSummary extractor)The extractor that was used for this run.ExtractRun._FinalStageextractor(java.util.Optional<ExtractorSummary> extractor)The extractor that was used for this run.ExtractRun._FinalStageextractorVersion(Nullable<ExtractorVersionSummary> extractorVersion)The version of the extractor that was used for this run.ExtractRun._FinalStageextractorVersion(ExtractorVersionSummary extractorVersion)The version of the extractor that was used for this run.ExtractRun._FinalStageextractorVersion(java.util.Optional<ExtractorVersionSummary> extractorVersion)The version of the extractor that was used for this run.ExtractRun._FinalStagefailureMessage(Nullable<java.lang.String> failureMessage)A detailed message about the failure.ExtractRun._FinalStagefailureMessage(java.lang.String failureMessage)A detailed message about the failure.ExtractRun._FinalStagefailureMessage(java.util.Optional<java.lang.String> failureMessage)A detailed message about the failure.ExtractRun._FinalStagefailureReason(Nullable<java.lang.String> failureReason)The reason for failure.ExtractRun._FinalStagefailureReason(java.lang.String failureReason)The reason for failure.ExtractRun._FinalStagefailureReason(java.util.Optional<java.lang.String> failureReason)The reason for failure.ExtractRun._FinalStagefile(Nullable<FileSummary> file)The file that was processed.ExtractRun._FinalStagefile(FileSummary file)The file that was processed.ExtractRun._FinalStagefile(java.util.Optional<FileSummary> file)The file that was processed.ExtractRun._FinalStagefiles(Nullable<java.util.List<FileSummary>> files)The files that were processed, in the order they were submitted.ExtractRun._FinalStagefiles(java.util.List<FileSummary> files)The files that were processed, in the order they were submitted.ExtractRun._FinalStagefiles(java.util.Optional<java.util.List<FileSummary>> files)The files that were processed, in the order they were submitted.ExtractRun.Builderfrom(ExtractRun other)ExtractRun.StatusStageid(java.lang.String id)The unique identifier for this extract run.ExtractRun._FinalStageinitialOutput(Nullable<ExtractOutput> initialOutput)The initial output from the extract run, before any review edits.ExtractRun._FinalStageinitialOutput(ExtractOutput initialOutput)The initial output from the extract run, before any review edits.ExtractRun._FinalStageinitialOutput(java.util.Optional<ExtractOutput> initialOutput)The initial output from the extract run, before any review edits.ExtractRun._FinalStagemetadata(Nullable<java.util.Map<java.lang.String,java.lang.Object>> metadata)Any metadata that was provided when creating the extract run.ExtractRun._FinalStagemetadata(java.util.Map<java.lang.String,java.lang.Object> metadata)Any metadata that was provided when creating the extract run.ExtractRun._FinalStagemetadata(java.util.Optional<java.util.Map<java.lang.String,java.lang.Object>> metadata)Any metadata that was provided when creating the extract run.ExtractRun._FinalStageoutput(Nullable<ExtractOutput> output)The final output, either reviewed or initial.ExtractRun._FinalStageoutput(ExtractOutput output)The final output, either reviewed or initial.ExtractRun._FinalStageoutput(java.util.Optional<ExtractOutput> output)The final output, either reviewed or initial.ExtractRun._FinalStageparseRunId(Nullable<java.lang.String> parseRunId)The ID of the parse run that was used for this extract run.ExtractRun._FinalStageparseRunId(java.lang.String parseRunId)The ID of the parse run that was used for this extract run.ExtractRun._FinalStageparseRunId(java.util.Optional<java.lang.String> parseRunId)The ID of the parse run that was used for this extract run.ExtractRun.EditedStagereviewed(boolean reviewed)Indicates whether the run has been reviewed by a human.ExtractRun._FinalStagereviewedOutput(Nullable<ExtractOutput> reviewedOutput)The output after human review.ExtractRun._FinalStagereviewedOutput(ExtractOutput reviewedOutput)The output after human review.ExtractRun._FinalStagereviewedOutput(java.util.Optional<ExtractOutput> reviewedOutput)The output after human review.ExtractRun.ReviewedStagestatus(ProcessorRunStatus status)ExtractRun._FinalStageupdatedAt(java.time.OffsetDateTime updatedAt)ExtractRun._FinalStageusage(Nullable<RunUsage> usage)Usage credits consumed by this extract run.ExtractRun._FinalStageusage(RunUsage usage)Usage credits consumed by this extract run.ExtractRun._FinalStageusage(java.util.Optional<RunUsage> usage)Usage credits consumed by this extract run.
-
-
-
Method Detail
-
from
public ExtractRun.Builder from(ExtractRun other)
- Specified by:
fromin interfaceExtractRun.IdStage
-
id
public ExtractRun.StatusStage id(@NotNull java.lang.String id)
The unique identifier for this extract run.
Example:
"exr_Xj8mK2pL9nR4vT7qY5wZ"The unique identifier for this extract run.
Example:
"exr_Xj8mK2pL9nR4vT7qY5wZ"- Specified by:
idin interfaceExtractRun.IdStage- Returns:
- Reference to
thisso that method calls can be chained together.
-
status
public ExtractRun.ReviewedStage status(@NotNull ProcessorRunStatus status)
- Specified by:
statusin interfaceExtractRun.StatusStage
-
reviewed
public ExtractRun.EditedStage reviewed(boolean reviewed)
Indicates whether the run has been reviewed by a human.
Indicates whether the run has been reviewed by a human.
- Specified by:
reviewedin interfaceExtractRun.ReviewedStage- Returns:
- Reference to
thisso that method calls can be chained together.
-
edited
public ExtractRun.ConfigStage edited(boolean edited)
Indicates whether the run results have been edited during review.
Indicates whether the run results have been edited during review.
- Specified by:
editedin interfaceExtractRun.EditedStage- Returns:
- Reference to
thisso that method calls can be chained together.
-
config
public ExtractRun.DashboardUrlStage config(@NotNull ExtractConfig config)
The configuration used for this extract run. This is a union of two possible shapes:
- JSON Schema config: The current config format. All runs created through this API version use this shape.
- Legacy config: A fields-array config from a previous API version. This shape is only returned when retrieving runs that were originally created with the legacy format. This API version does not support creating runs with legacy configs.
The configuration used for this extract run. This is a union of two possible shapes:
- JSON Schema config: The current config format. All runs created through this API version use this shape.
- Legacy config: A fields-array config from a previous API version. This shape is only returned when retrieving runs that were originally created with the legacy format. This API version does not support creating runs with legacy configs.
- Specified by:
configin interfaceExtractRun.ConfigStage- Returns:
- Reference to
thisso that method calls can be chained together.
-
dashboardUrl
public ExtractRun.CreatedAtStage dashboardUrl(@NotNull java.lang.String dashboardUrl)
The URL to view the extract run in the Extend dashboard.
The URL to view the extract run in the Extend dashboard.
- Specified by:
dashboardUrlin interfaceExtractRun.DashboardUrlStage- Returns:
- Reference to
thisso that method calls can be chained together.
-
createdAt
public ExtractRun.UpdatedAtStage createdAt(@NotNull java.time.OffsetDateTime createdAt)
- Specified by:
createdAtin interfaceExtractRun.CreatedAtStage
-
updatedAt
public ExtractRun._FinalStage updatedAt(@NotNull java.time.OffsetDateTime updatedAt)
- Specified by:
updatedAtin interfaceExtractRun.UpdatedAtStage
-
usage
public ExtractRun._FinalStage usage(Nullable<RunUsage> usage)
Usage credits consumed by this extract run.
Availability: Present when
statusis"PROCESSED". Will not be returned for runs created before October 7, 2025 or for customers on legacy billing systems.- Specified by:
usagein interfaceExtractRun._FinalStage- Returns:
- Reference to
thisso that method calls can be chained together.
-
usage
public ExtractRun._FinalStage usage(RunUsage usage)
Usage credits consumed by this extract run.
Availability: Present when
statusis"PROCESSED". Will not be returned for runs created before October 7, 2025 or for customers on legacy billing systems.- Specified by:
usagein interfaceExtractRun._FinalStage- Returns:
- Reference to
thisso that method calls can be chained together.
-
usage
public ExtractRun._FinalStage usage(java.util.Optional<RunUsage> usage)
Usage credits consumed by this extract run.
Availability: Present when
statusis"PROCESSED". Will not be returned for runs created before October 7, 2025 or for customers on legacy billing systems.- Specified by:
usagein interfaceExtractRun._FinalStage
-
parseRunId
public ExtractRun._FinalStage parseRunId(Nullable<java.lang.String> parseRunId)
The ID of the parse run that was used for this extract run.
Availability: Present when a parse run was created.
- Specified by:
parseRunIdin interfaceExtractRun._FinalStage- Returns:
- Reference to
thisso that method calls can be chained together.
-
parseRunId
public ExtractRun._FinalStage parseRunId(java.lang.String parseRunId)
The ID of the parse run that was used for this extract run.
Availability: Present when a parse run was created.
- Specified by:
parseRunIdin interfaceExtractRun._FinalStage- Returns:
- Reference to
thisso that method calls can be chained together.
-
parseRunId
public ExtractRun._FinalStage parseRunId(java.util.Optional<java.lang.String> parseRunId)
The ID of the parse run that was used for this extract run.
Availability: Present when a parse run was created.
- Specified by:
parseRunIdin interfaceExtractRun._FinalStage
-
files
public ExtractRun._FinalStage files(Nullable<java.util.List<FileSummary>> files)
The files that were processed, in the order they were submitted. Only populated for multifile runs (created with
package).For single-file runs, this is
null— usefileinstead.- Specified by:
filesin interfaceExtractRun._FinalStage- Returns:
- Reference to
thisso that method calls can be chained together.
-
files
public ExtractRun._FinalStage files(java.util.List<FileSummary> files)
The files that were processed, in the order they were submitted. Only populated for multifile runs (created with
package).For single-file runs, this is
null— usefileinstead.- Specified by:
filesin interfaceExtractRun._FinalStage- Returns:
- Reference to
thisso that method calls can be chained together.
-
files
public ExtractRun._FinalStage files(java.util.Optional<java.util.List<FileSummary>> files)
The files that were processed, in the order they were submitted. Only populated for multifile runs (created with
package).For single-file runs, this is
null— usefileinstead.- Specified by:
filesin interfaceExtractRun._FinalStage
-
file
public ExtractRun._FinalStage file(Nullable<FileSummary> file)
The file that was processed.
nullfor multifile runs (usefilesinstead), andnullwhen the file could not be accessed or processed (for example, a run that failed during file ingestion).- Specified by:
filein interfaceExtractRun._FinalStage- Returns:
- Reference to
thisso that method calls can be chained together.
-
file
public ExtractRun._FinalStage file(FileSummary file)
The file that was processed.
nullfor multifile runs (usefilesinstead), andnullwhen the file could not be accessed or processed (for example, a run that failed during file ingestion).- Specified by:
filein interfaceExtractRun._FinalStage- Returns:
- Reference to
thisso that method calls can be chained together.
-
file
public ExtractRun._FinalStage file(java.util.Optional<FileSummary> file)
The file that was processed.
nullfor multifile runs (usefilesinstead), andnullwhen the file could not be accessed or processed (for example, a run that failed during file ingestion).- Specified by:
filein interfaceExtractRun._FinalStage
-
extractorVersion
public ExtractRun._FinalStage extractorVersion(Nullable<ExtractorVersionSummary> extractorVersion)
The version of the extractor that was used for this run.
Availability: Present when an extractor reference was provided. Not present when using inline
config.- Specified by:
extractorVersionin interfaceExtractRun._FinalStage- Returns:
- Reference to
thisso that method calls can be chained together.
-
extractorVersion
public ExtractRun._FinalStage extractorVersion(ExtractorVersionSummary extractorVersion)
The version of the extractor that was used for this run.
Availability: Present when an extractor reference was provided. Not present when using inline
config.- Specified by:
extractorVersionin interfaceExtractRun._FinalStage- Returns:
- Reference to
thisso that method calls can be chained together.
-
extractorVersion
public ExtractRun._FinalStage extractorVersion(java.util.Optional<ExtractorVersionSummary> extractorVersion)
The version of the extractor that was used for this run.
Availability: Present when an extractor reference was provided. Not present when using inline
config.- Specified by:
extractorVersionin interfaceExtractRun._FinalStage
-
extractor
public ExtractRun._FinalStage extractor(Nullable<ExtractorSummary> extractor)
The extractor that was used for this run.
Availability: Present when an extractor reference was provided. Not present when using inline
config.- Specified by:
extractorin interfaceExtractRun._FinalStage- Returns:
- Reference to
thisso that method calls can be chained together.
-
extractor
public ExtractRun._FinalStage extractor(ExtractorSummary extractor)
The extractor that was used for this run.
Availability: Present when an extractor reference was provided. Not present when using inline
config.- Specified by:
extractorin interfaceExtractRun._FinalStage- Returns:
- Reference to
thisso that method calls can be chained together.
-
extractor
public ExtractRun._FinalStage extractor(java.util.Optional<ExtractorSummary> extractor)
The extractor that was used for this run.
Availability: Present when an extractor reference was provided. Not present when using inline
config.- Specified by:
extractorin interfaceExtractRun._FinalStage
-
edits
public ExtractRun._FinalStage edits(Nullable<java.util.Map<java.lang.String,java.util.Optional<ExtractOutputEdits>>> edits)
Details of edits made during review.
Availability: Present when
editedistrue.- Specified by:
editsin interfaceExtractRun._FinalStage- Returns:
- Reference to
thisso that method calls can be chained together.
-
edits
public ExtractRun._FinalStage edits(java.util.Map<java.lang.String,java.util.Optional<ExtractOutputEdits>> edits)
Details of edits made during review.
Availability: Present when
editedistrue.- Specified by:
editsin interfaceExtractRun._FinalStage- Returns:
- Reference to
thisso that method calls can be chained together.
-
edits
public ExtractRun._FinalStage edits(java.util.Optional<java.util.Map<java.lang.String,java.util.Optional<ExtractOutputEdits>>> edits)
Details of edits made during review.
Availability: Present when
editedistrue.- Specified by:
editsin interfaceExtractRun._FinalStage
-
metadata
public ExtractRun._FinalStage metadata(Nullable<java.util.Map<java.lang.String,java.lang.Object>> metadata)
Any metadata that was provided when creating the extract run.
Availability: Present when metadata was provided during creation.
- Specified by:
metadatain interfaceExtractRun._FinalStage- Returns:
- Reference to
thisso that method calls can be chained together.
-
metadata
public ExtractRun._FinalStage metadata(java.util.Map<java.lang.String,java.lang.Object> metadata)
Any metadata that was provided when creating the extract run.
Availability: Present when metadata was provided during creation.
- Specified by:
metadatain interfaceExtractRun._FinalStage- Returns:
- Reference to
thisso that method calls can be chained together.
-
metadata
public ExtractRun._FinalStage metadata(java.util.Optional<java.util.Map<java.lang.String,java.lang.Object>> metadata)
Any metadata that was provided when creating the extract run.
Availability: Present when metadata was provided during creation.
- Specified by:
metadatain interfaceExtractRun._FinalStage
-
failureMessage
public ExtractRun._FinalStage failureMessage(Nullable<java.lang.String> failureMessage)
A detailed message about the failure.
Availability: Present when
statusis"FAILED".- Specified by:
failureMessagein interfaceExtractRun._FinalStage- Returns:
- Reference to
thisso that method calls can be chained together.
-
failureMessage
public ExtractRun._FinalStage failureMessage(java.lang.String failureMessage)
A detailed message about the failure.
Availability: Present when
statusis"FAILED".- Specified by:
failureMessagein interfaceExtractRun._FinalStage- Returns:
- Reference to
thisso that method calls can be chained together.
-
failureMessage
public ExtractRun._FinalStage failureMessage(java.util.Optional<java.lang.String> failureMessage)
A detailed message about the failure.
Availability: Present when
statusis"FAILED".- Specified by:
failureMessagein interfaceExtractRun._FinalStage
-
failureReason
public ExtractRun._FinalStage failureReason(Nullable<java.lang.String> failureReason)
The reason for failure.
Availability: Present when
statusis"FAILED".Possible values include:
ABORTED- The run was aborted by the userINTERNAL_ERROR- An unexpected internal error occurredFAILED_TO_PROCESS_FILE- Failed to process the file (e.g., OCR failure, file access issues)INVALID_PROCESSOR- The processor configuration is invalidINVALID_CONFIGURATION- The provided configuration is incompatible with the selected modelPARSING_ERROR- Failed to parse the extraction outputPRE_PROCESSING_FAILURE- An error occurred during preprocessing (e.g., chunking)POST_PROCESSING_FAILURE- An error occurred during postprocessingOUT_OF_CREDITS- Insufficient credits to run the extractionSCHEMA_GENERATION_FAILED- Automatic schema inference failed (only applies whenschemais omitted). The file could not be parsed or a schema could not be generated from it.
Note: Additional failure reasons may be added in the future. Your integration should handle unknown values gracefully.
- Specified by:
failureReasonin interfaceExtractRun._FinalStage- Returns:
- Reference to
thisso that method calls can be chained together.
-
failureReason
public ExtractRun._FinalStage failureReason(java.lang.String failureReason)
The reason for failure.
Availability: Present when
statusis"FAILED".Possible values include:
ABORTED- The run was aborted by the userINTERNAL_ERROR- An unexpected internal error occurredFAILED_TO_PROCESS_FILE- Failed to process the file (e.g., OCR failure, file access issues)INVALID_PROCESSOR- The processor configuration is invalidINVALID_CONFIGURATION- The provided configuration is incompatible with the selected modelPARSING_ERROR- Failed to parse the extraction outputPRE_PROCESSING_FAILURE- An error occurred during preprocessing (e.g., chunking)POST_PROCESSING_FAILURE- An error occurred during postprocessingOUT_OF_CREDITS- Insufficient credits to run the extractionSCHEMA_GENERATION_FAILED- Automatic schema inference failed (only applies whenschemais omitted). The file could not be parsed or a schema could not be generated from it.
Note: Additional failure reasons may be added in the future. Your integration should handle unknown values gracefully.
- Specified by:
failureReasonin interfaceExtractRun._FinalStage- Returns:
- Reference to
thisso that method calls can be chained together.
-
failureReason
public ExtractRun._FinalStage failureReason(java.util.Optional<java.lang.String> failureReason)
The reason for failure.
Availability: Present when
statusis"FAILED".Possible values include:
ABORTED- The run was aborted by the userINTERNAL_ERROR- An unexpected internal error occurredFAILED_TO_PROCESS_FILE- Failed to process the file (e.g., OCR failure, file access issues)INVALID_PROCESSOR- The processor configuration is invalidINVALID_CONFIGURATION- The provided configuration is incompatible with the selected modelPARSING_ERROR- Failed to parse the extraction outputPRE_PROCESSING_FAILURE- An error occurred during preprocessing (e.g., chunking)POST_PROCESSING_FAILURE- An error occurred during postprocessingOUT_OF_CREDITS- Insufficient credits to run the extractionSCHEMA_GENERATION_FAILED- Automatic schema inference failed (only applies whenschemais omitted). The file could not be parsed or a schema could not be generated from it.
Note: Additional failure reasons may be added in the future. Your integration should handle unknown values gracefully.
- Specified by:
failureReasonin interfaceExtractRun._FinalStage
-
reviewedOutput
public ExtractRun._FinalStage reviewedOutput(Nullable<ExtractOutput> reviewedOutput)
The output after human review.
Availability: Present when
reviewedistrue.- Specified by:
reviewedOutputin interfaceExtractRun._FinalStage- Returns:
- Reference to
thisso that method calls can be chained together.
-
reviewedOutput
public ExtractRun._FinalStage reviewedOutput(ExtractOutput reviewedOutput)
The output after human review.
Availability: Present when
reviewedistrue.- Specified by:
reviewedOutputin interfaceExtractRun._FinalStage- Returns:
- Reference to
thisso that method calls can be chained together.
-
reviewedOutput
public ExtractRun._FinalStage reviewedOutput(java.util.Optional<ExtractOutput> reviewedOutput)
The output after human review.
Availability: Present when
reviewedistrue.- Specified by:
reviewedOutputin interfaceExtractRun._FinalStage
-
initialOutput
public ExtractRun._FinalStage initialOutput(Nullable<ExtractOutput> initialOutput)
The initial output from the extract run, before any review edits.
Availability: Present when
reviewedistrue.- Specified by:
initialOutputin interfaceExtractRun._FinalStage- Returns:
- Reference to
thisso that method calls can be chained together.
-
initialOutput
public ExtractRun._FinalStage initialOutput(ExtractOutput initialOutput)
The initial output from the extract run, before any review edits.
Availability: Present when
reviewedistrue.- Specified by:
initialOutputin interfaceExtractRun._FinalStage- Returns:
- Reference to
thisso that method calls can be chained together.
-
initialOutput
public ExtractRun._FinalStage initialOutput(java.util.Optional<ExtractOutput> initialOutput)
The initial output from the extract run, before any review edits.
Availability: Present when
reviewedistrue.- Specified by:
initialOutputin interfaceExtractRun._FinalStage
-
output
public ExtractRun._FinalStage output(Nullable<ExtractOutput> output)
The final output, either reviewed or initial. This is a union of two possible shapes:
- JSON Schema output: The current output format, returned for runs created with a JSON Schema config.
- Legacy output: A legacy output format from a previous API version. This shape is only returned for runs that were originally created with a legacy config.
Availability: Present when
statusis"PROCESSED".- Specified by:
outputin interfaceExtractRun._FinalStage- Returns:
- Reference to
thisso that method calls can be chained together.
-
output
public ExtractRun._FinalStage output(ExtractOutput output)
The final output, either reviewed or initial. This is a union of two possible shapes:
- JSON Schema output: The current output format, returned for runs created with a JSON Schema config.
- Legacy output: A legacy output format from a previous API version. This shape is only returned for runs that were originally created with a legacy config.
Availability: Present when
statusis"PROCESSED".- Specified by:
outputin interfaceExtractRun._FinalStage- Returns:
- Reference to
thisso that method calls can be chained together.
-
output
public ExtractRun._FinalStage output(java.util.Optional<ExtractOutput> output)
The final output, either reviewed or initial. This is a union of two possible shapes:
- JSON Schema output: The current output format, returned for runs created with a JSON Schema config.
- Legacy output: A legacy output format from a previous API version. This shape is only returned for runs that were originally created with a legacy config.
Availability: Present when
statusis"PROCESSED".- Specified by:
outputin interfaceExtractRun._FinalStage
-
build
public ExtractRun build()
- Specified by:
buildin interfaceExtractRun._FinalStage
-
-