Skip to content

Latest commit

 

History

History
37 lines (27 loc) · 1.06 KB

TRANSFORMER.md

File metadata and controls

37 lines (27 loc) · 1.06 KB

Transformer

By default, the model signature output name alongside the model prediction gets used to produce cachable output. This can be customized by implementing a custom transformer.

A custom transformer has to use the following function signature:

type Transformer func(ctx context.Context, signature *Signature, input *gtly.Object, output interface{}) (common.Storable, error)

Then to register the transformer:

import "github.com/viant/mly/service/domain/transformer"

func init() {
  transformer.Register("myTransformer", aTransformer)
}

Optionally you can implement a storable provider.

import "github.com/viant/mly/service/domain/transformer"

func init() {
  transformer.Register("myType", func() interface{} {
      return &MyOutputType{}
  })
}

Where MyOutputType could implement the following interfaces to avoid reflection: