{"repo":"supabase-community/nextjs-openai-doc-search","free":true,"listed":false,"github":"https://github.com/supabase-community/nextjs-openai-doc-search","clone":"git clone https://github.com/supabase-community/nextjs-openai-doc-search.git","description":"Template for building your own custom ChatGPT style doc search powered by Next.js, OpenAI, and Supabase.","language":"TypeScript","stars":1732,"topics":["ai","chatgpt","nextjs","openai","postgres","supabase","template","vector-search"],"license":"Apache-2.0","category":"databases-storage","readme_excerpt":"Next.js OpenAI Doc Search Starter This starter takes all the .mdx files in the pages directory and processes them to use as custom context within OpenAI Text Completion prompts. Deploy Deploy this starter to Vercel. The Supabase integration will automatically set the required environment variables and configure your Database Schema. All you have to do is set your OPENAI KEY and you're ready to go! [ Technical Details Building your own custom ChatGPT involves four steps: 1. [👷 Build time] Pre-process the knowledge base (your .mdx files in your pages folder). 2. [👷 Build time] Store embeddings in Postgres with pgvector. 3. [🏃 Runtime] Perform vector similarity search to find the content that's relevant to the question. 4. [🏃 Runtime] Inject content into OpenAI GPT-3 text completion prompt and stream response to the client. 👷 Build time Step 1. and 2. happen at build time, e.g. when Vercel builds your Next.js app. During this time the generate-embeddings script is being executed which performs the following tasks: In addition to storing the embeddings, this script generates a checksum for each of your .mdx files and stores this in another database table to make sure the embeddings are only regenerated when the file has changed. 🏃 Runtime Step 3. and 4. happen at runtime, anytime the user submits a question. When this happens, the following sequence of tasks is performed: The relevant files for this are the SearchDialog (Client) component and the vector-search (Edge Functio","default_branch":null,"files":null,"tree":[],"storefront":"/r/supabase-community","claimed":false,"request_supported":{"post":"https://gitbuyer.com/r/supabase-community/nextjs-openai-doc-search/request-supported","requests":0},"note":"indexed from public GitHub; nothing is for sale on this page. Clone it from GitHub. Paid listings live at /search."}