map optional params

This commit is contained in:
Tim Xia 2024-03-02 13:25:04 -05:00
parent 67110df3e1
commit a4e24761a0

View file

@ -4551,6 +4551,21 @@ def get_optional_params(
optional_params["temperature"] = temperature optional_params["temperature"] = temperature
if max_tokens is not None: if max_tokens is not None:
optional_params["max_tokens"] = max_tokens optional_params["max_tokens"] = max_tokens
elif "mistral" in model:
supported_params = ["max_tokens", "temperature", "stop", "top_p", "stream"]
_check_valid_arg(supported_params=supported_params)
# mistral params on bedrock
# \"max_tokens_to_sample\":300,\"temperature\":0.5,\"top_p\":1,\"stop_sequences\":[\"\\\\n\\\\nHuman:\"]}"
if max_tokens is not None:
optional_params["max_tokens"] = max_tokens
if temperature is not None:
optional_params["temperature"] = temperature
if top_p is not None:
optional_params["top_p"] = top_p
if stop is not None:
optional_params["stop"] = stop
if stream is not None:
optional_params["stream"] = stream
elif custom_llm_provider == "aleph_alpha": elif custom_llm_provider == "aleph_alpha":
supported_params = [ supported_params = [
"max_tokens", "max_tokens",