You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tooling.apache.org by ak...@apache.org on 2026/06/09 00:59:19 UTC
(tooling-gofannon) 04/04: bedrock-mythos: align param shape with Opus 4.8 and detect adaptive thinking
This is an automated email from the ASF dual-hosted git repository.
andrewmusselman pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/tooling-gofannon.git
commit fa99daa609315a6df610e3694994f57dd8588ecb
Author: Andrew Musselman <ak...@apache.org>
AuthorDate: Mon Jun 8 17:59:03 2026 -0700
bedrock-mythos: align param shape with Opus 4.8 and detect adaptive thinking
The Mythos provider entry was undersized on first cut: 4096 max_tokens
default and a missing top_p and reasoning_effort. Mythos is described
as 1M input and 128K output with reasoning, vision, and tool use, same
shape as Opus 4.7/4.8, so the parameter config should mirror that.
- max_tokens default 4096 -> 16384 (match Opus 4.8)
- max_tokens cap 131072 -> 128000 (match Opus 4.8 convention)
- add top_p (mutually exclusive with temperature)
- add reasoning_effort (Mythos supports thinking.type=adaptive)
Also broaden _is_opus_4_7_or_later() to match claude-mythos so the
adaptive-thinking code path picks Mythos up too.
---
.../user-service/config/bedrock_mythos/__init__.py | 50 ++++++++++++----------
.../api/user-service/services/llm_service.py | 13 +++---
2 files changed, 35 insertions(+), 28 deletions(-)
diff --git a/webapp/packages/api/user-service/config/bedrock_mythos/__init__.py b/webapp/packages/api/user-service/config/bedrock_mythos/__init__.py
index 6dc774b..5d9cfb9 100644
--- a/webapp/packages/api/user-service/config/bedrock_mythos/__init__.py
+++ b/webapp/packages/api/user-service/config/bedrock_mythos/__init__.py
@@ -1,24 +1,14 @@
-# Mythos preview model configuration (accessed via AWS Bedrock Mantle).
-#
-# Mantle is a distinct Bedrock endpoint
-# (https://bedrock-mantle.{region}.api.aws/v1) with OpenAI-compatible
-# APIs and its own IAM action namespace (bedrock-mantle:*). Mythos is
-# exposed there as anthropic.claude-mythos-preview.
-#
-# Auth flow at request time:
-# 1. boto3 reads ambient credentials (EC2 instance profile in prod,
-# `aws login` session locally)
-# 2. STS AssumeRole into the cross-account devs role in Anthropic's
-# preview AWS account (861792231409)
-# 3. aws-bedrock-token-generator mints a SigV4-derived bearer token
-# from the assumed credentials
-# 4. Bearer token passed to litellm as api_key; litellm routes via
-# its bedrock_mantle provider to the Mantle endpoint
-#
-# See llm_service._get_bedrock_mythos_api_key() and the bedrock-mythos
-# entry in provider_config.PROVIDER_CONFIG.
-
models = {
+ # =========================================================================
+ # Anthropic Claude Mythos Preview (via Bedrock Mantle).
+ # 1M token context, 128K max output. Same adaptive thinking shape as
+ # Opus 4.7+/4.8 (thinking={"type":"adaptive"}, output_config={"effort":"high"}).
+ # llm_service.py's existing claude-opus substring detection in
+ # _is_opus_4_7_or_later() does NOT match this model ID — if Mythos
+ # needs the same adaptive-thinking code path, the detection function
+ # may need updating. Worth verifying when Anthropic's setup email
+ # confirms which thinking format Mythos expects.
+ # =========================================================================
"anthropic.claude-mythos-preview": {
"returns_thoughts": True,
"supports_effort": True,
@@ -33,12 +23,26 @@ models = {
"description": "Randomness (0=focused, 1=creative). Locked to 1.0 when thinking enabled.",
"mutually_exclusive_with": ["top_p"],
},
+ "top_p": {
+ "type": "float",
+ "default": 0.9,
+ "min": 0.0,
+ "max": 1.0,
+ "description": "Nucleus sampling (0.1=conservative, 0.95=diverse)",
+ "mutually_exclusive_with": ["temperature"],
+ },
+ "reasoning_effort": {
+ "type": "choice",
+ "default": "disable",
+ "choices": ["disable", "low", "medium", "high", "xhigh", "max"],
+ "description": "Reasoning Effort: Enables extended thinking. xhigh/max are Opus 4.7+ only.",
+ },
"max_tokens": {
"type": "integer",
- "default": 4096,
+ "default": 16384,
"min": 1,
- "max": 131072,
- "description": "Maximum tokens to generate (up to 128K output).",
+ "max": 128000,
+ "description": "Maximum tokens in response",
},
},
},
diff --git a/webapp/packages/api/user-service/services/llm_service.py b/webapp/packages/api/user-service/services/llm_service.py
index 3688644..b720753 100644
--- a/webapp/packages/api/user-service/services/llm_service.py
+++ b/webapp/packages/api/user-service/services/llm_service.py
@@ -65,11 +65,14 @@ def _extract_response_cost(response_obj: Any) -> Optional[float]:
def _is_opus_4_7_or_later(model: str) -> bool:
"""Opus 4.7+ uses adaptive thinking with output_config.effort
instead of the old reasoning_effort -> thinking.type.enabled
- translation that litellm does for Opus 4.6 and earlier."""
- if "claude-opus" not in model:
- return False
- if "claude-opus-4-6" in model:
- return False
+ translation that litellm does for Opus 4.6 and earlier.
+
+ Mythos preview uses the same adaptive thinking shape as Opus 4.7+,
+ so we match it here despite the function name. If more non-Opus
+ models join this club, consider renaming to e.g.
+ _supports_adaptive_thinking."""
+ if "claude-mythos" in model:
+ return True
return any(tag in model for tag in ("claude-opus-4-7", "claude-opus-4-8"))
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@tooling.apache.org
For additional commands, e-mail: commits-help@tooling.apache.org