Skip to content

Commit 27353f7

Browse files
committed
feat: Add Claude-4 thinking support for Bedrock
1 parent 25ddc60 commit 27353f7

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

examples/pipelines/providers/aws_bedrock_claude_pipeline.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -50,14 +50,6 @@ def __init__(self):
5050
# self.id = "openai_pipeline"
5151
self.name = "Bedrock: "
5252

53-
self.valves = self.Valves(
54-
**{
55-
"AWS_ACCESS_KEY": os.getenv("AWS_ACCESS_KEY", "your-aws-access-key-here"),
56-
"AWS_SECRET_KEY": os.getenv("AWS_SECRET_KEY", "your-aws-secret-key-here"),
57-
"AWS_REGION_NAME": os.getenv("AWS_REGION_NAME", "your-aws-region-name-here"),
58-
}
59-
)
60-
6153
self.valves = self.Valves(
6254
**{
6355
"AWS_ACCESS_KEY": os.getenv("AWS_ACCESS_KEY", ""),
@@ -72,6 +64,13 @@ def __init__(self):
7264

7365
self.update_pipelines()
7466

67+
def get_thinking_supported_models(self):
68+
"""Returns list of model identifiers that support extended thinking"""
69+
return [
70+
"claude-3-7",
71+
"claude-sonnet-4",
72+
"claude-opus-4"
73+
]
7574

7675
async def on_startup(self):
7776
# This function is called when the server is started.
@@ -183,13 +182,14 @@ def pipe(
183182
}
184183

185184
if body.get("stream", False):
186-
supports_thinking = "claude-3-7" in model_id
185+
supports_thinking = any(model in model_id for model in self.get_thinking_supported_models())
187186
reasoning_effort = body.get("reasoning_effort", "none")
188187
budget_tokens = REASONING_EFFORT_BUDGET_TOKEN_MAP.get(reasoning_effort)
189188

190189
# Allow users to input an integer value representing budget tokens
191190
if (
192191
not budget_tokens
192+
and reasoning_effort is not None
193193
and reasoning_effort not in REASONING_EFFORT_BUDGET_TOKEN_MAP.keys()
194194
):
195195
try:

0 commit comments

Comments
 (0)