Skip to content
View ai-jiraphinya's full-sized avatar
🏠
ทำงานจากที่บ้าน
🏠
ทำงานจากที่บ้าน
  • ดาวอังคาร
  • 01:33 (UTC +07:00)
Block or Report

Block or report ai-jiraphinya

Block user

Prevent this user from interacting with your repositories and sending you notifications. Learn more about blocking users.

You must be logged in to block users.

Please don't include any personal information such as legal names or email addresses. Maximum 100 characters, markdown supported. This note will be visible to only you.
Report abuse

Contact GitHub support about this user’s behavior. Learn more about reporting abuse.

Report abuse
ai-jiraphinya/README.md

Document Search By Mint

support/จ้างงาน FRONT END , BACK END: สนับสนุนทุนการศึกษา/ชานมเย็นสักแก้ว

บัญชีพี่มิว ปรีดิ์ปราโมทย์ เวชบุตร กสิกรไทย 110-8-25747-0
บัญชีเเม่ สุมาลี วงค์ศรีชา กสิกรไทย 121-3-84931-6 บัญชีเเม่
ส่งข้อความให้กำลังใจ หมายเลข 096-3346517 มิ้นน้อย

Deploy Netlify NoOPENAI_KEYNo AI

Netlify Status

Deploy OPENAI_KEY Build MySQL:Supabase Docs

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 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!

Deploy with Vercel

Technical Details

Building your own custom ChatGPT involves four steps:

Authentication-Supabase

  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:

sequenceDiagram
    participant Vercel
    participant DB (pgvector)
    participant OpenAI (API)
    loop 1. Pre-process the knowledge base
        Vercel->>Vercel: Chunk .mdx pages into sections
        loop 2. Create & store embeddings
            Vercel->>OpenAI (API): create embedding for page section
            OpenAI (API)->>Vercel: embedding vector(1536)
            Vercel->>DB (pgvector): store embedding for page section
        end
    end

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:

sequenceDiagram
    participant Client
    participant Edge Function
    participant DB (pgvector)
    participant OpenAI (API)
    Client->>Edge Function: { query: lorem ispum }
    critical 3. Perform vector similarity search
        Edge Function->>OpenAI (API): create embedding for query
        OpenAI (API)->>Edge Function: embedding vector(1536)
        Edge Function->>DB (pgvector): vector similarity search
        DB (pgvector)->>Edge Function: relevant docs content
    end
    critical 4. Inject content into prompt
        Edge Function->>OpenAI (API): completion request prompt: query + relevant docs content
        OpenAI (API)-->>Client: text/event-stream: completions response
    end

The relevant files for this are the SearchDialog (Client) component and the vector-search (Edge Function).

The initialization of the database, including the setup of the pgvector extension is stored in the supabase/migrations folder which is automatically applied to your local Postgres instance when running supabase start.

Local Development

Configuration

  • cp .env.example .env
  • Set your OPENAI_KEY in the newly created .env file.
  • Set NEXT_PUBLIC_SUPABASE_ANON_KEY and SUPABASE_SERVICE_ROLE_KEY run:

    Note: You have to run supabase to retrieve the keys.

Start Supabase

Make sure you have Docker installed and running locally. Then run

supabase start

To retrieve NEXT_PUBLIC_SUPABASE_ANON_KEY and SUPABASE_SERVICE_ROLE_KEY run:

supabase status

Start the Next.js App

In a new terminal window, run

pnpm dev

Using your custom .mdx docs

  1. By default your documentation will need to be in .mdx format. This can be done by renaming existing (or compatible) markdown .md file.
  2. Run pnpm run embeddings to regenerate embeddings.

    Note: Make sure supabase is running. To check, run supabase status. If is not running run supabase start.

  3. Run pnpm dev again to refresh NextJS localhost:3000 rendered page.

Learn More You need to find the video "Supabase" on YouTube.

I only have basic skills, so I might not be able to help you much.

Video: How I Built Supabase’s OpenAI Doc Search

Licence

Apache 2.0

จ้างงาน FRONT END , BACK END:

  • วิทยาศาสตร์ข้อมูล,เทรน,สร้าง Model เเบบกำหนดเอง ทั้ง Local,online,firebase aws tmbd-api movies
  • Bayesian Neural Network ฯ
  • เพราะไม่ใช่คนเก่งอะไร เพียงอยากเเสวงหาความรู้เเลกเปลี่ยน เเบ่งปัน ราคางาน เริ่มต้นจึงเเค่ 300 บาท

Popular repositories

  1. document-search document-search Public

    เเค่สนามเด็กเล่น. อย่าได้ถือสาหาความ, การเขียนภาษาอื่นอาจผิดบ้าง. เพราะฉันใช้ภาษาไทย!

    JavaScript 2

  2. angular-movies angular-movies Public

    เลิกผลิต หากต้องการ npm run nx run firebase-function:deploy-firebase && npm run nx run movies:deploy-firebase เเละแก้ .env

    TypeScript 2

  3. dlive-graphql-example dlive-graphql-example Public

    Forked from iamalisajid/dlive-graphql-example

    Basic app to connect to DLive graphql and websockets

    JavaScript 1

  4. react-portfolio-template react-portfolio-template Public template

    Forked from chetanverma16/react-portfolio-template

    Modern React Portfolio Template (FREE)

    JavaScript 1

  5. eCommerce eCommerce Public

    Forked from codingforentrepreneurs/eCommerce

    We're going to take you step-by-step to build a modern, fully open-source, eCommerce web application using Python, Django, Bootstrap, Javascript, and more.

    Python 1

  6. DevRel-Examples-External DevRel-Examples-External Public

    Forked from RapidAPI/DevRel-Examples-External

    RapidAPI Examples by external developers — curated as is.

    JavaScript 1