diff --git a/phi/document/chunking/agentic.py b/phi/document/chunking/agentic.py index 7c50e6415..f8b3e1c17 100644 --- a/phi/document/chunking/agentic.py +++ b/phi/document/chunking/agentic.py @@ -9,7 +9,7 @@ class AgenticChunking(ChunkingStrategy): """Chunking strategy that uses an LLM to determine natural breakpoints in the text""" - + def __init__(self, model: Optional[Model] = None, max_chunk_size: int = 5000): self.model = model or OpenAIChat() self.max_chunk_size = max_chunk_size diff --git a/phi/document/chunking/base.py b/phi/document/chunking/base.py index 61c22cd2e..e4e24a325 100644 --- a/phi/document/chunking/base.py +++ b/phi/document/chunking/base.py @@ -10,7 +10,7 @@ class ChunkingStrategy(ABC): @abstractmethod def chunk(self, document: Document) -> List[Document]: raise NotImplementedError - + def clean_text(self, text: str) -> str: """Clean the text by replacing multiple newlines with a single newline""" import re diff --git a/phi/document/chunking/fixed.py b/phi/document/chunking/fixed.py index d9f19df51..c1fbf81d8 100644 --- a/phi/document/chunking/fixed.py +++ b/phi/document/chunking/fixed.py @@ -6,7 +6,7 @@ class FixedChunking(ChunkingStrategy): """Chunking strategy that splits text into fixed-size chunks with optional overlap""" - + def __init__(self, chunk_size: int = 5000, overlap: int = 0): self.chunk_size = chunk_size self.overlap = overlap diff --git a/phi/document/reader/base.py b/phi/document/reader/base.py index 765eb2abe..044e99a81 100644 --- a/phi/document/reader/base.py +++ b/phi/document/reader/base.py @@ -19,4 +19,4 @@ def read(self, obj: Any) -> List[Document]: raise NotImplementedError def chunk_document(self, document: Document) -> List[Document]: - return self.chunking_strategy.chunk(document) \ No newline at end of file + return self.chunking_strategy.chunk(document) diff --git a/phi/knowledge/agent.py b/phi/knowledge/agent.py index 028e89aef..33cf73304 100644 --- a/phi/knowledge/agent.py +++ b/phi/knowledge/agent.py @@ -5,7 +5,6 @@ from phi.document import Document from phi.document.reader.base import Reader from phi.knowledge.base import AssistantKnowledge -from phi.knowledge.chunks import CharacterChunks, ChunkingStrategy from phi.vectordb import VectorDb from phi.utils.log import logger