Skip to content

Commit

Permalink
update doc
Browse files Browse the repository at this point in the history
Signed-off-by: cmuhao <[email protected]>
  • Loading branch information
HaoXuAI committed Apr 16, 2024
1 parent 6abffbf commit 8dc7060
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions docs/reference/online-stores/postgres.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ online_store:
sslkey_path: /path/to/client-key.pem
sslcert_path: /path/to/client-cert.pem
sslrootcert_path: /path/to/server-ca.pem
pgvector_enabled: false
vector_len: 512
```
{% endcode %}
Expand Down Expand Up @@ -60,3 +62,29 @@ Below is a matrix indicating which functionality is supported by the Postgres on
| collocated by entity key | no |
To compare this set of functionality against other online stores, please see the full [functionality matrix](overview.md#functionality-matrix).
## PGVector
The Postgres online store supports the use of [PGVector](https://pgvector.dev/) for storing feature values.
To enable PGVector, set `pgvector_enabled: true` in the online store configuration.
The `vector_len` parameter can be used to specify the length of the vector. The default value is 512.

Then you can use `retrieve_online_documents` to retrieve the top k closest vectors to a query vector.

{% code title="python" %}
```python
from feast import FeatureStore
from feast.infra.online_stores.postgres import retrieve_online_documents
feature_store = FeatureStore(repo_path=".")
query_vector = [0.1, 0.2, 0.3, 0.4, 0.5]
top_k = 5
feature_values = retrieve_online_documents(
feature_store=feature_store,
feature_view_name="document_fv:embedding_float",
query_vector=query_vector,
top_k=top_k,
)
```
{% endcode %}

0 comments on commit 8dc7060

Please sign in to comment.