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 |
|---|---|
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:
- Parsing — the file is converted to plain text using a format-specific parser (e.g., PDFMiner for PDFs, MsWordParser for Word documents).
- Chunking — the text is split into smaller overlapping segments using a recursive character text splitter.
- Embedding — each chunk is converted into a numerical vector using OpenAI embeddings.
- 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:
- The user's question is converted to an embedding vector.
- The system searches the vector store for the most similar document chunks.
- The relevant chunks are included in the assistant's context.
- 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¶
- List — view all files attached to an assistant.
- Delete — remove a file and its associated vector embeddings.
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.