Files & Knowledge Base

Upload documents to give your assistant domain-specific knowledge. When a user asks a question, the assistant automatically searches your uploaded files and includes relevant passages in its response. This is called Retrieval-Augmented Generation (RAG).

Supported File Types

Format MIME Type
PDF application/pdf
Word (.docx) application/vnd.openxmlformats-officedocument.wordprocessingml.document
Word (.doc) application/msword
Plain text (.txt) text/plain
HTML text/html
CSV text/csv

Additionally, any file that can be decoded as text will be processed using a fallback parser. Binary files that cannot be read as text will be stored with a note indicating the content could not be extracted.

How File Ingestion Works

When you upload a file, the following happens behind the scenes:

  1. Parsing — the file is converted to plain text using a format-specific parser (e.g., PDFMiner for PDFs, MsWordParser for Word documents).
  2. Chunking — the text is split into smaller overlapping segments using a recursive character text splitter.
  3. Embedding — each chunk is converted into a numerical vector using OpenAI embeddings.
  4. Storage — the vectors are stored in a PostgreSQL database with the pgvector extension, along with metadata (file name, namespace, size).

Each file is associated with a specific assistant via a namespace, so different assistants can have different knowledge bases.

How the Assistant Uses Files

During a conversation:

  1. The user's question is converted to an embedding vector.
  2. The system searches the vector store for the most similar document chunks.
  3. The relevant chunks are included in the assistant's context.
  4. The assistant generates a response informed by those passages.

This happens automatically — you don't need to tell the assistant to "look things up."

Uploading Files

Files are uploaded to a specific assistant. Navigate to the assistant's configuration and use the file upload section.

Managing Files

Limits

API Reference

Operation Endpoint
Upload file to assistant POST /assistants/{aid}/files
List assistant files GET /assistants/{aid}/files
Delete assistant file DELETE /assistants/{aid}/files/{file_id}

See the full API documentation at /docs#Assistants.