Files
openrouter-python-sdk-retry…/src/openrouter/utils/unmarshal_json_response.py
T
2025-08-22 10:31:13 -05:00

25 lines
586 B
Python

"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from typing import Any, Optional
import httpx
from .serializers import unmarshal_json
from openrouter import errors
def unmarshal_json_response(
typ: Any, http_res: httpx.Response, body: Optional[str] = None
) -> Any:
if body is None:
body = http_res.text
try:
return unmarshal_json(body, typ)
except Exception as e:
raise errors.ResponseValidationError(
"Response validation failed",
http_res,
e,
body,
) from e