@@ -1863,11 +1863,11 @@ def retrieve_online_documents(
18631863
18641864 def retrieve_online_documents_v2 (
18651865 self ,
1866- query : Union [str , List [float ]],
1867- top_k : int ,
18681866 features : List [str ],
1869- distance_metric : Optional [str ] = "L2" ,
1867+ top_k : int ,
1868+ query : Optional [List [float ]] = None ,
18701869 query_string : Optional [str ] = None ,
1870+ distance_metric : Optional [str ] = "L2" ,
18711871 ) -> OnlineResponse :
18721872 """
18731873 Retrieves the top k closest document features. Note, embeddings are a subset of features.
@@ -1876,15 +1876,14 @@ def retrieve_online_documents_v2(
18761876 features: The list of features that should be retrieved from the online document store. These features can be
18771877 specified either as a list of string document feature references or as a feature service. String feature
18781878 references must have format "feature_view:feature", e.g, "document_fv:document_embeddings".
1879- query: The query to retrieve the closest document features for.
1879+ query: The embeded query to retrieve the closest document features for (optional)
18801880 top_k: The number of closest document features to retrieve.
18811881 distance_metric: The distance metric to use for retrieval.
18821882 query_string: The query string to retrieve the closest document features using keyword search (bm25).
18831883 """
1884- if isinstance (query , str ):
1885- raise ValueError (
1886- "Using embedding functionality is not supported for document retrieval. Please embed the query before calling retrieve_online_documents."
1887- )
1884+ assert query is not None or query_string is not None , (
1885+ "Either query or query_string must be provided."
1886+ )
18881887
18891888 (
18901889 available_feature_views ,
@@ -1988,7 +1987,7 @@ def _retrieve_from_online_store_v2(
19881987 provider : Provider ,
19891988 table : FeatureView ,
19901989 requested_features : List [str ],
1991- query : List [float ],
1990+ query : Optional [ List [float ] ],
19921991 top_k : int ,
19931992 distance_metric : Optional [str ],
19941993 query_string : Optional [str ],
0 commit comments