This commits extends the "add_local" function. It adds support to take text and index/embed it.
17 lines
418 B
Python
17 lines
418 B
Python
from embedchain.chunkers.base_chunker import BaseChunker
|
|
|
|
from langchain.text_splitter import RecursiveCharacterTextSplitter
|
|
|
|
|
|
TEXT_SPLITTER_CHUNK_PARAMS = {
|
|
"chunk_size": 300,
|
|
"chunk_overlap": 0,
|
|
"length_function": len,
|
|
}
|
|
|
|
|
|
class TextChunker(BaseChunker):
|
|
def __init__(self):
|
|
text_splitter = RecursiveCharacterTextSplitter(**TEXT_SPLITTER_CHUNK_PARAMS)
|
|
super().__init__(text_splitter)
|