class_docstr: Custom Handler for integrating vLLM
class_docstr_tok: ["Custom","Handler","for","integrating","vLLM"]
docstr: Pre-processing of prompts being sent to TorchServe
  Args:
      requests (list): A list of dictionaries with a "data" or "body" field, each
                      containing the input text to be processed.
  Returns:
      tuple: A tuple with two tensors: the batch of input ids and the batch of
          attention masks.
docstr_tok: ["Pre-processing","of","prompts","being","sent","to","TorchServe","Args",":","requests","(","list",")",":","A","list","of","dictionaries","with","a","``","data","''","or","``","body","''","field",",","each","containing","the","input","text","to","be","processed",".","Returns",":","tuple",":","A","tuple","with","two","tensors",":","the","batch","of","input","ids","and","the","batch","of","attention","masks","."]
code: def preprocess(self, requests):
      """
      Pre-processing of prompts being sent to TorchServe
      Args:
          requests (list): A list of dictionaries with a "data" or "body" field, each
                          containing the input text to be processed.
      Returns:
          tuple: A tuple with two tensors: the batch of input ids and the batch of
              attention masks.
      """
      input_texts = [
          data.get("data") or data.get("body") for data in requests
      ]
      input_texts = [
          input_text.decode("utf-8")
          if isinstance(input_text, (bytes, bytearray))
          else input_text
          for input_text in input_texts
      ]
      return input_texts
  
file_path: serve/examples/large_models/vllm/mistral/custom_handler.py
imports: import logging
  import torch
  import vllm
  from vllm import LLM, SamplingParams
  from ts.context import Context
  from ts.torch_handler.base_handler import BaseHandler
label_desc: Use image node_id 3 for calling the CustomHandler obj's underlying member method code with example usage: obj.preprocess(requests) and returns: input_texts