Skip to content

Commit a365c80

Browse files
committed
Added test for testing the new OpenAI api
Signed-off-by: Chaitany patel <patelchaitany93@gmail.com>
1 parent 265a4b0 commit a365c80

24 files changed

Lines changed: 2214 additions & 863 deletions

File tree

docs/reference/alpha-vector-database.md

Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,100 @@ backwards compatibility and the adopt industry standard naming conventions.
3232

3333
**Note**: Milvus and SQLite implement 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.
3434

35+
## OpenAI-Compatible Vector Store Search
36+
37+
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.
38+
39+
This is useful for AI agents and LLM tool-calling workflows where the client cannot produce raw embedding vectors.
40+
41+
### Requirements
42+
43+
- An `embedding_model` section in your `feature_store.yaml` (uses [LiteLLM](https://docs.litellm.ai/) for provider support):
44+
45+
```yaml
46+
embedding_model:
47+
model: text-embedding-3-small
48+
api_key: ${OPENAI_API_KEY}
49+
# api_base, api_version, dimensions are optional
50+
```
51+
52+
- A feature view with `vector_index=True` on a vector field, materialized to an online store that supports vector search.
53+
- 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.
54+
55+
### Usage
56+
57+
Start the feature server with `feast serve`, then send a search request:
58+
59+
```bash
60+
curl -X POST http://localhost:6566/v1/vector_stores/my_feature_view/search \
61+
-H "Content-Type: application/json" \
62+
-d '{
63+
"query": "wireless noise-cancelling headphones",
64+
"max_num_results": 5
65+
}'
66+
```
67+
68+
### Request fields
69+
70+
| Field | Type | Default | Description |
71+
|-------|------|---------|-------------|
72+
| `query` | `string` or `list[string]` | (required) | Plain text search query. Lists are joined with spaces before embedding. |
73+
| `max_num_results` | `int` | `10` | Maximum number of results to return. |
74+
| `filters` | `object` | `null` | OpenAI-style filters (see below). |
75+
| `ranking_options` | `object` | `null` | Accepted but not yet applied. |
76+
| `rewrite_query` | `bool` | `null` | Accepted but not yet applied. |
77+
| `metadata` | `object` | `null` | Optional. `metadata.features_to_retrieve` selects specific features. |
78+
79+
### Filters
80+
81+
The endpoint supports OpenAI-style filters for narrowing results beyond vector similarity.
82+
83+
**Comparison operators:** `eq`, `ne`, `gt`, `gte`, `lt`, `lte`, `in`, `nin`
84+
85+
```json
86+
{"type": "eq", "key": "category", "value": "Electronics"}
87+
```
88+
89+
**Compound operators:** `and`, `or` (nest to arbitrary depth)
90+
91+
```json
92+
{
93+
"type": "and",
94+
"filters": [
95+
{"type": "eq", "key": "category", "value": "Electronics"},
96+
{"type": "gte", "key": "rating", "value": 4.5}
97+
]
98+
}
99+
```
100+
101+
String equality filters work on all backends. Numeric and boolean filters require `enable_openai_compatible_store: true` in the online store config.
102+
103+
### Response format
104+
105+
Responses follow the OpenAI `vector_store.search_results.page` schema:
106+
107+
```json
108+
{
109+
"object": "vector_store.search_results.page",
110+
"search_query": ["wireless noise-cancelling headphones"],
111+
"data": [
112+
{
113+
"file_id": "my_feature_view_42",
114+
"filename": "my_feature_view",
115+
"score": 0.92,
116+
"attributes": {"name": "...", "category": "..."},
117+
"content": [
118+
{"type": "text", "text": "..."}
119+
]
120+
}
121+
],
122+
"has_more": false,
123+
"next_page": null
124+
}
125+
```
126+
127+
Pagination is not yet implemented; `has_more` is always `false`.
128+
35129
## Examples
36130

37131
- 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).

docs/reference/feature-servers/python-feature-server.md

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -457,6 +457,66 @@ Prometheus adds an `instance` label per pod, so there is no
457457
duplication. Use `sum(rate(...))` or `histogram_quantile(...)` across
458458
instances as usual.
459459

460+
## OpenAI-Compatible Vector Store Search
461+
462+
The feature server exposes an OpenAI-compatible vector store search endpoint. This allows clients (including LLM agents and tool-calling frameworks) to search vector data with plain text queries, without computing embeddings client-side.
463+
464+
### Endpoint
465+
466+
`POST /v1/vector_stores/{vector_store_id}/search`
467+
468+
The `vector_store_id` path parameter is the **feature view name**.
469+
470+
### Configuration
471+
472+
Add an `embedding_model` section to your `feature_store.yaml`:
473+
474+
```yaml
475+
embedding_model:
476+
model: text-embedding-3-small
477+
api_key: ${OPENAI_API_KEY}
478+
```
479+
480+
Any [LiteLLM](https://docs.litellm.ai/)-supported provider works (OpenAI, Ollama, Azure, Cohere, etc.). See [Alpha Vector Database](../alpha-vector-database.md#openai-compatible-vector-store-search) for full configuration and filter details.
481+
482+
### Example
483+
484+
```bash
485+
curl -X POST http://localhost:6566/v1/vector_stores/product_catalog/search \
486+
-H "Content-Type: application/json" \
487+
-d '{
488+
"query": "wireless noise-cancelling headphones",
489+
"max_num_results": 5,
490+
"filters": {
491+
"type": "eq",
492+
"key": "category",
493+
"value": "Electronics"
494+
}
495+
}'
496+
```
497+
498+
The response follows the OpenAI `vector_store.search_results.page` format:
499+
500+
```json
501+
{
502+
"object": "vector_store.search_results.page",
503+
"search_query": ["wireless noise-cancelling headphones"],
504+
"data": [
505+
{
506+
"file_id": "product_catalog_42",
507+
"filename": "product_catalog",
508+
"score": 0.92,
509+
"attributes": {"name": "Sony WH-1000XM5", "category": "Electronics"},
510+
"content": [{"type": "text", "text": "Sony WH-1000XM5"}]
511+
}
512+
],
513+
"has_more": false,
514+
"next_page": null
515+
}
516+
```
517+
518+
For metadata filtering with numeric comparisons, set `enable_openai_compatible_store: true` on your online store config and run `feast apply`.
519+
460520
## Starting the feature server in TLS(SSL) mode
461521

462522
Enabling TLS mode ensures that data between the Feast client and server is transmitted securely. For an ideal production environment, it is recommended to start the feature server in TLS mode.
@@ -529,6 +589,7 @@ The [PyTorch NLP template](https://github.com/feast-dev/feast/tree/main/sdk/pyth
529589
|----------------------------|---------------------------------|-------------------------------------------------------|----------------------------------------------------------------|
530590
| /get-online-features | FeatureView,OnDemandFeatureView | Read Online | Get online features from the feature store |
531591
| /retrieve-online-documents | FeatureView | Read Online | Retrieve online documents from the feature store for RAG |
592+
| /v1/vector_stores/{id}/search | FeatureView | Read Online | OpenAI-compatible vector search with server-side embedding |
532593
| /push | FeatureView | Write Online, Write Offline, Write Online and Offline | Push features to the feature store (online, offline, or both) |
533594
| /write-to-online-store | FeatureView | Write Online | Write features to the online store |
534595
| /materialize | FeatureView | Write Online | Materialize features within a specified time range |

0 commit comments

Comments
 (0)