Skip to content

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

Neon 7 min read Announcement mediumAdept

Generate embeddings with Neon AI Gateway

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.

Assumes: vector embeddingspgvector basicsOpenAI SDK

Related posts

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

    Deno mediumAdept

    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.

  • Hugging Face x LangChain : A new partner package

    Hugging Face mediumAdept

    langchain-huggingface is a new Python partner package jointly maintained by Hugging Face and LangChain, replacing community-written integrations that had drifted out of date. It provides HuggingFacePipeline for running transformers models locally, HuggingFaceEndpoint for the serverless Inference API or deployed TGI endpoints via InferenceClient, and ChatHuggingFace, which turns message lists into model-specific prompts with tokenizer.apply_chat_template. For embeddings it offers HuggingFaceEmbeddings (local sentence-transformers) and HuggingFaceEndpointEmbeddings (Hub or TEI instances), each shown with short code examples.

  • Getting Started With Embeddings

    Hugging Face mediumAdept

    Embeddings turn text or images into fixed-length vectors that capture meaning, so semantic similarity becomes a distance calculation. A walkthrough builds a small FAQ matcher: it embeds 13 Medicare FAQs into 384-dimensional vectors with sentence-transformers/all-MiniLM-L6-v2 through the Hugging Face Inference API, hosts the vectors as a CSV dataset on the Hub, then embeds a user query and ranks the top 5 FAQs by cosine similarity with util.semantic_search. Practical notes include retrying the first API call while the model loads, and using FAISS via add_faiss_index as an alternative search path.

  • Semantic search using OpenAI, pg_embedding and Neon

    Neon mediumAdept

    A YC idea-matcher app implements semantic search by embedding ~4,400 YCombinator company descriptions with OpenAI's text-embedding-ada-002 (1536 dimensions) and storing them as real[] columns in Neon Postgres via the pg_embedding extension. Queries embed the user's idea and order rows by cosine distance (<=>) to return the top five matches from a Next.js edge function, which is colocated with the database region and uses the Neon serverless driver, Upstash rate limiting and Zod validation. The full ingestion script and API route are shown. Sequential scan is fine for this small dataset, but larger tables need an HNSW index. pg_embedding has since been deprecated in favor of pgvector.

  • Image search with 🤗 datasets

    Hugging Face mediumAdept

    A text-to-image search over 10,000 British Library book embellishments can be built by loading the images with the 🤗 datasets ImageFolder loader and embedding them with the CLIP ViT-B/32 model via sentence_transformers. The embeddings are indexed with datasets' built-in add_faiss_index, and text prompts are queried with get_nearest_examples. push_to_hub stores intermediate datasets so work can move between machines, such as a laptop and a Colab GPU. Results for prompts like "a steam engine" or "a musical instrument" are not always correct but are usually reasonable, which is enough to search images by semantic content.

The quest for software engineering knowledge.

Look:
Layout: