From cca946f437dfc9f6f54e2fb10270f3c4a2ba9c8a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20MANSUY?= Date: Thu, 4 Dec 2025 19:14:26 +0800 Subject: [PATCH] cherry-pick d94aae9c --- lightrag/llm/openai.py | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/lightrag/llm/openai.py b/lightrag/llm/openai.py index fce33cac..155fd3e9 100644 --- a/lightrag/llm/openai.py +++ b/lightrag/llm/openai.py @@ -609,7 +609,7 @@ async def openai_embed( model: str = "text-embedding-3-small", base_url: str | None = None, api_key: str | None = None, - embedding_dim: int | None = None, + embedding_dim: int = None, client_configs: dict[str, Any] | None = None, token_tracker: Any | None = None, ) -> np.ndarray: @@ -620,12 +620,7 @@ async def openai_embed( model: The OpenAI embedding model to use. base_url: Optional base URL for the OpenAI API. api_key: Optional OpenAI API key. If None, uses the OPENAI_API_KEY environment variable. - embedding_dim: Optional embedding dimension for dynamic dimension reduction. - **IMPORTANT**: This parameter is automatically injected by the EmbeddingFunc wrapper. - Do NOT manually pass this parameter when calling the function directly. - The dimension is controlled by the @wrap_embedding_func_with_attrs decorator. - Manually passing a different value will trigger a warning and be ignored. - When provided (by EmbeddingFunc), it will be passed to the OpenAI API for dimension reduction. + embedding_dim: Optional embedding dimension. If None, uses the default embedding dimension for the model. (will be passed to API for dimension reduction). client_configs: Additional configuration options for the AsyncOpenAI client. These will override any default configurations but will be overridden by explicit parameters (api_key, base_url).