Visitar URL original
feat: Making feast vector store with open ai search api compatible by patelchaitany · Pull Request #6121 · feast-dev/feast · GitHub
Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Updatethe Docs, documented OpenAI search API as Alpha
Signed-off-by: Chaitany Patel <patelchaitany93@gmail.com>
  • Loading branch information
patelchaitany committed Jul 21, 2026
commit c1cc0009f7cd9775f264a79376d88f9d6e5da318
3 changes: 3 additions & 0 deletions docs/SUMMARY.md
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,10 @@
* [\[Beta\] On demand feature view](reference/beta-on-demand-feature-view.md)
* [\[Alpha\] Static Artifacts Loading](reference/alpha-static-artifacts.md)
* [\[Alpha\] Vector Database](reference/alpha-vector-database.md)
* [\[Alpha\] OpenAI-Compatible Vector Store API](reference/alpha-vector-database.md#alpha-openai-compatible-vector-store-api)

* [Data Quality Monitoring](reference/dqm.md)
* [\[Deprecated\] Data quality monitoring (Great Expectations)](reference/dqm.md)
* [\[Alpha\] Streaming feature computation with Denormalized](reference/denormalized.md)
* [\[Alpha\] Feature View Versioning](reference/alpha-feature-view-versioning.md)
* [OpenLineage Integration](reference/openlineage.md)
Expand Down
156 changes: 138 additions & 18 deletions docs/reference/alpha-vector-database.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,45 +38,127 @@ backwards compatibility and the adopt industry standard naming conventions.
| Endpoint | Use when |
|----------|----------|
| `POST /search` | You have an embedding vector (or use `api_version: 2` with `query_string`) and want Feast's native online-features response format. |
| `POST /v1/vector_stores/{feature_view}/search` | You want plain-text queries with server-side embedding and an OpenAI-compatible response. |
| `GET /v1/vector_stores` | You want to discover available vector stores and their `vs_{hash}` IDs (OpenAI-compatible). |
| `GET /v1/vector_stores/{id}` | You want metadata for a specific vector store (OpenAI-compatible). |
| `POST /v1/vector_stores/{id}/search` | You want plain-text queries with server-side embedding and an OpenAI-compatible response. |

`POST /retrieve-online-documents` is deprecated; use `POST /search` instead.

## OpenAI-Compatible Vector Store Search
## [Alpha] OpenAI-Compatible Vector Store API

Feast exposes an OpenAI-compatible vector store search endpoint at `POST /v1/vector_stores/{feature_view}/search`. This endpoint accepts plain text queries, handles embedding server-side, and returns results in the [OpenAI Vector Store Search API](https://platform.openai.com/docs/api-reference/vector-stores-search) format.
{% hint style="warning" %}
**Alpha feature.** This API surface is functional and tested, but may change in future releases. Feedback and contributions are welcome.
{% endhint %}

Feast exposes a set of [OpenAI-compatible vector store endpoints](https://platform.openai.com/docs/api-reference/vector-stores) that let clients discover, inspect, and search vector stores using plain text queries with server-side embedding. This enables integration with AI agents, LLM tool-calling frameworks, and any OpenAI-compatible client without requiring the caller to produce raw embedding vectors.

### Vector store IDs

Each feature view with at least one `vector_index=True` field is automatically assigned a deterministic identifier of the form `vs_{hash}`, where `{hash}` is the first 24 characters of `SHA-256(project + ":" + feature_view_name)`. These IDs are stable across server restarts and registry refreshes.

For example, a feature view named `product_catalog` in project `my_project` always maps to the same `vs_...` identifier. The listing endpoints return these IDs so clients can discover stores at runtime.

### Endpoints

| Method | Path | Permission | Description |
|--------|------|------------|-------------|
| `GET` | `/v1/vector_stores` | `DESCRIBE` | List all vector stores the caller has access to |
| `GET` | `/v1/vector_stores/{vector_store_id}` | `DESCRIBE` | Get metadata for a single vector store |
| `POST` | `/v1/vector_stores/{vector_store_id}/search` | `READ_ONLINE` | Search a vector store with a plain text query |

This is useful for AI agents and LLM tool-calling workflows where the client cannot produce raw embedding vectors.
All endpoints enforce RBAC when authentication is configured. The listing endpoint filters out stores the caller cannot `DESCRIBE`.

### Requirements

- An `embedding_model` section in your `feature_store.yaml`. Feast uses [Sentence Transformers](https://www.sbert.net/) for local embedding — no external API key required (`pip install sentence-transformers`):
1. **Embedding model** — an `embedding_model` section in `feature_store.yaml`. Feast uses [Sentence Transformers](https://www.sbert.net/) by default for local embedding — no external API key required (`pip install sentence-transformers`):

```yaml
embedding_model:
provider: sentence_transformers # default; can be omitted
model: all-MiniLM-L6-v2
```

2. **Vector-indexed feature view** — at least one feature view with `vector_index=True` on a vector field, materialized to an online store that supports vector search.

3. **Numeric filtering (optional)** — for metadata filters that use numeric or boolean comparisons, set `enable_openai_compatible_store: true` on your online store config and run `feast apply` to add the required `value_num` column.

### Custom embedding providers

The built-in Sentence Transformers provider works for most use cases. To use a different embedding backend (OpenAI, Cohere, a custom model, etc.), implement the `EmbeddingProvider` protocol and pass an instance to `FeatureStore`:

```python
from feast.embedder import EmbeddingProvider

class MyEmbeddingProvider:
def embed(self, texts: list[str]) -> list[list[float]]:
# Call your embedding API here
return my_model.encode(texts)

async def aembed(self, texts: list[str]) -> list[list[float]]:
return await my_model.aencode(texts)

store = FeatureStore(
repo_path=".",
embedding_provider=MyEmbeddingProvider(),
)
```

### Numeric storage (`enable_openai_compatible_store`)

By default, feature values are stored as text in the online store. This means string-ordered comparisons apply (e.g., `'9' > '100'` is `true`). When `enable_openai_compatible_store: true` is set on the online store config, Feast adds a `value_num` column that stores `int`, `float`, `double`, and `bool` values natively so that numeric filters produce correct results.

```yaml
embedding_model:
provider: sentence_transformers # default; can be omitted
model: all-MiniLM-L6-v2
```
```yaml
online_store:
type: postgres # or sqlite
# ... connection settings ...
enable_openai_compatible_store: true
```

Custom embedding providers can be plugged in by implementing the `EmbeddingProvider` protocol and passing an instance to `FeatureStore`.
After changing this setting, run `feast apply` to update the database schema.

- A feature view with `vector_index=True` on a vector field, materialized to an online store that supports vector search.
- For metadata filtering with numeric or boolean comparisons, set `enable_openai_compatible_store: true` on your online store config and run `feast apply` to update the schema.
### List vector stores

### Usage
```bash
curl http://localhost:6566/v1/vector_stores
```

```json
{
"object": "list",
"data": [
{
"id": "vs_a1b2c3d4e5f6a1b2c3d4e5f6",
"object": "vector_store",
"name": "product_catalog",
"status": "completed",
"created_at": 1717200000
}
]
}
```

### Get a single vector store

```bash
curl http://localhost:6566/v1/vector_stores/vs_a1b2c3d4e5f6a1b2c3d4e5f6
```

Returns the same object shape as a single entry in the list response. Returns `404` if the ID does not match any vector-indexed feature view.

### Search

Start the feature server with `feast serve`, then send a search request:

```bash
curl -X POST http://localhost:6566/v1/vector_stores/my_feature_view/search \
curl -X POST http://localhost:6566/v1/vector_stores/vs_a1b2c3d4e5f6a1b2c3d4e5f6/search \
-H "Content-Type: application/json" \
-d '{
"query": "wireless noise-cancelling headphones",
"max_num_results": 5
}'
```

### Request fields
#### Request fields

| Field | Type | Default | Description |
|-------|------|---------|-------------|
Expand Down Expand Up @@ -111,6 +193,8 @@ The endpoint supports OpenAI-style filters for narrowing results beyond vector s

For Postgres and SQLite backends, all filtering (including string equality) requires `enable_openai_compatible_store: true` in the online store config. After enabling, run `feast apply` to update the database schema.

ScyllaDB supports vector retrieval via `retrieve_online_documents_v2`, but OpenAI-style metadata filtering is not implemented yet. Passing `filters` raises `NotImplementedError`.

### Response format

Responses follow the OpenAI `vector_store.search_results.page` schema:
Expand All @@ -121,8 +205,8 @@ Responses follow the OpenAI `vector_store.search_results.page` schema:
"search_query": ["wireless noise-cancelling headphones"],
"data": [
{
"file_id": "my_feature_view_42",
"filename": "my_feature_view",
"file_id": "vs_a1b2c3d4e5f6a1b2c3d4e5f6_42",
"filename": "vs_a1b2c3d4e5f6a1b2c3d4e5f6",
"score": 0.92,
"attributes": {"name": "...", "category": "..."},
"content": [
Expand All @@ -135,6 +219,8 @@ Responses follow the OpenAI `vector_store.search_results.page` schema:
}
```

The `file_id` and `filename` fields use the `vs_{hash}` identifier, not raw feature view names.

The `score` field is a higher-is-better relevance score derived from the raw vector distance using a metric-dependent conversion:

| Distance metric | Conversion | Range |
Expand All @@ -147,6 +233,40 @@ The metric is determined by `vector_search_metric` on the feature view's vector

Pagination is not yet implemented; `has_more` is always `false`.

### SDK usage

The OpenAI-compatible search is also available directly via the Python SDK:

```python
import asyncio
from feast import FeatureStore

store = FeatureStore(repo_path=".")

result = asyncio.run(store.openai_search(
vector_store_id="product_catalog",
query="wireless noise-cancelling headphones",
max_num_results=5,
filters={"type": "eq", "key": "category", "value": "Electronics"},
))

for item in result["data"]:
print(f"{item['score']:.3f} {item['attributes']}")
```

### Supported online stores

The OpenAI-compatible filtering has been implemented for the following online stores:

| Online Store | Vector Search | Metadata Filtering | Notes |
|-------------|--------------|-------------------|-------|
| Milvus | Yes | Yes | Boolean expressions |
| Elasticsearch | Yes | Yes | Query DSL clauses |
| Postgres (pgvector) | Yes | Yes | Requires `enable_openai_compatible_store: true` |
| SQLite (sqlite-vec) | Yes | Yes | Requires `enable_openai_compatible_store: true` |
| MongoDB | Yes | Yes | Aggregation pipeline |
| ScyllaDB | Yes | No | Vector search only; metadata filters are not supported yet |

## Examples

- 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).
Expand Down
83 changes: 15 additions & 68 deletions docs/reference/feature-servers/python-feature-server.md
Original file line number Diff line number Diff line change
Expand Up @@ -533,19 +533,23 @@ The feature server exposes `POST /search` for vector similarity search against o

`POST /retrieve-online-documents` is a deprecated alias with the same request body and response; new integrations should use `/search`.

## OpenAI-Compatible Vector Store API
## [Alpha] OpenAI-Compatible Vector Store API

{% hint style="warning" %}
**Alpha feature.** This API surface is functional and tested, but may change in future releases.
{% endhint %}

The feature server exposes OpenAI-compatible vector store endpoints. This allows clients (including LLM agents and tool-calling frameworks) to discover and search vector data with plain text queries, without computing embeddings client-side.

Each feature view with vector-indexed fields gets a deterministic `vs_{hash}` identifier derived from the project name and feature view name.
Each feature view with vector-indexed fields gets a deterministic `vs_{hash}` identifier derived from `SHA-256(project + ":" + feature_view_name)`. These IDs are stable across server restarts.

### Endpoints

| Method | Path | Description |
|---|---|---|
| `GET` | `/v1/vector_stores` | List all vector stores (RBAC: `DESCRIBE` per feature view) |
| `GET` | `/v1/vector_stores/{vector_store_id}` | Get a single vector store (RBAC: `DESCRIBE`) |
| `POST` | `/v1/vector_stores/{vector_store_id}/search` | Search a vector store (RBAC: `READ_ONLINE`) |
| Method | Path | RBAC | Description |
|---|---|---|---|
| `GET` | `/v1/vector_stores` | `DESCRIBE` | List all vector stores (filtered by caller permissions) |
| `GET` | `/v1/vector_stores/{vector_store_id}` | `DESCRIBE` | Get metadata for a single vector store |
| `POST` | `/v1/vector_stores/{vector_store_id}/search` | `READ_ONLINE` | Search a vector store with server-side embedding |

### Configuration

Expand All @@ -557,66 +561,7 @@ embedding_model:
model: all-MiniLM-L6-v2
```

Feast uses **Sentence Transformers** (default) for local embedding inference — no external API key required. See [Alpha Vector Database](../alpha-vector-database.md#openai-compatible-vector-store-search) for full configuration and filter details.

### List vector stores

```bash
curl http://localhost:6566/v1/vector_stores
```

```json
{
"object": "list",
"data": [
{
"id": "vs_a1b2c3d4e5f6a1b2c3d4e5f6",
"object": "vector_store",
"name": "product_catalog",
"status": "completed",
"created_at": 1717200000
}
]
}
```

### Search example

```bash
curl -X POST http://localhost:6566/v1/vector_stores/vs_a1b2c3d4e5f6a1b2c3d4e5f6/search \
-H "Content-Type: application/json" \
-d '{
"query": "wireless noise-cancelling headphones",
"max_num_results": 5,
"filters": {
"type": "eq",
"key": "category",
"value": "Electronics"
}
}'
```

The response follows the OpenAI `vector_store.search_results.page` format:

```json
{
"object": "vector_store.search_results.page",
"search_query": ["wireless noise-cancelling headphones"],
"data": [
{
"file_id": "vs_a1b2c3d4e5f6a1b2c3d4e5f6_42",
"filename": "vs_a1b2c3d4e5f6a1b2c3d4e5f6",
"score": 0.92,
"attributes": {"name": "Sony WH-1000XM5", "category": "Electronics"},
"content": [{"type": "text", "text": "Sony WH-1000XM5"}]
}
],
"has_more": false,
"next_page": null
}
```

For metadata filtering with numeric comparisons, set `enable_openai_compatible_store: true` on your online store config and run `feast apply`.
Feast uses **Sentence Transformers** (default) for local embedding inference — no external API key required. Custom embedding providers can be plugged in by implementing the `EmbeddingProvider` protocol. See [\[Alpha\] Vector Database](../alpha-vector-database.md#alpha-openai-compatible-vector-store-api) for full configuration, custom providers, filter details, and SDK usage.

## Starting the feature server in TLS(SSL) mode

Expand Down Expand Up @@ -691,7 +636,9 @@ The [PyTorch NLP template](https://github.com/feast-dev/feast/tree/main/sdk/pyth
| /get-online-features | FeatureView,OnDemandFeatureView | Read Online | Get online features from the feature store |
| /search | FeatureView | Read Online | Vector similarity search for RAG (embedding vector or text query) |
| /retrieve-online-documents | FeatureView | Read Online | **Deprecated.** Use `/search` instead. |
| /v1/vector_stores/{id}/search | FeatureView | Read Online | OpenAI-compatible vector search with server-side embedding |
| /v1/vector_stores | FeatureView | Describe | [Alpha] List all vector stores |
| /v1/vector_stores/{id} | FeatureView | Describe | [Alpha] Get a single vector store |
| /v1/vector_stores/{id}/search | FeatureView | Read Online | [Alpha] OpenAI-compatible vector search with server-side embedding |
| /push | FeatureView | Write Online, Write Offline, Write Online and Offline | Push features to the feature store (online, offline, or both) |
| /write-to-online-store | FeatureView | Write Online | Write features to the online store |
| /materialize | FeatureView | Write Online | Materialize features within a specified time range |
Expand Down
7 changes: 7 additions & 0 deletions docs/reference/online-stores/scylladb.md
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,13 @@ result = store.retrieve_online_documents_v2(
)
```

### Metadata filtering (OpenAI-compatible)

ScyllaDB supports vector similarity search, but OpenAI-style metadata filtering is **not supported yet**.
Passing `filters` to `retrieve_online_documents_v2` or the OpenAI-compatible search endpoint raises `NotImplementedError`.

For filtered vector search today, use one of the backends that implement metadata filters (for example Milvus, Elasticsearch, Postgres, SQLite, or MongoDB). See [Alpha Vector Database](../alpha-vector-database.md#supported-online-stores).

## Functionality Matrix

The set of functionality supported by online stores is described in detail [here](overview.md#functionality).
Expand Down
2 changes: 1 addition & 1 deletion sdk/python/feast/embedder.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class EmbeddingProvider(Protocol):

Implement this to plug in any embedding backend (OpenAI, Cohere,
SentenceTransformers, a local model, etc.) for use in
``retrieve_online_documents_openai`` and the OpenAI-compatible
``openai_search`` and the OpenAI-compatible
feature server endpoints.

Example::
Expand Down
2 changes: 1 addition & 1 deletion sdk/python/feast/feature_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -593,12 +593,12 @@
return JSONResponse(content=build_vector_store_object(store.project, fv))

@app.post(
"/v1/vector_stores/{vector_store_id}/search",
dependencies=[Depends(inject_user_details)],
)
async def vector_store_search(
vector_store_id: str,
request: OpenAISearchRequest,
) -> JSONResponse:
with feast_metrics.track_request_latency(
"/v1/vector_stores/{vector_store_id}/search"
Expand All @@ -610,7 +610,7 @@
actions=[AuthzedAction.READ_ONLINE],
)

result = await store.retrieve_online_documents_openai(
result = await store.openai_search(
vector_store_id=feature_view.name,
query=request.query,
vs_id=vector_store_id,
Expand Down
6 changes: 3 additions & 3 deletions sdk/python/feast/feature_store.py
Original file line number Diff line number Diff line change
Expand Up @@ -4142,7 +4142,7 @@ def retrieve_online_documents_v2(
include_feature_view_version_metadata,
)

async def retrieve_online_documents_openai(
async def openai_search(
self,
vector_store_id: str,
query: Union[str, List[str]],
Expand Down Expand Up @@ -4186,7 +4186,7 @@ async def retrieve_online_documents_openai(
Examples:
Keyword search (no embedding model configured)::

result = await store.retrieve_online_documents_openai(
result = await store.openai_search(
vector_store_id="city_embeddings",
query="cities in California",
max_num_results=5,
Expand All @@ -4197,7 +4197,7 @@ async def retrieve_online_documents_openai(
# feature_store.yaml has:
# embedding_model:
# model: text-embedding-3-small
result = await store.retrieve_online_documents_openai(
result = await store.openai_search(
vector_store_id="product_embeddings",
query="wireless audio device",
max_num_results=3,
Expand Down
Loading
Loading