1- import warnings
21from typing import Any
32
43from pyseekdb .client .embedding_function import Documents , Embeddings
@@ -58,7 +57,6 @@ def __init__(
5857 model_name : str = "mistral-embed" ,
5958 api_key_env : str | None = None ,
6059 api_base : str | None = None ,
61- dimensions : int | None = None ,
6260 ** kwargs : Any ,
6361 ):
6462 """Initialize MistralEmbeddingFunction.
@@ -70,27 +68,17 @@ def __init__(
7068 Defaults to "MISTRAL_API_KEY" if not provided.
7169 api_base (str, optional): Base URL for the Mistral API endpoint.
7270 Defaults to "https://api.mistral.ai/v1" if not provided.
73- dimensions (int, optional): This parameter is not supported by the Mistral embeddings API.
74- If provided, a warning will be issued and the parameter will be ignored.
7571 **kwargs: Additional arguments to pass to the OpenAI client.
7672 Common options include:
7773 - timeout: Request timeout in seconds
7874 - max_retries: Maximum number of retries
7975 - See https://github.com/openai/openai-python for more options
8076 """
81- if dimensions is not None :
82- warnings .warn (
83- "The dimensions parameter is not supported by Mistral embeddings. "
84- "The provided dimensions parameter will be ignored." ,
85- UserWarning ,
86- stacklevel = 2 ,
87- )
8877
8978 super ().__init__ (
9079 model_name = model_name ,
9180 api_key_env = api_key_env ,
9281 api_base = api_base ,
93- dimensions = None ,
9482 ** kwargs ,
9583 )
9684
@@ -139,7 +127,6 @@ def build_from_config(config: dict[str, Any]) -> "MistralEmbeddingFunction":
139127
140128 api_key_env = config .get ("api_key_env" )
141129 api_base = config .get ("api_base" )
142- dimensions = config .get ("dimensions" )
143130 client_kwargs = config .get ("client_kwargs" , {})
144131 if not isinstance (client_kwargs , dict ):
145132 raise TypeError (f"client_kwargs must be a dictionary, but got { client_kwargs } " )
@@ -148,6 +135,5 @@ def build_from_config(config: dict[str, Any]) -> "MistralEmbeddingFunction":
148135 model_name = model_name ,
149136 api_key_env = api_key_env ,
150137 api_base = api_base ,
151- dimensions = dimensions ,
152138 ** client_kwargs ,
153139 )
0 commit comments