from praisonaiagents import Agentagent = Agent( instructions="Answer questions from research papers.", knowledge={ "sources": ["papers/"], "chunker": { "type": "semantic", "chunk_size": 512, "embedding_model": "all-MiniLM-L6-v2" } })response = agent.start("What methodology did they use?")
from praisonaiagents.knowledge.chunking import Chunkingchunker = Chunking( chunker_type="semantic", chunk_size=512, embedding_model="all-MiniLM-L6-v2")chunks = chunker.chunk("Your research paper content here...")for chunk in chunks: print(chunk.text)
Semantic chunking requires computing embeddings and is slower than token/sentence chunking. Use for quality-sensitive applications where retrieval accuracy matters more than speed.