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 allows you to read and extract text content from PowerPoint (.pptx) files, converting them into vector embeddings for your knowledge base.

Code

pptx_reader.py
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"

# Create a knowledge base with the PPTX documents
knowledge = Knowledge(
    # Table name: ai.pptx_documents
    vector_db=PgVector(
        table_name="pptx_documents",
        db_url=db_url,
    ),
)
# Load the knowledge
knowledge.add_content(
    path="data/pptx_files",
    reader=PPTXReader(),
)

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

# Ask the agent about the knowledge
agent.print_response("What can you tell me about the content in these PowerPoint presentations?", markdown=True)

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.py

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