code: def test_invalid_api_naming():
      svc = bentoml.Service(name="invalid_api_naming")
  
      @svc.api(name="similar", input=Text(), output=Text())
      def r1(obj: str) -> int:
          return 1
  
      with pytest.raises(BentoMLException) as excinfo:
  
          @svc.api(name="similar", input=Text(), output=Text())
          def r2(obj: str) -> int:
              return 1
  
      assert "is already defined in Service" in str(excinfo.value)
  
file_path: BentoML/tests/unit/_internal/test_service_api.py
imports: from __future__ import annotations
  import logging
  from typing import TYPE_CHECKING
  import pytest
  import bentoml
  from bentoml.exceptions import BentoMLException
  from bentoml.io import Text
label_desc: Use image node_id 2 for calling a global function with example usage: test_invalid_api_naming() and returns: int, int