# ChatGPT Retrieval Plugin | Build Custom GPTs with a Retrieval Plugin

**URL:** <https://onehack.st/t/chatgpt-retrieval-plugin-build-custom-gpts-with-a-retrieval-plugin/291898>\
**Category:** Tools & Scripts\
**Tags:** tools, documents, ai\
**Created:** [September 23, 2024, 9:48pm UTC](https://onehack.st/t/chatgpt-retrieval-plugin-build-custom-gpts-with-a-retrieval-plugin/291898 "2024-09-23T21:48:00Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![WhiteHat](https://onehack.st/user_avatar/onehack.st/whitehat/32/162514_2.png) [@WhiteHat](https://onehack.st/u/WhiteHat)\
**Post date:** [September 23, 2024, 9:48pm UTC](https://onehack.st/t/chatgpt-retrieval-plugin-build-custom-gpts-with-a-retrieval-plugin/291898/1 "2024-09-23T21:48:00Z")

</div>

# ChatGPT Retrieval Plugin

Build Custom GPTs with a Retrieval Plugin backend to give ChatGPT access to personal documents. [![Example Custom GPT Screenshot](https://github.com/openai/chatgpt-retrieval-plugin/raw/main/assets/example.png)](https://github.com/openai/chatgpt-retrieval-plugin/blob/main/assets/example.png)

## 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](https://chat.openai.com/gpts/discovery), [function calling](https://platform.openai.com/docs/guides/function-calling) with the [chat completions](https://platform.openai.com/docs/guides/text-generation) or [assistants APIs](https://platform.openai.com/docs/assistants/overview), or with the [ChatGPT plugins model (deprecated)](https://chat.openai.com/?model=gpt-4-plugins). 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`](https://github.com/openai/chatgpt-retrieval-plugin/blob/main/datastore) | Contains the core logic for storing and querying document embeddings using various vector database providers. |
| [`docs`](https://github.com/openai/chatgpt-retrieval-plugin/blob/main/docs) | Includes documentation for setting up and using each vector database provider, webhooks, and removing unused dependencies. |
| [`examples`](https://github.com/openai/chatgpt-retrieval-plugin/blob/main/examples) | Provides example configurations, authentication methods, and provider-specific examples. |
| [`local_server`](https://github.com/openai/chatgpt-retrieval-plugin/blob/main/local_server) | Contains an implementation of the Retrieval Plugin configured for localhost testing. |
| [`models`](https://github.com/openai/chatgpt-retrieval-plugin/blob/main/models) | Contains the data models used by the plugin, such as document and metadata models. |
| [`scripts`](https://github.com/openai/chatgpt-retrieval-plugin/blob/main/scripts) | Offers scripts for processing and uploading documents from different data sources. |
| [`server`](https://github.com/openai/chatgpt-retrieval-plugin/blob/main/server) | Houses the main FastAPI server implementation. |
| [`services`](https://github.com/openai/chatgpt-retrieval-plugin/blob/main/services) | Contains utility services for tasks like chunking, metadata extraction, and PII detection. |
| [`tests`](https://github.com/openai/chatgpt-retrieval-plugin/blob/main/tests) | Includes integration tests for various vector database providers. |
| [`.well-known`](https://github.com/openai/chatgpt-retrieval-plugin/blob/main/.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](https://github.com/openai/chatgpt-retrieval-plugin#quickstart)
- [About](https://github.com/openai/chatgpt-retrieval-plugin#about)
  - [Retrieval Plugin](https://github.com/openai/chatgpt-retrieval-plugin#retrieval-plugin)
  - [Retrieval Plugin with custom GPTs](https://github.com/openai/chatgpt-retrieval-plugin#retrieval-plugin-with-custom-gpts)
  - [Retrieval Plugin with function calling](https://github.com/openai/chatgpt-retrieval-plugin#retrieval-plugin-with-function-calling)
  - [Retrieval Plugin with the plugins model (deprecated)](https://github.com/openai/chatgpt-retrieval-plugin#chatgpt-plugins-model)
  - [API Endpoints](https://github.com/openai/chatgpt-retrieval-plugin#api-endpoints)
  - [Memory Feature](https://github.com/openai/chatgpt-retrieval-plugin#memory-feature)
  - [Security](https://github.com/openai/chatgpt-retrieval-plugin#security)
  - [Choosing an Embeddings Model](https://github.com/openai/chatgpt-retrieval-plugin#choosing-an-embeddings-model)

- [Development](https://github.com/openai/chatgpt-retrieval-plugin#development)
  - [Setup](https://github.com/openai/chatgpt-retrieval-plugin#setup)
    - [General Environment Variables](https://github.com/openai/chatgpt-retrieval-plugin#general-environment-variables)

  - [Choosing a Vector Database](https://github.com/openai/chatgpt-retrieval-plugin#choosing-a-vector-database)
    - [Pinecone](https://github.com/openai/chatgpt-retrieval-plugin#pinecone)
    - [Elasticsearch](https://github.com/openai/chatgpt-retrieval-plugin#elasticsearch)
    - [MongoDB Atlas](https://github.com/openai/chatgpt-retrieval-plugin#mongodb-atlas)
    - [Weaviate](https://github.com/openai/chatgpt-retrieval-plugin#weaviate)
    - [Zilliz](https://github.com/openai/chatgpt-retrieval-plugin#zilliz)
    - [Milvus](https://github.com/openai/chatgpt-retrieval-plugin#milvus)
    - [Qdrant](https://github.com/openai/chatgpt-retrieval-plugin#qdrant)
    - [Redis](https://github.com/openai/chatgpt-retrieval-plugin#redis)
    - [Llama Index](https://github.com/openai/chatgpt-retrieval-plugin#llamaindex)
    - [Chroma](https://github.com/openai/chatgpt-retrieval-plugin#chroma)
    - [Azure Cognitive Search](https://github.com/openai/chatgpt-retrieval-plugin#azure-cognitive-search)
    - [Azure CosmosDB Mongo vCore](https://github.com/openai/chatgpt-retrieval-plugin#azure-cosmosdb-mongo-vcore)
    - [Supabase](https://github.com/openai/chatgpt-retrieval-plugin#supabase)
    - [Postgres](https://github.com/openai/chatgpt-retrieval-plugin#postgres)
    - [AnalyticDB](https://github.com/openai/chatgpt-retrieval-plugin#analyticdb)

  - [Running the API Locally](https://github.com/openai/chatgpt-retrieval-plugin#running-the-api-locally)
  - [Personalization](https://github.com/openai/chatgpt-retrieval-plugin#personalization)
  - [Authentication Methods](https://github.com/openai/chatgpt-retrieval-plugin#authentication-methods)

- [Deployment](https://github.com/openai/chatgpt-retrieval-plugin#deployment)
- [Webhooks](https://github.com/openai/chatgpt-retrieval-plugin#webhooks)
- [Scripts](https://github.com/openai/chatgpt-retrieval-plugin#scripts)
- [Limitations](https://github.com/openai/chatgpt-retrieval-plugin#limitations)
- [Contributors](https://github.com/openai/chatgpt-retrieval-plugin#contributors)
- [Future Directions](https://github.com/openai/chatgpt-retrieval-plugin#future-directions)

## Quickstart

Follow these steps to quickly set up and run the ChatGPT Retrieval Plugin:

1. Install Python 3.10, if not already installed.
2. Clone the repository: `git clone https://github.com/openai/chatgpt-retrieval-plugin.git`
3. Navigate to the cloned repository directory: `cd /path/to/chatgpt-retrieval-plugin`
4. Install poetry: `pip install poetry`
5. Create a new virtual environment with Python 3.10: `poetry env use python3.10`
6. Activate the virtual environment: `poetry shell`
7. Install app dependencies: `poetry install`
8. Create a [bearer token](https://github.com/openai/chatgpt-retrieval-plugin#general-environment-variables)
9. Set the required environment variables:
10. Run the API locally: `poetry run start`
11. Access the API documentation at `http://0.0.0.0:8000/docs` and test the API endpoints (make sure to add your bearer token).

## GitHub:

[https://github.com/openai/chatgpt-retrieval-plugin](https://github.com/openai/chatgpt-retrieval-plugin)

---

<div class="post-metadata">

**Author:** ![Myownman](https://onehack.st/user_avatar/onehack.st/myownman/32/128175_2.png) [@Myownman](https://onehack.st/u/Myownman)\
**Post date:** [September 24, 2024, 4:38am UTC](https://onehack.st/t/chatgpt-retrieval-plugin-build-custom-gpts-with-a-retrieval-plugin/291898/2 "2024-09-24T04:38:02Z")

</div>

Nice Buddy! Thank You!
