mirror of
https://github.com/mudler/LocalAI.git
synced 2024-12-21 21:47:51 +00:00
607fd066f0
chore(model-loader): increase coverage of model loader Signed-off-by: Ettore Di Giacinto <mudler@localai.io>
29 lines
454 B
Go
29 lines
454 B
Go
package model
|
|
|
|
import grpc "github.com/mudler/LocalAI/pkg/grpc"
|
|
|
|
type Model struct {
|
|
address string
|
|
client grpc.Backend
|
|
}
|
|
|
|
func NewModel(address string) *Model {
|
|
return &Model{
|
|
address: address,
|
|
}
|
|
}
|
|
|
|
func (m *Model) GRPC(parallel bool, wd *WatchDog) grpc.Backend {
|
|
if m.client != nil {
|
|
return m.client
|
|
}
|
|
|
|
enableWD := false
|
|
if wd != nil {
|
|
enableWD = true
|
|
}
|
|
|
|
m.client = grpc.NewClient(m.address, parallel, wd, enableWD)
|
|
return m.client
|
|
}
|