package faiss

import (
	"time"

	"gitlab.alibaba-inc.com/pai_biz_arch/pairec/recconf"
)

const ()

type FaissModel struct {
	name   string
	client *VectorClient
}

func NewFaissModel(name string) *FaissModel {
	return &FaissModel{name: name}
}
func (m *FaissModel) Init(conf *recconf.AlgoConfig) error {
	client, err := NewVectorClient(conf.VectorConf.ServerAddress, time.Millisecond*time.Duration(conf.VectorConf.Timeout))
	if err != nil {
		return err
	}

	m.client = client
	return nil

}
func (m *FaissModel) Run(algoData interface{}) (interface{}, error) {
	return m.client.Search(algoData)
}
