|
| 1 | +# Pinecone online store |
| 2 | + |
| 3 | +## Description |
| 4 | + |
| 5 | +The [Pinecone](https://www.pinecone.io/) online store provides support for materializing feature values into a Pinecone vector database. It is particularly suited for AI workloads that require both low-latency feature serving and vector similarity search for RAG (Retrieval-Augmented Generation) applications. |
| 6 | + |
| 7 | +## Getting started |
| 8 | + |
| 9 | +In order to use this online store, you'll need to install the Pinecone extra (along with the dependency needed for the offline store of choice). E.g. |
| 10 | + |
| 11 | +`pip install 'feast[pinecone]'` |
| 12 | + |
| 13 | +You will also need a Pinecone account and API key. Set your API key via the `PINECONE_API_KEY` environment variable or directly in `feature_store.yaml`. |
| 14 | + |
| 15 | +## Examples |
| 16 | + |
| 17 | +{% code title="feature_store.yaml" %} |
| 18 | +```yaml |
| 19 | +project: my_feature_repo |
| 20 | +registry: data/registry.db |
| 21 | +provider: local |
| 22 | +online_store: |
| 23 | + type: pinecone |
| 24 | + api_key: ${PINECONE_API_KEY} |
| 25 | + index_name: feast-online |
| 26 | + embedding_dim: 384 |
| 27 | + metric: cosine |
| 28 | + cloud: aws |
| 29 | + region: us-east-1 |
| 30 | + vector_enabled: true |
| 31 | +``` |
| 32 | +{% endcode %} |
| 33 | +
|
| 34 | +### Using a custom namespace |
| 35 | +
|
| 36 | +By default, Feast maps each feature view to a Pinecone namespace (`{project}_{feature_view_name}`). You can override this with a fixed namespace: |
| 37 | + |
| 38 | +{% code title="feature_store.yaml" %} |
| 39 | +```yaml |
| 40 | +online_store: |
| 41 | + type: pinecone |
| 42 | + api_key: ${PINECONE_API_KEY} |
| 43 | + index_name: feast-online |
| 44 | + namespace: my-custom-namespace |
| 45 | + embedding_dim: 384 |
| 46 | +``` |
| 47 | +{% endcode %} |
| 48 | + |
| 49 | +### Vector similarity search |
| 50 | + |
| 51 | +Pinecone supports the `retrieve_online_documents_v2` API for vector similarity search: |
| 52 | + |
| 53 | +```python |
| 54 | +from feast import FeatureStore |
| 55 | +
|
| 56 | +store = FeatureStore(repo_path=".") |
| 57 | +
|
| 58 | +results = store.retrieve_online_documents_v2( |
| 59 | + features=[ |
| 60 | + "city_embeddings:vector", |
| 61 | + "city_embeddings:sentence_chunks", |
| 62 | + ], |
| 63 | + query=query_embedding, |
| 64 | + top_k=5, |
| 65 | + distance_metric="cosine", |
| 66 | +).to_df() |
| 67 | +``` |
| 68 | + |
| 69 | +The full set of configuration options is available in [PineconeOnlineStoreConfig](https://rtd.feast.dev/en/latest/#feast.infra.online_stores.pinecone_online_store.pinecone.PineconeOnlineStoreConfig). |
| 70 | + |
| 71 | +## Configuration options |
| 72 | + |
| 73 | +| Option | Type | Default | Description | |
| 74 | +|:---|:---|:---|:---| |
| 75 | +| `type` | string | `"pinecone"` | Must be `pinecone` | |
| 76 | +| `api_key` | string | `None` | Pinecone API key (falls back to `PINECONE_API_KEY` env var) | |
| 77 | +| `index_name` | string | `"feast-online"` | Name of the Pinecone index | |
| 78 | +| `namespace` | string | `None` | Override namespace (default: `{project}_{fv_name}`) | |
| 79 | +| `embedding_dim` | int | `128` | Vector dimension | |
| 80 | +| `metric` | string | `"cosine"` | Distance metric: `cosine`, `euclidean`, or `dotproduct` | |
| 81 | +| `cloud` | string | `"aws"` | Cloud provider for serverless indexes | |
| 82 | +| `region` | string | `"us-east-1"` | Cloud region for serverless indexes | |
| 83 | +| `vector_enabled` | bool | `true` | Enable vector similarity search | |
| 84 | +| `batch_size` | int | `100` | Number of vectors per upsert batch | |
| 85 | + |
| 86 | +## Functionality Matrix |
| 87 | + |
| 88 | +The set of functionality supported by online stores is described in detail [here](overview.md#functionality). |
| 89 | +Below is a matrix indicating which functionality is supported by the Pinecone online store. |
| 90 | + |
| 91 | +| | Pinecone | |
| 92 | +|:----------------------------------------------------------|:---------| |
| 93 | +| write feature values to the online store | yes | |
| 94 | +| read feature values from the online store | yes | |
| 95 | +| update infrastructure (e.g. tables) in the online store | yes | |
| 96 | +| teardown infrastructure (e.g. tables) in the online store | yes | |
| 97 | +| generate a plan of infrastructure changes | no | |
| 98 | +| support for on-demand transforms | yes | |
| 99 | +| readable by Python SDK | yes | |
| 100 | +| readable by Java | no | |
| 101 | +| readable by Go | no | |
| 102 | +| support for entityless feature views | yes | |
| 103 | +| support for concurrent writing to the same key | yes | |
| 104 | +| support for ttl (time to live) at retrieval | no | |
| 105 | +| support for deleting expired data | no | |
| 106 | +| collocated by feature view | no | |
| 107 | +| collocated by feature service | no | |
| 108 | +| collocated by entity key | no | |
| 109 | +| vector similarity search | yes | |
0 commit comments