Skip to content

Que: chunk size check in SemanticChunker #605

Description

@nathnet

Question
Hi Chonkers! I'm new to LLM and RAG in general and I'm currently taking a course to learn how to implement RAG. I came across the concepts of how each embedding model has token window limit that will silent fail any text that has more than tokens they allow. And while I was working with SemanticChunker, I received Token indices sequence length is longer than the specified maximum sequence length for this model (595 > 512). Running this sequence through the model will result in indexing errors from HuggingFace tokenizer lib, which sounds like my document whose size is larger than the embedding model I use has already gone through the embedding stage of some sorts, even though I have already set chunk_size on SemanticChunker to limit it below the model's limit.

So I went to check the codebase and found that the chunk_size is only used to break down the chunks after it has already gone through vector similarity computation. My question/confusion is, shouldn't the chunk_size be somewhat in the prepare_sentences stage to make sure no sentences would go into the embedding model if the size exceeds the limit?

Thank you!

Additional Context
https://github.com/chonkie-inc/chonkie/blob/ac3a74fa4fba7551ad3f1fffc2a23e5b6815273f/src/chonkie/chunker/semantic.py#L463

Metadata

Metadata

Labels

questionFurther information is requested

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions