code: def test_echo_stream_inference(model_name_and_stdout):
      model_name, _ = model_name_and_stdout
      responses = []
      data = [
          {
              "prompt": "The capital of France",
              "max_new_tokens": 5,
          },
          {
              "prompt": "Europe is",
              "max_new_tokens": 10,
          },
          {
              "prompt": "The US are",
              "max_new_tokens": 15,
          },
          {
              "prompt": "When travelling to NYC",
              "max_new_tokens": 5,
          },
      ]
      for d in data:
          res = requests.post(
              url=f"http://localhost:8080/predictions/{model_name}",
              data=json.dumps(d),
              stream=True,
          )
  
          responses.append(res)
      assert all(
          r.headers["Transfer-Encoding"] == "chunked" for r in responses
      )
  
      all_predictions = []
      for idx, d in enumerate(data):
          prediction = []
          for chunk in responses[idx].iter_content(chunk_size=None):
              if chunk:
                  prediction.append(chunk.decode("utf-8"))
  
          all_predictions.append(
              "".join(json.loads(p)["text"] for p in prediction)
          )
  
      assert (
          all_predictions[0] == "The capital of France, Paris, is home"
      )
      assert (
          all_predictions[1]
          == "Europe is a country of immigrants, and it is a country"
      )
      assert (
          all_predictions[2]
          == "The US are not going to be able to do that. They're going to have to"
      )
      assert (
          all_predictions[3] == "When travelling to NYC, I was able to"
      )
  
file_path: serve/test/pytest/test_continuous_batching.py
imports: import json
  import shutil
  from pathlib import Path
  from queue import Empty
  from unittest.mock import patch
  from zipfile import ZIP_STORED, ZipFile
  import pytest
  import requests
  import test_utils
  import torch
  from model_archiver import ModelArchiverConfig
  from test_data.streaming.stream_handler import StreamingHandler
  from ts.torch_handler.unit_tests.test_utils.mock_context import MockContext
label_desc: Use image node_id 5 for calling a global function with example usage: test_echo_stream_inference(model_name_and_stdout) without return types