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

from yandex.cloud.ai.foundation_models.v1.text_generation import text_generation_service_pb2 as yandex_dot_cloud_dot_ai_dot_foundation__models_dot_v1_dot_text__generation_dot_text__generation__service__pb2
from yandex.cloud.operation import operation_pb2 as yandex_dot_cloud_dot_operation_dot_operation__pb2


class TextGenerationServiceStub(object):
    """Service for text generation.
    """

    def __init__(self, channel):
        """Constructor.

        Args:
            channel: A grpc.Channel.
        """
        self.Completion = channel.unary_stream(
                '/yandex.cloud.ai.foundation_models.v1.TextGenerationService/Completion',
                request_serializer=yandex_dot_cloud_dot_ai_dot_foundation__models_dot_v1_dot_text__generation_dot_text__generation__service__pb2.CompletionRequest.SerializeToString,
                response_deserializer=yandex_dot_cloud_dot_ai_dot_foundation__models_dot_v1_dot_text__generation_dot_text__generation__service__pb2.CompletionResponse.FromString,
                )


class TextGenerationServiceServicer(object):
    """Service for text generation.
    """

    def Completion(self, request, context):
        """A method for generating text completions in [synchronous mode](/docs/foundation-models/concepts/#working-mode).
        """
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')


def add_TextGenerationServiceServicer_to_server(servicer, server):
    rpc_method_handlers = {
            'Completion': grpc.unary_stream_rpc_method_handler(
                    servicer.Completion,
                    request_deserializer=yandex_dot_cloud_dot_ai_dot_foundation__models_dot_v1_dot_text__generation_dot_text__generation__service__pb2.CompletionRequest.FromString,
                    response_serializer=yandex_dot_cloud_dot_ai_dot_foundation__models_dot_v1_dot_text__generation_dot_text__generation__service__pb2.CompletionResponse.SerializeToString,
            ),
    }
    generic_handler = grpc.method_handlers_generic_handler(
            'yandex.cloud.ai.foundation_models.v1.TextGenerationService', rpc_method_handlers)
    server.add_generic_rpc_handlers((generic_handler,))


 # This class is part of an EXPERIMENTAL API.
class TextGenerationService(object):
    """Service for text generation.
    """

    @staticmethod
    def Completion(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, '/yandex.cloud.ai.foundation_models.v1.TextGenerationService/Completion',
            yandex_dot_cloud_dot_ai_dot_foundation__models_dot_v1_dot_text__generation_dot_text__generation__service__pb2.CompletionRequest.SerializeToString,
            yandex_dot_cloud_dot_ai_dot_foundation__models_dot_v1_dot_text__generation_dot_text__generation__service__pb2.CompletionResponse.FromString,
            options, channel_credentials,
            insecure, call_credentials, compression, wait_for_ready, timeout, metadata)


class TextGenerationAsyncServiceStub(object):
    """Service for asynchronous text generation.
    """

    def __init__(self, channel):
        """Constructor.

        Args:
            channel: A grpc.Channel.
        """
        self.Completion = channel.unary_unary(
                '/yandex.cloud.ai.foundation_models.v1.TextGenerationAsyncService/Completion',
                request_serializer=yandex_dot_cloud_dot_ai_dot_foundation__models_dot_v1_dot_text__generation_dot_text__generation__service__pb2.CompletionRequest.SerializeToString,
                response_deserializer=yandex_dot_cloud_dot_operation_dot_operation__pb2.Operation.FromString,
                )


class TextGenerationAsyncServiceServicer(object):
    """Service for asynchronous text generation.
    """

    def Completion(self, request, context):
        """A method for generating text completions in [asynchronous mode](/docs/foundation-models/concepts/#working-mode).
        """
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')


def add_TextGenerationAsyncServiceServicer_to_server(servicer, server):
    rpc_method_handlers = {
            'Completion': grpc.unary_unary_rpc_method_handler(
                    servicer.Completion,
                    request_deserializer=yandex_dot_cloud_dot_ai_dot_foundation__models_dot_v1_dot_text__generation_dot_text__generation__service__pb2.CompletionRequest.FromString,
                    response_serializer=yandex_dot_cloud_dot_operation_dot_operation__pb2.Operation.SerializeToString,
            ),
    }
    generic_handler = grpc.method_handlers_generic_handler(
            'yandex.cloud.ai.foundation_models.v1.TextGenerationAsyncService', rpc_method_handlers)
    server.add_generic_rpc_handlers((generic_handler,))


 # This class is part of an EXPERIMENTAL API.
class TextGenerationAsyncService(object):
    """Service for asynchronous text generation.
    """

    @staticmethod
    def Completion(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, '/yandex.cloud.ai.foundation_models.v1.TextGenerationAsyncService/Completion',
            yandex_dot_cloud_dot_ai_dot_foundation__models_dot_v1_dot_text__generation_dot_text__generation__service__pb2.CompletionRequest.SerializeToString,
            yandex_dot_cloud_dot_operation_dot_operation__pb2.Operation.FromString,
            options, channel_credentials,
            insecure, call_credentials, compression, wait_for_ready, timeout, metadata)


class TokenizerServiceStub(object):
    """Service for tokenizing input content.
    """

    def __init__(self, channel):
        """Constructor.

        Args:
            channel: A grpc.Channel.
        """
        self.Tokenize = channel.unary_unary(
                '/yandex.cloud.ai.foundation_models.v1.TokenizerService/Tokenize',
                request_serializer=yandex_dot_cloud_dot_ai_dot_foundation__models_dot_v1_dot_text__generation_dot_text__generation__service__pb2.TokenizeRequest.SerializeToString,
                response_deserializer=yandex_dot_cloud_dot_ai_dot_foundation__models_dot_v1_dot_text__generation_dot_text__generation__service__pb2.TokenizeResponse.FromString,
                )
        self.TokenizeCompletion = channel.unary_unary(
                '/yandex.cloud.ai.foundation_models.v1.TokenizerService/TokenizeCompletion',
                request_serializer=yandex_dot_cloud_dot_ai_dot_foundation__models_dot_v1_dot_text__generation_dot_text__generation__service__pb2.CompletionRequest.SerializeToString,
                response_deserializer=yandex_dot_cloud_dot_ai_dot_foundation__models_dot_v1_dot_text__generation_dot_text__generation__service__pb2.TokenizeResponse.FromString,
                )


class TokenizerServiceServicer(object):
    """Service for tokenizing input content.
    """

    def Tokenize(self, request, context):
        """RPC method for tokenizing text.
        """
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')

    def TokenizeCompletion(self, request, context):
        """RPC method for tokenizing content of CompletionRequest
        """
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')


def add_TokenizerServiceServicer_to_server(servicer, server):
    rpc_method_handlers = {
            'Tokenize': grpc.unary_unary_rpc_method_handler(
                    servicer.Tokenize,
                    request_deserializer=yandex_dot_cloud_dot_ai_dot_foundation__models_dot_v1_dot_text__generation_dot_text__generation__service__pb2.TokenizeRequest.FromString,
                    response_serializer=yandex_dot_cloud_dot_ai_dot_foundation__models_dot_v1_dot_text__generation_dot_text__generation__service__pb2.TokenizeResponse.SerializeToString,
            ),
            'TokenizeCompletion': grpc.unary_unary_rpc_method_handler(
                    servicer.TokenizeCompletion,
                    request_deserializer=yandex_dot_cloud_dot_ai_dot_foundation__models_dot_v1_dot_text__generation_dot_text__generation__service__pb2.CompletionRequest.FromString,
                    response_serializer=yandex_dot_cloud_dot_ai_dot_foundation__models_dot_v1_dot_text__generation_dot_text__generation__service__pb2.TokenizeResponse.SerializeToString,
            ),
    }
    generic_handler = grpc.method_handlers_generic_handler(
            'yandex.cloud.ai.foundation_models.v1.TokenizerService', rpc_method_handlers)
    server.add_generic_rpc_handlers((generic_handler,))


 # This class is part of an EXPERIMENTAL API.
class TokenizerService(object):
    """Service for tokenizing input content.
    """

    @staticmethod
    def Tokenize(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, '/yandex.cloud.ai.foundation_models.v1.TokenizerService/Tokenize',
            yandex_dot_cloud_dot_ai_dot_foundation__models_dot_v1_dot_text__generation_dot_text__generation__service__pb2.TokenizeRequest.SerializeToString,
            yandex_dot_cloud_dot_ai_dot_foundation__models_dot_v1_dot_text__generation_dot_text__generation__service__pb2.TokenizeResponse.FromString,
            options, channel_credentials,
            insecure, call_credentials, compression, wait_for_ready, timeout, metadata)

    @staticmethod
    def TokenizeCompletion(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, '/yandex.cloud.ai.foundation_models.v1.TokenizerService/TokenizeCompletion',
            yandex_dot_cloud_dot_ai_dot_foundation__models_dot_v1_dot_text__generation_dot_text__generation__service__pb2.CompletionRequest.SerializeToString,
            yandex_dot_cloud_dot_ai_dot_foundation__models_dot_v1_dot_text__generation_dot_text__generation__service__pb2.TokenizeResponse.FromString,
            options, channel_credentials,
            insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
