alexa
menu

Document Processing

    Show / Hide Table of Contents

    Interface IChunkingService

    Provides operations for generating chunks suitable for retrieval-augmented generation (RAG) from documents.

    Namespace: Syncfusion.DocumentChunking
    Assembly: Syncfusion.DocumentChunking.Base.dll
    Syntax
    public interface IChunkingService
    Remarks

    Documents can be processed from a file path or a stream by using synchronous or asynchronous operations.

    Methods

    Chunk(Stream, String, ChunkingOptions)

    Generates chunks from the document contained in the specified stream.

    Declaration
    IChunkingResult Chunk(Stream stream, string sourceName, ChunkingOptions options = null)
    Parameters
    Type Name Description
    System.IO.Stream stream

    The stream containing the document data.

    System.String sourceName

    The source name, including the file extension used for document format detection and metadata generation.

    ChunkingOptions options

    The chunking options to use, or null to use the default options.

    Returns
    Type Description
    IChunkingResult

    The result of the chunking operation.

    Exceptions
    Type Condition
    System.ArgumentNullException

    stream or sourceName is null.

    System.ArgumentException

    sourceName is empty or consists only of white-space characters.

    System.InvalidOperationException

    The document format is not supported.

    Chunk(String, ChunkingOptions)

    Generates chunks from the document at the specified file path.

    Declaration
    IChunkingResult Chunk(string filePath, ChunkingOptions options = null)
    Parameters
    Type Name Description
    System.String filePath

    The absolute or relative path of the document to process.

    ChunkingOptions options

    The chunking options to use, or null to use the default options.

    Returns
    Type Description
    IChunkingResult

    The result of the chunking operation.

    Exceptions
    Type Condition
    System.ArgumentNullException

    filePath is null.

    System.ArgumentException

    filePath is empty or consists only of white-space characters.

    System.IO.FileNotFoundException

    The specified file does not exist.

    System.InvalidOperationException

    The document format is not supported.

    ChunkAsync(Stream, String, ChunkingOptions, CancellationToken)

    Asynchronously generates chunks from the document contained in the specified stream.

    Declaration
    Task<IChunkingResult> ChunkAsync(Stream stream, string sourceName, ChunkingOptions options = null, CancellationToken cancellationToken = null)
    Parameters
    Type Name Description
    System.IO.Stream stream

    The stream containing the document data.

    System.String sourceName

    The source name, including the file extension used for document format detection and metadata generation.

    ChunkingOptions options

    The chunking options to use, or null to use the default options.

    System.Threading.CancellationToken cancellationToken

    The token used to cancel the operation.

    Returns
    Type Description
    System.Threading.Tasks.Task<IChunkingResult>

    A task that represents the asynchronous operation. The task result contains the result of the chunking operation.

    Exceptions
    Type Condition
    System.ArgumentNullException

    stream or sourceName is null.

    System.ArgumentException

    sourceName is empty or consists only of white-space characters.

    System.InvalidOperationException

    The document format is not supported.

    System.OperationCanceledException

    The operation is canceled by cancellationToken.

    ChunkAsync(String, ChunkingOptions, CancellationToken)

    Asynchronously generates chunks from the document at the specified file path.

    Declaration
    Task<IChunkingResult> ChunkAsync(string filePath, ChunkingOptions options = null, CancellationToken cancellationToken = null)
    Parameters
    Type Name Description
    System.String filePath

    The absolute or relative path of the document to process.

    ChunkingOptions options

    The chunking options to use, or null to use the default options.

    System.Threading.CancellationToken cancellationToken

    The token used to cancel the operation.

    Returns
    Type Description
    System.Threading.Tasks.Task<IChunkingResult>

    A task that represents the asynchronous operation. The task result contains the result of the chunking operation.

    Exceptions
    Type Condition
    System.ArgumentNullException

    filePath is null.

    System.ArgumentException

    filePath is empty or consists only of white-space characters.

    System.IO.FileNotFoundException

    The specified file does not exist.

    System.InvalidOperationException

    The document format is not supported.

    System.OperationCanceledException

    The operation is canceled by cancellationToken.

    Back to top Generated by DocFX
    Copyright © 2001 - 2026 Syncfusion Inc. All Rights Reserved