@@ -1863,11 +1863,11 @@ def retrieve_online_documents(
1863
1863
1864
1864
def retrieve_online_documents_v2 (
1865
1865
self ,
1866
- query : Union [str , List [float ]],
1867
- top_k : int ,
1868
1866
features : List [str ],
1869
- distance_metric : Optional [str ] = "L2" ,
1867
+ top_k : int ,
1868
+ query : Optional [List [float ]] = None ,
1870
1869
query_string : Optional [str ] = None ,
1870
+ distance_metric : Optional [str ] = "L2" ,
1871
1871
) -> OnlineResponse :
1872
1872
"""
1873
1873
Retrieves the top k closest document features. Note, embeddings are a subset of features.
@@ -1876,15 +1876,14 @@ def retrieve_online_documents_v2(
1876
1876
features: The list of features that should be retrieved from the online document store. These features can be
1877
1877
specified either as a list of string document feature references or as a feature service. String feature
1878
1878
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)
1880
1880
top_k: The number of closest document features to retrieve.
1881
1881
distance_metric: The distance metric to use for retrieval.
1882
1882
query_string: The query string to retrieve the closest document features using keyword search (bm25).
1883
1883
"""
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
+ )
1888
1887
1889
1888
(
1890
1889
available_feature_views ,
@@ -1988,7 +1987,7 @@ def _retrieve_from_online_store_v2(
1988
1987
provider : Provider ,
1989
1988
table : FeatureView ,
1990
1989
requested_features : List [str ],
1991
- query : List [float ],
1990
+ query : Optional [ List [float ] ],
1992
1991
top_k : int ,
1993
1992
distance_metric : Optional [str ],
1994
1993
query_string : Optional [str ],
0 commit comments