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

import grpc
import warnings

from . import inference_pb2 as inference__pb2

GRPC_GENERATED_VERSION = "1.78.0"
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 inference_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 InferenceStub(object):
    """Inference service provides cluster inference configuration and bundle delivery."""

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

        Args:
            channel: A grpc.Channel.
        """
        self.GetInferenceBundle = channel.unary_unary(
            "/openshell.inference.v1.Inference/GetInferenceBundle",
            request_serializer=inference__pb2.GetInferenceBundleRequest.SerializeToString,
            response_deserializer=inference__pb2.GetInferenceBundleResponse.FromString,
            _registered_method=True,
        )
        self.SetClusterInference = channel.unary_unary(
            "/openshell.inference.v1.Inference/SetClusterInference",
            request_serializer=inference__pb2.SetClusterInferenceRequest.SerializeToString,
            response_deserializer=inference__pb2.SetClusterInferenceResponse.FromString,
            _registered_method=True,
        )
        self.GetClusterInference = channel.unary_unary(
            "/openshell.inference.v1.Inference/GetClusterInference",
            request_serializer=inference__pb2.GetClusterInferenceRequest.SerializeToString,
            response_deserializer=inference__pb2.GetClusterInferenceResponse.FromString,
            _registered_method=True,
        )


class InferenceServicer(object):
    """Inference service provides cluster inference configuration and bundle delivery."""

    def GetInferenceBundle(self, request, context):
        """Return the resolved inference route bundle for sandbox-local execution."""
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details("Method not implemented!")
        raise NotImplementedError("Method not implemented!")

    def SetClusterInference(self, request, context):
        """Set cluster-level inference configuration.

        This controls how requests sent to `inference.local` are routed.
        """
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details("Method not implemented!")
        raise NotImplementedError("Method not implemented!")

    def GetClusterInference(self, request, context):
        """Get cluster-level inference configuration."""
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details("Method not implemented!")
        raise NotImplementedError("Method not implemented!")


def add_InferenceServicer_to_server(servicer, server):
    rpc_method_handlers = {
        "GetInferenceBundle": grpc.unary_unary_rpc_method_handler(
            servicer.GetInferenceBundle,
            request_deserializer=inference__pb2.GetInferenceBundleRequest.FromString,
            response_serializer=inference__pb2.GetInferenceBundleResponse.SerializeToString,
        ),
        "SetClusterInference": grpc.unary_unary_rpc_method_handler(
            servicer.SetClusterInference,
            request_deserializer=inference__pb2.SetClusterInferenceRequest.FromString,
            response_serializer=inference__pb2.SetClusterInferenceResponse.SerializeToString,
        ),
        "GetClusterInference": grpc.unary_unary_rpc_method_handler(
            servicer.GetClusterInference,
            request_deserializer=inference__pb2.GetClusterInferenceRequest.FromString,
            response_serializer=inference__pb2.GetClusterInferenceResponse.SerializeToString,
        ),
    }
    generic_handler = grpc.method_handlers_generic_handler(
        "openshell.inference.v1.Inference", rpc_method_handlers
    )
    server.add_generic_rpc_handlers((generic_handler,))
    server.add_registered_method_handlers("openshell.inference.v1.Inference", rpc_method_handlers)


# This class is part of an EXPERIMENTAL API.
class Inference(object):
    """Inference service provides cluster inference configuration and bundle delivery."""

    @staticmethod
    def GetInferenceBundle(
        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,
            "/openshell.inference.v1.Inference/GetInferenceBundle",
            inference__pb2.GetInferenceBundleRequest.SerializeToString,
            inference__pb2.GetInferenceBundleResponse.FromString,
            options,
            channel_credentials,
            insecure,
            call_credentials,
            compression,
            wait_for_ready,
            timeout,
            metadata,
            _registered_method=True,
        )

    @staticmethod
    def SetClusterInference(
        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,
            "/openshell.inference.v1.Inference/SetClusterInference",
            inference__pb2.SetClusterInferenceRequest.SerializeToString,
            inference__pb2.SetClusterInferenceResponse.FromString,
            options,
            channel_credentials,
            insecure,
            call_credentials,
            compression,
            wait_for_ready,
            timeout,
            metadata,
            _registered_method=True,
        )

    @staticmethod
    def GetClusterInference(
        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,
            "/openshell.inference.v1.Inference/GetClusterInference",
            inference__pb2.GetClusterInferenceRequest.SerializeToString,
            inference__pb2.GetClusterInferenceResponse.FromString,
            options,
            channel_credentials,
            insecure,
            call_credentials,
            compression,
            wait_for_ready,
            timeout,
            metadata,
            _registered_method=True,
        )
