2023-07-15 01:19:43 +02:00
|
|
|
package grpc
|
|
|
|
|
|
|
|
import (
|
2024-01-05 12:04:46 -05:00
|
|
|
"github.com/go-skynet/LocalAI/api/schema"
|
2023-07-15 01:19:43 +02:00
|
|
|
pb "github.com/go-skynet/LocalAI/pkg/grpc/proto"
|
|
|
|
)
|
|
|
|
|
|
|
|
type LLM interface {
|
2023-08-18 15:23:14 -04:00
|
|
|
Busy() bool
|
2023-08-20 14:04:45 +02:00
|
|
|
Lock()
|
|
|
|
Unlock()
|
|
|
|
Locking() bool
|
2023-07-15 01:19:43 +02:00
|
|
|
Predict(*pb.PredictOptions) (string, error)
|
2023-07-15 01:19:43 +02:00
|
|
|
PredictStream(*pb.PredictOptions, chan string) error
|
2023-07-15 01:19:43 +02:00
|
|
|
Load(*pb.ModelOptions) error
|
2023-07-15 01:19:43 +02:00
|
|
|
Embeddings(*pb.PredictOptions) ([]float32, error)
|
2023-07-15 01:19:43 +02:00
|
|
|
GenerateImage(*pb.GenerateImageRequest) error
|
2024-01-05 12:04:46 -05:00
|
|
|
AudioTranscription(*pb.TranscriptRequest) (schema.Result, error)
|
2023-07-15 01:19:43 +02:00
|
|
|
TTS(*pb.TTSRequest) error
|
2023-08-18 15:23:14 -04:00
|
|
|
TokenizeString(*pb.PredictOptions) (pb.TokenizationResponse, error)
|
|
|
|
Status() (pb.StatusResponse, error)
|
2023-07-15 01:19:43 +02:00
|
|
|
}
|
2023-07-27 18:41:04 +02:00
|
|
|
|
|
|
|
func newReply(s string) *pb.Reply {
|
|
|
|
return &pb.Reply{Message: []byte(s)}
|
|
|
|
}
|