code: def call_vllm(input_tokens, max_new_tokens, stream=True):
      api_url = "http://localhost:26500/generate"
      headers = {"User-Agent": "Benchmark Client"}
      pload = {
          "prompt": input_tokens,
          "n": 1,
          "use_beam_search": False,
          "temperature": 1.0,
          "top_p": 0.9,
          "max_tokens": max_new_tokens,
          "ignore_eos": False,
          "stream": stream,
      }
  
      def clear_line(n: int = 1) -> None:
          LINE_UP = "\033[1A"
          LINE_CLEAR = "\x1b[2K"
          for _ in range(n):
              print(LINE_UP, end=LINE_CLEAR, flush=True)
  
      def get_streaming_response(
          response: requests.Response, time_last_token
      ) -> Iterable[List[str]]:
          for chunk in response.iter_lines(
              chunk_size=8192, decode_unicode=False, delimiter=b"\0"
          ):
              if chunk:
                  data = json.loads(chunk.decode("utf-8"))
                  output = data["text"][0]
                  time_now = time.time()
                  yield output, time_now - time_last_token
                  time_last_token = time_now
  
      def get_response(response: requests.Response) -> List[str]:
          data = json.loads(response.content)
          output = data["text"]
          return output
  
      start_time = time.time()
      response = requests.post(
          api_url, headers=headers, json=pload, stream=stream
      )
      if stream:
          token_gen_time = []
          for h, t in get_streaming_response(response, start_time):
              output = h
              token_gen_time.append(t)
  
          return ResponseDetails(
              generated_tokens=output,
              prompt=input_tokens,
              start_time=start_time,
              end_time=time.time(),
              model_time=0,
              token_gen_time=token_gen_time,
          )
      else:
          output = get_response(response)
          raise NotImplementedError("Not implemented for non-streaming")
  
imports: import os
  import time
  import random
  import argparse
  import queue
  import multiprocessing
  import threading
  from statistics import mean
  from dataclasses import dataclass, asdict
  from typing import List, Iterable
  from pathlib import Path
  from datetime import datetime
  import numpy
  from transformers import AutoTokenizer
  from random_query_generator import RandomQueryGenerator
  from sample_input import all_text
  import time
  import json
  import asyncio
  import requests
  from postprocess_results import get_summary, ResponseDetails
label_desc: Use image node_id 3 for calling a global function with example usage: call_vllm(input_tokens, max_new_tokens, stream) and returns: output, ResponseDetails