LocalAI/pkg/model/options.go
Ettore Di Giacinto 58f6aab637 feat: move llama to a grpc
Signed-off-by: Ettore Di Giacinto <mudler@localai.io>
2023-07-15 01:19:43 +02:00

55 lines
883 B
Go

package model
import (
pb "github.com/go-skynet/LocalAI/pkg/grpc/proto"
)
type Options struct {
backendString string
modelFile string
threads uint32
assetDir string
gRPCOptions *pb.ModelOptions
}
type Option func(*Options)
func WithBackendString(backend string) Option {
return func(o *Options) {
o.backendString = backend
}
}
func WithModelFile(modelFile string) Option {
return func(o *Options) {
o.modelFile = modelFile
}
}
func WithLoadGRPCOpts(opts *pb.ModelOptions) Option {
return func(o *Options) {
o.gRPCOptions = opts
}
}
func WithThreads(threads uint32) Option {
return func(o *Options) {
o.threads = threads
}
}
func WithAssetDir(assetDir string) Option {
return func(o *Options) {
o.assetDir = assetDir
}
}
func NewOptions(opts ...Option) *Options {
o := &Options{}
for _, opt := range opts {
opt(o)
}
return o
}