feat: add claude-opus-4-5 to TEMPERATURE_TOPP_CONFLICT_MODELS set (#208)

Co-authored-by: Hooman Yar <yarhooma@amazon.com>
This commit is contained in:
Hooman Yar
2025-12-05 09:22:37 +08:00
committed by GitHub
co-authored by Hooman Yar
parent 2c518bbd70
commit 0411454b3a
+8 -7
View File
@@ -94,6 +94,7 @@ profile_metadata = {}
TEMPERATURE_TOPP_CONFLICT_MODELS = { TEMPERATURE_TOPP_CONFLICT_MODELS = {
"claude-sonnet-4-5", "claude-sonnet-4-5",
"claude-haiku-4-5", "claude-haiku-4-5",
"claude-opus-4-5",
} }
@@ -162,7 +163,7 @@ def list_bedrock_models() -> dict:
except Exception as e: except Exception as e:
logger.warning(f"Error processing application profile: {e}") logger.warning(f"Error processing application profile: {e}")
continue continue
# List foundation models, only cares about text outputs here. # List foundation models, only cares about text outputs here.
response = bedrock_client.list_foundation_models(byOutputModality="TEXT") response = bedrock_client.list_foundation_models(byOutputModality="TEXT")
@@ -533,7 +534,7 @@ class BedrockModel(BaseChatModel):
has_content = len(message.content) > 0 has_content = len(message.content) > 0
elif message.content is not None: elif message.content is not None:
has_content = True has_content = True
if has_content: if has_content:
# Text message # Text message
messages.append( messages.append(
@@ -566,10 +567,10 @@ class BedrockModel(BaseChatModel):
# Bedrock does not support tool role, # Bedrock does not support tool role,
# Add toolResult to content # Add toolResult to content
# https://docs.aws.amazon.com/bedrock/latest/APIReference/API_runtime_ToolResultBlock.html # https://docs.aws.amazon.com/bedrock/latest/APIReference/API_runtime_ToolResultBlock.html
# Handle different content formats from OpenAI SDK # Handle different content formats from OpenAI SDK
tool_content = self._extract_tool_content(message.content) tool_content = self._extract_tool_content(message.content)
messages.append( messages.append(
{ {
"role": "user", "role": "user",
@@ -591,7 +592,7 @@ class BedrockModel(BaseChatModel):
def _extract_tool_content(self, content) -> str: def _extract_tool_content(self, content) -> str:
"""Extract text content from various OpenAI SDK tool message formats. """Extract text content from various OpenAI SDK tool message formats.
Handles: Handles:
- String content (legacy format) - String content (legacy format)
- List of content objects (OpenAI SDK 1.91.0+) - List of content objects (OpenAI SDK 1.91.0+)
@@ -600,7 +601,7 @@ class BedrockModel(BaseChatModel):
try: try:
if isinstance(content, str): if isinstance(content, str):
return content return content
if isinstance(content, list): if isinstance(content, list):
text_parts = [] text_parts = []
for i, item in enumerate(content): for i, item in enumerate(content):
@@ -632,7 +633,7 @@ class BedrockModel(BaseChatModel):
# Convert any other type to string # Convert any other type to string
text_parts.append(str(item)) text_parts.append(str(item))
return "\n".join(text_parts) return "\n".join(text_parts)
# Fallback for any other type # Fallback for any other type
return str(content) return str(content)
except Exception as e: except Exception as e: