def __init__(self, **kwargs):
        """Initialize the OpenAI Text2Vec model with a shared client."""
        super().__init__(**kwargs)

        # Create a single shared client with extended timeout for high concurrency
        # Default is 10 minutes, but we extend it for reliability with 100 concurrent workers
        self._client = AsyncOpenAI(
            api_key=self.api_key,
            timeout=1200.0,  # 20 minutes total timeout (was 10 minutes default)
            max_retries=2,  # Retry on transient errors
        )
        logger.info("Created shared OpenAI client with 20 minute timeout")

        # Initialize rate limiting semaphore (limit concurrent OpenAI requests)
        global _openai_semaphore
        if _openai_semaphore is None:
            # Limit concurrent OpenAI requests to prevent API overload
            max_concurrent = getattr(settings, "OPENAI_MAX_CONCURRENT", 20)
            _openai_semaphore = asyncio.Semaphore(max_concurrent)
            logger.info(f"Initialized OpenAI rate limiting to {max_concurrent} concurrent requests")
Initialize the OpenAI Text2Vec model with a shared client.
backend/airweave/platform/embedding_models/openai_text2vec.py