mirror of
https://github.com/mudler/LocalAI.git
synced 2024-12-30 09:28:51 +00:00
cb7512734d
* backends(transformers): use AutoModel with LLM types * examples: animagine-xl * Add codellama examples
458 lines
16 KiB
Go
458 lines
16 KiB
Go
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
|
|
// versions:
|
|
// - protoc-gen-go-grpc v1.2.0
|
|
// - protoc v4.23.4
|
|
// source: backend/backend.proto
|
|
|
|
package proto
|
|
|
|
import (
|
|
context "context"
|
|
grpc "google.golang.org/grpc"
|
|
codes "google.golang.org/grpc/codes"
|
|
status "google.golang.org/grpc/status"
|
|
)
|
|
|
|
// This is a compile-time assertion to ensure that this generated file
|
|
// is compatible with the grpc package it is being compiled against.
|
|
// Requires gRPC-Go v1.32.0 or later.
|
|
const _ = grpc.SupportPackageIsVersion7
|
|
|
|
// BackendClient is the client API for Backend service.
|
|
//
|
|
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
|
|
type BackendClient interface {
|
|
Health(ctx context.Context, in *HealthMessage, opts ...grpc.CallOption) (*Reply, error)
|
|
Predict(ctx context.Context, in *PredictOptions, opts ...grpc.CallOption) (*Reply, error)
|
|
LoadModel(ctx context.Context, in *ModelOptions, opts ...grpc.CallOption) (*Result, error)
|
|
PredictStream(ctx context.Context, in *PredictOptions, opts ...grpc.CallOption) (Backend_PredictStreamClient, error)
|
|
Embedding(ctx context.Context, in *PredictOptions, opts ...grpc.CallOption) (*EmbeddingResult, error)
|
|
GenerateImage(ctx context.Context, in *GenerateImageRequest, opts ...grpc.CallOption) (*Result, error)
|
|
AudioTranscription(ctx context.Context, in *TranscriptRequest, opts ...grpc.CallOption) (*TranscriptResult, error)
|
|
TTS(ctx context.Context, in *TTSRequest, opts ...grpc.CallOption) (*Result, error)
|
|
TokenizeString(ctx context.Context, in *PredictOptions, opts ...grpc.CallOption) (*TokenizationResponse, error)
|
|
Status(ctx context.Context, in *HealthMessage, opts ...grpc.CallOption) (*StatusResponse, error)
|
|
}
|
|
|
|
type backendClient struct {
|
|
cc grpc.ClientConnInterface
|
|
}
|
|
|
|
func NewBackendClient(cc grpc.ClientConnInterface) BackendClient {
|
|
return &backendClient{cc}
|
|
}
|
|
|
|
func (c *backendClient) Health(ctx context.Context, in *HealthMessage, opts ...grpc.CallOption) (*Reply, error) {
|
|
out := new(Reply)
|
|
err := c.cc.Invoke(ctx, "/backend.Backend/Health", in, out, opts...)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return out, nil
|
|
}
|
|
|
|
func (c *backendClient) Predict(ctx context.Context, in *PredictOptions, opts ...grpc.CallOption) (*Reply, error) {
|
|
out := new(Reply)
|
|
err := c.cc.Invoke(ctx, "/backend.Backend/Predict", in, out, opts...)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return out, nil
|
|
}
|
|
|
|
func (c *backendClient) LoadModel(ctx context.Context, in *ModelOptions, opts ...grpc.CallOption) (*Result, error) {
|
|
out := new(Result)
|
|
err := c.cc.Invoke(ctx, "/backend.Backend/LoadModel", in, out, opts...)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return out, nil
|
|
}
|
|
|
|
func (c *backendClient) PredictStream(ctx context.Context, in *PredictOptions, opts ...grpc.CallOption) (Backend_PredictStreamClient, error) {
|
|
stream, err := c.cc.NewStream(ctx, &Backend_ServiceDesc.Streams[0], "/backend.Backend/PredictStream", opts...)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
x := &backendPredictStreamClient{stream}
|
|
if err := x.ClientStream.SendMsg(in); err != nil {
|
|
return nil, err
|
|
}
|
|
if err := x.ClientStream.CloseSend(); err != nil {
|
|
return nil, err
|
|
}
|
|
return x, nil
|
|
}
|
|
|
|
type Backend_PredictStreamClient interface {
|
|
Recv() (*Reply, error)
|
|
grpc.ClientStream
|
|
}
|
|
|
|
type backendPredictStreamClient struct {
|
|
grpc.ClientStream
|
|
}
|
|
|
|
func (x *backendPredictStreamClient) Recv() (*Reply, error) {
|
|
m := new(Reply)
|
|
if err := x.ClientStream.RecvMsg(m); err != nil {
|
|
return nil, err
|
|
}
|
|
return m, nil
|
|
}
|
|
|
|
func (c *backendClient) Embedding(ctx context.Context, in *PredictOptions, opts ...grpc.CallOption) (*EmbeddingResult, error) {
|
|
out := new(EmbeddingResult)
|
|
err := c.cc.Invoke(ctx, "/backend.Backend/Embedding", in, out, opts...)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return out, nil
|
|
}
|
|
|
|
func (c *backendClient) GenerateImage(ctx context.Context, in *GenerateImageRequest, opts ...grpc.CallOption) (*Result, error) {
|
|
out := new(Result)
|
|
err := c.cc.Invoke(ctx, "/backend.Backend/GenerateImage", in, out, opts...)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return out, nil
|
|
}
|
|
|
|
func (c *backendClient) AudioTranscription(ctx context.Context, in *TranscriptRequest, opts ...grpc.CallOption) (*TranscriptResult, error) {
|
|
out := new(TranscriptResult)
|
|
err := c.cc.Invoke(ctx, "/backend.Backend/AudioTranscription", in, out, opts...)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return out, nil
|
|
}
|
|
|
|
func (c *backendClient) TTS(ctx context.Context, in *TTSRequest, opts ...grpc.CallOption) (*Result, error) {
|
|
out := new(Result)
|
|
err := c.cc.Invoke(ctx, "/backend.Backend/TTS", in, out, opts...)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return out, nil
|
|
}
|
|
|
|
func (c *backendClient) TokenizeString(ctx context.Context, in *PredictOptions, opts ...grpc.CallOption) (*TokenizationResponse, error) {
|
|
out := new(TokenizationResponse)
|
|
err := c.cc.Invoke(ctx, "/backend.Backend/TokenizeString", in, out, opts...)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return out, nil
|
|
}
|
|
|
|
func (c *backendClient) Status(ctx context.Context, in *HealthMessage, opts ...grpc.CallOption) (*StatusResponse, error) {
|
|
out := new(StatusResponse)
|
|
err := c.cc.Invoke(ctx, "/backend.Backend/Status", in, out, opts...)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return out, nil
|
|
}
|
|
|
|
// BackendServer is the server API for Backend service.
|
|
// All implementations must embed UnimplementedBackendServer
|
|
// for forward compatibility
|
|
type BackendServer interface {
|
|
Health(context.Context, *HealthMessage) (*Reply, error)
|
|
Predict(context.Context, *PredictOptions) (*Reply, error)
|
|
LoadModel(context.Context, *ModelOptions) (*Result, error)
|
|
PredictStream(*PredictOptions, Backend_PredictStreamServer) error
|
|
Embedding(context.Context, *PredictOptions) (*EmbeddingResult, error)
|
|
GenerateImage(context.Context, *GenerateImageRequest) (*Result, error)
|
|
AudioTranscription(context.Context, *TranscriptRequest) (*TranscriptResult, error)
|
|
TTS(context.Context, *TTSRequest) (*Result, error)
|
|
TokenizeString(context.Context, *PredictOptions) (*TokenizationResponse, error)
|
|
Status(context.Context, *HealthMessage) (*StatusResponse, error)
|
|
mustEmbedUnimplementedBackendServer()
|
|
}
|
|
|
|
// UnimplementedBackendServer must be embedded to have forward compatible implementations.
|
|
type UnimplementedBackendServer struct {
|
|
}
|
|
|
|
func (UnimplementedBackendServer) Health(context.Context, *HealthMessage) (*Reply, error) {
|
|
return nil, status.Errorf(codes.Unimplemented, "method Health not implemented")
|
|
}
|
|
func (UnimplementedBackendServer) Predict(context.Context, *PredictOptions) (*Reply, error) {
|
|
return nil, status.Errorf(codes.Unimplemented, "method Predict not implemented")
|
|
}
|
|
func (UnimplementedBackendServer) LoadModel(context.Context, *ModelOptions) (*Result, error) {
|
|
return nil, status.Errorf(codes.Unimplemented, "method LoadModel not implemented")
|
|
}
|
|
func (UnimplementedBackendServer) PredictStream(*PredictOptions, Backend_PredictStreamServer) error {
|
|
return status.Errorf(codes.Unimplemented, "method PredictStream not implemented")
|
|
}
|
|
func (UnimplementedBackendServer) Embedding(context.Context, *PredictOptions) (*EmbeddingResult, error) {
|
|
return nil, status.Errorf(codes.Unimplemented, "method Embedding not implemented")
|
|
}
|
|
func (UnimplementedBackendServer) GenerateImage(context.Context, *GenerateImageRequest) (*Result, error) {
|
|
return nil, status.Errorf(codes.Unimplemented, "method GenerateImage not implemented")
|
|
}
|
|
func (UnimplementedBackendServer) AudioTranscription(context.Context, *TranscriptRequest) (*TranscriptResult, error) {
|
|
return nil, status.Errorf(codes.Unimplemented, "method AudioTranscription not implemented")
|
|
}
|
|
func (UnimplementedBackendServer) TTS(context.Context, *TTSRequest) (*Result, error) {
|
|
return nil, status.Errorf(codes.Unimplemented, "method TTS not implemented")
|
|
}
|
|
func (UnimplementedBackendServer) TokenizeString(context.Context, *PredictOptions) (*TokenizationResponse, error) {
|
|
return nil, status.Errorf(codes.Unimplemented, "method TokenizeString not implemented")
|
|
}
|
|
func (UnimplementedBackendServer) Status(context.Context, *HealthMessage) (*StatusResponse, error) {
|
|
return nil, status.Errorf(codes.Unimplemented, "method Status not implemented")
|
|
}
|
|
func (UnimplementedBackendServer) mustEmbedUnimplementedBackendServer() {}
|
|
|
|
// UnsafeBackendServer may be embedded to opt out of forward compatibility for this service.
|
|
// Use of this interface is not recommended, as added methods to BackendServer will
|
|
// result in compilation errors.
|
|
type UnsafeBackendServer interface {
|
|
mustEmbedUnimplementedBackendServer()
|
|
}
|
|
|
|
func RegisterBackendServer(s grpc.ServiceRegistrar, srv BackendServer) {
|
|
s.RegisterService(&Backend_ServiceDesc, srv)
|
|
}
|
|
|
|
func _Backend_Health_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
|
in := new(HealthMessage)
|
|
if err := dec(in); err != nil {
|
|
return nil, err
|
|
}
|
|
if interceptor == nil {
|
|
return srv.(BackendServer).Health(ctx, in)
|
|
}
|
|
info := &grpc.UnaryServerInfo{
|
|
Server: srv,
|
|
FullMethod: "/backend.Backend/Health",
|
|
}
|
|
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
|
return srv.(BackendServer).Health(ctx, req.(*HealthMessage))
|
|
}
|
|
return interceptor(ctx, in, info, handler)
|
|
}
|
|
|
|
func _Backend_Predict_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
|
in := new(PredictOptions)
|
|
if err := dec(in); err != nil {
|
|
return nil, err
|
|
}
|
|
if interceptor == nil {
|
|
return srv.(BackendServer).Predict(ctx, in)
|
|
}
|
|
info := &grpc.UnaryServerInfo{
|
|
Server: srv,
|
|
FullMethod: "/backend.Backend/Predict",
|
|
}
|
|
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
|
return srv.(BackendServer).Predict(ctx, req.(*PredictOptions))
|
|
}
|
|
return interceptor(ctx, in, info, handler)
|
|
}
|
|
|
|
func _Backend_LoadModel_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
|
in := new(ModelOptions)
|
|
if err := dec(in); err != nil {
|
|
return nil, err
|
|
}
|
|
if interceptor == nil {
|
|
return srv.(BackendServer).LoadModel(ctx, in)
|
|
}
|
|
info := &grpc.UnaryServerInfo{
|
|
Server: srv,
|
|
FullMethod: "/backend.Backend/LoadModel",
|
|
}
|
|
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
|
return srv.(BackendServer).LoadModel(ctx, req.(*ModelOptions))
|
|
}
|
|
return interceptor(ctx, in, info, handler)
|
|
}
|
|
|
|
func _Backend_PredictStream_Handler(srv interface{}, stream grpc.ServerStream) error {
|
|
m := new(PredictOptions)
|
|
if err := stream.RecvMsg(m); err != nil {
|
|
return err
|
|
}
|
|
return srv.(BackendServer).PredictStream(m, &backendPredictStreamServer{stream})
|
|
}
|
|
|
|
type Backend_PredictStreamServer interface {
|
|
Send(*Reply) error
|
|
grpc.ServerStream
|
|
}
|
|
|
|
type backendPredictStreamServer struct {
|
|
grpc.ServerStream
|
|
}
|
|
|
|
func (x *backendPredictStreamServer) Send(m *Reply) error {
|
|
return x.ServerStream.SendMsg(m)
|
|
}
|
|
|
|
func _Backend_Embedding_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
|
in := new(PredictOptions)
|
|
if err := dec(in); err != nil {
|
|
return nil, err
|
|
}
|
|
if interceptor == nil {
|
|
return srv.(BackendServer).Embedding(ctx, in)
|
|
}
|
|
info := &grpc.UnaryServerInfo{
|
|
Server: srv,
|
|
FullMethod: "/backend.Backend/Embedding",
|
|
}
|
|
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
|
return srv.(BackendServer).Embedding(ctx, req.(*PredictOptions))
|
|
}
|
|
return interceptor(ctx, in, info, handler)
|
|
}
|
|
|
|
func _Backend_GenerateImage_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
|
in := new(GenerateImageRequest)
|
|
if err := dec(in); err != nil {
|
|
return nil, err
|
|
}
|
|
if interceptor == nil {
|
|
return srv.(BackendServer).GenerateImage(ctx, in)
|
|
}
|
|
info := &grpc.UnaryServerInfo{
|
|
Server: srv,
|
|
FullMethod: "/backend.Backend/GenerateImage",
|
|
}
|
|
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
|
return srv.(BackendServer).GenerateImage(ctx, req.(*GenerateImageRequest))
|
|
}
|
|
return interceptor(ctx, in, info, handler)
|
|
}
|
|
|
|
func _Backend_AudioTranscription_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
|
in := new(TranscriptRequest)
|
|
if err := dec(in); err != nil {
|
|
return nil, err
|
|
}
|
|
if interceptor == nil {
|
|
return srv.(BackendServer).AudioTranscription(ctx, in)
|
|
}
|
|
info := &grpc.UnaryServerInfo{
|
|
Server: srv,
|
|
FullMethod: "/backend.Backend/AudioTranscription",
|
|
}
|
|
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
|
return srv.(BackendServer).AudioTranscription(ctx, req.(*TranscriptRequest))
|
|
}
|
|
return interceptor(ctx, in, info, handler)
|
|
}
|
|
|
|
func _Backend_TTS_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
|
in := new(TTSRequest)
|
|
if err := dec(in); err != nil {
|
|
return nil, err
|
|
}
|
|
if interceptor == nil {
|
|
return srv.(BackendServer).TTS(ctx, in)
|
|
}
|
|
info := &grpc.UnaryServerInfo{
|
|
Server: srv,
|
|
FullMethod: "/backend.Backend/TTS",
|
|
}
|
|
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
|
return srv.(BackendServer).TTS(ctx, req.(*TTSRequest))
|
|
}
|
|
return interceptor(ctx, in, info, handler)
|
|
}
|
|
|
|
func _Backend_TokenizeString_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
|
in := new(PredictOptions)
|
|
if err := dec(in); err != nil {
|
|
return nil, err
|
|
}
|
|
if interceptor == nil {
|
|
return srv.(BackendServer).TokenizeString(ctx, in)
|
|
}
|
|
info := &grpc.UnaryServerInfo{
|
|
Server: srv,
|
|
FullMethod: "/backend.Backend/TokenizeString",
|
|
}
|
|
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
|
return srv.(BackendServer).TokenizeString(ctx, req.(*PredictOptions))
|
|
}
|
|
return interceptor(ctx, in, info, handler)
|
|
}
|
|
|
|
func _Backend_Status_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
|
in := new(HealthMessage)
|
|
if err := dec(in); err != nil {
|
|
return nil, err
|
|
}
|
|
if interceptor == nil {
|
|
return srv.(BackendServer).Status(ctx, in)
|
|
}
|
|
info := &grpc.UnaryServerInfo{
|
|
Server: srv,
|
|
FullMethod: "/backend.Backend/Status",
|
|
}
|
|
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
|
return srv.(BackendServer).Status(ctx, req.(*HealthMessage))
|
|
}
|
|
return interceptor(ctx, in, info, handler)
|
|
}
|
|
|
|
// Backend_ServiceDesc is the grpc.ServiceDesc for Backend service.
|
|
// It's only intended for direct use with grpc.RegisterService,
|
|
// and not to be introspected or modified (even as a copy)
|
|
var Backend_ServiceDesc = grpc.ServiceDesc{
|
|
ServiceName: "backend.Backend",
|
|
HandlerType: (*BackendServer)(nil),
|
|
Methods: []grpc.MethodDesc{
|
|
{
|
|
MethodName: "Health",
|
|
Handler: _Backend_Health_Handler,
|
|
},
|
|
{
|
|
MethodName: "Predict",
|
|
Handler: _Backend_Predict_Handler,
|
|
},
|
|
{
|
|
MethodName: "LoadModel",
|
|
Handler: _Backend_LoadModel_Handler,
|
|
},
|
|
{
|
|
MethodName: "Embedding",
|
|
Handler: _Backend_Embedding_Handler,
|
|
},
|
|
{
|
|
MethodName: "GenerateImage",
|
|
Handler: _Backend_GenerateImage_Handler,
|
|
},
|
|
{
|
|
MethodName: "AudioTranscription",
|
|
Handler: _Backend_AudioTranscription_Handler,
|
|
},
|
|
{
|
|
MethodName: "TTS",
|
|
Handler: _Backend_TTS_Handler,
|
|
},
|
|
{
|
|
MethodName: "TokenizeString",
|
|
Handler: _Backend_TokenizeString_Handler,
|
|
},
|
|
{
|
|
MethodName: "Status",
|
|
Handler: _Backend_Status_Handler,
|
|
},
|
|
},
|
|
Streams: []grpc.StreamDesc{
|
|
{
|
|
StreamName: "PredictStream",
|
|
Handler: _Backend_PredictStream_Handler,
|
|
ServerStreams: true,
|
|
},
|
|
},
|
|
Metadata: "backend/backend.proto",
|
|
}
|