From f7cf90a6360d5cc5c156c8852799bd09a9297b97 Mon Sep 17 00:00:00 2001 From: Krrish Dholakia Date: Fri, 15 Mar 2024 09:41:22 -0700 Subject: [PATCH] fix(bedrock.py): add all supported bedrock / anthropic messages api params --- litellm/llms/bedrock.py | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/litellm/llms/bedrock.py b/litellm/llms/bedrock.py index 4aa27b3c9d8..31e4905cb4b 100644 --- a/litellm/llms/bedrock.py +++ b/litellm/llms/bedrock.py @@ -82,12 +82,22 @@ class AmazonAnthropicClaude3Config: Supported Params for the Amazon / Anthropic Claude 3 models: - - `max_tokens` (integer) max tokens, - - `anthropic_version` (string) version of anthropic for bedrock - e.g. "bedrock-2023-05-31" + - `max_tokens` Required (integer) max tokens, + - `anthropic_version` Required (string) version of anthropic for bedrock - e.g. "bedrock-2023-05-31" + - `system` Optional (string) the system prompt, conversion from openai format to this is handled in factory.py + - `temperature` Optional (float) The amount of randomness injected into the response + - `top_p` Optional (float) Use nucleus sampling. + - `top_k` Optional (int) Only sample from the top K options for each subsequent token + - `stop_sequences` Optional (List[str]) Custom text sequences that cause the model to stop generating """ max_tokens: Optional[int] = litellm.max_tokens anthropic_version: Optional[str] = "bedrock-2023-05-31" + system: Optional[str] = None + temperature: Optional[float] = None + top_p: Optional[float] = None + top_k: Optional[int] = None + stop_sequences: Optional[List[str]] = None def __init__( self, @@ -128,6 +138,12 @@ class AmazonAnthropicClaude3Config: optional_params["tools"] = value if param == "stream": optional_params["stream"] = value + if param == "stop": + optional_params["stop_sequences"] = value + if param == "temperature": + optional_params["temperature"] = value + if param == "top_p": + optional_params["top_p"] = value return optional_params