2023-07-14 23:19:43 +00:00
|
|
|
package grpc
|
|
|
|
|
|
|
|
|
|
import (
|
2024-06-23 08:24:36 +00:00
|
|
|
pb "github.com/mudler/LocalAI/pkg/grpc/proto"
|
2023-07-14 23:19:43 +00:00
|
|
|
)
|
|
|
|
|
|
2025-07-27 20:02:51 +00:00
|
|
|
type AIModel interface {
|
2023-08-18 19:23:14 +00:00
|
|
|
Busy() bool
|
2023-08-20 12:04:45 +00:00
|
|
|
Lock()
|
|
|
|
|
Unlock()
|
|
|
|
|
Locking() bool
|
2023-07-14 23:19:43 +00:00
|
|
|
Predict(*pb.PredictOptions) (string, error)
|
2023-07-14 23:19:43 +00:00
|
|
|
PredictStream(*pb.PredictOptions, chan string) error
|
2023-07-14 23:19:43 +00:00
|
|
|
Load(*pb.ModelOptions) error
|
2026-03-03 11:39:06 +00:00
|
|
|
Free() error
|
2023-07-14 23:19:43 +00:00
|
|
|
Embeddings(*pb.PredictOptions) ([]float32, error)
|
2023-07-14 23:19:43 +00:00
|
|
|
GenerateImage(*pb.GenerateImageRequest) error
|
2025-04-26 16:05:01 +00:00
|
|
|
GenerateVideo(*pb.GenerateVideoRequest) error
|
2025-07-27 20:02:51 +00:00
|
|
|
Detect(*pb.DetectOptions) (pb.DetectResponse, error)
|
2024-09-02 13:48:53 +00:00
|
|
|
AudioTranscription(*pb.TranscriptRequest) (pb.TranscriptResult, error)
|
2023-07-14 23:19:43 +00:00
|
|
|
TTS(*pb.TTSRequest) error
|
2026-01-30 10:58:01 +00:00
|
|
|
TTSStream(*pb.TTSRequest, chan []byte) error
|
2024-08-24 00:20:28 +00:00
|
|
|
SoundGeneration(*pb.SoundGenerationRequest) error
|
2023-08-18 19:23:14 +00:00
|
|
|
TokenizeString(*pb.PredictOptions) (pb.TokenizationResponse, error)
|
|
|
|
|
Status() (pb.StatusResponse, error)
|
2024-03-22 20:14:04 +00:00
|
|
|
|
|
|
|
|
StoresSet(*pb.StoresSetOptions) error
|
|
|
|
|
StoresDelete(*pb.StoresDeleteOptions) error
|
|
|
|
|
StoresGet(*pb.StoresGetOptions) (pb.StoresGetResult, error)
|
|
|
|
|
StoresFind(*pb.StoresFindOptions) (pb.StoresFindResult, error)
|
2024-11-20 13:48:40 +00:00
|
|
|
|
|
|
|
|
VAD(*pb.VADRequest) (pb.VADResponse, error)
|
2026-01-22 23:38:28 +00:00
|
|
|
|
2026-03-13 20:37:15 +00:00
|
|
|
AudioEncode(*pb.AudioEncodeRequest) (*pb.AudioEncodeResult, error)
|
|
|
|
|
AudioDecode(*pb.AudioDecodeRequest) (*pb.AudioDecodeResult, error)
|
|
|
|
|
|
2026-01-22 23:38:28 +00:00
|
|
|
ModelMetadata(*pb.ModelOptions) (*pb.ModelMetadataResponse, error)
|
2026-03-21 01:08:02 +00:00
|
|
|
|
|
|
|
|
// Fine-tuning
|
|
|
|
|
StartFineTune(*pb.FineTuneRequest) (*pb.FineTuneJobResult, error)
|
|
|
|
|
FineTuneProgress(*pb.FineTuneProgressRequest, chan *pb.FineTuneProgressUpdate) error
|
|
|
|
|
StopFineTune(*pb.FineTuneStopRequest) error
|
|
|
|
|
ListCheckpoints(*pb.ListCheckpointsRequest) (*pb.ListCheckpointsResponse, error)
|
|
|
|
|
ExportModel(*pb.ExportModelRequest) error
|
2026-03-21 23:56:34 +00:00
|
|
|
|
|
|
|
|
// Quantization
|
|
|
|
|
StartQuantization(*pb.QuantizationRequest) (*pb.QuantizationJobResult, error)
|
|
|
|
|
QuantizationProgress(*pb.QuantizationProgressRequest, chan *pb.QuantizationProgressUpdate) error
|
|
|
|
|
StopQuantization(*pb.QuantizationStopRequest) error
|
2023-07-14 23:19:43 +00:00
|
|
|
}
|
2023-07-27 16:41:04 +00:00
|
|
|
|
|
|
|
|
func newReply(s string) *pb.Reply {
|
|
|
|
|
return &pb.Reply{Message: []byte(s)}
|
|
|
|
|
}
|