mirror of
https://github.com/wassname/openrouter-python-sdk-retry-errors.git
synced 2026-08-01 12:40:23 +08:00
25 lines
586 B
Python
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
|