Chatgpt retrieval plugin
Author: n | 2025-04-23
Integrating the ChatGPT retrieval plugin within a ChatGPT application. To integrate the ChatGPT retrieval plugin with a ChatGPT application, follow these: API integration.
GitHub - e4c6/chatgpt-retrieval-plugin: The ChatGPT Retrieval Plugin
ServerOpenAI offers plugins that allow ChatGPT to interface with API endpoints to retrieve external information. There is a variety of examples and instructions given in Introduction - OpenAI ChatGPT Plugins. ChatGPT plugins are currently available in beta.The ChatGPT retrieval plugin provides an easy way to read data from a vector database using semantic similarity, and upsert new data into the database. For example, user conversations with ChatGPT, and their embedding representations can be stored for later retrieval. With PostgreSQL as a supported datastore, the retrieval plugin can store and interact with a PostgreSQL database.The diagram below depicts the interactions between the retrieval plugin, database and OpenAI/ChatGPT service. The retrieval plugin exposes endpoints such as /query and /upsert, and further details of functionality can be found in the retrieval plugin API Endpoints documentation.Figure 1: Retrieval plugin internals. Data upsert flow (1), (2) & (3). ChatGPT query flow (a), (b), (c) & (d).Initially, you may want to input data into the database that ChatGPT can later recall, as you can see in the diagram above:(1) To input data into the database, /upsert endpoint or /upsert-file can be called.(2) Within the retrieval plugin this will trigger calls to get embedding from the OpenAI API endpoint.(3) After obtaining the embedding, the retrieval plugin stores the input data and embeddings into the backend datastore.In the context of this post, PostgreSQL is used as a datastore which is managed by Azure Database for PostgreSQL - Flexible Server. The embeddings are stored as vector types offered by the pgvector extension.OK, now let's explore the ChatGPT portion of the workflow (indicated by letters) in Figure 1's diagram above:(a) language queries posed by the user to ChatGPT(b) the OpenAI / ChatGPT service will reach out to the /query endpoint of the plugin(c) the plugin then calls OpenAI / ChatGPT
GitHub - openai/chatgpt-retrieval-plugin: The ChatGPT Retrieval Plugin
ChatGPT appends the knowledge it gains using retrieval plugin.At Build, Azure OpenAI is announcing a private preview for plugins. Below you can see a sneak peek of using PostgreSQL as retrieval plugin datastore with Azure OpenAI. On posting the question the retrieval plugin was triggered. The plugin queries the PostgreSQL database and returns relevant results to the service. The model used the results from the query to give a response grounded in data entered earlier in the database. Figure 4: Example Azure OpenAI chat session asking about PG extension support in Azure Database for PostgreSQL - Flexible Server.We are just at the beginning of a quantum shift in AI and Data. Some features and functionality mentioned in this post are currently in beta/private preview mode. As we go through this journey with OpenAI / ChatGPT and Azure, there are interesting challenges of data privacy, performance, and enterprise security which will have to be addressed. So... there is a lot more to come. Until next time, goodbye, and happy ChatGPT-ing. !Here are a few links where you can learn more on the topics relevant to this post:Azure Database for PostgreSQL – Flexible ServerAzure Cosmos DB for PostgreSQLGitHub - pgvector/pgvector: Open-source vector similarity search for PostgresChatGPT plugins (openai.com)GitHub - openai/chatgpt-retrieval-plugin: The ChatGPT Retrieval Plugin lets you easily find personal or work documents by asking questions in natural language.Azure OpenAI Service – Advanced Language Models | Microsoft Azurechatgpt-retrieval-plugin: The ChatGPT Retrieval Plugin lets you
Integrating another vector database provider with the ChatGPT Retrieval Plugin, feel free to submit an implementation.Additional scripts: Expanding the range of scripts available for processing and uploading documents from various data sources would make the plugin even more versatile.User Interface: Developing a user interface for managing documents and interacting with the plugin could improve the user experience.Hybrid search / TF-IDF option: Enhancing the datastore's upsert function with an option to use hybrid search or TF-IDF indexing could improve the plugin's performance for keyword-based queries.Advanced chunking strategies and embeddings calculations: Implementing more sophisticated chunking strategies and embeddings calculations, such as embedding document titles and summaries, performing weighted averaging of document chunks and summaries, or calculating the average embedding for a document, could lead to better search results.Custom metadata: Allowing users to add custom metadata to document chunks, such as titles or other relevant information, might improve the retrieved results in some use cases.Additional optional services: Integrating more optional services, such as summarizing documents or pre-processing documents before embedding them, could enhance the plugin's functionality and quality of retrieved results. These services could be implemented using language models and integrated directly into the plugin, rather than just being available in the scripts.We welcome contributions from the community to help improve the ChatGPT Retrieval Plugin and expand its capabilities. If you have an idea or feature you'd like to contribute, please submit a pull request to the repository.ContributorsWe would like to extend our gratitude to the following contributors for their code / documentation contributions, and support in integrating various vector database providers with the ChatGPT Retrieval Plugin:PineconeacatavgkoganjamescalamWeaviatebyronvoorbachhsm207sebawitaZillizfilip-haltMilvusfilip-haltQdrantkacperlukawskiRedissparteetylerhutcherson. Integrating the ChatGPT retrieval plugin within a ChatGPT application. To integrate the ChatGPT retrieval plugin with a ChatGPT application, follow these: API integration. Retrieval plugin by ChatGPT. This ChatGPT plugin is designed to enable the model to retrieve specific information from a dataset or knowledge base. The retrieval pluginGitHub - GPTpanda/chatgpt-retrieval-plugin: The ChatGPT Retrieval
To add your bearer token).Testing in ChatGPTTo test a locally hosted plugin in ChatGPT, follow these steps:Run the API on localhost: poetry run devFollow the instructions in the Testing a Localhost Plugin in ChatGPT section of the README.For more detailed information on setting up, developing, and deploying the ChatGPT Retrieval Plugin, refer to the full Development section below.AboutPluginsPlugins are chat extensions designed specifically for language models like ChatGPT, enabling them to access up-to-date information, run computations, or interact with third-party services in response to a user's request. They unlock a wide range of potential use cases and enhance the capabilities of language models.Developers can create a plugin by exposing an API through their website and providing a standardized manifest file that describes the API. ChatGPT consumes these files and allows the AI models to make calls to the API defined by the developer.A plugin consists of:An APIAn API schema (OpenAPI JSON or YAML format)A manifest (JSON file) that defines relevant metadata for the pluginThe Retrieval Plugin already contains all of these components. Read the Chat Plugins blogpost here, and find the docs here.Retrieval PluginThis is a plugin for ChatGPT that enables semantic search and retrieval of personal or organizational documents. It allows users to obtain the most relevant document snippets from their data sources, such as files, notes, or emails, by asking questions or expressing needs in natural language. Enterprises can make their internal documents available to their employees through ChatGPT using this plugin.The plugin uses OpenAI's text-embedding-ada-002 embeddings model to generate embeddings of document chunks, and then stores and queries them using a vector database on the backend. As an open-source and self-hosted solution, developers can deploy their own Retrieval Plugin and register it with ChatGPT. The Retrieval Plugin supports several vector database providers, allowing developers to choose their preferred one from a list.A FastAPI server exposes the plugin's endpoints for upserting, querying, and deleting documents. Users can refine their search results by using metadata filters by source, date, author, or other criteria. The plugin can be hosted on any cloud platform that supports Docker containers, such as Fly.io, Heroku or Azure Container Apps. To keep the vector database updated with the latest documents, the plugin can process and store documents from various data sources continuously, using incoming webhooks to the upsert and delete endpoints. Tools like Zapier or Make can help configure the webhooks based on events orGitHub - wangshouh/chatgpt-retrieval: The ChatGPT Retrieval Plugin
Schedules.Memory FeatureA notable feature of the Retrieval Plugin is its capacity to provide ChatGPT with memory. By utilizing the plugin's upsert endpoint, ChatGPT can save snippets from the conversation to the vector database for later reference (only when prompted to do so by the user). This functionality contributes to a more context-aware chat experience by allowing ChatGPT to remember and retrieve information from previous conversations. Learn how to configure the Retrieval Plugin with memory here.SecurityThe Retrieval Plugin allows ChatGPT to search a vector database of content, and then add the best results into the ChatGPT session. This means it doesn’t have any external effects, and the main risk consideration is data authorization and privacy. Developers should only add content into their Retrieval Plugin that they have authorization for and that they are fine with appearing in users’ ChatGPT sessions. You can choose from a number of different authentication methods to secure the plugin (more information here).API EndpointsThe Retrieval Plugin is built using FastAPI, a web framework for building APIs with Python. FastAPI allows for easy development, validation, and documentation of API endpoints. Find the FastAPI documentation here.One of the benefits of using FastAPI is the automatic generation of interactive API documentation with Swagger UI. When the API is running locally, Swagger UI at /docs can be used to interact with the API endpoints, test their functionality, and view the expected request and response models.The plugin exposes the following endpoints for upserting, querying, and deleting documents from the vector database. All requests and responses are in JSON format, and require a valid bearer token as an authorization header./upsert: This endpoint allows uploading one or more documents and storing their text and metadata in the vector database. The documents are split into chunks of around 200 tokens, each with a unique ID. The endpoint expects a list of documents in the request body, each with a text field, and optional id and metadata fields. The metadata field can contain the following optional subfields: source, source_id, url, created_at, and author. The endpoint returns a list of the IDs of the inserted documents (an ID is generated if not initially provided)./upsert-file: This endpoint allows uploading a single file (PDF, TXT, DOCX, PPTX, or MD) and storing its text and metadata in the vector database. The file is converted to plain text and split into chunks of around 200 tokens, each with a unique ID.GitHub - openai/chatgpt-retrieval-plugin: The ChatGPT Retrieval
To get embeddings for the query text(d) the plugin performs a similarity search on the contents in the databaseThe pgvector extension provides similarity search on vectors and this facility is used by the plugin to find out the similar strings. ChatGPT then appends more context to the results and returns the information to the user.Here are set of instructions to help you configure the retrieval plugin (that is using pgvector) with OpenAI and Flexible Server in Azure Database for PostgreSQL—in a local setup for testing.Create a managed database instance: Managed instance of Azure databases for PostgreSQL Flexible Server can be created using azure cli commands, documentation for which can be found here az postgres flexible-server | Microsoft Learn. Alternatively, the server can be provisioned from the Azure portal by searching for Azure Database for PostgreSQL Flexible Server in Marketplace. Allow list pgvector and another extension to try out the test code: The pgvector extension can be allow listed on the Managed PostgreSQL created using set parameter cli command az postgres flexible-server parameter | Microsoft Learn az postgres flexible-server parameter set --resource-group --server-name --name azure.extensions --value "vector,uuid-ossp"Environment setup for retrieval plugin: Before running the openai/chatgpt-retrieval-plugin, the following environment variables are expected to be configured. export DATASTORE=POSTGRESexport OPENAI_API_KEY=export PG_HOST=export PG_DATABASE=postgresexport BEARER_TOKEN=export PG_PORTexport PG_USERexport PG_PASSWORDInitialization scripts to setup the tables: Run the init scripts available from chatgpt-retrieval-plugin/setup.md and validate the extension and the documents tables postgres=> \i init.sqlCREATE EXTENSIONCREATE TABLECREATE INDEXCREATE INDEXCREATE INDEXCREATE INDEXCREATE INDEXALTER TABLECREATE FUNCTIONpostgres=> \dx List of installed extensions Name | Version | Schema | Description-----------+---------+------------+-------------------------------------------------azure | 1.0 | pg_catalog | azure extension for PostgreSQL servicepg_cron | 1.4-1 | public | Job scheduler for PostgreSQLpgaadauth | 1.0 | pg_catalog | Azure Active Directory Authenticationpgcrypto | 1.3 | public | cryptographic functionsplpgsql | 1.0 | pg_catalog | PL/pgSQL procedural languageuuid-ossp |ChatGPT plugins : ChatGPT Retrieval Plugin demo - YouTube
1.1 | public | generate universally unique identifiers (UUIDs)vector | 0.4.1 | public | vector data type and ivfflat access method(7 rows)postgres=> \dt List of relationsSchema | Name | Type | Owner--------+-----------+-------+----------public | documents | table | pgvector(1 row)Running the plugin locally: The python dependency management tool poetry is used by the retrieval plugin to instantiate the local API endpoint.$ poetry run devINFO: Will watch for changes in these directories: ['/home/rohan/chatgpt-retrieval-plugin']INFO: Uvicorn running on (Press CTRL+C to quit)INFO: Started reloader process [1701689] using WatchFilesINFO: Started server process [1701697]INFO: Waiting for application startup.INFO: Application startup complete.Add content into the datastore using the /upsert endpoint using the local endpoint at The details for traversal can be found here: API endpoints. Here we input the contents we are going to query against – two strings which talks about the Azure Database for PostgreSQL supported versions and extensions.curl -X 'POST' \ ' \ -H 'accept: application/json' \ -H 'Content-Type: application/json' \ -d '{ "documents": [ { "id": "12", "text": "Azure Databases for PostgreSQL supports PostgreSQL versions 11, 12, 13, and 14. The public preview of PostgreSQL 15 will be announced soon.", "metadata": { "source": "file", "source_id": "file", "url": "www.localhost.com", "created_at": "05-18-2023", "author": "xyz" } } ]}'{"ids":["12"]} -- outputcurl -X 'POST' \ ' \ -H 'accept: application/json' \ -H 'Content-Type: application/json' \ -d '{ "documents": [ { "id": "13", "text": "Azure Databases for PostgreSQL supports several extensions. Some of these include TimeScaleDB, PostGIS, PgAnonimizer, PgVector.", "metadata": { "source": "file", "source_id": "file", "url": "www.localhost.com", "created_at": "05-18-2023", "author": "xyz" } } ]}'{"ids":["13"]} -- outputRegister the local plugin with instructions from: ChatGPT and the data retrieved via the plugin will start to appear in the context.Figure 2: Query ChatGPT using retrieval plugin on supported PostgreSQL versions.Figure 3: Query ChatGPT using retrieval plugin on supported extensions.As you can see. Integrating the ChatGPT retrieval plugin within a ChatGPT application. To integrate the ChatGPT retrieval plugin with a ChatGPT application, follow these: API integration.
GitHub - kohl00/chatgpt-retrieval-plugin-1: The ChatGPT Retrieval
ChatGPT Retrieval PluginJoin the ChatGPT plugins waitlist here!Find an example video of a Retrieval Plugin that has access to the UN Annual Reports from 2018 to 2022 here.IntroductionThe ChatGPT Retrieval Plugin repository provides a flexible solution for semantic search and retrieval of personal or organizational documents using natural language queries. The repository is organized into several directories:DirectoryDescriptiondatastoreContains the core logic for storing and querying document embeddings using various vector database providers.docsIncludes documentation for setting up and using each vector database provider, webhooks, and removing unused dependencies.examplesProvides example configurations, authentication methods, and provider-specific examples.modelsContains the data models used by the plugin, such as document and metadata models.scriptsOffers scripts for processing and uploading documents from different data sources.serverHouses the main FastAPI server implementation.servicesContains utility services for tasks like chunking, metadata extraction, and PII detection.testsIncludes integration tests for various vector database providers..well-knownStores 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.Table of ContentsQuickstartAboutPluginsRetrieval PluginMemory FeatureSecurityAPI EndpointsDevelopmentSetupGeneral Environment VariablesChoosing a Vector DatabasePineconeWeaviateZillizMilvusQdrantRedisRunning the API LocallyTesting a Localhost Plugin in ChatGPTPersonalizationAuthentication MethodsDeploymentInstalling a Developer PluginWebhooksScriptsLimitationsContributorsFuture DirectionsQuickstartFollow 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 to the cloned repository directory: cd /path/to/chatgpt-retrieval-pluginInstall poetry: pip install poetryCreate a new virtual environment with Python 3.10: poetry env use python3.10Activate the virtual environment: poetry shellInstall app dependencies: poetry installSet the required environment variables:export BEARER_TOKEN=export OPENAI_API_KEY=# Add the environment variables for your chosen vector DB.# Some of these are optional; read the provider's setup docs in /docs/providers for more information.# Pineconeexport PINECONE_API_KEY=export PINECONE_ENVIRONMENT=export PINECONE_INDEX=# Weaviateexport WEAVIATE_HOST=export WEAVIATE_PORT=export WEAVIATE_INDEX=export WEAVIATE_USERNAME=export WEAVIATE_PASSWORD=export WEAVIATE_SCOPES=export WEAVIATE_BATCH_SIZE=export WEAVIATE_BATCH_DYNAMIC=export WEAVIATE_BATCH_TIMEOUT_RETRIES=export WEAVIATE_BATCH_NUM_WORKERS=# Zillizexport ZILLIZ_COLLECTION=export ZILLIZ_URI=export ZILLIZ_USER=export ZILLIZ_PASSWORD=# Milvusexport MILVUS_COLLECTION=export MILVUS_HOST=export MILVUS_PORT=export MILVUS_USER=export MILVUS_PASSWORD=# Qdrantexport QDRANT_URL=export QDRANT_PORT=export QDRANT_GRPC_PORT=export QDRANT_API_KEY=export QDRANT_COLLECTION=# Redisexport REDIS_HOST=export REDIS_PORT=export REDIS_PASSWORD=export REDIS_INDEX_NAME=export REDIS_DOC_PREFIX=export REDIS_DISTANCE_METRIC=export REDIS_INDEX_TYPE=">export DATASTORE=export BEARER_TOKEN=export OPENAI_API_KEY=# Add the environment variables for your chosen vector DB.# Some of these are optional; read the provider's setup docs in /docs/providers for more information.# Pineconeexport PINECONE_API_KEY=export PINECONE_ENVIRONMENT=export PINECONE_INDEX=# Weaviateexport WEAVIATE_HOST=export WEAVIATE_PORT=export WEAVIATE_INDEX=export WEAVIATE_USERNAME=export WEAVIATE_PASSWORD=export WEAVIATE_SCOPES=export WEAVIATE_BATCH_SIZE=export WEAVIATE_BATCH_DYNAMIC=export WEAVIATE_BATCH_TIMEOUT_RETRIES=export WEAVIATE_BATCH_NUM_WORKERS=# Zillizexport ZILLIZ_COLLECTION=export ZILLIZ_URI=export ZILLIZ_USER=export ZILLIZ_PASSWORD=# Milvusexport MILVUS_COLLECTION=export MILVUS_HOST=export MILVUS_PORT=export MILVUS_USER=export MILVUS_PASSWORD=# Qdrantexport QDRANT_URL=export QDRANT_PORT=export QDRANT_GRPC_PORT=export QDRANT_API_KEY=export QDRANT_COLLECTION=# Redisexport REDIS_HOST=export REDIS_PORT=export REDIS_PASSWORD=export REDIS_INDEX_NAME=export REDIS_DOC_PREFIX=export REDIS_DISTANCE_METRIC=export REDIS_INDEX_TYPE=Run the API locally: poetry run startAccess the API documentation at and test the API endpoints (make sureGitHub - WaVEV/chatgpt-retrieval-plugin_: The ChatGPT Retrieval Plugin
Optionally other fields to populate the metadata. You can provide custom metadata as a JSON string and flags to screen for PII and extract metadata.process_zip: This script processes a file dump of documents in a zip file and stores them in the vector database with some metadata. The format of the zip file should be a flat zip file folder of docx, pdf, txt, md, pptx or csv files. You can provide custom metadata as a JSON string and flags to screen for PII and extract metadata.LimitationsWhile the ChatGPT Retrieval Plugin is designed to provide a flexible solution for semantic search and retrieval, it does have some limitations:Keyword search limitations: The embeddings generated by the text-embedding-ada-002 model may not always be effective at capturing exact keyword matches. As a result, the plugin might not return the most relevant results for queries that rely heavily on specific keywords. Some vector databases, like Pinecone and Weaviate, use hybrid search and might perform better for keyword searches.Sensitive data handling: The plugin does not automatically detect or filter sensitive data. It is the responsibility of the developers to ensure that they have the necessary authorization to include content in the Retrieval Plugin and that the content complies with data privacy requirements.Scalability: The performance of the plugin may vary depending on the chosen vector database provider and the size of the dataset. Some providers may offer better scalability and performance than others.Language support: The plugin currently uses OpenAI's text-embedding-ada-002 model, which is optimized for use in English. However, it is still robust enough to generate good results for a variety of languages.Metadata extraction: The optional metadata extraction feature relies on a language model to extract information from the document text. This process may not always be accurate, and the quality of the extracted metadata may vary depending on the document content and structure.PII detection: The optional PII detection feature is not foolproof and may not catch all instances of personally identifiable information. Use this feature with caution and verify its effectiveness for your specific use case.Future DirectionsThe ChatGPT Retrieval Plugin provides a flexible solution for semantic search and retrieval, but there is always potential for further development. We encourage users to contribute to the project by submitting pull requests for new features or enhancements. Notable contributions may be acknowledged with OpenAI credits.Some ideas for future directions include:More vector database providers: If you are interested in. Integrating the ChatGPT retrieval plugin within a ChatGPT application. To integrate the ChatGPT retrieval plugin with a ChatGPT application, follow these: API integration.GitHub - rjarun8/nptel-chatgpt-retrieval-plugin: The ChatGPT Retrieval
Join our daily and weekly newsletters for the latest updates and exclusive content on industry-leading AI coverage. Learn MoreOpenAI today announced its support of new third-party plugins for ChatGPT, and it already has Twitter buzzing about the company’s potential platform play. In a blog post, the company stated that the plugins are “tools designed specifically for language models with safety as a core principle, and help ChatGPT access up-to-date information, run computations, or use third-party services.” A sign of OpenAI’s accelerating dominanceThe announcement was quickly received by the public as a signal of OpenAI‘s ambitions to further its dominance by turning ChatGPT into a developer platform. “OpenAI is seeing ChatGPT as a platform play,” tweeted Marco Mascorro, cofounder of Fellow AI. And @gregmushen tweeted: “I think the introduction of plugins to ChatGPT is a threat to the App Store. It creates a new platform with new monetization methods.”In sharing the announcement, OpenAI CEO Sam Altman tweeted: “We are starting our rollout of ChatGPT plugins. you can install plugins to help with a wide variety of tasks. we are excited to see what developers create!” OpenAI, he said, is offering a web browsing plugin and a code execution plugin. He added that the company is open-sourcing the code for a retrieval plugin. The plugins, he said, are “very experimental still,” but maintained that “we think there’s something great in this direction; it’s been a heavily requested feature.” ChatGPT plugins: Major milestone in development of AI chatOpenAI announced that plugin developers who have been invited off the company’s waitlist can use its documentation to build a plugin for ChatGPT. The first plugins have already been created by companies including Expedia, Instacart, Kayak, OpenTable and Zapier. According to Expedia, their new plugin simplifies trip planning for ChatGPT users. “Until now, ChatGPT could identify what to do and where to stay, but it couldn’t help travelers shop and book,” said a press representative in an email.Now, once a traveler enables the Expedia plugin, they can bring a trip itinerary created through a conversation with ChatGPT “to life” with information powered by Expedia’s travel dataComments
ServerOpenAI offers plugins that allow ChatGPT to interface with API endpoints to retrieve external information. There is a variety of examples and instructions given in Introduction - OpenAI ChatGPT Plugins. ChatGPT plugins are currently available in beta.The ChatGPT retrieval plugin provides an easy way to read data from a vector database using semantic similarity, and upsert new data into the database. For example, user conversations with ChatGPT, and their embedding representations can be stored for later retrieval. With PostgreSQL as a supported datastore, the retrieval plugin can store and interact with a PostgreSQL database.The diagram below depicts the interactions between the retrieval plugin, database and OpenAI/ChatGPT service. The retrieval plugin exposes endpoints such as /query and /upsert, and further details of functionality can be found in the retrieval plugin API Endpoints documentation.Figure 1: Retrieval plugin internals. Data upsert flow (1), (2) & (3). ChatGPT query flow (a), (b), (c) & (d).Initially, you may want to input data into the database that ChatGPT can later recall, as you can see in the diagram above:(1) To input data into the database, /upsert endpoint or /upsert-file can be called.(2) Within the retrieval plugin this will trigger calls to get embedding from the OpenAI API endpoint.(3) After obtaining the embedding, the retrieval plugin stores the input data and embeddings into the backend datastore.In the context of this post, PostgreSQL is used as a datastore which is managed by Azure Database for PostgreSQL - Flexible Server. The embeddings are stored as vector types offered by the pgvector extension.OK, now let's explore the ChatGPT portion of the workflow (indicated by letters) in Figure 1's diagram above:(a) language queries posed by the user to ChatGPT(b) the OpenAI / ChatGPT service will reach out to the /query endpoint of the plugin(c) the plugin then calls OpenAI / ChatGPT
2025-04-12ChatGPT appends the knowledge it gains using retrieval plugin.At Build, Azure OpenAI is announcing a private preview for plugins. Below you can see a sneak peek of using PostgreSQL as retrieval plugin datastore with Azure OpenAI. On posting the question the retrieval plugin was triggered. The plugin queries the PostgreSQL database and returns relevant results to the service. The model used the results from the query to give a response grounded in data entered earlier in the database. Figure 4: Example Azure OpenAI chat session asking about PG extension support in Azure Database for PostgreSQL - Flexible Server.We are just at the beginning of a quantum shift in AI and Data. Some features and functionality mentioned in this post are currently in beta/private preview mode. As we go through this journey with OpenAI / ChatGPT and Azure, there are interesting challenges of data privacy, performance, and enterprise security which will have to be addressed. So... there is a lot more to come. Until next time, goodbye, and happy ChatGPT-ing. !Here are a few links where you can learn more on the topics relevant to this post:Azure Database for PostgreSQL – Flexible ServerAzure Cosmos DB for PostgreSQLGitHub - pgvector/pgvector: Open-source vector similarity search for PostgresChatGPT plugins (openai.com)GitHub - openai/chatgpt-retrieval-plugin: The ChatGPT Retrieval Plugin lets you easily find personal or work documents by asking questions in natural language.Azure OpenAI Service – Advanced Language Models | Microsoft Azure
2025-04-18To add your bearer token).Testing in ChatGPTTo test a locally hosted plugin in ChatGPT, follow these steps:Run the API on localhost: poetry run devFollow the instructions in the Testing a Localhost Plugin in ChatGPT section of the README.For more detailed information on setting up, developing, and deploying the ChatGPT Retrieval Plugin, refer to the full Development section below.AboutPluginsPlugins are chat extensions designed specifically for language models like ChatGPT, enabling them to access up-to-date information, run computations, or interact with third-party services in response to a user's request. They unlock a wide range of potential use cases and enhance the capabilities of language models.Developers can create a plugin by exposing an API through their website and providing a standardized manifest file that describes the API. ChatGPT consumes these files and allows the AI models to make calls to the API defined by the developer.A plugin consists of:An APIAn API schema (OpenAPI JSON or YAML format)A manifest (JSON file) that defines relevant metadata for the pluginThe Retrieval Plugin already contains all of these components. Read the Chat Plugins blogpost here, and find the docs here.Retrieval PluginThis is a plugin for ChatGPT that enables semantic search and retrieval of personal or organizational documents. It allows users to obtain the most relevant document snippets from their data sources, such as files, notes, or emails, by asking questions or expressing needs in natural language. Enterprises can make their internal documents available to their employees through ChatGPT using this plugin.The plugin uses OpenAI's text-embedding-ada-002 embeddings model to generate embeddings of document chunks, and then stores and queries them using a vector database on the backend. As an open-source and self-hosted solution, developers can deploy their own Retrieval Plugin and register it with ChatGPT. The Retrieval Plugin supports several vector database providers, allowing developers to choose their preferred one from a list.A FastAPI server exposes the plugin's endpoints for upserting, querying, and deleting documents. Users can refine their search results by using metadata filters by source, date, author, or other criteria. The plugin can be hosted on any cloud platform that supports Docker containers, such as Fly.io, Heroku or Azure Container Apps. To keep the vector database updated with the latest documents, the plugin can process and store documents from various data sources continuously, using incoming webhooks to the upsert and delete endpoints. Tools like Zapier or Make can help configure the webhooks based on events or
2025-04-19Schedules.Memory FeatureA notable feature of the Retrieval Plugin is its capacity to provide ChatGPT with memory. By utilizing the plugin's upsert endpoint, ChatGPT can save snippets from the conversation to the vector database for later reference (only when prompted to do so by the user). This functionality contributes to a more context-aware chat experience by allowing ChatGPT to remember and retrieve information from previous conversations. Learn how to configure the Retrieval Plugin with memory here.SecurityThe Retrieval Plugin allows ChatGPT to search a vector database of content, and then add the best results into the ChatGPT session. This means it doesn’t have any external effects, and the main risk consideration is data authorization and privacy. Developers should only add content into their Retrieval Plugin that they have authorization for and that they are fine with appearing in users’ ChatGPT sessions. You can choose from a number of different authentication methods to secure the plugin (more information here).API EndpointsThe Retrieval Plugin is built using FastAPI, a web framework for building APIs with Python. FastAPI allows for easy development, validation, and documentation of API endpoints. Find the FastAPI documentation here.One of the benefits of using FastAPI is the automatic generation of interactive API documentation with Swagger UI. When the API is running locally, Swagger UI at /docs can be used to interact with the API endpoints, test their functionality, and view the expected request and response models.The plugin exposes the following endpoints for upserting, querying, and deleting documents from the vector database. All requests and responses are in JSON format, and require a valid bearer token as an authorization header./upsert: This endpoint allows uploading one or more documents and storing their text and metadata in the vector database. The documents are split into chunks of around 200 tokens, each with a unique ID. The endpoint expects a list of documents in the request body, each with a text field, and optional id and metadata fields. The metadata field can contain the following optional subfields: source, source_id, url, created_at, and author. The endpoint returns a list of the IDs of the inserted documents (an ID is generated if not initially provided)./upsert-file: This endpoint allows uploading a single file (PDF, TXT, DOCX, PPTX, or MD) and storing its text and metadata in the vector database. The file is converted to plain text and split into chunks of around 200 tokens, each with a unique ID.
2025-04-131.1 | public | generate universally unique identifiers (UUIDs)vector | 0.4.1 | public | vector data type and ivfflat access method(7 rows)postgres=> \dt List of relationsSchema | Name | Type | Owner--------+-----------+-------+----------public | documents | table | pgvector(1 row)Running the plugin locally: The python dependency management tool poetry is used by the retrieval plugin to instantiate the local API endpoint.$ poetry run devINFO: Will watch for changes in these directories: ['/home/rohan/chatgpt-retrieval-plugin']INFO: Uvicorn running on (Press CTRL+C to quit)INFO: Started reloader process [1701689] using WatchFilesINFO: Started server process [1701697]INFO: Waiting for application startup.INFO: Application startup complete.Add content into the datastore using the /upsert endpoint using the local endpoint at The details for traversal can be found here: API endpoints. Here we input the contents we are going to query against – two strings which talks about the Azure Database for PostgreSQL supported versions and extensions.curl -X 'POST' \ ' \ -H 'accept: application/json' \ -H 'Content-Type: application/json' \ -d '{ "documents": [ { "id": "12", "text": "Azure Databases for PostgreSQL supports PostgreSQL versions 11, 12, 13, and 14. The public preview of PostgreSQL 15 will be announced soon.", "metadata": { "source": "file", "source_id": "file", "url": "www.localhost.com", "created_at": "05-18-2023", "author": "xyz" } } ]}'{"ids":["12"]} -- outputcurl -X 'POST' \ ' \ -H 'accept: application/json' \ -H 'Content-Type: application/json' \ -d '{ "documents": [ { "id": "13", "text": "Azure Databases for PostgreSQL supports several extensions. Some of these include TimeScaleDB, PostGIS, PgAnonimizer, PgVector.", "metadata": { "source": "file", "source_id": "file", "url": "www.localhost.com", "created_at": "05-18-2023", "author": "xyz" } } ]}'{"ids":["13"]} -- outputRegister the local plugin with instructions from: ChatGPT and the data retrieved via the plugin will start to appear in the context.Figure 2: Query ChatGPT using retrieval plugin on supported PostgreSQL versions.Figure 3: Query ChatGPT using retrieval plugin on supported extensions.As you can see
2025-03-28