CSV row chunking is a method of splitting CSV files based on the number of rows, rather than character count. This approach treats each row (or group of rows) as a semantic unit, preserving the integrity of individual records while enabling efficient processing of tabular data.
import asynciofrom agno.agent import Agentfrom agno.knowledge.chunking.row import RowChunkingfrom agno.knowledge.knowledge import Knowledgefrom agno.knowledge.reader.csv_reader import CSVReaderfrom agno.vectordb.pgvector import PgVectordb_url = "postgresql+psycopg://ai:ai@localhost:5532/ai"knowledge_base = Knowledge( vector_db=PgVector(table_name="imdb_movies_row_chunking", db_url=db_url),)asyncio.run(knowledge_base.add_content_async( url="https://agno-public.s3.amazonaws.com/demo_data/IMDB-Movie-Data.csv", reader=CSVReader( chunking_strategy=RowChunking(), ),)) # Initialize the Agent with the knowledge_baseagent = Agent( knowledge=knowledge_base, search_knowledge=True,)# Use the agent agent.print_response("Tell me about the movie Guardians of the Galaxy", markdown=True)