Merge pull request #2290 from ti3x/bedrock_mistral

Add support for Bedrock Mistral models
This commit is contained in:
Ishaan Jaff 2024-03-04 08:42:47 -08:00 committed by GitHub
commit 84415ef7b5
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 151 additions and 20 deletions

View file

@ -4551,6 +4551,21 @@ def get_optional_params(
optional_params["temperature"] = temperature
if max_tokens is not None:
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\":400,\"temperature\":0.7,\"top_p\":0.7,\"stop\":[\"\\\\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":
supported_params = [
"max_tokens",
@ -9677,4 +9692,4 @@ def _get_base_model_from_metadata(model_call_details=None):
base_model = model_info.get("base_model", None)
if base_model is not None:
return base_model
return None
return None