// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
// versions:
// - protoc-gen-go-grpc v1.6.1
// - protoc             v3.21.12
// source: yandex/cloud/ai/llm/v1alpha/llm_service.proto

package llm

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_Instruct_FullMethodName = "/yandex.cloud.ai.llm.v1alpha.TextGenerationService/Instruct"
	TextGenerationService_Chat_FullMethodName     = "/yandex.cloud.ai.llm.v1alpha.TextGenerationService/Chat"
)

// 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 and conversation.
type TextGenerationServiceClient interface {
	// RPC method for instructing the model to generate text.
	Instruct(ctx context.Context, in *InstructRequest, opts ...grpc.CallOption) (grpc.ServerStreamingClient[InstructResponse], error)
	// RPC method for engaging in a chat conversation with the model.
	Chat(ctx context.Context, in *ChatRequest, opts ...grpc.CallOption) (grpc.ServerStreamingClient[ChatResponse], error)
}

type textGenerationServiceClient struct {
	cc grpc.ClientConnInterface
}

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

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

func (c *textGenerationServiceClient) Chat(ctx context.Context, in *ChatRequest, opts ...grpc.CallOption) (grpc.ServerStreamingClient[ChatResponse], error) {
	cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
	stream, err := c.cc.NewStream(ctx, &TextGenerationService_ServiceDesc.Streams[1], TextGenerationService_Chat_FullMethodName, cOpts...)
	if err != nil {
		return nil, err
	}
	x := &grpc.GenericClientStream[ChatRequest, ChatResponse]{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_ChatClient = grpc.ServerStreamingClient[ChatResponse]

// TextGenerationServiceServer is the server API for TextGenerationService service.
// All implementations should embed UnimplementedTextGenerationServiceServer
// for forward compatibility.
//
// Service for text generation and conversation.
type TextGenerationServiceServer interface {
	// RPC method for instructing the model to generate text.
	Instruct(*InstructRequest, grpc.ServerStreamingServer[InstructResponse]) error
	// RPC method for engaging in a chat conversation with the model.
	Chat(*ChatRequest, grpc.ServerStreamingServer[ChatResponse]) 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) Instruct(*InstructRequest, grpc.ServerStreamingServer[InstructResponse]) error {
	return status.Error(codes.Unimplemented, "method Instruct not implemented")
}
func (UnimplementedTextGenerationServiceServer) Chat(*ChatRequest, grpc.ServerStreamingServer[ChatResponse]) error {
	return status.Error(codes.Unimplemented, "method Chat 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 panics, 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_Instruct_Handler(srv interface{}, stream grpc.ServerStream) error {
	m := new(InstructRequest)
	if err := stream.RecvMsg(m); err != nil {
		return err
	}
	return srv.(TextGenerationServiceServer).Instruct(m, &grpc.GenericServerStream[InstructRequest, InstructResponse]{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_InstructServer = grpc.ServerStreamingServer[InstructResponse]

func _TextGenerationService_Chat_Handler(srv interface{}, stream grpc.ServerStream) error {
	m := new(ChatRequest)
	if err := stream.RecvMsg(m); err != nil {
		return err
	}
	return srv.(TextGenerationServiceServer).Chat(m, &grpc.GenericServerStream[ChatRequest, ChatResponse]{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_ChatServer = grpc.ServerStreamingServer[ChatResponse]

// 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.llm.v1alpha.TextGenerationService",
	HandlerType: (*TextGenerationServiceServer)(nil),
	Methods:     []grpc.MethodDesc{},
	Streams: []grpc.StreamDesc{
		{
			StreamName:    "Instruct",
			Handler:       _TextGenerationService_Instruct_Handler,
			ServerStreams: true,
		},
		{
			StreamName:    "Chat",
			Handler:       _TextGenerationService_Chat_Handler,
			ServerStreams: true,
		},
	},
	Metadata: "yandex/cloud/ai/llm/v1alpha/llm_service.proto",
}

const (
	TokenizerService_Tokenize_FullMethodName = "/yandex.cloud.ai.llm.v1alpha.TokenizerService/Tokenize"
)

// 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 text.
type TokenizerServiceClient interface {
	// RPC method for tokenizing input text.
	Tokenize(ctx context.Context, in *TokenizeRequest, 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
}

// TokenizerServiceServer is the server API for TokenizerService service.
// All implementations should embed UnimplementedTokenizerServiceServer
// for forward compatibility.
//
// Service for tokenizing input text.
type TokenizerServiceServer interface {
	// RPC method for tokenizing input text.
	Tokenize(context.Context, *TokenizeRequest) (*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.Error(codes.Unimplemented, "method Tokenize 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 panics, 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)
}

// 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.llm.v1alpha.TokenizerService",
	HandlerType: (*TokenizerServiceServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "Tokenize",
			Handler:    _TokenizerService_Tokenize_Handler,
		},
	},
	Streams:  []grpc.StreamDesc{},
	Metadata: "yandex/cloud/ai/llm/v1alpha/llm_service.proto",
}

const (
	EmbeddingsService_Embedding_FullMethodName = "/yandex.cloud.ai.llm.v1alpha.EmbeddingsService/Embedding"
)

// EmbeddingsServiceClient is the client API for EmbeddingsService 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 obtaining embeddings for text data.
type EmbeddingsServiceClient interface {
	// RPC method to obtain embeddings for input text data.
	Embedding(ctx context.Context, in *EmbeddingRequest, opts ...grpc.CallOption) (*EmbeddingResponse, error)
}

type embeddingsServiceClient struct {
	cc grpc.ClientConnInterface
}

func NewEmbeddingsServiceClient(cc grpc.ClientConnInterface) EmbeddingsServiceClient {
	return &embeddingsServiceClient{cc}
}

func (c *embeddingsServiceClient) Embedding(ctx context.Context, in *EmbeddingRequest, opts ...grpc.CallOption) (*EmbeddingResponse, error) {
	cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
	out := new(EmbeddingResponse)
	err := c.cc.Invoke(ctx, EmbeddingsService_Embedding_FullMethodName, in, out, cOpts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

// EmbeddingsServiceServer is the server API for EmbeddingsService service.
// All implementations should embed UnimplementedEmbeddingsServiceServer
// for forward compatibility.
//
// Service for obtaining embeddings for text data.
type EmbeddingsServiceServer interface {
	// RPC method to obtain embeddings for input text data.
	Embedding(context.Context, *EmbeddingRequest) (*EmbeddingResponse, error)
}

// UnimplementedEmbeddingsServiceServer 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 UnimplementedEmbeddingsServiceServer struct{}

func (UnimplementedEmbeddingsServiceServer) Embedding(context.Context, *EmbeddingRequest) (*EmbeddingResponse, error) {
	return nil, status.Error(codes.Unimplemented, "method Embedding not implemented")
}
func (UnimplementedEmbeddingsServiceServer) testEmbeddedByValue() {}

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

func RegisterEmbeddingsServiceServer(s grpc.ServiceRegistrar, srv EmbeddingsServiceServer) {
	// If the following call panics, it indicates UnimplementedEmbeddingsServiceServer 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(&EmbeddingsService_ServiceDesc, srv)
}

func _EmbeddingsService_Embedding_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
	in := new(EmbeddingRequest)
	if err := dec(in); err != nil {
		return nil, err
	}
	if interceptor == nil {
		return srv.(EmbeddingsServiceServer).Embedding(ctx, in)
	}
	info := &grpc.UnaryServerInfo{
		Server:     srv,
		FullMethod: EmbeddingsService_Embedding_FullMethodName,
	}
	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
		return srv.(EmbeddingsServiceServer).Embedding(ctx, req.(*EmbeddingRequest))
	}
	return interceptor(ctx, in, info, handler)
}

// EmbeddingsService_ServiceDesc is the grpc.ServiceDesc for EmbeddingsService service.
// It's only intended for direct use with grpc.RegisterService,
// and not to be introspected or modified (even as a copy)
var EmbeddingsService_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "yandex.cloud.ai.llm.v1alpha.EmbeddingsService",
	HandlerType: (*EmbeddingsServiceServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "Embedding",
			Handler:    _EmbeddingsService_Embedding_Handler,
		},
	},
	Streams:  []grpc.StreamDesc{},
	Metadata: "yandex/cloud/ai/llm/v1alpha/llm_service.proto",
}

const (
	TextGenerationAsyncService_Instruct_FullMethodName = "/yandex.cloud.ai.llm.v1alpha.TextGenerationAsyncService/Instruct"
)

// 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 {
	// RPC method for instructing the model to generate text.
	Instruct(ctx context.Context, in *InstructRequest, opts ...grpc.CallOption) (*operation.Operation, error)
}

type textGenerationAsyncServiceClient struct {
	cc grpc.ClientConnInterface
}

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

func (c *textGenerationAsyncServiceClient) Instruct(ctx context.Context, in *InstructRequest, opts ...grpc.CallOption) (*operation.Operation, error) {
	cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
	out := new(operation.Operation)
	err := c.cc.Invoke(ctx, TextGenerationAsyncService_Instruct_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 {
	// RPC method for instructing the model to generate text.
	Instruct(context.Context, *InstructRequest) (*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) Instruct(context.Context, *InstructRequest) (*operation.Operation, error) {
	return nil, status.Error(codes.Unimplemented, "method Instruct 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 panics, 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_Instruct_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
	in := new(InstructRequest)
	if err := dec(in); err != nil {
		return nil, err
	}
	if interceptor == nil {
		return srv.(TextGenerationAsyncServiceServer).Instruct(ctx, in)
	}
	info := &grpc.UnaryServerInfo{
		Server:     srv,
		FullMethod: TextGenerationAsyncService_Instruct_FullMethodName,
	}
	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
		return srv.(TextGenerationAsyncServiceServer).Instruct(ctx, req.(*InstructRequest))
	}
	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.llm.v1alpha.TextGenerationAsyncService",
	HandlerType: (*TextGenerationAsyncServiceServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "Instruct",
			Handler:    _TextGenerationAsyncService_Instruct_Handler,
		},
	},
	Streams:  []grpc.StreamDesc{},
	Metadata: "yandex/cloud/ai/llm/v1alpha/llm_service.proto",
}
