mirror of
https://github.com/BerriAI/litellm.git
synced 2026-10-08 03:08:45 +00:00
style(mcp): unquote annotations and use PEP 604 unions in the faults package
This commit is contained in:
parent
9e94f2be14
commit
e8090028f3
3 changed files with 5 additions and 5 deletions
|
|
@ -35,7 +35,7 @@ def _safe_json(response: httpx.Response) -> object:
|
|||
return None
|
||||
|
||||
|
||||
def _bounded_field(value: object) -> "str | None":
|
||||
def _bounded_field(value: object) -> str | None:
|
||||
if not isinstance(value, str) or not value:
|
||||
return None
|
||||
return value[:MAX_WIRE_FIELD_CHARS]
|
||||
|
|
|
|||
|
|
@ -58,7 +58,7 @@ def render_token_fault(fault: UpstreamOAuthFault) -> JSONResponse:
|
|||
assert_never(fault.tag)
|
||||
|
||||
|
||||
def dcr_fault_detail(fault: UpstreamOAuthFault) -> "tuple[int, str]":
|
||||
def dcr_fault_detail(fault: UpstreamOAuthFault) -> tuple[int, str]:
|
||||
"""Status and detail string for a registration fault, raised as HTTPException by the caller.
|
||||
RFC 7591 §3.2.2 defines registration errors as 400, so a contract-conformant rejection is 400
|
||||
regardless of the status the upstream chose; everything else is a 502 upstream fault."""
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ when an upstream's status and error code are relayed independently.
|
|||
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import Literal, Optional, TypeAlias
|
||||
from typing import Literal, TypeAlias
|
||||
|
||||
from pydantic import BaseModel, ConfigDict
|
||||
|
||||
|
|
@ -33,8 +33,8 @@ class CallerRejected(BaseModel):
|
|||
model_config = ConfigDict(frozen=True)
|
||||
tag: Literal["caller_rejected"] = "caller_rejected"
|
||||
code: str
|
||||
description: Optional[str] = None
|
||||
error_uri: Optional[str] = None
|
||||
description: str | None = None
|
||||
error_uri: str | None = None
|
||||
|
||||
|
||||
class GatewayCredentialsRejected(BaseModel):
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue