Skip to content

The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.

feat: AI docs update (#40183)

Rodrigo Mansueli6a142b77524f
diff --git a/apps/docs/content/guides/ai/vector-indexes.mdx b/apps/docs/content/guides/ai/vector-indexes.mdx
index 93b4d303e73..99f1d8823b1 100644
--- a/apps/docs/content/guides/ai/vector-indexes.mdx
+++ b/apps/docs/content/guides/ai/vector-indexes.mdx
@@ -26,7 +26,15 @@ Indexes can be used to improve performance of nearest neighbor search using vari
| `<#>` | negative inner product | `vector_ip_ops` |
| `<=>` | cosine distance | `vector_cosine_ops` |
-Currently vectors with up to 2,000 dimensions can be indexed.
+For pgvector versions 0.7.0 and above, it's possible to create indexes on vectors with the following maximum dimensions:
+
+- vector: up to 2,000 dimensions
+- halfvec: up to 4,000 dimensions
+- bit: up to 64,000 dimensions
+
+You can check your current pgvector version by running: `SELECT * FROM pg_extension WHERE extname = 'vector';` or by navigating to the [Extensions](/dashboard/project/_/database/extensions) tab in your Supabase project dashboard.
+
+If you are on an earlier version of pgvector, you should [upgrade your project here](/dashboard/project/_/settings/infrastructure).
## Resources
diff --git a/apps/docs/content/guides/ai/vector-indexes/hnsw-indexes.mdx b/apps/docs/content/guides/ai/vector-indexes/hnsw-indexes.mdx
index eb7d09ac96f..0fba3bbb296 100644
--- a/apps/docs/content/guides/ai/vector-indexes/hnsw-indexes.mdx
+++ b/apps/docs/content/guides/ai/vector-indexes/hnsw-indexes.mdx
@@ -37,7 +37,30 @@ create index on items using hnsw (column_name vector_ip_ops);
create index on items using hnsw (column_name vector_cosine_ops);
```
-Currently vectors with up to 2,000 dimensions can be indexed.
+For pgvector versions 0.7.0 and above, it's possible to create indexes on vectors with the following maximum dimensions:
+
+- vector: up to 2,000 dimensions
+- halfvec: up to 4,000 dimensions
+- bit: up to 64,000 dimensions
+
+You can check your current pgvector version by running: `SELECT * FROM pg_extension WHERE extname = 'vector';` or by navigating to the [Extensions](/dashboard/project/_/database/extensions) tab in your Supabase project dashboard.
+
+If you are on an earlier version of pgvector, you should [upgrade your project here](/dashboard/project/_/settings/infrastructure).
+
+## Example with high-dimensional vectors
+
+For vectors with more than 2,000 dimensions, you can use the `halfvec` type to create indexes. Here's an example with 3,072 dimensions:
+
+```sql
+CREATE TABLE documents (
+ id bigint GENERATED BY DEFAULT AS IDENTITY PRIMARY KEY,
+ content text,
+ embedding vector(3072)
+);
+
+CREATE INDEX ON documents
+ USING hnsw ((embedding::halfvec(3072)) halfvec_cosine_ops);
+```
## How does HNSW work?
diff --git a/supa-mdx-lint/Rule003Spelling.toml b/supa-mdx-lint/Rule003Spelling.toml
index c8830de5c2e..fc8a15fe3fa 100644
--- a/supa-mdx-lint/Rule003Spelling.toml
+++ b/supa-mdx-lint/Rule003Spelling.toml
@@ -336,6 +336,7 @@ allow_list = [
"dotenv",
"e.g.",
"gte-small",
+ "halfvec",
"hCaptcha",
"https?:\\/\\/\\S+",
"i.e.",