Skip to content

Chunk processor

Defines a base class for chunk processors used in Gen AI applications.

Authors

Henry Wicaksono (henry.wicaksono@gdplabs.id)

References

NONE

BaseChunkProcessor

Bases: Component, ABC

An abstract base class for the chunk processors used in Gen AI applications.

process_chunks(chunks) async

Processes the given list of chunks.

This method call the private _process_chunks method after validating the input.

Parameters:

Name Type Description Default
chunks list[Chunk]

The list of chunks to be processed.

required

Returns:

Type Description
list[Chunk]

list[Chunk]: A list of processed chunks.

Raises:

Type Description
ValueError

If any item in the chunks list is not of type Chunk.