feast-dev / feast

The Open Source Feature Store for Machine Learning
https://feast.dev
Apache License 2.0
5.62k stars 1k forks source link

Refactor Vector Retrieval into Feature View #4716

Open franciscojavierarceo opened 3 weeks ago

franciscojavierarceo commented 3 weeks ago

Is your feature request related to a problem? Please describe.

Currently we define vector search using existing FeatureViews and the Field(name="Embeddings", dtype=Array(Float32)), syntax defined in the FeatureView schema.

Then at online retrieval we make the client use:

store.retrieve_online_documents(
    feature="city_embeddings:Embeddings",
    query=query,
    top_k=5
).to_dict()

This is inefficient and requires the client to make two calls if the client wants both features and the most similar documents.

Describe the solution you'd like

We should specify the vector retrieval requirement declaratively in the FeatureView and use that to orchestrate the retrieval. This would enable us to move the existing retrieve_online_documents into get_online_features and do document search and feature retrieval.

Describe alternatives you've considered Keeping things the same is a suboptimal option.

Instead of using some Boolean or equivalent, we could declare an explicit DocumentFeatureView class or something equivalent but we should move away from creating more feature views as that is a primitive that we want to centralize on (discussed further in https://github.com/feast-dev/feast/issues/4584).

Additional context @HaoXuAI @tokoko