Do you have questions about PostgreSQL or Neon? We built a custom Neon and PostgreSQL OpenAI GPT expert to help you with your queries and projects.
OpenAI’s GPT allows developers to create custom ChatGPT experiences to perform specific tasks or answer questions about a given topic.
This article walks you through the steps to create your own custom GPT using Python and Postgres.
What are GPTs?
Generative Pre-trained Transformers, commonly referred to as GPTs, are a group of machine learning models that provide human-like text interfaces that can answer questions in a conversational manner. OpenAI’s GPT allows developers to create custom ChatGPTs that are experts in specific domains and enable additional capabilities like web browsing and DALL·E image generation.
OpenAI has also introduced the GPT Store, a marketplace where users can explore and access various GPTs. Creators can feature their GPTs in this store and potentially earn money based on their usage by the community.
How to create a GPT
Developers with a Plus or Enterprise subscription can create GPTs by interacting with the GPT Builder in ChatGPT, where they can add instructions, upload files for the knowledge base, and select capabilities such as web searching, image creation, or data analysis.
Here’s how to create a GPT:
Head to https://chat.openai.com/gpts/editor (or select your name and then “My GPTs”)In the “Configure” tab, enter the name, description and instructions.
Example of instructions we used for the Neon PostgreSQL Expert GPT: “Your role is to act as a PostgreSQL expert, specifically tailored for Neon’s database as a service. You will provide detailed, accurate information and guidance on PostgreSQL, focusing on its use within the Neon platform. This includes offering advice on best practices, troubleshooting, performance optimization, and the nuances of working with Neon’s database service. You should be thorough in your explanations, ensuring clarity and precision in your responses. In cases where exact details are required and not provided, you should ask for clarification to provide the most accurate and helpful advice possible. Your responses should reflect a deep understanding of PostgreSQL and its application in a cloud-based environment like Neon.”
When you’re ready to publish your GPT, select “Publish” and share it with others if you’d like.
You can find the instructions in the OpenAI Chatgpt Neon PostgreSQL Expert repo on GitHub.
Enhance your GPT with Retrieval Augmented Generation
You can provide additional knowledge to your GPT by uploading text documents and a process named Retrieval-Augmented Generation (RAG).
RAG is a framework that enhances the capabilities of large language models (LLMs) like GPT by allowing them to access facts from an external knowledge base. This helps overcome some of the limitations with LLMs, like accessing up-to-date and private information, or reducing hallucinations.
The advantage of GPTs is that you don’t need to fully understand RAG to expand your chatbot with additional knowledge. But if you’re interested in understanding what happens under the hood, typically, documents are uploaded, then the text is split into pieces and chunks, added to a vector database, and used for RAG. Each user’s request will trigger a semantic search in the database to find the knowledge related to the user’s question. To understand more about how semantic search works, check out the YC Matcher code on GitHub.
RAG limitations with GPTs
Custom knowledge in GPTs is limited to 20 documents. Additionally, The text document formats that are currently supported to create GPTs are limited. For our example, we executed a script to crawl Neon’s documentation and generate markdown files.
The above limitations make it difficult for applications with extensive knowledge bases and gigabytes of private data to be converted to GPTs. Another concern is related to data security. OpenAI operates as a black box, which makes it challenging to know what’s going on internally and how your data is accessed. This can be a blocker for users with sensitive data.
An alternative would be to create your own RAG app that uses open-source tools and models such as Mixtral 8x7B and pgvector. Learn more about AI concepts and how to use create a chatbot using pgvector and Next.js.
Publishing to the GPT Store
One exciting aspect of building a GPT is that users can be paid based on engagement. To monetize your GPT, make sure to save it for Everyone and that you have a verified Builder Profile.
That’s it!
Conclusion
GPTs and the GPT Store are a great way to create, monetize, and share your own custom ChatGPTs with the world. GPTs such as the Neon PostgreSQL Expert do not require developer knowledge and are designed to be easy to publish and enhance with a few clicks.
However, GPTs come with limitations and do not replace RAG apps for apps that require extensive private and custom datasets or a further customized experience at the moment.
What about you? Are you thinking of a GPT? Let us know your thoughts and if you built a GPT or a RAG app. Join us and share your projects with us on our Discord server.