ChatGPT Retrieval Plugin
Build Custom GPTs with a Retrieval Plugin backend to give ChatGPT access to personal documents.
Introduction
The ChatGPT Retrieval Plugin repository provides a flexible solution for semantic search and retrieval of personal or organizational documents using natural language queries. It is a standalone retrieval backend, and can be used with ChatGPT custom GPTs, function calling with the chat completions or assistants APIs, or with the ChatGPT plugins model (deprecated). ChatGPT and the Assistants API both natively support retrieval from uploaded files, so you should use the Retrieval Plugin as a backend only if you want more granular control of your retrieval system (e.g. document text chunk length, embedding model / size, etc.).
The repository is organized into several directories:
Directory | Description |
---|---|
datastore |
Contains the core logic for storing and querying document embeddings using various vector database providers. |
docs |
Includes documentation for setting up and using each vector database provider, webhooks, and removing unused dependencies. |
examples |
Provides example configurations, authentication methods, and provider-specific examples. |
local_server |
Contains an implementation of the Retrieval Plugin configured for localhost testing. |
models |
Contains the data models used by the plugin, such as document and metadata models. |
scripts |
Offers scripts for processing and uploading documents from different data sources. |
server |
Houses the main FastAPI server implementation. |
services |
Contains utility services for tasks like chunking, metadata extraction, and PII detection. |
tests |
Includes integration tests for various vector database providers. |
.well-known |
Stores the plugin manifest file and OpenAPI schema, which define the plugin configuration and API specification. |
This README provides detailed information on how to set up, develop, and deploy the ChatGPT Retrieval Plugin (stand-alone retrieval backend).
Table of Contents
Quickstart
Follow these steps to quickly set up and run the ChatGPT Retrieval Plugin:
- Install Python 3.10, if not already installed.
- Clone the repository:
git clone https://github.com/openai/chatgpt-retrieval-plugin.git
- Navigate to the cloned repository directory:
cd /path/to/chatgpt-retrieval-plugin
- Install poetry:
pip install poetry
- Create a new virtual environment with Python 3.10:
poetry env use python3.10
- Activate the virtual environment:
poetry shell
- Install app dependencies:
poetry install
- Create a bearer token
- Set the required environment variables:
- Run the API locally:
poetry run start
- Access the API documentation at
http://0.0.0.0:8000/docs
and test the API endpoints (make sure to add your bearer token).