// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
// versions:
// - protoc-gen-go-grpc v1.5.1
// - protoc             v3.21.12
// source: yandex/cloud/ai/foundation_models/v1/text_generation/text_generation_service.proto

package foundation_models

import (
	context "context"
	operation "github.com/yandex-cloud/go-genproto/yandex/cloud/operation"
	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.64.0 or later.
const _ = grpc.SupportPackageIsVersion9

const (
	TextGenerationService_Completion_FullMethodName = "/yandex.cloud.ai.foundation_models.v1.TextGenerationService/Completion"
)

// TextGenerationServiceClient is the client API for TextGenerationService 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.
//
// Service for text generation.
type TextGenerationServiceClient interface {
	// A method for generating text completions in [synchronous mode](/docs/foundation-models/concepts/#working-mode).
	Completion(ctx context.Context, in *CompletionRequest, opts ...grpc.CallOption) (grpc.ServerStreamingClient[CompletionResponse], error)
}

type textGenerationServiceClient struct {
	cc grpc.ClientConnInterface
}

func NewTextGenerationServiceClient(cc grpc.ClientConnInterface) TextGenerationServiceClient {
	return &textGenerationServiceClient{cc}
}

func (c *textGenerationServiceClient) Completion(ctx context.Context, in *CompletionRequest, opts ...grpc.CallOption) (grpc.ServerStreamingClient[CompletionResponse], error) {
	cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
	stream, err := c.cc.NewStream(ctx, &TextGenerationService_ServiceDesc.Streams[0], TextGenerationService_Completion_FullMethodName, cOpts...)
	if err != nil {
		return nil, err
	}
	x := &grpc.GenericClientStream[CompletionRequest, CompletionResponse]{ClientStream: 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
}

// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name.
type TextGenerationService_CompletionClient = grpc.ServerStreamingClient[CompletionResponse]

// TextGenerationServiceServer is the server API for TextGenerationService service.
// All implementations should embed UnimplementedTextGenerationServiceServer
// for forward compatibility.
//
// Service for text generation.
type TextGenerationServiceServer interface {
	// A method for generating text completions in [synchronous mode](/docs/foundation-models/concepts/#working-mode).
	Completion(*CompletionRequest, grpc.ServerStreamingServer[CompletionResponse]) error
}

// UnimplementedTextGenerationServiceServer should be embedded to have
// forward compatible implementations.
//
// NOTE: this should be embedded by value instead of pointer to avoid a nil
// pointer dereference when methods are called.
type UnimplementedTextGenerationServiceServer struct{}

func (UnimplementedTextGenerationServiceServer) Completion(*CompletionRequest, grpc.ServerStreamingServer[CompletionResponse]) error {
	return status.Errorf(codes.Unimplemented, "method Completion not implemented")
}
func (UnimplementedTextGenerationServiceServer) testEmbeddedByValue() {}

// UnsafeTextGenerationServiceServer may be embedded to opt out of forward compatibility for this service.
// Use of this interface is not recommended, as added methods to TextGenerationServiceServer will
// result in compilation errors.
type UnsafeTextGenerationServiceServer interface {
	mustEmbedUnimplementedTextGenerationServiceServer()
}

func RegisterTextGenerationServiceServer(s grpc.ServiceRegistrar, srv TextGenerationServiceServer) {
	// If the following call pancis, it indicates UnimplementedTextGenerationServiceServer was
	// embedded by pointer and is nil.  This will cause panics if an
	// unimplemented method is ever invoked, so we test this at initialization
	// time to prevent it from happening at runtime later due to I/O.
	if t, ok := srv.(interface{ testEmbeddedByValue() }); ok {
		t.testEmbeddedByValue()
	}
	s.RegisterService(&TextGenerationService_ServiceDesc, srv)
}

func _TextGenerationService_Completion_Handler(srv interface{}, stream grpc.ServerStream) error {
	m := new(CompletionRequest)
	if err := stream.RecvMsg(m); err != nil {
		return err
	}
	return srv.(TextGenerationServiceServer).Completion(m, &grpc.GenericServerStream[CompletionRequest, CompletionResponse]{ServerStream: stream})
}

// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name.
type TextGenerationService_CompletionServer = grpc.ServerStreamingServer[CompletionResponse]

// TextGenerationService_ServiceDesc is the grpc.ServiceDesc for TextGenerationService service.
// It's only intended for direct use with grpc.RegisterService,
// and not to be introspected or modified (even as a copy)
var TextGenerationService_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "yandex.cloud.ai.foundation_models.v1.TextGenerationService",
	HandlerType: (*TextGenerationServiceServer)(nil),
	Methods:     []grpc.MethodDesc{},
	Streams: []grpc.StreamDesc{
		{
			StreamName:    "Completion",
			Handler:       _TextGenerationService_Completion_Handler,
			ServerStreams: true,
		},
	},
	Metadata: "yandex/cloud/ai/foundation_models/v1/text_generation/text_generation_service.proto",
}

const (
	TextGenerationAsyncService_Completion_FullMethodName = "/yandex.cloud.ai.foundation_models.v1.TextGenerationAsyncService/Completion"
)

// TextGenerationAsyncServiceClient is the client API for TextGenerationAsyncService 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.
//
// Service for asynchronous text generation.
type TextGenerationAsyncServiceClient interface {
	// A method for generating text completions in [asynchronous mode](/docs/foundation-models/concepts/#working-mode).
	Completion(ctx context.Context, in *CompletionRequest, opts ...grpc.CallOption) (*operation.Operation, error)
}

type textGenerationAsyncServiceClient struct {
	cc grpc.ClientConnInterface
}

func NewTextGenerationAsyncServiceClient(cc grpc.ClientConnInterface) TextGenerationAsyncServiceClient {
	return &textGenerationAsyncServiceClient{cc}
}

func (c *textGenerationAsyncServiceClient) Completion(ctx context.Context, in *CompletionRequest, opts ...grpc.CallOption) (*operation.Operation, error) {
	cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
	out := new(operation.Operation)
	err := c.cc.Invoke(ctx, TextGenerationAsyncService_Completion_FullMethodName, in, out, cOpts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

// TextGenerationAsyncServiceServer is the server API for TextGenerationAsyncService service.
// All implementations should embed UnimplementedTextGenerationAsyncServiceServer
// for forward compatibility.
//
// Service for asynchronous text generation.
type TextGenerationAsyncServiceServer interface {
	// A method for generating text completions in [asynchronous mode](/docs/foundation-models/concepts/#working-mode).
	Completion(context.Context, *CompletionRequest) (*operation.Operation, error)
}

// UnimplementedTextGenerationAsyncServiceServer should be embedded to have
// forward compatible implementations.
//
// NOTE: this should be embedded by value instead of pointer to avoid a nil
// pointer dereference when methods are called.
type UnimplementedTextGenerationAsyncServiceServer struct{}

func (UnimplementedTextGenerationAsyncServiceServer) Completion(context.Context, *CompletionRequest) (*operation.Operation, error) {
	return nil, status.Errorf(codes.Unimplemented, "method Completion not implemented")
}
func (UnimplementedTextGenerationAsyncServiceServer) testEmbeddedByValue() {}

// UnsafeTextGenerationAsyncServiceServer may be embedded to opt out of forward compatibility for this service.
// Use of this interface is not recommended, as added methods to TextGenerationAsyncServiceServer will
// result in compilation errors.
type UnsafeTextGenerationAsyncServiceServer interface {
	mustEmbedUnimplementedTextGenerationAsyncServiceServer()
}

func RegisterTextGenerationAsyncServiceServer(s grpc.ServiceRegistrar, srv TextGenerationAsyncServiceServer) {
	// If the following call pancis, it indicates UnimplementedTextGenerationAsyncServiceServer was
	// embedded by pointer and is nil.  This will cause panics if an
	// unimplemented method is ever invoked, so we test this at initialization
	// time to prevent it from happening at runtime later due to I/O.
	if t, ok := srv.(interface{ testEmbeddedByValue() }); ok {
		t.testEmbeddedByValue()
	}
	s.RegisterService(&TextGenerationAsyncService_ServiceDesc, srv)
}

func _TextGenerationAsyncService_Completion_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
	in := new(CompletionRequest)
	if err := dec(in); err != nil {
		return nil, err
	}
	if interceptor == nil {
		return srv.(TextGenerationAsyncServiceServer).Completion(ctx, in)
	}
	info := &grpc.UnaryServerInfo{
		Server:     srv,
		FullMethod: TextGenerationAsyncService_Completion_FullMethodName,
	}
	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
		return srv.(TextGenerationAsyncServiceServer).Completion(ctx, req.(*CompletionRequest))
	}
	return interceptor(ctx, in, info, handler)
}

// TextGenerationAsyncService_ServiceDesc is the grpc.ServiceDesc for TextGenerationAsyncService service.
// It's only intended for direct use with grpc.RegisterService,
// and not to be introspected or modified (even as a copy)
var TextGenerationAsyncService_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "yandex.cloud.ai.foundation_models.v1.TextGenerationAsyncService",
	HandlerType: (*TextGenerationAsyncServiceServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "Completion",
			Handler:    _TextGenerationAsyncService_Completion_Handler,
		},
	},
	Streams:  []grpc.StreamDesc{},
	Metadata: "yandex/cloud/ai/foundation_models/v1/text_generation/text_generation_service.proto",
}

const (
	TokenizerService_Tokenize_FullMethodName           = "/yandex.cloud.ai.foundation_models.v1.TokenizerService/Tokenize"
	TokenizerService_TokenizeCompletion_FullMethodName = "/yandex.cloud.ai.foundation_models.v1.TokenizerService/TokenizeCompletion"
)

// TokenizerServiceClient is the client API for TokenizerService 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.
//
// Service for tokenizing input content.
type TokenizerServiceClient interface {
	// RPC method for tokenizing text.
	Tokenize(ctx context.Context, in *TokenizeRequest, opts ...grpc.CallOption) (*TokenizeResponse, error)
	// RPC method for tokenizing content of CompletionRequest
	TokenizeCompletion(ctx context.Context, in *CompletionRequest, opts ...grpc.CallOption) (*TokenizeResponse, error)
}

type tokenizerServiceClient struct {
	cc grpc.ClientConnInterface
}

func NewTokenizerServiceClient(cc grpc.ClientConnInterface) TokenizerServiceClient {
	return &tokenizerServiceClient{cc}
}

func (c *tokenizerServiceClient) Tokenize(ctx context.Context, in *TokenizeRequest, opts ...grpc.CallOption) (*TokenizeResponse, error) {
	cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
	out := new(TokenizeResponse)
	err := c.cc.Invoke(ctx, TokenizerService_Tokenize_FullMethodName, in, out, cOpts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

func (c *tokenizerServiceClient) TokenizeCompletion(ctx context.Context, in *CompletionRequest, opts ...grpc.CallOption) (*TokenizeResponse, error) {
	cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
	out := new(TokenizeResponse)
	err := c.cc.Invoke(ctx, TokenizerService_TokenizeCompletion_FullMethodName, in, out, cOpts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

// TokenizerServiceServer is the server API for TokenizerService service.
// All implementations should embed UnimplementedTokenizerServiceServer
// for forward compatibility.
//
// Service for tokenizing input content.
type TokenizerServiceServer interface {
	// RPC method for tokenizing text.
	Tokenize(context.Context, *TokenizeRequest) (*TokenizeResponse, error)
	// RPC method for tokenizing content of CompletionRequest
	TokenizeCompletion(context.Context, *CompletionRequest) (*TokenizeResponse, error)
}

// UnimplementedTokenizerServiceServer should be embedded to have
// forward compatible implementations.
//
// NOTE: this should be embedded by value instead of pointer to avoid a nil
// pointer dereference when methods are called.
type UnimplementedTokenizerServiceServer struct{}

func (UnimplementedTokenizerServiceServer) Tokenize(context.Context, *TokenizeRequest) (*TokenizeResponse, error) {
	return nil, status.Errorf(codes.Unimplemented, "method Tokenize not implemented")
}
func (UnimplementedTokenizerServiceServer) TokenizeCompletion(context.Context, *CompletionRequest) (*TokenizeResponse, error) {
	return nil, status.Errorf(codes.Unimplemented, "method TokenizeCompletion not implemented")
}
func (UnimplementedTokenizerServiceServer) testEmbeddedByValue() {}

// UnsafeTokenizerServiceServer may be embedded to opt out of forward compatibility for this service.
// Use of this interface is not recommended, as added methods to TokenizerServiceServer will
// result in compilation errors.
type UnsafeTokenizerServiceServer interface {
	mustEmbedUnimplementedTokenizerServiceServer()
}

func RegisterTokenizerServiceServer(s grpc.ServiceRegistrar, srv TokenizerServiceServer) {
	// If the following call pancis, it indicates UnimplementedTokenizerServiceServer was
	// embedded by pointer and is nil.  This will cause panics if an
	// unimplemented method is ever invoked, so we test this at initialization
	// time to prevent it from happening at runtime later due to I/O.
	if t, ok := srv.(interface{ testEmbeddedByValue() }); ok {
		t.testEmbeddedByValue()
	}
	s.RegisterService(&TokenizerService_ServiceDesc, srv)
}

func _TokenizerService_Tokenize_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
	in := new(TokenizeRequest)
	if err := dec(in); err != nil {
		return nil, err
	}
	if interceptor == nil {
		return srv.(TokenizerServiceServer).Tokenize(ctx, in)
	}
	info := &grpc.UnaryServerInfo{
		Server:     srv,
		FullMethod: TokenizerService_Tokenize_FullMethodName,
	}
	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
		return srv.(TokenizerServiceServer).Tokenize(ctx, req.(*TokenizeRequest))
	}
	return interceptor(ctx, in, info, handler)
}

func _TokenizerService_TokenizeCompletion_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
	in := new(CompletionRequest)
	if err := dec(in); err != nil {
		return nil, err
	}
	if interceptor == nil {
		return srv.(TokenizerServiceServer).TokenizeCompletion(ctx, in)
	}
	info := &grpc.UnaryServerInfo{
		Server:     srv,
		FullMethod: TokenizerService_TokenizeCompletion_FullMethodName,
	}
	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
		return srv.(TokenizerServiceServer).TokenizeCompletion(ctx, req.(*CompletionRequest))
	}
	return interceptor(ctx, in, info, handler)
}

// TokenizerService_ServiceDesc is the grpc.ServiceDesc for TokenizerService service.
// It's only intended for direct use with grpc.RegisterService,
// and not to be introspected or modified (even as a copy)
var TokenizerService_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "yandex.cloud.ai.foundation_models.v1.TokenizerService",
	HandlerType: (*TokenizerServiceServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "Tokenize",
			Handler:    _TokenizerService_Tokenize_Handler,
		},
		{
			MethodName: "TokenizeCompletion",
			Handler:    _TokenizerService_TokenizeCompletion_Handler,
		},
	},
	Streams:  []grpc.StreamDesc{},
	Metadata: "yandex/cloud/ai/foundation_models/v1/text_generation/text_generation_service.proto",
}
