Files
fil/packages/java/dev/kreuzberg/LayoutDetectionConfig.java

106 lines
3.8 KiB
Java
Raw Permalink Normal View History

2026-06-01 23:40:55 +02:00
// This file is auto-generated by alef — DO NOT EDIT.
// alef:hash:4e15143f4af1ae8bafbdb1506ef057da924484c66a19483966333558ad437e75
// To regenerate: alef generate
// To verify freshness: alef verify --exit-code
// Issues & docs: https://github.com/kreuzberg-dev/alef
package dev.kreuzberg;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonPOJOBuilder;
import org.jspecify.annotations.Nullable;
/**
* Layout detection configuration.
*
* Controls layout detection behavior in the extraction pipeline.
* When set on ExtractionConfig(super.ExtractionConfig), layout detection
* is enabled for PDF extraction.
*/
@JsonInclude(JsonInclude.Include.NON_ABSENT)
@JsonDeserialize(builder = LayoutDetectionConfig.Builder.class)
public record LayoutDetectionConfig(
/**
* Confidence threshold override (null = use model default).
*/
@Nullable @JsonProperty("confidence_threshold") Float confidenceThreshold,
/**
* Whether to apply postprocessing heuristics (default: true).
*/
@Nullable @JsonProperty("apply_heuristics") Boolean applyHeuristics,
/**
* Table structure recognition model.
*
* Controls which model is used for table cell detection within layout-detected
* table regions. Defaults to TableModel.Tatr.
*/
@Nullable @JsonProperty("table_model") TableModel tableModel,
/**
* Hardware acceleration for ONNX models (layout detection + table structure).
*
* When set, controls which execution provider (CPU, CUDA, CoreML, TensorRT)
* is used for inference. Defaults to {@code None} (auto-select per platform).
*/
@Nullable @JsonProperty("acceleration") AccelerationConfig acceleration
) {
public static Builder builder() {
return new Builder();
}
// CPD-OFF
@JsonPOJOBuilder(withPrefix = "with", buildMethodName = "build")
public static final class Builder {
@JsonProperty("confidence_threshold")
private Float confidenceThreshold = null;
@JsonProperty("apply_heuristics")
private Boolean applyHeuristics = null;
@JsonProperty("table_model")
@Nullable private TableModel tableModel = TableModel.Tatr;
@Nullable private AccelerationConfig acceleration = null;
/** Sets the confidenceThreshold field. */
@JsonProperty("confidence_threshold")
public Builder withConfidenceThreshold(final @Nullable Float value) {
this.confidenceThreshold = value;
return this;
}
/** Sets the applyHeuristics field. */
@JsonProperty("apply_heuristics")
public Builder withApplyHeuristics(final @Nullable Boolean value) {
this.applyHeuristics = value;
return this;
}
/** Sets the tableModel field. */
@JsonProperty("table_model")
public Builder withTableModel(final @Nullable TableModel value) {
this.tableModel = value;
return this;
}
/** Sets the acceleration field. */
@JsonProperty("acceleration")
public Builder withAcceleration(final @Nullable AccelerationConfig value) {
this.acceleration = value;
return this;
}
/** Builds the LayoutDetectionConfig instance. */
public LayoutDetectionConfig build() {
return new LayoutDetectionConfig(
confidenceThreshold,
applyHeuristics,
tableModel,
acceleration
);
}
}
// CPD-ON
public static LayoutDetectionConfig defaultInstance() {
throw new UnsupportedOperationException("defaultInstance is not yet bridged via JNI; use the Builder instead.");
}
}