code: def test_compose_deployments_in_app(serve_instance):
      """Test composing deployment handle refs within a deployment."""
  
      @serve.deployment
      class Downstream:
          def __init__(self, msg: str):
              self._msg = msg
  
          def __call__(self, inp: str):
              return f"{self._msg}|{inp}"
  
      @serve.deployment
      class Deployment:
          def __init__(
              self, handle1: RayServeHandle, handle2: RayServeHandle
          ):
              self._handle1 = handle1.options(use_new_handle_api=True)
              self._handle2 = handle2.options(use_new_handle_api=True)
  
          async def __call__(self):
              result = await self._handle1.remote(
                  self._handle2.remote("hi")
              )
              return f"driver|{result}"
  
      handle = serve.run(
          Deployment.bind(
              Downstream.options(name="downstream1").bind(
                  "downstream1"
              ),
              Downstream.options(name="downstream2").bind(
                  "downstream2"
              ),
          ),
      ).options(use_new_handle_api=True)
      assert (
          handle.remote().result()
          == "driver|downstream1|downstream2|hi"
      )
  
file_path: ray/python/ray/serve/tests/test_new_handle_api.py
imports: import sys
  from typing import Any
  import pytest
  import ray
  from ray import serve
  from ray._private.test_utils import SignalActor
  from ray.serve.handle import DeploymentHandle, DeploymentResponse, DeploymentResponseGenerator, RayServeHandle, RayServeSyncHandle
label_desc: Use image node_id 4 for calling a global function with example usage: test_compose_deployments_in_app(serve_instance) and returns: self, str, inp, str, result