mirror of
https://github.com/mudler/LocalAI.git
synced 2024-12-21 05:33:09 +00:00
ad0e30bca5
* refactor: move backends into the backends directory Signed-off-by: Ettore Di Giacinto <mudler@localai.io> * refactor: move main close to implementation for every backend Signed-off-by: Ettore Di Giacinto <mudler@localai.io> --------- Signed-off-by: Ettore Di Giacinto <mudler@localai.io>
364 lines
15 KiB
Python
364 lines
15 KiB
Python
# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT!
|
|
"""Client and server classes corresponding to protobuf-defined services."""
|
|
import grpc
|
|
|
|
import backend_pb2 as backend__pb2
|
|
|
|
|
|
class BackendStub(object):
|
|
"""Missing associated documentation comment in .proto file."""
|
|
|
|
def __init__(self, channel):
|
|
"""Constructor.
|
|
|
|
Args:
|
|
channel: A grpc.Channel.
|
|
"""
|
|
self.Health = channel.unary_unary(
|
|
'/backend.Backend/Health',
|
|
request_serializer=backend__pb2.HealthMessage.SerializeToString,
|
|
response_deserializer=backend__pb2.Reply.FromString,
|
|
)
|
|
self.Predict = channel.unary_unary(
|
|
'/backend.Backend/Predict',
|
|
request_serializer=backend__pb2.PredictOptions.SerializeToString,
|
|
response_deserializer=backend__pb2.Reply.FromString,
|
|
)
|
|
self.LoadModel = channel.unary_unary(
|
|
'/backend.Backend/LoadModel',
|
|
request_serializer=backend__pb2.ModelOptions.SerializeToString,
|
|
response_deserializer=backend__pb2.Result.FromString,
|
|
)
|
|
self.PredictStream = channel.unary_stream(
|
|
'/backend.Backend/PredictStream',
|
|
request_serializer=backend__pb2.PredictOptions.SerializeToString,
|
|
response_deserializer=backend__pb2.Reply.FromString,
|
|
)
|
|
self.Embedding = channel.unary_unary(
|
|
'/backend.Backend/Embedding',
|
|
request_serializer=backend__pb2.PredictOptions.SerializeToString,
|
|
response_deserializer=backend__pb2.EmbeddingResult.FromString,
|
|
)
|
|
self.GenerateImage = channel.unary_unary(
|
|
'/backend.Backend/GenerateImage',
|
|
request_serializer=backend__pb2.GenerateImageRequest.SerializeToString,
|
|
response_deserializer=backend__pb2.Result.FromString,
|
|
)
|
|
self.AudioTranscription = channel.unary_unary(
|
|
'/backend.Backend/AudioTranscription',
|
|
request_serializer=backend__pb2.TranscriptRequest.SerializeToString,
|
|
response_deserializer=backend__pb2.TranscriptResult.FromString,
|
|
)
|
|
self.TTS = channel.unary_unary(
|
|
'/backend.Backend/TTS',
|
|
request_serializer=backend__pb2.TTSRequest.SerializeToString,
|
|
response_deserializer=backend__pb2.Result.FromString,
|
|
)
|
|
self.TokenizeString = channel.unary_unary(
|
|
'/backend.Backend/TokenizeString',
|
|
request_serializer=backend__pb2.PredictOptions.SerializeToString,
|
|
response_deserializer=backend__pb2.TokenizationResponse.FromString,
|
|
)
|
|
self.Status = channel.unary_unary(
|
|
'/backend.Backend/Status',
|
|
request_serializer=backend__pb2.HealthMessage.SerializeToString,
|
|
response_deserializer=backend__pb2.StatusResponse.FromString,
|
|
)
|
|
|
|
|
|
class BackendServicer(object):
|
|
"""Missing associated documentation comment in .proto file."""
|
|
|
|
def Health(self, request, context):
|
|
"""Missing associated documentation comment in .proto file."""
|
|
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
|
|
context.set_details('Method not implemented!')
|
|
raise NotImplementedError('Method not implemented!')
|
|
|
|
def Predict(self, request, context):
|
|
"""Missing associated documentation comment in .proto file."""
|
|
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
|
|
context.set_details('Method not implemented!')
|
|
raise NotImplementedError('Method not implemented!')
|
|
|
|
def LoadModel(self, request, context):
|
|
"""Missing associated documentation comment in .proto file."""
|
|
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
|
|
context.set_details('Method not implemented!')
|
|
raise NotImplementedError('Method not implemented!')
|
|
|
|
def PredictStream(self, request, context):
|
|
"""Missing associated documentation comment in .proto file."""
|
|
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
|
|
context.set_details('Method not implemented!')
|
|
raise NotImplementedError('Method not implemented!')
|
|
|
|
def Embedding(self, request, context):
|
|
"""Missing associated documentation comment in .proto file."""
|
|
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
|
|
context.set_details('Method not implemented!')
|
|
raise NotImplementedError('Method not implemented!')
|
|
|
|
def GenerateImage(self, request, context):
|
|
"""Missing associated documentation comment in .proto file."""
|
|
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
|
|
context.set_details('Method not implemented!')
|
|
raise NotImplementedError('Method not implemented!')
|
|
|
|
def AudioTranscription(self, request, context):
|
|
"""Missing associated documentation comment in .proto file."""
|
|
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
|
|
context.set_details('Method not implemented!')
|
|
raise NotImplementedError('Method not implemented!')
|
|
|
|
def TTS(self, request, context):
|
|
"""Missing associated documentation comment in .proto file."""
|
|
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
|
|
context.set_details('Method not implemented!')
|
|
raise NotImplementedError('Method not implemented!')
|
|
|
|
def TokenizeString(self, request, context):
|
|
"""Missing associated documentation comment in .proto file."""
|
|
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
|
|
context.set_details('Method not implemented!')
|
|
raise NotImplementedError('Method not implemented!')
|
|
|
|
def Status(self, request, context):
|
|
"""Missing associated documentation comment in .proto file."""
|
|
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
|
|
context.set_details('Method not implemented!')
|
|
raise NotImplementedError('Method not implemented!')
|
|
|
|
|
|
def add_BackendServicer_to_server(servicer, server):
|
|
rpc_method_handlers = {
|
|
'Health': grpc.unary_unary_rpc_method_handler(
|
|
servicer.Health,
|
|
request_deserializer=backend__pb2.HealthMessage.FromString,
|
|
response_serializer=backend__pb2.Reply.SerializeToString,
|
|
),
|
|
'Predict': grpc.unary_unary_rpc_method_handler(
|
|
servicer.Predict,
|
|
request_deserializer=backend__pb2.PredictOptions.FromString,
|
|
response_serializer=backend__pb2.Reply.SerializeToString,
|
|
),
|
|
'LoadModel': grpc.unary_unary_rpc_method_handler(
|
|
servicer.LoadModel,
|
|
request_deserializer=backend__pb2.ModelOptions.FromString,
|
|
response_serializer=backend__pb2.Result.SerializeToString,
|
|
),
|
|
'PredictStream': grpc.unary_stream_rpc_method_handler(
|
|
servicer.PredictStream,
|
|
request_deserializer=backend__pb2.PredictOptions.FromString,
|
|
response_serializer=backend__pb2.Reply.SerializeToString,
|
|
),
|
|
'Embedding': grpc.unary_unary_rpc_method_handler(
|
|
servicer.Embedding,
|
|
request_deserializer=backend__pb2.PredictOptions.FromString,
|
|
response_serializer=backend__pb2.EmbeddingResult.SerializeToString,
|
|
),
|
|
'GenerateImage': grpc.unary_unary_rpc_method_handler(
|
|
servicer.GenerateImage,
|
|
request_deserializer=backend__pb2.GenerateImageRequest.FromString,
|
|
response_serializer=backend__pb2.Result.SerializeToString,
|
|
),
|
|
'AudioTranscription': grpc.unary_unary_rpc_method_handler(
|
|
servicer.AudioTranscription,
|
|
request_deserializer=backend__pb2.TranscriptRequest.FromString,
|
|
response_serializer=backend__pb2.TranscriptResult.SerializeToString,
|
|
),
|
|
'TTS': grpc.unary_unary_rpc_method_handler(
|
|
servicer.TTS,
|
|
request_deserializer=backend__pb2.TTSRequest.FromString,
|
|
response_serializer=backend__pb2.Result.SerializeToString,
|
|
),
|
|
'TokenizeString': grpc.unary_unary_rpc_method_handler(
|
|
servicer.TokenizeString,
|
|
request_deserializer=backend__pb2.PredictOptions.FromString,
|
|
response_serializer=backend__pb2.TokenizationResponse.SerializeToString,
|
|
),
|
|
'Status': grpc.unary_unary_rpc_method_handler(
|
|
servicer.Status,
|
|
request_deserializer=backend__pb2.HealthMessage.FromString,
|
|
response_serializer=backend__pb2.StatusResponse.SerializeToString,
|
|
),
|
|
}
|
|
generic_handler = grpc.method_handlers_generic_handler(
|
|
'backend.Backend', rpc_method_handlers)
|
|
server.add_generic_rpc_handlers((generic_handler,))
|
|
|
|
|
|
# This class is part of an EXPERIMENTAL API.
|
|
class Backend(object):
|
|
"""Missing associated documentation comment in .proto file."""
|
|
|
|
@staticmethod
|
|
def Health(request,
|
|
target,
|
|
options=(),
|
|
channel_credentials=None,
|
|
call_credentials=None,
|
|
insecure=False,
|
|
compression=None,
|
|
wait_for_ready=None,
|
|
timeout=None,
|
|
metadata=None):
|
|
return grpc.experimental.unary_unary(request, target, '/backend.Backend/Health',
|
|
backend__pb2.HealthMessage.SerializeToString,
|
|
backend__pb2.Reply.FromString,
|
|
options, channel_credentials,
|
|
insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
|
|
|
|
@staticmethod
|
|
def Predict(request,
|
|
target,
|
|
options=(),
|
|
channel_credentials=None,
|
|
call_credentials=None,
|
|
insecure=False,
|
|
compression=None,
|
|
wait_for_ready=None,
|
|
timeout=None,
|
|
metadata=None):
|
|
return grpc.experimental.unary_unary(request, target, '/backend.Backend/Predict',
|
|
backend__pb2.PredictOptions.SerializeToString,
|
|
backend__pb2.Reply.FromString,
|
|
options, channel_credentials,
|
|
insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
|
|
|
|
@staticmethod
|
|
def LoadModel(request,
|
|
target,
|
|
options=(),
|
|
channel_credentials=None,
|
|
call_credentials=None,
|
|
insecure=False,
|
|
compression=None,
|
|
wait_for_ready=None,
|
|
timeout=None,
|
|
metadata=None):
|
|
return grpc.experimental.unary_unary(request, target, '/backend.Backend/LoadModel',
|
|
backend__pb2.ModelOptions.SerializeToString,
|
|
backend__pb2.Result.FromString,
|
|
options, channel_credentials,
|
|
insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
|
|
|
|
@staticmethod
|
|
def PredictStream(request,
|
|
target,
|
|
options=(),
|
|
channel_credentials=None,
|
|
call_credentials=None,
|
|
insecure=False,
|
|
compression=None,
|
|
wait_for_ready=None,
|
|
timeout=None,
|
|
metadata=None):
|
|
return grpc.experimental.unary_stream(request, target, '/backend.Backend/PredictStream',
|
|
backend__pb2.PredictOptions.SerializeToString,
|
|
backend__pb2.Reply.FromString,
|
|
options, channel_credentials,
|
|
insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
|
|
|
|
@staticmethod
|
|
def Embedding(request,
|
|
target,
|
|
options=(),
|
|
channel_credentials=None,
|
|
call_credentials=None,
|
|
insecure=False,
|
|
compression=None,
|
|
wait_for_ready=None,
|
|
timeout=None,
|
|
metadata=None):
|
|
return grpc.experimental.unary_unary(request, target, '/backend.Backend/Embedding',
|
|
backend__pb2.PredictOptions.SerializeToString,
|
|
backend__pb2.EmbeddingResult.FromString,
|
|
options, channel_credentials,
|
|
insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
|
|
|
|
@staticmethod
|
|
def GenerateImage(request,
|
|
target,
|
|
options=(),
|
|
channel_credentials=None,
|
|
call_credentials=None,
|
|
insecure=False,
|
|
compression=None,
|
|
wait_for_ready=None,
|
|
timeout=None,
|
|
metadata=None):
|
|
return grpc.experimental.unary_unary(request, target, '/backend.Backend/GenerateImage',
|
|
backend__pb2.GenerateImageRequest.SerializeToString,
|
|
backend__pb2.Result.FromString,
|
|
options, channel_credentials,
|
|
insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
|
|
|
|
@staticmethod
|
|
def AudioTranscription(request,
|
|
target,
|
|
options=(),
|
|
channel_credentials=None,
|
|
call_credentials=None,
|
|
insecure=False,
|
|
compression=None,
|
|
wait_for_ready=None,
|
|
timeout=None,
|
|
metadata=None):
|
|
return grpc.experimental.unary_unary(request, target, '/backend.Backend/AudioTranscription',
|
|
backend__pb2.TranscriptRequest.SerializeToString,
|
|
backend__pb2.TranscriptResult.FromString,
|
|
options, channel_credentials,
|
|
insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
|
|
|
|
@staticmethod
|
|
def TTS(request,
|
|
target,
|
|
options=(),
|
|
channel_credentials=None,
|
|
call_credentials=None,
|
|
insecure=False,
|
|
compression=None,
|
|
wait_for_ready=None,
|
|
timeout=None,
|
|
metadata=None):
|
|
return grpc.experimental.unary_unary(request, target, '/backend.Backend/TTS',
|
|
backend__pb2.TTSRequest.SerializeToString,
|
|
backend__pb2.Result.FromString,
|
|
options, channel_credentials,
|
|
insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
|
|
|
|
@staticmethod
|
|
def TokenizeString(request,
|
|
target,
|
|
options=(),
|
|
channel_credentials=None,
|
|
call_credentials=None,
|
|
insecure=False,
|
|
compression=None,
|
|
wait_for_ready=None,
|
|
timeout=None,
|
|
metadata=None):
|
|
return grpc.experimental.unary_unary(request, target, '/backend.Backend/TokenizeString',
|
|
backend__pb2.PredictOptions.SerializeToString,
|
|
backend__pb2.TokenizationResponse.FromString,
|
|
options, channel_credentials,
|
|
insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
|
|
|
|
@staticmethod
|
|
def Status(request,
|
|
target,
|
|
options=(),
|
|
channel_credentials=None,
|
|
call_credentials=None,
|
|
insecure=False,
|
|
compression=None,
|
|
wait_for_ready=None,
|
|
timeout=None,
|
|
metadata=None):
|
|
return grpc.experimental.unary_unary(request, target, '/backend.Backend/Status',
|
|
backend__pb2.HealthMessage.SerializeToString,
|
|
backend__pb2.StatusResponse.FromString,
|
|
options, channel_credentials,
|
|
insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
|