This is a client for the Feature Store Feast, written in TypeScript.
It stays close to the Python SDK, but diverges from it in a few ways - see more on that below.
npm install feast-client --save
import * as feast from 'feast-client'
// instantiate a Feast Client
const feastClient = new feast.Client({ coreUrl: 'localhost:6565', servingUrl: 'localhost:6566' })
// create a new Feast project
await feastClient.createProject('example-project')
// create a new Feast FeatureSet
const entity = feast.Entity.fromConfig('customerId', feast.ValueType.STRING)
const orderValue = feast.Feature.fromConfig('orderValueInUSDCents', feast.ValueType.INT32)
const ageOfCustomer = feast.Feature.fromConfig('ageOfCustomerInYears', feast.ValueType.INT32)
const featureSet = feast.FeatureSet.fromConfig('example-feature-set', {
project: 'example-project',
entities: [entity],
features: [orderValue, ageOfCustomer]
})
// register the FeatureSet with Feast
await feastClient.applyFeatureSet(featureSet)
// create a feature row ...
const featureRow = feast.FeatureRow.fromConfig({
fields: {
orderValueInUSDCents: 995,
ageOfCustomerInYears: 30
},
eventTimestamp: Date.now(),
featureSet: 'example-project/example-feature-set'
})
// ... and submit to the server
const ingestionId = await feastClient.ingest([featureRow])
const feast = require('feast-client')
// instantiate a Feast Client
const feastClient = new feast.Client({ coreUrl: 'localhost:6565', servingUrl: 'localhost:6566' })
// create a new Feast project
await feastClient.createProject('example-project')
// create a new Feast FeatureSet
const entity = feast.Entity.fromConfig('customerId', ValueType.STRING)
const orderValue = feast.Feature.fromConfig('orderValueInUSDCents', ValueType.INT32)
const ageOfCustomer = feast.Feature.fromConfig('ageOfCustomerInYears', ValueType.INT32)
const featureSet = feast.FeatureSet.fromConfig('example-feature-set', {
project: 'example-project',
entities: [entity],
features: [orderValue, ageOfCustomer]
})
// register the FeatureSet with Feast
await feastClient.applyFeatureSet(featureSet)
// create a feature row ...
const featureRow = feast.FeatureRow.fromConfig({
fields: {
orderValueInUSDCents: 995,
ageOfCustomerInYears: 30
},
eventTimestamp: Date.now(),
featureSet: 'example-project/example-feature-set'
})
// ... and submit to the server
const ingestionId = await feastClient.ingest([featureRow])
For more see the examples directory.
client.apply
- due toapply
being an inherited function for all Objects in JS,client.apply
isclient.applyFeatureSet
for this SDK. To apply (i.e. create or update) multiple feature sets at once useapplyFeatureSets
.new FeatureSet (also Entity and Feature)
- there are two common flows for instantiating a feature set - manually instantiating it (when it is not yet registered with Feast) and receiving a feature set that is registered with Feast. To support each flow conveniently, there are two constructor methodsFeatureSet.fromConfig
andFeatureSet.fromFeast
- the constructor (i.e.new FeatureSet
) is set toprivate
and can not be called directly. The same applies toEntity
andFeature
.
- Implement Authentication and Authorization features
- Implement support for tags (aka. labels)
- Implement
Statistics
features