@@ -580,19 +580,11 @@ pprint(feature_vector)
580580
581581### Step 8: Using a feature service to fetch online features instead.
582582
583- You can also use feature services to manage multiple features, and decouple feature view definitions and the
584- features needed by end applications. The feature store can also be used to fetch either online or historical
585- features using the same API below. More information can be found
586- [ here] ( https://docs.feast.dev/getting-started/concepts/feature-retrieval ) .
587-
588- The ` driver_activity_v1 ` feature service pulls all features from the ` driver_hourly_stats ` feature view:
589-
590- ``` python
591- from feast import FeatureService
592- driver_stats_fs = FeatureService(
593- name = " driver_activity_v1" , features = [driver_stats_fv]
594- )
595- ```
583+ A feature service groups the features an application needs. In the local template,
584+ ` driver_activity_v1 ` selects ` conv_rate ` from ` driver_hourly_stats ` and both features
585+ from ` transformed_conv_rate ` . Pass ` val_to_add ` and ` val_to_add_2 ` for each driver
586+ so Feast can compute the two on-demand features at request time.
587+ See [ feature retrieval] ( https://docs.feast.dev/getting-started/concepts/feature-retrieval ) for more details.
596588
597589{% tabs %}
598590{% tab title="Python" %}
@@ -605,9 +597,8 @@ feature_service = feature_store.get_feature_service("driver_activity_v1")
605597feature_vector = feature_store.get_online_features(
606598 features = feature_service,
607599 entity_rows = [
608- # {join_key: entity_value}
609- {" driver_id" : 1004 },
610- {" driver_id" : 1005 },
600+ {" driver_id" : 1004 , " val_to_add" : 1 , " val_to_add_2" : 10 },
601+ {" driver_id" : 1005 , " val_to_add" : 2 , " val_to_add_2" : 20 },
611602 ],
612603).to_dict()
613604pprint(feature_vector)
@@ -616,14 +607,12 @@ pprint(feature_vector)
616607{% endtabs %}
617608
618609{% tabs %}
619- {% tab title="Output" %}
620- ``` bash
621- {
622- ' acc_rate' : [0.5732735991477966, 0.7828438878059387],
623- ' avg_daily_trips' : [33, 984],
624- ' conv_rate' : [0.15498852729797363, 0.6263588070869446],
625- ' driver_id' : [1004, 1005]
626- }
610+ {% tab title="Output (example)" %}
611+ ``` text
612+ {'conv_rate': [0.29568812251091003, 0.2832344174385071],
613+ 'conv_rate_plus_val1': [1.29568812251091, 2.283234417438507],
614+ 'conv_rate_plus_val2': [10.29568812251091, 20.283234417438507],
615+ 'driver_id': [1004, 1005]}
627616```
628617{% endtab %}
629618{% endtabs %}
0 commit comments