mirror of
https://github.com/wassname/openrouter-python-sdk-retry-errors.git
synced 2026-08-01 12:40:23 +08:00
first commit
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
"""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
|
||||
Reference in New Issue
Block a user