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.

📄 Arguments

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

â†Šī¸ Return

Type: TextSplitter

An instance of a TextSplitter subclass.

✍ Example

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