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

31 lines
890 B
Python

"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
import httpx
from openrouter.errors import OpenRouterError
from openrouter.models import chatcompletionerror as models_chatcompletionerror
from openrouter.types import BaseModel
from typing import Optional
class ChatCompletionErrorData(BaseModel):
error: models_chatcompletionerror.Error
r"""Error object structure"""
class ChatCompletionError(OpenRouterError):
r"""Chat completion error response"""
data: ChatCompletionErrorData
def __init__(
self,
data: ChatCompletionErrorData,
raw_response: httpx.Response,
body: Optional[str] = None,
):
fallback = body or raw_response.text
message = str(data.error.message) or fallback
super().__init__(message, raw_response, body)
self.data = data