You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat: Updating documents to highlight v2 api for Vector Similarity Se… (#5000)
* feat: Updating documents to highlight v2 api for Vector Similarity Search
Signed-off-by: Francisco Javier Arceo <[email protected]>
* updated to add another column about v2 support
Signed-off-by: Francisco Javier Arceo <[email protected]>
---------
Signed-off-by: Francisco Javier Arceo <[email protected]>
*Note: V2 Support means the SDK supports retrieval of features along with vector embeddings from vector similarity search.
18
20
19
21
Note: SQLite is in limited access and only working on Python 3.10. It will be updated as [sqlite_vec](https://github.com/asg017/sqlite-vec/) progresses.
20
22
21
-
## Example
23
+
{% hint style="danger" %}
24
+
We will be deprecating the `retrieve_online_documents` method in the SDK in the future.
25
+
We recommend using the `retrieve_online_documents_v2` method instead, which offers easier vector index configuration
26
+
directly in the Feature View and the ability to retrieve standard features alongside your vector embeddings for richer context injection.
27
+
28
+
Long term we will collapse the two methods into one, but for now, we recommend using the `retrieve_online_documents_v2` method.
29
+
Beyond that, we will then have `retrieve_online_documents` and `retrieve_online_documents_v2` simply point to `get_online_features` for
30
+
backwards compatibility and the adopt industry standard naming conventions.
31
+
{% endhint %}
32
+
33
+
**Note**: Milvus implements the v2 `retrieve_online_documents_v2` method in the SDK. This will be the longer-term solution so that Data Scientists can easily enable vector similarity search by just flipping a flag.
22
34
23
-
See [https://github.com/feast-dev/feast-workshop/blob/rag/module_4_rag](https://github.com/feast-dev/feast-workshop/blob/rag/module_4_rag) for an example on how to use vector database.
35
+
## Examples
36
+
37
+
- See the v0 [Rag Demo](https://github.com/feast-dev/feast-workshop/blob/rag/module_4_rag) for an example on how to use vector database using the `retrieve_online_documents` method (planning migration and deprecation (planning migration and deprecation).
38
+
- See the v1 [Milvus Quickstart](../../examples/rag/milvus-quickstart.ipynb) for a quickstart guide on how to use Feast with Milvus using the `retrieve_online_documents_v2` method.
24
39
25
40
### **Prepare offline embedding dataset**
26
41
Run the following commands to prepare the embedding dataset:
@@ -34,25 +49,23 @@ The output will be stored in `data/city_wikipedia_summaries.csv.`
34
49
Use the feature_store.yaml file to initialize the feature store. This will use the data as offline store, and Pgvector as online store.
35
50
36
51
```yaml
37
-
project: feast_demo_local
52
+
project: local_rag
38
53
provider: local
39
-
registry:
40
-
registry_type: sql
41
-
path: postgresql://@localhost:5432/feast
54
+
registry: data/registry.db
42
55
online_store:
43
-
type: postgres
56
+
type: milvus
57
+
path: data/online_store.db
44
58
vector_enabled: true
45
-
vector_len: 384
46
-
host: 127.0.0.1
47
-
port: 5432
48
-
database: feast
49
-
user: ""
50
-
password: ""
59
+
embedding_dim: 384
60
+
index_type: "IVF_FLAT"
51
61
52
62
53
63
offline_store:
54
64
type: file
55
-
entity_key_serialization_version: 2
65
+
entity_key_serialization_version: 3
66
+
# By default, no_auth for authentication and authorization, other possible values kubernetes and oidc. Refer the documentation for more details.
67
+
auth:
68
+
type: no_auth
56
69
```
57
70
Run the following command in terminal to apply the feature store configuration:
58
71
@@ -63,75 +76,128 @@ feast apply
63
76
Note that when you run `feast apply` you are going to apply the following Feature View that we will use for retrieval later:
During inference (e.g., during when a user submits a chat message) we need to embed the input text. This can be thought of as a feature transformation of the input data. In this example, we'll do this with a small Sentence Transformer from Hugging Face.
108
+
85
109
```python
86
-
from batch_score_documents import run_model, TOKENIZER, MODEL
110
+
import torch
111
+
import torch.nn.functional as F
112
+
from feast import FeatureStore
113
+
from pymilvus import MilvusClient, DataType, FieldSchema
87
114
from transformers import AutoTokenizer, AutoModel
88
-
89
-
question ="the most populous city in the U.S. state of Texas?"
115
+
from example_repo import city_embeddings_feature_view, item
We offer [PGVector](https://github.com/pgvector/pgvector), [SQLite](https://github.com/asg017/sqlite-vec), [Elasticsearch](https://www.elastic.co) and [Qdrant](https://qdrant.tech/) as Online Store options for Vector Databases.
119
-
120
-
#### Installation with SQLite
175
+
client = OpenAI(
176
+
api_key=os.environ.get("OPENAI_API_KEY"),
177
+
)
178
+
response = client.chat.completions.create(
179
+
model="gpt-4o-mini",
180
+
messages=[
181
+
{"role": "system", "content": FULL_PROMPT},
182
+
{"role": "user", "content": question}
183
+
],
184
+
)
121
185
122
-
If you are using `pyenv` to manage your Python versions, you can install the SQLite extension with the following command:
# And this will print the content. Look at the examples/rag/milvus-quickstart.ipynb for an end-to-end example.
187
+
print('\n'.join([c.message.content for c in response.choices]))
128
188
```
129
-
And you can the Feast install package via:
189
+
190
+
### Configuration and Installation
191
+
192
+
We offer [Milvus](https://milvus.io/), [PGVector](https://github.com/pgvector/pgvector), [SQLite](https://github.com/asg017/sqlite-vec), [Elasticsearch](https://www.elastic.co) and [Qdrant](https://qdrant.tech/) as Online Store options for Vector Databases.
193
+
194
+
Milvus offers a convenient local implementation for vector similarity search. To use Milvus, you can install the Feast package with the Milvus extra.
0 commit comments