forked from phoenix/litellm-mirror
fixes to get_optional_params
This commit is contained in:
parent
b70640e969
commit
7cec308a2c
6 changed files with 4 additions and 4 deletions
Binary file not shown.
Binary file not shown.
|
@ -218,7 +218,7 @@ def completion(
|
||||||
######## end of unpacking kwargs ###########
|
######## end of unpacking kwargs ###########
|
||||||
args = locals()
|
args = locals()
|
||||||
openai_params = ["functions", "function_call", "temperature", "temperature", "top_p", "n", "stream", "stop", "max_tokens", "presence_penalty", "frequency_penalty", "logit_bias", "user", "metadata"]
|
openai_params = ["functions", "function_call", "temperature", "temperature", "top_p", "n", "stream", "stop", "max_tokens", "presence_penalty", "frequency_penalty", "logit_bias", "user", "metadata"]
|
||||||
litellm_params = ["return_async", "mock_response", "api_key", "api_version", "api_base", "force_timeout", "logger_fn", "verbose", "custom_llm_provider", "litellm_logging_obj", "litellm_call_id", "use_client", "id", "metadata", "fallbacks"]
|
litellm_params = ["caching", "return_async", "mock_response", "api_key", "api_version", "api_base", "force_timeout", "logger_fn", "verbose", "custom_llm_provider", "litellm_logging_obj", "litellm_call_id", "use_client", "id", "metadata", "fallbacks"]
|
||||||
default_params = openai_params + litellm_params
|
default_params = openai_params + litellm_params
|
||||||
non_default_params = {k: v for k,v in kwargs.items() if k not in default_params} # model-specific params - pass them straight to the model/provider
|
non_default_params = {k: v for k,v in kwargs.items() if k not in default_params} # model-specific params - pass them straight to the model/provider
|
||||||
if mock_response:
|
if mock_response:
|
||||||
|
|
|
@ -48,7 +48,7 @@ def test_completion_invalid_param_cohere():
|
||||||
try:
|
try:
|
||||||
response = completion(model="command-nightly", messages=messages, top_p=1)
|
response = completion(model="command-nightly", messages=messages, top_p=1)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
if "Function calling is not supported by this provider" in str(e):
|
if "Unsupported parameters passed: top_p" in str(e):
|
||||||
pass
|
pass
|
||||||
else:
|
else:
|
||||||
pytest.fail(f'An error occurred {e}')
|
pytest.fail(f'An error occurred {e}')
|
||||||
|
|
|
@ -531,7 +531,7 @@ def test_completion_openai_with_more_optional_params():
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
pytest.fail(f"Error occurred: {e}")
|
pytest.fail(f"Error occurred: {e}")
|
||||||
|
|
||||||
|
test_completion_openai_with_more_optional_params()
|
||||||
# def test_completion_openai_azure_with_functions():
|
# def test_completion_openai_azure_with_functions():
|
||||||
# function1 = [
|
# function1 = [
|
||||||
# {
|
# {
|
||||||
|
|
|
@ -1209,7 +1209,7 @@ def get_optional_params( # use the openai defaults
|
||||||
if top_p:
|
if top_p:
|
||||||
optional_params["top_p"] = top_p
|
optional_params["top_p"] = top_p
|
||||||
else: # assume passing in params for openai/azure openai
|
else: # assume passing in params for openai/azure openai
|
||||||
supported_params = ["functions", "function_call", "temperature", "top_p", "n", "stream", "stop", "max_tokens", "presence_penalty", "logit_bias", "user", "deployment_id"]
|
supported_params = ["functions", "function_call", "temperature", "top_p", "n", "stream", "stop", "max_tokens", "presence_penalty", "frequency_penalty", "logit_bias", "user", "deployment_id"]
|
||||||
_check_valid_arg(supported_params=supported_params)
|
_check_valid_arg(supported_params=supported_params)
|
||||||
optional_params = non_default_params
|
optional_params = non_default_params
|
||||||
# if user passed in non-default kwargs for specific providers/models, pass them along
|
# if user passed in non-default kwargs for specific providers/models, pass them along
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue