hermes: normalize routed vision messages

This commit is contained in:
jenkins 2026-08-16 07:00:50 -03:00
parent 5dd13368c6
commit bfd53100d9
2 changed files with 23 additions and 1 deletions

View File

@ -224,7 +224,7 @@ def _upstream_headers(token: str) -> dict[str, str]:
def _normalize_input_images(response_input: list[Any]) -> None:
"""Normalize Chat-Completions image parts for the Codex Responses API."""
for item in response_input:
if not isinstance(item, dict) or item.get("type") != "message":
if not isinstance(item, dict):
continue
content = item.get("content")
if not isinstance(content, list):

View File

@ -779,6 +779,28 @@ def test_codex_broker_auth_and_request_contract(tmp_path: Path, monkeypatch):
"image_url": "data:image/png;base64,cHJpdmF0ZQ==",
"detail": "high",
}
switchyard_image_items = [
{
"role": "user",
"content": [
{"type": "input_text", "text": "What color is this?"},
{
"type": "image_url",
"image_url": {
"url": "data:image/png;base64,cHJpdmF0ZQ==",
"detail": "auto",
},
},
],
}
]
assert module._validate_payload(
{"model": "gpt-5.6-terra", "input": switchyard_image_items}
)["input"][0]["content"][1] == {
"type": "input_image",
"image_url": "data:image/png;base64,cHJpdmF0ZQ==",
"detail": "auto",
}
with pytest.raises(ValueError, match="non-empty Responses image URL"):
module._validate_payload(
{