Class DocumentRequest

java.lang.Object
ai.docling.serve.api.request.DocumentRequest
Direct Known Subclasses:
BatchConvertDocumentRequest, ChunkDocumentRequest, ConvertDocumentRequest

public abstract sealed class DocumentRequest extends Object permits ConvertDocumentRequest, BatchConvertDocumentRequest, ChunkDocumentRequest
Abstract base class for all document processing requests. Provides the common fields shared across conversion, chunking, and batch conversion requests: document sources and an optional output target.

This is a sealed class — the only permitted subtypes are ConvertDocumentRequest, BatchConvertDocumentRequest, and ChunkDocumentRequest — enabling exhaustive pattern matching:


 switch (request) {
   case ConvertDocumentRequest r    -> client.convertSource(r);
   case BatchConvertDocumentRequest r -> client.convertSourceBatch(r);
   case HierarchicalChunkDocumentRequest r -> client.chunkSourceWithHierarchicalChunker(r);
   case HybridChunkDocumentRequest r       -> client.chunkSourceWithHybridChunker(r);
 }
 
  • Constructor Details

  • Method Details

    • getSources

      public List<Source> getSources()
      List of document sources to be processed. Each source can be a file (base64-encoded), an HTTP URL, or an S3 reference.
      Returns:
      the list of document sources
    • getTarget

      public @Nullable Target getTarget()
      Specification for the type of output target. If not specified, the result is returned in the response body.
      Returns:
      the output target specification, or null if not specified
    • toString

      public @NonNull String toString()
      Overrides:
      toString in class Object