cloud.google.com/go/aiplatform@v1.106.0/apiv1/aiplatformpb/llm_utility_service_grpc.pb.go (about)

     1  // Copyright 2025 Google LLC
     2  //
     3  // Licensed under the Apache License, Version 2.0 (the "License");
     4  // you may not use this file except in compliance with the License.
     5  // You may obtain a copy of the License at
     6  //
     7  //     http://www.apache.org/licenses/LICENSE-2.0
     8  //
     9  // Unless required by applicable law or agreed to in writing, software
    10  // distributed under the License is distributed on an "AS IS" BASIS,
    11  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    12  // See the License for the specific language governing permissions and
    13  // limitations under the License.
    14  
    15  // Code generated by protoc-gen-go-grpc. DO NOT EDIT.
    16  // versions:
    17  // - protoc-gen-go-grpc v1.3.0
    18  // - protoc             v4.25.7
    19  // source: google/cloud/aiplatform/v1/llm_utility_service.proto
    20  
    21  package aiplatformpb
    22  
    23  import (
    24  	context "context"
    25  	grpc "google.golang.org/grpc"
    26  	codes "google.golang.org/grpc/codes"
    27  	status "google.golang.org/grpc/status"
    28  )
    29  
    30  // This is a compile-time assertion to ensure that this generated file
    31  // is compatible with the grpc package it is being compiled against.
    32  // Requires gRPC-Go v1.32.0 or later.
    33  const _ = grpc.SupportPackageIsVersion7
    34  
    35  const (
    36  	LlmUtilityService_CountTokens_FullMethodName   = "/google.cloud.aiplatform.v1.LlmUtilityService/CountTokens"
    37  	LlmUtilityService_ComputeTokens_FullMethodName = "/google.cloud.aiplatform.v1.LlmUtilityService/ComputeTokens"
    38  )
    39  
    40  // LlmUtilityServiceClient is the client API for LlmUtilityService service.
    41  //
    42  // 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.
    43  type LlmUtilityServiceClient interface {
    44  	// Perform a token counting.
    45  	CountTokens(ctx context.Context, in *CountTokensRequest, opts ...grpc.CallOption) (*CountTokensResponse, error)
    46  	// Return a list of tokens based on the input text.
    47  	ComputeTokens(ctx context.Context, in *ComputeTokensRequest, opts ...grpc.CallOption) (*ComputeTokensResponse, error)
    48  }
    49  
    50  type llmUtilityServiceClient struct {
    51  	cc grpc.ClientConnInterface
    52  }
    53  
    54  func NewLlmUtilityServiceClient(cc grpc.ClientConnInterface) LlmUtilityServiceClient {
    55  	return &llmUtilityServiceClient{cc}
    56  }
    57  
    58  func (c *llmUtilityServiceClient) CountTokens(ctx context.Context, in *CountTokensRequest, opts ...grpc.CallOption) (*CountTokensResponse, error) {
    59  	out := new(CountTokensResponse)
    60  	err := c.cc.Invoke(ctx, LlmUtilityService_CountTokens_FullMethodName, in, out, opts...)
    61  	if err != nil {
    62  		return nil, err
    63  	}
    64  	return out, nil
    65  }
    66  
    67  func (c *llmUtilityServiceClient) ComputeTokens(ctx context.Context, in *ComputeTokensRequest, opts ...grpc.CallOption) (*ComputeTokensResponse, error) {
    68  	out := new(ComputeTokensResponse)
    69  	err := c.cc.Invoke(ctx, LlmUtilityService_ComputeTokens_FullMethodName, in, out, opts...)
    70  	if err != nil {
    71  		return nil, err
    72  	}
    73  	return out, nil
    74  }
    75  
    76  // LlmUtilityServiceServer is the server API for LlmUtilityService service.
    77  // All implementations should embed UnimplementedLlmUtilityServiceServer
    78  // for forward compatibility
    79  type LlmUtilityServiceServer interface {
    80  	// Perform a token counting.
    81  	CountTokens(context.Context, *CountTokensRequest) (*CountTokensResponse, error)
    82  	// Return a list of tokens based on the input text.
    83  	ComputeTokens(context.Context, *ComputeTokensRequest) (*ComputeTokensResponse, error)
    84  }
    85  
    86  // UnimplementedLlmUtilityServiceServer should be embedded to have forward compatible implementations.
    87  type UnimplementedLlmUtilityServiceServer struct {
    88  }
    89  
    90  func (UnimplementedLlmUtilityServiceServer) CountTokens(context.Context, *CountTokensRequest) (*CountTokensResponse, error) {
    91  	return nil, status.Errorf(codes.Unimplemented, "method CountTokens not implemented")
    92  }
    93  func (UnimplementedLlmUtilityServiceServer) ComputeTokens(context.Context, *ComputeTokensRequest) (*ComputeTokensResponse, error) {
    94  	return nil, status.Errorf(codes.Unimplemented, "method ComputeTokens not implemented")
    95  }
    96  
    97  // UnsafeLlmUtilityServiceServer may be embedded to opt out of forward compatibility for this service.
    98  // Use of this interface is not recommended, as added methods to LlmUtilityServiceServer will
    99  // result in compilation errors.
   100  type UnsafeLlmUtilityServiceServer interface {
   101  	mustEmbedUnimplementedLlmUtilityServiceServer()
   102  }
   103  
   104  func RegisterLlmUtilityServiceServer(s grpc.ServiceRegistrar, srv LlmUtilityServiceServer) {
   105  	s.RegisterService(&LlmUtilityService_ServiceDesc, srv)
   106  }
   107  
   108  func _LlmUtilityService_CountTokens_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
   109  	in := new(CountTokensRequest)
   110  	if err := dec(in); err != nil {
   111  		return nil, err
   112  	}
   113  	if interceptor == nil {
   114  		return srv.(LlmUtilityServiceServer).CountTokens(ctx, in)
   115  	}
   116  	info := &grpc.UnaryServerInfo{
   117  		Server:     srv,
   118  		FullMethod: LlmUtilityService_CountTokens_FullMethodName,
   119  	}
   120  	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
   121  		return srv.(LlmUtilityServiceServer).CountTokens(ctx, req.(*CountTokensRequest))
   122  	}
   123  	return interceptor(ctx, in, info, handler)
   124  }
   125  
   126  func _LlmUtilityService_ComputeTokens_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
   127  	in := new(ComputeTokensRequest)
   128  	if err := dec(in); err != nil {
   129  		return nil, err
   130  	}
   131  	if interceptor == nil {
   132  		return srv.(LlmUtilityServiceServer).ComputeTokens(ctx, in)
   133  	}
   134  	info := &grpc.UnaryServerInfo{
   135  		Server:     srv,
   136  		FullMethod: LlmUtilityService_ComputeTokens_FullMethodName,
   137  	}
   138  	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
   139  		return srv.(LlmUtilityServiceServer).ComputeTokens(ctx, req.(*ComputeTokensRequest))
   140  	}
   141  	return interceptor(ctx, in, info, handler)
   142  }
   143  
   144  // LlmUtilityService_ServiceDesc is the grpc.ServiceDesc for LlmUtilityService service.
   145  // It's only intended for direct use with grpc.RegisterService,
   146  // and not to be introspected or modified (even as a copy)
   147  var LlmUtilityService_ServiceDesc = grpc.ServiceDesc{
   148  	ServiceName: "google.cloud.aiplatform.v1.LlmUtilityService",
   149  	HandlerType: (*LlmUtilityServiceServer)(nil),
   150  	Methods: []grpc.MethodDesc{
   151  		{
   152  			MethodName: "CountTokens",
   153  			Handler:    _LlmUtilityService_CountTokens_Handler,
   154  		},
   155  		{
   156  			MethodName: "ComputeTokens",
   157  			Handler:    _LlmUtilityService_ComputeTokens_Handler,
   158  		},
   159  	},
   160  	Streams:  []grpc.StreamDesc{},
   161  	Metadata: "google/cloud/aiplatform/v1/llm_utility_service.proto",
   162  }