A Python application that reads documents from a local directory and answers questions about their content using OpenAI's GPT models and LlamaIndex.
- Read multiple documents from a local directory
- Convert document content into vector embeddings
- Query documents with natural language questions
- Uses OpenAI's GPT for intelligent responses
- Support for various file formats
- Python 3.8+
- OpenAI API key
- Clone or download this project
- Install dependencies:
pip install llama-index llama-index-core llama-index-llms-openai python-dotenv- Create a
.envfile in the project root:
OPENAI_API_KEY=your_api_key_here
- Get your API key from OpenAI Platform
Run the script:
python directoryreader.py- Reads all documents from the specified directory
- Creates vector embeddings of the content
- Builds a searchable index
- Answers your query using OpenAI's GPT model
Update the main() function with your directory path:
main(url=r"your_directory_path_here")- Free tier: 3 requests per minute
- Upgrade your OpenAI account for higher limits
MIT License - See LICENSE file for details