code: def test_serialization_pydantic_runtime_env(ray_start_regular):
      @ray.remote
      def test(pydantic_model):
          return pydantic_model.x
  
      @ray.remote(runtime_env={"pip": ["pydantic<2"]})
      def py1():
          from pydantic import BaseModel
  
          class Foo(BaseModel):
              x: int
  
          return ray.get(test.remote(Foo(x=1)))
  
      @ray.remote(runtime_env={"pip": ["pydantic>=2"]})
      def py2():
          from pydantic.v1 import BaseModel
  
          class Foo(BaseModel):
              x: int
  
          return ray.get(test.remote(Foo(x=2)))
  
      assert ray.get(py1.remote()) == 1
      assert ray.get(py2.remote()) == 2
  
imports: import collections
  import io
  import logging
  import re
  import string
  import sys
  import weakref
  from dataclasses import make_dataclass
  import numpy
  import pytest
  from numpy import log
  import ray
  import ray.cluster_utils
label_desc: Use image node_id 16 for calling a global function with example usage: test_serialization_pydantic_runtime_env(ray_start_regular) and returns: pydantic_model, ray, ray