Skip to content

`rabbithole_instantiates_splitter`

Hook the splitter used to split text in chunks.

Allows replacing the default text splitter to customize the splitting process.

Name Type Description
text_splitter TextSplitter The text splitter used by default, currently is the Langchain’s TextSplitter.
cat Cat Cheshire Cat instance, allows you to use the framework components.

Type: TextSplitter

An instance of a TextSplitter subclass.

from cat.mad_hatter.decorators import hook
@hook # default priority = 1
def rabbithole_instantiates_splitter(text_splitter, cat):
text_splitter._chunk_size = 64
text_splitter._chunk_overlap = 8
return text_splitter