mirror of
https://github.com/wassname/openrouter-python-sdk-retry-errors.git
synced 2026-07-31 12:30:30 +08:00
31 lines
890 B
Python
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
|