Skip to content

Commit 90e627f

Browse files
authored
docs: Add rag-retriever example link to docs (feast-dev#5465)
Signed-off-by: Fiona Waters <[email protected]>
1 parent 0173033 commit 90e627f

File tree

5 files changed

+16
-10
lines changed

5 files changed

+16
-10
lines changed

docs/SUMMARY.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@
5353
* [Validating historical features with Great Expectations](tutorials/validating-historical-features.md)
5454
* [Building streaming features](tutorials/building-streaming-features.md)
5555
* [Retrieval Augmented Generation (RAG) with Feast](tutorials/rag-with-docling.md)
56+
* [RAG Fine Tuning with Feast and Milvus](../examples/rag-retriever/README.md)
5657
* [MCP - AI Agent Example](../examples/mcp_feature_store/README.md)
5758

5859
## How-to Guides

docs/getting-started/genai.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,7 @@ For more detailed information and examples:
156156

157157
* [Vector Database Reference](../reference/alpha-vector-database.md)
158158
* [RAG Tutorial with Docling](../tutorials/rag-with-docling.md)
159+
* [RAG Fine Tuning with Feast and Milvus](../../examples/rag-retriever/README.md)
159160
* [Milvus Quickstart Example](https://github.com/feast-dev/feast/tree/master/examples/rag/milvus-quickstart.ipynb)
160161
* [MCP Feature Store Example](../../examples/mcp_feature_store/)
161162
* [MCP Feature Server Reference](../reference/feature-servers/mcp-feature-server.md)

examples/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ The following examples illustrate various **Feast** use cases to enhance underst
1212
1. **[Remote Offline Store](remote-offline-store)**: Demonstrates how to set up and use a remote offline store.
1313
1. **[Podman/Podman Compose Local](podman_local)**: Demonstrates how to deploy Feast remote server components using Podman Compose locally.
1414
1. **[RHOAI Feast Demo](rhoai-quickstart)**: Showcases Feast's core functionality using a Jupyter notebook, including fetching online feature data from a remote server and retrieving metadata from a remote registry.
15+
1. **[RAG Fine Tuning with Feast and Milvus](rag-retriever)**: Demonstrates end-to-end RAG fine-tuning using Feast and Milvus, including data preparation, embedding generation, feature store setup, and RAG system implementation with custom FeastRagRetriever.
1516

1617
# Feast Operator Examples
1718

examples/rag-retriever/README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
# End-to-end RAG example using Feast and Milvus.
1+
# End-to-end RAG Fine Tuning example using Feast and Milvus.
22

33
## Introduction
4-
This example notebook provides a step-by-step demonstration of building and using a RAG system with Feast Feature Store and the custom FeastRagRetriever. The notebook walks through:
4+
This example notebook provides a step-by-step demonstration of building and using a RAG system with Feast and the custom FeastRagRetriever. The notebook walks through:
55

66
1. Data Preparation
7-
- Loads a subset of the Wikipedia DPR dataset (1% of training data)
7+
- Loads a subset of the [Wikipedia DPR dataset](https://huggingface.co/datasets/facebook/wiki_dpr) (1% of training data)
88
- Implements text chunking with configurable chunk size and overlap
99
- Processes text into manageable passages with unique IDs
1010

@@ -49,7 +49,7 @@ Navigate to the examples/rag-retriever directory. Here you will find the followi
4949
This is the Feast feature repository configuration that defines the schema and data source for Wikipedia passage embeddings.
5050

5151
* **__rag_feast.ipynb__**
52-
This is a notebook demonstrating the implementation of a RAG system using Feast feature store. The notebook provides:
52+
This is a notebook demonstrating the implementation of a RAG system using Feast. The notebook provides:
5353

5454
- A complete end-to-end example of building a RAG system with:
5555
- Data preparation using the Wiki DPR dataset

sdk/python/feast/rag_retriever.py

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,8 @@ def __init__(
6363
generator_tokenizer: Tokenizer for the generator model
6464
generator_model: The generator model
6565
feast_repo_path: Path to the Feast repository
66+
feature_view: Feast FeatureView containing the document data
67+
features: List of feature names to use from the feature view
6668
search_type: Type of search to perform (text, vector, or hybrid)
6769
config: Configuration for the retriever
6870
index: Index instance (must be FeastIndex)
@@ -141,7 +143,7 @@ def retrieve( # type: ignore [override]
141143
Args:
142144
question_hidden_states (np.ndarray):
143145
Hidden state representation of the question from the encoder.
144-
Expected shape is (1, seq_len, hidden_dim).
146+
Expected shape is (batch_size, seq_len, hidden_dim).
145147
n_docs (int):
146148
Number of top documents to retrieve.
147149
query (Optional[str]):
@@ -151,11 +153,12 @@ def retrieve( # type: ignore [override]
151153
Returns:
152154
Tuple containing:
153155
- retrieved_doc_embeds (np.ndarray):
154-
Embeddings of the retrieved documents with shape (1, n_docs, embed_dim).
155-
- doc_ids (list[str]):
156-
List of document IDs or passage identifiers.
157-
- doc_dicts (list[dict[str, str]]):
158-
List of dictionaries containing document text fields.
156+
Embeddings of the retrieved documents with shape (batch_size, n_docs, embed_dim).
157+
- doc_ids (np.ndarray):
158+
Array of document IDs or passage identifiers with shape (batch_size, n_docs).
159+
- doc_dicts (list[dict]):
160+
List of dictionaries containing document metadata and text.
161+
Each dictionary has keys "text", "id", and "title".
159162
"""
160163

161164
batch_size = question_hidden_states.shape[0]

0 commit comments

Comments
 (0)