From: jkatz (@jkatz) <noreply+jkatz@github.com>
To: pgvector/pgvector <noreply+pgvector-pgvector@github.com>
Subject: Re: [pgvector/pgvector] issue #442: OpenAI's text-embedding-3-large model not compatible with pgvector 5.1
Date: Wed, 11 Sep 2024 15:51:25 +0000
Message-ID: <gh-pgvector-pgvector-442-c2344048390@github.com> (raw)
In-Reply-To: <gh-pgvector-pgvector-442@github.com>
References: <gh-pgvector-pgvector-442@github.com>
@touhi99 I have some examples in this blog post on [scalar and binary quantization](https://jkatz05.com/post/postgres/pgvector-scalar-binary-quantization/), e.g.:
```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);
```
Note that this example stores the full vector in the table, and the `halfvec` in the index. You can also opt to store the `halfvec` only in the table, though you may lose some precision by storing the reduced-size vector in the table.