◐ Shell
clean mode source ↗

Feast - The Open Source Feature Store for Machine Learning

from feast import FeatureStore

# Initialize the feature store
store = FeatureStore(repo_path="feature_repo")

# Get features for training
training_df = store.get_historical_features(
    entity_df=training_entities,
    features=[
        "customer_stats:daily_transactions",
        "customer_stats:lifetime_value",
        "product_features:price"
    ]
).to_df()

# Get online features for inference
features = store.get_online_features(
    features=[
        "customer_stats:daily_transactions",
        "customer_stats:lifetime_value",
        "product_features:price"
    ],
    entity_rows=[{"customer_id": "C123", "product_id": "P456"}]
).to_dict()

# Retrieve your documents using vector similarity search for RAG
features = store.retrieve_online_documents(
    features=[
        "corpus:document_id",
        "corpus:chunk_id",
        "corpus:chunk_text",
        "corpus:chunk_embedding",
    ],
    query="What is the biggest city in the USA?"
).to_dict()