Repository navigation
Conversation
…elax OpenRouter routing OpenAI requires all fields in structured output schemas to be listed as required. Add a dedicated schema variant and use it for OpenAI-routed models. Also default require_parameters to false to avoid OpenRouter filtering out providers that don't advertise support for every parameter.
Codecov Report✅ All modified and coverable lines are covered by tests.
Flags with carried forward coverage won't be shown. Click here to find out more.
... and 1 file with indirect coverage changes 🚀 New features to boost your workflow:
|
Jazzcort
left a comment
There was a problem hiding this comment.
Just some notes there for the detail of the decision I made. 😁
| class GatekeeperResult(BaseModel): | ||
| status: GatekeeperStatus | ||
| detail: str = "" | ||
| detail: Annotated[str, BeforeValidator(_empty_string_if_none)] = "" |
There was a problem hiding this comment.
With this we can eliminate the "" or None situation. Let me know ifstr | None is preferred more. 😁
|
|
||
| class OpenRouterProvider(BaseModel): | ||
| require_parameters: bool = True | ||
| require_parameters: bool = False |
There was a problem hiding this comment.
This change is because it strictly forces the parameters we provide in the request to match the supported parameters in the model's metadata.
As we can see here in https://openrouter.ai/api/v1/parameters/openai/gpt-5.2, temperature is not listed so when our request contains it with require_parameters=True we will hit a API error from OpenRouter.
I think we don't have to force the parameters we provide to strictly match what the model supports since usually those not supported parameters will be ignored gracefully. What do you think @owtaylor?
OpenAI requires all fields in structured output schemas to be listed as required. Add a dedicated schema variant and use it for OpenAI-routed models. Also default require_parameters to false to avoid OpenRouter filtering out providers that don't advertise support for every parameter.