Skip to main content

Documentation Index

Fetch the complete documentation index at: https://spacesail.mintlify.app/llms.txt

Use this file to discover all available pages before exploring further.

The PPTX Reader with asynchronous processing allows you to read and extract text content from PowerPoint (.pptx) files with better performance for concurrent operations.

Code

pptx_reader_async.py
import asyncio

from agno.agent import Agent
from agno.knowledge.knowledge import Knowledge
from agno.knowledge.reader.pptx_reader import PPTXReader
from agno.vectordb.pgvector import PgVector

db_url = "postgresql+psycopg://ai:ai@localhost:5532/ai"

knowledge = Knowledge(
    # Table name: ai.pptx_documents
    vector_db=PgVector(
        table_name="pptx_documents",
        db_url=db_url,
    ),
)

# Create an agent with the knowledge
agent = Agent(
    knowledge=knowledge,
    search_knowledge=True,
)

def main():
    # Load the knowledge
    asyncio.run(
        knowledge.add_content_async(
            path="data/pptx_files",
            reader=PPTXReader(),
        )
    )

    # Create and use the agent
    asyncio.run(
        agent.aprint_response(
            "What can you tell me about the content in these PowerPoint presentations?", markdown=True
        )
    )

if __name__ == "__main__":
    main()

Usage

1

Create a virtual environment

Open the Terminal and create a python virtual environment.
python3 -m venv .venv
source .venv/bin/activate
2

Install libraries

pip install -U python-pptx sqlalchemy psycopg pgvector agno
3

Run PgVector

docker run -d \
  -e POSTGRES_DB=ai \
  -e POSTGRES_USER=ai \
  -e POSTGRES_PASSWORD=ai \
  -e PGDATA=/var/lib/postgresql/data/pgdata \
  -v pgvolume:/var/lib/postgresql/data \
  -p 5532:5432 \
  --name pgvector \
  agno/pgvector:16
4

Run Agent

python pptx_reader_async.py

PPTX Reader Params

ParameterTypeDefaultDescription
fileUnion[Path, IO[Any]]RequiredPath to PPTX file or file-like object containing a PowerPoint presentation
nameOptional[str]NoneOptional name for the document
chunkboolTrueWhether to chunk the document
chunk_sizeint5000Size of chunks when chunking is enabled
chunking_strategyOptional[ChunkingStrategy]DocumentChunking()Strategy for chunking the document
encodingOptional[str]NoneText encoding to use for reading