# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT!
"""Client and server classes corresponding to protobuf-defined services."""

import grpc
from utilities.plugins.tgis_grpc import generation_pb2 as generation__pb2

GRPC_GENERATED_VERSION = "1.68.1"
GRPC_VERSION = grpc.__version__
_version_not_supported = False

try:
    from grpc._utilities import first_version_is_lower

    _version_not_supported = first_version_is_lower(GRPC_VERSION, GRPC_GENERATED_VERSION)
except ImportError:
    _version_not_supported = True

if _version_not_supported:
    raise RuntimeError(
        f"The grpc package installed is at version {GRPC_VERSION},"
        + " but the generated code in generation_pb2_grpc.py depends on"
        + f" grpcio>={GRPC_GENERATED_VERSION}."
        + f" Please upgrade your grpc module to grpcio>={GRPC_GENERATED_VERSION}"
        + f" or downgrade your generated code using grpcio-tools<={GRPC_VERSION}."
    )


class GenerationServiceStub(object):
    """Missing associated documentation comment in .proto file."""

    def __init__(self, channel):  # type: ignore
        """Constructor.

        Args:
            channel: A grpc.Channel.
        """
        self.Generate = channel.unary_unary(
            "/fmaas.GenerationService/Generate",
            request_serializer=generation__pb2.BatchedGenerationRequest.SerializeToString,  # type: ignore
            response_deserializer=generation__pb2.BatchedGenerationResponse.FromString,  # type: ignore
            _registered_method=True,
        )
        self.GenerateStream = channel.unary_stream(
            "/fmaas.GenerationService/GenerateStream",
            request_serializer=generation__pb2.SingleGenerationRequest.SerializeToString,  # type: ignore
            response_deserializer=generation__pb2.GenerationResponse.FromString,  # type: ignore
            _registered_method=True,
        )
        self.Tokenize = channel.unary_unary(
            "/fmaas.GenerationService/Tokenize",
            request_serializer=generation__pb2.BatchedTokenizeRequest.SerializeToString,  # type: ignore
            response_deserializer=generation__pb2.BatchedTokenizeResponse.FromString,  # type: ignore
            _registered_method=True,
        )
        self.ModelInfo = channel.unary_unary(
            "/fmaas.GenerationService/ModelInfo",
            request_serializer=generation__pb2.ModelInfoRequest.SerializeToString,  # type: ignore
            response_deserializer=generation__pb2.ModelInfoResponse.FromString,  # type: ignore
            _registered_method=True,
        )


class GenerationServiceServicer(object):
    """Missing associated documentation comment in .proto file."""

    def Generate(self, request, context):  # type: ignore
        """Generates text given a text prompt, for one or more inputs"""
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details("Method not implemented!")
        raise NotImplementedError("Method not implemented!")

    def GenerateStream(self, request, context):  # type: ignore
        """Generates text given a single input prompt, streaming the response"""
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details("Method not implemented!")
        raise NotImplementedError("Method not implemented!")

    def Tokenize(self, request, context):  # type: ignore
        """Tokenize text"""
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details("Method not implemented!")
        raise NotImplementedError("Method not implemented!")

    def ModelInfo(self, request, context):  # type: ignore
        """Model info"""
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details("Method not implemented!")
        raise NotImplementedError("Method not implemented!")


def add_GenerationServiceServicer_to_server(servicer, server):  # type: ignore
    rpc_method_handlers = {
        "Generate": grpc.unary_unary_rpc_method_handler(
            servicer.Generate,
            request_deserializer=generation__pb2.BatchedGenerationRequest.FromString,  # type: ignore
            response_serializer=generation__pb2.BatchedGenerationResponse.SerializeToString,  # type: ignore
        ),
        "GenerateStream": grpc.unary_stream_rpc_method_handler(
            servicer.GenerateStream,
            request_deserializer=generation__pb2.SingleGenerationRequest.FromString,  # type: ignore
            response_serializer=generation__pb2.GenerationResponse.SerializeToString,  # type: ignore
        ),
        "Tokenize": grpc.unary_unary_rpc_method_handler(
            servicer.Tokenize,
            request_deserializer=generation__pb2.BatchedTokenizeRequest.FromString,  # type: ignore
            response_serializer=generation__pb2.BatchedTokenizeResponse.SerializeToString,  # type: ignore
        ),
        "ModelInfo": grpc.unary_unary_rpc_method_handler(
            servicer.ModelInfo,
            request_deserializer=generation__pb2.ModelInfoRequest.FromString,  # type: ignore
            response_serializer=generation__pb2.ModelInfoResponse.SerializeToString,  # type: ignore
        ),
    }
    generic_handler = grpc.method_handlers_generic_handler("fmaas.GenerationService", rpc_method_handlers)
    server.add_generic_rpc_handlers((generic_handler,))
    server.add_registered_method_handlers("fmaas.GenerationService", rpc_method_handlers)


# This class is part of an EXPERIMENTAL API.
class GenerationService(object):
    """Missing associated documentation comment in .proto file."""

    @staticmethod
    def Generate(  # type: ignore
        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,
            "/fmaas.GenerationService/Generate",
            generation__pb2.BatchedGenerationRequest.SerializeToString,  # type: ignore
            generation__pb2.BatchedGenerationResponse.FromString,  # type: ignore
            options,
            channel_credentials,
            insecure,
            call_credentials,
            compression,
            wait_for_ready,
            timeout,
            metadata,
            _registered_method=True,
        )

    @staticmethod
    def GenerateStream(  # type: ignore
        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,
            "/fmaas.GenerationService/GenerateStream",
            generation__pb2.SingleGenerationRequest.SerializeToString,  # type: ignore
            generation__pb2.GenerationResponse.FromString,  # type: ignore
            options,
            channel_credentials,
            insecure,
            call_credentials,
            compression,
            wait_for_ready,
            timeout,
            metadata,
            _registered_method=True,
        )

    @staticmethod
    def Tokenize(  # type: ignore
        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,
            "/fmaas.GenerationService/Tokenize",
            generation__pb2.BatchedTokenizeRequest.SerializeToString,  # type: ignore
            generation__pb2.BatchedTokenizeResponse.FromString,  # type: ignore
            options,
            channel_credentials,
            insecure,
            call_credentials,
            compression,
            wait_for_ready,
            timeout,
            metadata,
            _registered_method=True,
        )

    @staticmethod
    def ModelInfo(  # type: ignore
        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,
            "/fmaas.GenerationService/ModelInfo",
            generation__pb2.ModelInfoRequest.SerializeToString,  # type: ignore
            generation__pb2.ModelInfoResponse.FromString,  # type: ignore
            options,
            channel_credentials,
            insecure,
            call_credentials,
            compression,
            wait_for_ready,
            timeout,
            metadata,
            _registered_method=True,
        )
