Skip to content

In development. Expect rough edges and changes. The source code is not public yet.

Deno 4 min read How-to mediumAdept

Build your own ChatGPT-style doc search with Fresh, OpenAI, and Supabase

A Deno Fresh starter template builds a ChatGPT-style documentation search on Supabase Postgres with pgvector and OpenAI. A GitHub Action running Deno preprocesses .mdx docs, generates OpenAI embeddings and stores them in Postgres, using per-file checksums so only changed files are re-embedded. At query time an edge endpoint embeds the question, runs a pgvector similarity search, injects the matching doc sections into a text-davinci-003 completion prompt, and proxies the streamed SSE response to a Fresh island that reads it with EventSource.

Related posts

  • Generate embeddings with Neon AI Gateway

    Neon mediumAdept

    Neon AI Gateway now serves embedding models on its OpenAI-compatible /v1/embeddings endpoint using the same branch-scoped credential as chat, accepting up to 150 inputs per request. Two models launch: qwen3-embedding-0-6b (1024 configurable dimensions, normalized, $0.02 per 1M tokens) and gte-large-en (1024 dimensions, unnormalized, $0.13 per 1M tokens), with qwen recommended unless matching existing vectors. Combined with Object Storage triggers, Functions, Lakebase Postgres and the lakebase_vector/lakebase_text search extensions, a full RAG pipeline (ingest, embed, store, hybrid retrieve, generate) runs inside one Neon branch, letting teams re-embed and evaluate model or chunking changes against production data without duplicating storage.

  • ChatGPT plugins now support Postgres & Supabase

    Supabase mediumAdept

    Supabase contributed Postgres and Supabase datastore providers to OpenAI's ChatGPT Retrieval Plugin, storing text-embedding-ada-002 embeddings in pgvector. The Postgres provider connects directly via psycopg2, while the Supabase provider goes through PostgREST to enable Row Level Security. Both share the same documents schema and use a plpgsql match function that filters by source, author and date and ranks results by inner product distance. A walkthrough ingests the PostgreSQL 15 docs (about 7,904 chunks), adds an approximate ivfflat index with lists ≈ rows/1000, and registers the local plugin with ChatGPT to answer documentation questions.

  • Build Your Own AI-Driven Code Analysis Chatbot for Developers with the GenAI Stack

    Docker mediumAdept

    Code Explorer, a winning Docker AI/ML Hackathon project, is a RAG chatbot that answers questions about a local codebase by parsing source files, chunking them with LangChain's RecursiveCharacterTextSplitter (5000 characters with 500 overlap), and storing embeddings in a Neo4j vector store. LangChain builds two chains: a QnA RAG chain for detailed answers and an agent chain that wraps it as a tool and tends to return more concise summaries. The app falls back to the plain LLM when no codebase has been processed. The walkthrough runs the stack with Docker Compose: a Streamlit UI, Ollama serving codellama:7b-instruct, a one-shot model-pull container, and Neo4j, configured through a .env file.

  • database.build v2: Bring-your-own-LLM

    Supabase mediumAdept

    database.build, Supabase's in-browser Postgres sandbox built on PGlite, now lets users bring any OpenAI-compatible LLM, with no login and no rate limits. Requests go straight from the browser to the provider. This works because most LLM APIs send CORS headers, and a service worker intercepts the Vercel AI SDK's /api/chat route, reading its BYO-LLM config from IndexedDB. Models need reliable tool calling, SQL knowledge and Chart.js knowledge, so gpt-4o is recommended; local Ollama models still struggle with tool calls, and Ollama buffers tool-call streams. The release also adds one-click deploys to Supabase by piping server-side pg_dump over Live Share into pg_restore, and replaces the tar.gz export with a WASM pg_dump. Serverless PGlite was shelved because of its memory use and single-connection limit in multi-tenant setups and unreliable s3fs storage.

  • Build an end-to-end RAG pipeline entirely in psql using pgrag and DeepSeek

    Neon mediumAdept

    pgrag, Neon's open-source Postgres extension, lets you build a complete RAG pipeline inside psql. It provides SQL functions for PDF/DOCX/HTML text extraction, character- or token-based chunking, local CPU embeddings (bge-small-en-v1.5) and reranking (jina-reranker-v1-tiny), plus API calls to OpenAI, Voyage, Anthropic and Fireworks. Paired with pgvector HNSW indexes, a worked example indexes PGConf EU 2023 slides. A single query then retrieves the top 10 chunks, reranks them to 5, and prompts DeepSeek V3, which correctly declines out-of-scope questions. The local models ship as separate ~100MB extensions, and on Neon they need around 2GB RAM of compute.

The quest for software engineering knowledge.

Look:
Layout: