async def embed(
        self,
        text: str,
        model: Optional[str] = None,
        encoding_format: str = "float",
        dimensions: Optional[int] = None,
        entity_context: Optional[str] = None,
    ) -> List[float]:
        """Embed a single text string using OpenAI official client.

        Args:
            text: The text to embed
            model: The OpenAI model to use (defaults to self.embedding_model)
            encoding_format: Format of the embedding (default: float)
            dimensions: Vector dimensions (defaults to self.vector_dimensions)
            entity_context: Optional context string for entity identification in logs

        Returns:
            List of embedding values
        """
        if dimensions:
            raise ValueError("Dimensions override not supported for OpenAI embedding")

        context_prefix = f"{entity_context} " if entity_context else ""

        if not text.strip():
            logger.info(f"{context_prefix}Empty text provided for embedding, returning zero vector")
            return [0.0] * self.vector_dimensions

        used_model = model or self.embedding_model
        logger.info(
            f"{context_prefix}Embedding single text with model {used_model} "
            f"(text length: {len(text)})"
        )

        loop = asyncio.get_event_loop()
        cpu_start = loop.time()
        try:
            # Wait for the API call to complete with await
            response = await self._client.embeddings.create(
                input=text,
                model=used_model,
                encoding_format=encoding_format,
            )

            embedding = response.data[0].embedding
            cpu_elapsed = loop.time() - cpu_start
            logger.info(
                f"{context_prefix}Embedding completed in {cpu_elapsed:.2f}s, "
                f"vector size: {len(embedding)}"
            )
            return embedding

        except Exception as e:
            cpu_elapsed = loop.time() - cpu_start
            error_type = type(e).__name__
            logger.error(
                f"{context_prefix}Embedding failed after {cpu_elapsed:.2f}s "
                f"with {error_type}: {str(e)}"
            )
            raise
Embed a single text string using OpenAI official client.

        Args:
            text: The text to embed
            model: The OpenAI model to use (defaults to self.embedding_model)
            encoding_format: Format of the embedding (default: float)
            dimensions: Vector dimensions (defaults to self.vector_dimensions)
            entity_context: Optional context string for entity identification in logs

        Returns:
            List of embedding values
        
backend/airweave/platform/embedding_models/openai_text2vec.py