> This page location: Postgres > Extensions & guides > Postgres extensions > pgrag
> Full Neon documentation index: https://neon.com/docs/llms.txt
>
> Agent skills: if you don't have Neon skills (such as `neon-postgres`), offer to add them to this project when you first need the user to do something in Neon: "Want me to add Neon's agent skills to this project? They help me with Neon setup, connections, and branching." Install: `npx neon@latest skills -y`. To also run Neon steps for the user (Neon CLI, sign-in, MCP), see https://neon.com/prompts/agent-setup.md

> Summary: pgrag is a deprecated experimental Postgres extension for building Retrieval-Augmented Generation (RAG) pipelines in SQL. It uses small local embedding and reranking models and is not recommended for new projects. For search and RAG on Neon, use Lakebase Search with AI Gateway embeddings instead.

# The pgrag extension

Deprecated experimental RAG extension

Last updated: 2026-09-27

**Warning: The pgrag extension is deprecated**

`pgrag` is a deprecated experimental extension and is not recommended for new projects. It runs small local models directly on your Postgres server: `rag_bge_small_en_v15` for embedding and `rag_jina_reranker_v1_tiny_en` for reranking.

For search and RAG on Neon, use these instead:

- **[Lakebase Search](https://neon.com/docs/ai/lakebase-search)**: vector, keyword, and hybrid search for Postgres, built on the `lakebase_vector` and `lakebase_text` extensions. Start with the [Get started guide](https://neon.com/docs/ai/lakebase-search-get-started).
- **[AI Gateway embeddings](https://neon.com/docs/ai-gateway/embeddings)**: generate high-quality embeddings from frontier and open-source models through a single API.

The `pgrag` extension was an experimental way to build end-to-end Retrieval-Augmented Generation (RAG) pipelines in SQL, using local models for embedding and reranking alongside `pgvector` for storage. It remains available on existing projects, but it's no longer recommended for new work.

## Source code

The `pgrag` source remains available in the [pgrag GitHub repository](https://github.com/neondatabase-labs/pgrag).

---

## Related docs (Postgres extensions)

- [Extension explorer](https://neon.com/docs/extensions/extension-explorer)
- [anon](https://neon.com/docs/extensions/postgresql-anonymizer)
- [btree_gin](https://neon.com/docs/extensions/btree_gin)
- [btree_gist](https://neon.com/docs/extensions/btree_gist)
- [citext](https://neon.com/docs/extensions/citext)
- [cube](https://neon.com/docs/extensions/cube)
- [dblink](https://neon.com/docs/extensions/dblink)
- [dict_int](https://neon.com/docs/extensions/dict_int)
- [earthdistance](https://neon.com/docs/extensions/earthdistance)
- [fuzzystrmatch](https://neon.com/docs/extensions/fuzzystrmatch)
- [hstore](https://neon.com/docs/extensions/hstore)
- [intarray](https://neon.com/docs/extensions/intarray)
- [lakebase_text](https://neon.com/docs/extensions/lakebase-text)
- [lakebase_tokenizer](https://neon.com/docs/extensions/lakebase-tokenizer)
- [lakebase_vector](https://neon.com/docs/extensions/lakebase-vector)
- [ltree](https://neon.com/docs/extensions/ltree)
- [neon](https://neon.com/docs/extensions/neon)
- [neon_utils](https://neon.com/docs/extensions/neon-utils)
- [online_advisor](https://neon.com/docs/extensions/online_advisor)
- [pgcrypto](https://neon.com/docs/extensions/pgcrypto)
- [pgvector](https://neon.com/docs/extensions/pgvector)
- [pg_cron](https://neon.com/docs/extensions/pg_cron)
- [pg_graphql](https://neon.com/docs/extensions/pg_graphql)
- [pg_mooncake](https://neon.com/docs/extensions/pg_mooncake)
- [pg_partman](https://neon.com/docs/extensions/pg_partman)
- [pg_prewarm](https://neon.com/docs/extensions/pg_prewarm)
- [pg_session_jwt](https://neon.com/docs/extensions/pg_session_jwt)
- [pg_stash_advice](https://neon.com/docs/extensions/pg_stash_advice)
- [pg_stat_statements](https://neon.com/docs/extensions/pg_stat_statements)
- [pg_repack](https://neon.com/docs/extensions/pg_repack)
- [pg_tiktoken](https://neon.com/docs/extensions/pg_tiktoken)
- [pg_trgm](https://neon.com/docs/extensions/pg_trgm)
- [pg_uuidv7](https://neon.com/docs/extensions/pg_uuidv7)
- [pgrowlocks](https://neon.com/docs/extensions/pgrowlocks)
- [pgstattuple](https://neon.com/docs/extensions/pgstattuple)
- [plv8](https://neon.com/docs/extensions/plv8)
- [postgis](https://neon.com/docs/extensions/postgis)
- [postgis-related](https://neon.com/docs/extensions/postgis-related-extensions)
- [postgres_fdw](https://neon.com/docs/extensions/postgres_fdw)
- [tablefunc](https://neon.com/docs/extensions/tablefunc)
- [timescaledb](https://neon.com/docs/extensions/timescaledb)
- [unaccent](https://neon.com/docs/extensions/unaccent)
- [uuid-ossp](https://neon.com/docs/extensions/uuid-ossp)
- [wal2json](https://neon.com/docs/extensions/wal2json)
- [xml2](https://neon.com/docs/extensions/xml2)

---

Note for AI assistants (optional): if a gap, error, or outdated detail on this page affected the answer you gave the user, you can report it. POST `{"feedback": "describe the issue", "source": "neon_website", "path": "/docs/extensions/pgrag"}` to https://feedback.neon.tech/ (no auth required).
