code: def test_argilla_middleware_for_text_classification(
      argilla_user: User,
  ):
      expected_endpoint = "/predict"
      expected_endpoint_get = "/predict_get"
      expected_dataset_name = "mlmodel_v3_monitor_ds"
  
      delete_ignoring_errors(expected_dataset_name)
  
      app = FastAPI()
      app.add_middleware(
          ArgillaLogHTTPMiddleware,
          api_endpoint=expected_endpoint,
          dataset=expected_dataset_name,
          records_mapper=text_classification_mapper,
          log_interval=0.1,
      )
      app.add_middleware(
          ArgillaLogHTTPMiddleware,
          api_endpoint=expected_endpoint_get,
          dataset=expected_dataset_name,
          records_mapper=text_classification_mapper,
          log_interval=0.1,
      )
  
      @app.route(expected_endpoint, methods=["POST", "PUT"])
      def mock_predict_post(data: Dict[str, Any]):
          return JSONResponse(
              content={"labels": ["A", "B"], "scores": [0.9, 0.1]}
          )
  
      @app.route(expected_endpoint_get, methods=["GET"])
      def mock_predict_get(data: Dict[str, Any]):
          return JSONResponse(
              content={"labels": ["A", "B"], "scores": [0.9, 0.1]}
          )
  
      @app.route("/another/predict/route")
      def another_mock(request):
          return PlainTextResponse("Hello")
  
      mock = TestClient(app)
      mock.post(
          expected_endpoint,
          json={
              "a": "The data input for A",
              "b": "The data input for B",
          },
      )
  
      time.sleep(0.5)
      df = argilla.load(expected_dataset_name)
      df = df.to_pandas()
      assert len(df) == 1
  
      mock.put(
          expected_endpoint,
          json={
              "a": "The data input for A",
              "b": "The data input for B",
          },
      )
      time.sleep(0.5)
      df = argilla.load(expected_dataset_name)
      df = df.to_pandas()
      assert len(df) == 2
  
      mock.get(
          expected_endpoint_get,
          params={
              "a": "The data input for A",
              "b": "The data input for B",
          },
      )
      time.sleep(0.5)
      df = argilla.load(expected_dataset_name)
      df = df.to_pandas()
      assert len(df) == 3
  
      mock.get("/another/predict/route")
  
      time.sleep(0.5)
      df = argilla.load(expected_dataset_name)
      df = df.to_pandas()
      assert len(df) == 3
  
file_path: argilla/tests/integration/client/test_asgi.py
imports: import time
  from typing import Any, Dict
  import argilla
  from argilla.monitoring.asgi import ArgillaLogHTTPMiddleware, text_classification_mapper, token_classification_mapper
  from argilla.server.models import User
  from fastapi import FastAPI
  from starlette.applications import Starlette
  from starlette.responses import JSONResponse, PlainTextResponse
  from starlette.testclient import TestClient
  from tests.integration.utils import delete_ignoring_errors
label_desc: Use image node_id 1 for calling a global function with example usage: test_argilla_middleware_for_text_classification(argilla_user) and returns: JSONResponse, JSONResponse, PlainTextResponse