(feat) add support for dimensions param

This commit is contained in:
ishaan-jaff 2024-01-26 10:54:34 -08:00
parent 6da3a46670
commit bc66c0e366

View file

@ -2224,6 +2224,7 @@ def embedding(
model, model,
input=[], input=[],
# Optional params # Optional params
dimensions: Optional[int] = None,
timeout=600, # default to 10 minutes timeout=600, # default to 10 minutes
# set api_base, api_version, api_key # set api_base, api_version, api_key
api_base: Optional[str] = None, api_base: Optional[str] = None,
@ -2244,6 +2245,7 @@ def embedding(
Parameters: Parameters:
- model: The embedding model to use. - model: The embedding model to use.
- input: The input for which embeddings are to be generated. - input: The input for which embeddings are to be generated.
- dimensions: The number of dimensions the resulting output embeddings should have. Only supported in text-embedding-3 and later models.
- timeout: The timeout value for the API call, default 10 mins - timeout: The timeout value for the API call, default 10 mins
- litellm_call_id: The call ID for litellm logging. - litellm_call_id: The call ID for litellm logging.
- litellm_logging_obj: The litellm logging object. - litellm_logging_obj: The litellm logging object.
@ -2277,6 +2279,7 @@ def embedding(
output_cost_per_second = kwargs.get("output_cost_per_second", None) output_cost_per_second = kwargs.get("output_cost_per_second", None)
openai_params = [ openai_params = [
"user", "user",
"dimensions",
"request_timeout", "request_timeout",
"api_base", "api_base",
"api_version", "api_version",
@ -2345,7 +2348,9 @@ def embedding(
api_key=api_key, api_key=api_key,
) )
optional_params = get_optional_params_embeddings( optional_params = get_optional_params_embeddings(
model=model,
user=user, user=user,
dimensions=dimensions,
encoding_format=encoding_format, encoding_format=encoding_format,
custom_llm_provider=custom_llm_provider, custom_llm_provider=custom_llm_provider,
**non_default_params, **non_default_params,