Interface DoclingServeChunkApi

All Known Subinterfaces:
DoclingServeApi

public interface DoclingServeChunkApi
Represents the Docling Serve Chunk API, providing methods for processing document sources by splitting them into smaller chunks using various chunking strategies. This interface ensures flexibility by supporting both hierarchical and hybrid chunking mechanisms.
  • Method Details

    • chunkSourceWithHierarchicalChunker

      ChunkDocumentResponse chunkSourceWithHierarchicalChunker(HierarchicalChunkDocumentRequest request)
      Converts and chunks the provided document source(s) into a processed document based on the specified options and using a hierarchical chunker for splitting the document into smaller chunks.
      Parameters:
      request - the request containing the document source(s) and options for hierarchical chunking
      Returns:
      a ChunkDocumentResponse containing the processed chunks, optionally the converted document,
      Throws:
      ValidationException - If request validation fails for any reason.
    • chunkFilesWithHierarchicalChunker

      default ChunkDocumentResponse chunkFilesWithHierarchicalChunker(Path... files)
      Processes and chunks the specified files into smaller, structured pieces using a hierarchical chunker. This method internally delegates the processing to another overloaded method with default options for the hierarchical chunker.
      Parameters:
      files - the files to be processed and chunked using the hierarchical chunker
      Returns:
      a ChunkDocumentResponse containing the processed chunks, optionally the converted documents, and associated metadata
      Throws:
      ValidationException - If request validation fails for any reason.
    • chunkFiles

      default ChunkDocumentResponse chunkFiles(ChunkType chunkType, Path... files)
      Splits the given files into smaller chunks based on the specified chunking type.
      Parameters:
      chunkType - the type of chunking to be applied, determining the chunking strategy
      files - the array of file paths to be processed and chunked
      Returns:
      a ChunkDocumentResponse containing the results of the chunking operation
    • chunkFilesWithHierarchicalChunker

      default ChunkDocumentResponse chunkFilesWithHierarchicalChunker(@Nullable HierarchicalChunkDocumentRequest request, Path... files)
      Processes and chunks the specified files into smaller, structured pieces using a hierarchical chunker. This method utilizes a provided hierarchical chunk request, applying additional configurations if needed during the creation of the chunking request.
      Parameters:
      request - the request containing configurations and options for hierarchical chunking. It may include settings for conversion, chunking parameters, and optional output specifications. Can be null to use default options.
      files - the files to be processed and chunked using the hierarchical chunker.
      Returns:
      a ChunkDocumentResponse containing the processed chunks, optionally the converted documents, and associated metadata.
      Throws:
      ValidationException - If request validation fails for any reason.
    • chunkSourceWithHybridChunker

      ChunkDocumentResponse chunkSourceWithHybridChunker(HybridChunkDocumentRequest request)
      Processes and chunks the provided document source(s) into smaller documents using a hybrid chunking strategy. The method utilizes the specified hybrid chunker options to split and process the input request.
      Parameters:
      request - the request containing the document source(s), conversion options, hybrid chunker configurations, and optional specifications for output targets
      Returns:
      a ChunkDocumentResponse containing the processed chunks, optionally the converted document, and other relevant metadata
      Throws:
      ValidationException - If request validation fails for any reason.
    • chunkFilesWithHybridChunker

      default ChunkDocumentResponse chunkFilesWithHybridChunker(Path... files)
      Processes and chunks the specified files into smaller, structured pieces using a hybrid chunking strategy. This method delegates the processing to another overloaded method with default options for the hybrid chunker.
      Parameters:
      files - the files to be processed and chunked using the hybrid chunker
      Returns:
      a ChunkDocumentResponse containing the processed chunks, optionally the converted documents, and associated metadata
      Throws:
      ValidationException - If request validation fails for any reason.
    • chunkFilesWithHybridChunker

      default ChunkDocumentResponse chunkFilesWithHybridChunker(@Nullable HybridChunkDocumentRequest request, Path... files)
      Processes and chunks the specified files into smaller, structured pieces using a hybrid chunking strategy. The method converts the input files into a hybrid chunk request and processes them to generate a structured representation of the content.
      Parameters:
      request - the request containing configurations for processing, including conversion options, hybrid chunking parameters, and optional specifications for output targets. Can be null to use default options.
      files - the files to be processed and chunked using the hybrid chunking strategy.
      Returns:
      a ChunkDocumentResponse containing the processed chunks, optionally the converted documents, and associated metadata.
      Throws:
      ValidationException - If request validation fails for any reason.
    • chunkSourceWithHierarchicalChunkerAsync

      CompletionStage<ChunkDocumentResponse> chunkSourceWithHierarchicalChunkerAsync(HierarchicalChunkDocumentRequest request)
      Asynchronously processes the provided document source(s) by converting and chunking them into smaller documents using the hierarchical chunker. This operation allows for handling large document processing tasks without blocking the caller thread.
      Parameters:
      request - the request containing the document source(s) and options for hierarchical chunking
      Returns:
      a CompletionStage that resolves to a ChunkDocumentResponse, which contains the processed chunks, optionally the converted document, and processing metadata
      Throws:
      ValidationException - If request validation fails for any reason.
    • chunkFilesWithHierarchicalChunkerAsync

      default CompletionStage<ChunkDocumentResponse> chunkFilesWithHierarchicalChunkerAsync(Path... files)
      Asynchronously processes and chunks the specified files into smaller, structured pieces using a hierarchical chunker. This method delegates the processing to another overloaded method with default options for the hierarchical chunker, leveraging non-blocking asynchronous execution.
      Parameters:
      files - the files to be processed and chunked using the hierarchical chunker
      Returns:
      a CompletionStage resolving to a ChunkDocumentResponse, which includes the processed chunks, optionally the converted documents, and associated metadata
      Throws:
      ValidationException - If request validation fails for any reason.
    • chunkFilesWithHierarchicalChunkerAsync

      default CompletionStage<ChunkDocumentResponse> chunkFilesWithHierarchicalChunkerAsync(@Nullable HierarchicalChunkDocumentRequest request, Path... files)
      Asynchronously processes and chunks the specified files into smaller, structured pieces using a hierarchical chunker. This method allows for non-blocking execution by delegating the processing to an underlying method that handles hierarchical chunking configurations and file chunking.
      Parameters:
      request - the request object containing configurations, options for hierarchical chunking, and optional specifications for output targets. Can be null to use default options for processing.
      files - the files to be processed and chunked using the hierarchical chunker.
      Returns:
      a CompletionStage that resolves to a ChunkDocumentResponse, which includes the processed chunks, optionally the converted documents, and associated metadata.
      Throws:
      ValidationException - If request validation fails for any reason.
    • chunkFilesAsync

      default CompletionStage<ChunkDocumentResponse> chunkFilesAsync(ChunkType chunkType, Path... files)
      Asynchronously chunks the provided files based on the specified chunk type.
      Parameters:
      chunkType - the type of chunking to apply, determining the chunking strategy
      files - the array of file paths to be chunked
      Returns:
      a CompletionStage that, when completed, contains the result of the chunking operation as a ChunkDocumentResponse
    • chunkSourceWithHybridChunkerAsync

      CompletionStage<ChunkDocumentResponse> chunkSourceWithHybridChunkerAsync(HybridChunkDocumentRequest request)
      Asynchronously processes the provided document source(s) by converting and chunking them into smaller documents using the hybrid chunker. This operation facilitates non-blocking processing of large document tasks by leveraging a hybrid chunking strategy.
      Parameters:
      request - the request containing the document source(s), options for conversion, hybrid chunking parameters, and optional specifications for output targets
      Returns:
      a CompletionStage that resolves to a ChunkDocumentResponse, which includes the processed chunks, optionally the converted document, and relevant processing metadata
      Throws:
      ValidationException - If request validation fails for any reason.
    • chunkFilesWithHybridChunkerAsync

      default CompletionStage<ChunkDocumentResponse> chunkFilesWithHybridChunkerAsync(Path... files)
      Asynchronously processes and chunks the provided files using a hybrid chunking strategy.
      Parameters:
      files - An array of file paths to be processed and chunked. Each path should represent a valid file location.
      Returns:
      A CompletionStage that, when completed, holds a ChunkDocumentResponse containing the results of the chunking operation.
      Throws:
      ValidationException - If request validation fails for any reason.
    • chunkFilesWithHybridChunkerAsync

      default CompletionStage<ChunkDocumentResponse> chunkFilesWithHybridChunkerAsync(@Nullable HybridChunkDocumentRequest request, Path... files)
      Asynchronously processes and chunks the given files using a hybrid chunking mechanism.
      Parameters:
      request - An optional HybridChunkDocumentRequest containing configuration details for chunking. If null, default settings will be applied.
      files - A varargs array of Path objects representing the files to be chunked. Must not be null or empty.
      Returns:
      A CompletionStage<ChunkDocumentResponse> that completes with the resulting ChunkDocumentResponse once the chunking operation is finished.
      Throws:
      ValidationException - If request validation fails for any reason.