class_docstr: A standard Starlette middleware that enables argilla logs for http prediction requests
class_docstr_tok: ["A","standard","Starlette","middleware","that","enables","argilla","logs","for","http","prediction","requests"]
code: def __init__(
      self,
      api_endpoint: str,
      dataset: str,
      records_mapper: Optional[Callable[[dict, dict], Record]],
      sample_rate: float = 1.0,
      log_interval: float = 1.0,
      agent: Optional[str] = None,
      tags: Dict[str, str] = None,
      *args,
      **kwargs,
  ):
      BaseHTTPMiddleware.__init__(self, *args, **kwargs)
  
      self._endpoint = api_endpoint
      self._dataset = dataset
      self._records_mapper = records_mapper
      self._monitor_cfg = dict(
          dataset=dataset,
          sample_rate=sample_rate,
          log_interval=log_interval,
          agent=agent,
          tags=tags,
      )
      self._monitor: Optional[BaseMonitor] = None
  
imports: import datetime
  import json
  import logging
  import re
  from typing import Any, Callable, Dict, List, Optional, Tuple
  from argilla.client.models import Record, TextClassificationRecord, TokenClassificationRecord
  from argilla.monitoring.base import BaseMonitor
  from argilla.utils.dependency import require_dependencies
  from starlette.middleware.base import BaseHTTPMiddleware, RequestResponseEndpoint
  from starlette.requests import Request
  from starlette.responses import JSONResponse, Response, StreamingResponse
  from starlette.types import Message, Receive
label_desc: Use image node_id 1 to create a new ArgillaLogHTTPMiddleware object from inherited base classes: BaseHTTPMiddleware with example: obj = ArgillaLogHTTPMiddleware(api_endpoint, dataset, records_mapper, sample_rate, log_interval, agent, tags)