code: def to_pb(self) -> generate_pb2.Generation:
      return generate_pb2.Generation(
          request_id=self.request_id,
          prefill_tokens=self.prefill_tokens.to_pb()
          if self.prefill_tokens is not None
          else None,
          tokens=self.tokens.to_pb(),
          generated_text=self.generated_text.to_pb()
          if self.generated_text is not None
          else None,
          top_tokens=self.top_tokens.to_pb()
          if self.top_tokens is not None
          else None,
      )
  
imports: from functools import total_ordering
  import torch
  from abc import ABC, abstractmethod
  from dataclasses import dataclass
  from typing import List, Optional
  from transformers import PreTrainedTokenizerBase
  from text_generation_server.pb import generate_pb2
  from text_generation_server.pb.generate_pb2 import FinishReason
label_desc: Use image node_id 1 for calling the Generation obj's underlying member method code with example usage: obj.to_pb() and returns: generate_pb2