From 27353f7402fe24bcd3498f7d232c14f97f3adf4b Mon Sep 17 00:00:00 2001 From: Takahiro Kikumoto Date: Sat, 31 May 2025 17:04:48 +0900 Subject: [PATCH] feat: Add Claude-4 thinking support for Bedrock --- .../providers/aws_bedrock_claude_pipeline.py | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/examples/pipelines/providers/aws_bedrock_claude_pipeline.py b/examples/pipelines/providers/aws_bedrock_claude_pipeline.py index e6ad83f..873bc90 100644 --- a/examples/pipelines/providers/aws_bedrock_claude_pipeline.py +++ b/examples/pipelines/providers/aws_bedrock_claude_pipeline.py @@ -50,14 +50,6 @@ class Pipeline: # self.id = "openai_pipeline" self.name = "Bedrock: " - self.valves = self.Valves( - **{ - "AWS_ACCESS_KEY": os.getenv("AWS_ACCESS_KEY", "your-aws-access-key-here"), - "AWS_SECRET_KEY": os.getenv("AWS_SECRET_KEY", "your-aws-secret-key-here"), - "AWS_REGION_NAME": os.getenv("AWS_REGION_NAME", "your-aws-region-name-here"), - } - ) - self.valves = self.Valves( **{ "AWS_ACCESS_KEY": os.getenv("AWS_ACCESS_KEY", ""), @@ -72,6 +64,13 @@ class Pipeline: self.update_pipelines() + def get_thinking_supported_models(self): + """Returns list of model identifiers that support extended thinking""" + return [ + "claude-3-7", + "claude-sonnet-4", + "claude-opus-4" + ] async def on_startup(self): # This function is called when the server is started. @@ -183,13 +182,14 @@ class Pipeline: } if body.get("stream", False): - supports_thinking = "claude-3-7" in model_id + supports_thinking = any(model in model_id for model in self.get_thinking_supported_models()) reasoning_effort = body.get("reasoning_effort", "none") budget_tokens = REASONING_EFFORT_BUDGET_TOKEN_MAP.get(reasoning_effort) # Allow users to input an integer value representing budget tokens if ( not budget_tokens + and reasoning_effort is not None and reasoning_effort not in REASONING_EFFORT_BUDGET_TOKEN_MAP.keys() ): try: