#3031·ragas

llm_factory: OpenAI GPT-6 Sol/Luna/Astra on Amazon Bedrock fail with 400 because Bedrock model IDs (openai.gpt-6-sol) skip the GPT-5+ parameter mapping

Author: kimnamuCreated Sep 24, 2026Updated Sep 24, 2026

Thanks for the reasoning-model handling in InstructorLLM._map_openai_params(); it already does the right thing for gpt-6-sol, and it made this easy to trace.

[ ] I have checked the documentation and related resources and couldn't resolve my bug.

Describe the bug On Amazon Bedrock the OpenAI models only have prefixed IDs: openai.gpt-6-sol on the bedrock-mantle /openai/v1 endpoint, us.openai.gpt-6-sol / global.openai.gpt-6-sol on bedrock-runtime /openai/v1. is_reasoning_model() checks startswith("gpt-") (src/ragas/llms/base.py L889), so these IDs keep max_tokens, temperature=0.01 and top_p=0.1, and every llm_factory call fails with 400. Faithfulness and MultiModalFaithfulness fail the same way. Found while trying OpenAI GPT-6 Sol and GPT-6 Luna, which became available on Bedrock on September 22; GPT-6 Astra fails the same way.

llm_factory(<id>, client=OpenAI(<bedrock /openai/v1>)) main @ 298b682 Prefix stripped before detection
openai.gpt-6-sol, openai.gpt-6-luna (bedrock-mantle us-east-1), openai.gpt-6-astra (bedrock-mantle us-west-2) ❌ 400 'max_tokens' is not supported ✅ Verdict(verdict=1, ...)
us. and global. IDs of Sol, Luna, Astra (bedrock-runtime us-east-1; us.openai.gpt-6-astra also us-west-2) ❌ same 400 ✅ OK
Params sent for those IDs temperature: 0.01, top_p: 0.1, max_tokens: 1024 temperature: 1.0, max_completion_tokens: 1024
Faithfulness / MultiModalFaithfulness (Sol, Luna, Astra) ❌ InstructorRetryException ✅ 1.0
gpt-6-sol, gpt-4o, openai.gpt-4.1, openai.gpt-oss-120b-1:0 mapping as today ✅ unchanged
Model ID sent to the API as passed ✅ unchanged

Ragas version: 0.4.4.dev8 (main @ 298b682) Python version: 3.12

Code to Reproduce

python
import os
from openai import OpenAI
from pydantic import BaseModel
from ragas.llms import llm_factory

class Verdict(BaseModel):
    verdict: int
    reason: str

client = OpenAI(base_url="https://bedrock-mantle.us-east-1.api.aws/openai/v1",
                api_key=os.environ["AWS_BEARER_TOKEN_BEDROCK"])
llm = llm_factory("openai.gpt-6-sol", client=client)
print(llm._map_openai_params())
print(llm.generate("Context: Paris is the capital of France. Is 'Paris is in France' supported? verdict=1 if yes.", Verdict))

Error trace (main @ 298b682, openai 3.3.0, instructor 1.17.0)

{'temperature': 0.01, 'top_p': 0.1, 'max_tokens': 1024}
API call failed on attempt 1: Error code: 400 - {'error': {'code': 'unsupported_parameter', 'message': "Unsupported parameter: 'max_tokens' is not supported with this model.", 'param': 'max_tokens', 'type': 'invalid_request_error'}}
...
instructor.v2.core.errors.InstructorRetryException: Error code: 400 - {'error': {'code': 'unsupported_parameter', 'message': "Unsupported parameter: 'max_tokens' is not supported with this model.", 'param': 'max_tokens', 'type': 'invalid_request_error'}}

Expected behavior Bedrock IDs get the same mapping as the bare names. On these models Bedrock's chat completions endpoints return 400 for max_tokens, temperature=0.01 and top_p=0.1, and accept max_completion_tokens, temperature=1 and top_p=1.

Additional context The open dotted-version work (#2708, #2573, PRs #2709, #2985 and others) anchors on gpt-, so it doesn't cover these IDs. The line below touches none of their lines and composes with them: GPT-5.6 on Bedrock (openai.gpt-5.6-sol) needs both, and works with #2709 plus this line. If a PR helps, I have one ready with tests; folding the line into one of those PRs works just as well.

Proposed patch and test results
diff
-        model_lower = self.model.lower()
+        # Amazon Bedrock IDs prefix the OpenAI name: openai.gpt-6-sol, us.openai.gpt-6-sol
+        model_lower = self.model.lower().split("openai.", 1)[-1]

A parametrized test in tests/unit/llms/test_instructor_factory.py covers openai.gpt-6-sol, us.openai.gpt-6-luna, global.openai.gpt-6-sol (mapped) and gpt-4o, openai.gpt-oss-120b-1:0 (unchanged).

# source reverted, new test kept
FAILED ...::test_openai_params_mapping_bedrock_model_ids[openai.gpt-6-sol-True] - KeyError: 'max_completion_tokens'
FAILED ...::test_openai_params_mapping_bedrock_model_ids[us.openai.gpt-6-luna-True] - KeyError: 'max_completion_tokens'
FAILED ...::test_openai_params_mapping_bedrock_model_ids[global.openai.gpt-6-sol-True] - KeyError: 'max_completion_tokens'
3 failed, 3 passed, 15 deselected
# with the fix
6 passed, 15 deselected; tests/unit/llms/test_instructor_factory.py: 21 passed
tests/unit -n 8: 771 passed (main: 765), same 3 failed / 8 errors as main, all missing optional deps not in dev-minimal (sacrebleu, rapidfuzz, git, llama_index)
  (test_executor_with_running_loop deselected on both: it depends on test order and also fails on main when run alone)
ruff format --check (touched files) / ruff check: OK
pyright src/ragas/llms/base.py: 0 errors, 0 warnings

Params each endpoint accepts (plain chat.completions.create, no ragas), same for Sol, Luna and Astra on bedrock-runtime and bedrock-mantle:

max_completion_tokens=1024   200
max_tokens=1024              400 Unsupported parameter: 'max_tokens' is not supported with this model.
temperature=0.01             400 Unsupported value: 'temperature' does not support 0.01 with this model. Only the default (1) value is supported.
temperature=1.0              200
top_p=0.1                    400 Unsupported parameter: 'top_p' is not supported with this model.
top_p=1                      200