Files
Ali Khokhar 8d2e5b95f7 Refactor OpenAI Responses into modular adapter facade (#847)
## Summary

- Split monolithic `core/openai_responses/conversion.py` and `sse.py`
into focused protocol modules (input, output, stream, tools, reasoning,
events, etc.) behind an `OpenAIResponsesAdapter` facade.
- Wire `ClaudeProxyService.create_response()` through the adapter
instead of importing conversion helpers directly, tightening the
API/import boundary.
- Add Codex bridging for Responses `custom_tool_call` items and document
the adapter architecture in `ARCHITECTURE.md`.

## Test plan

- [x] `uv run pytest tests/core/openai_responses/
tests/api/test_openai_responses.py tests/cli/test_adapters.py
tests/contracts/test_import_boundaries.py`
- [x] Full CI via `.\scripts\ci.ps1`
2026-06-17 20:19:51 -07:00

23 lines
556 B
Python

"""Errors and error envelopes for OpenAI Responses compatibility."""
from __future__ import annotations
from typing import Any
class ResponsesConversionError(ValueError):
"""Raised when a Responses request cannot be converted deterministically."""
def openai_error_payload(*, message: str, error_type: str) -> dict[str, Any]:
"""Return an OpenAI-compatible error envelope."""
return {
"error": {
"message": message,
"type": error_type,
"param": None,
"code": None,
}
}