mirror of
https://github.com/BerriAI/litellm.git
synced 2026-10-03 02:22:24 +00:00
Fix xAI OAuth CI failures
This commit is contained in:
parent
d0f15559e2
commit
653fa73864
2 changed files with 12 additions and 10 deletions
|
|
@ -9,7 +9,7 @@ import time
|
|||
import uuid
|
||||
import webbrowser
|
||||
from http.server import BaseHTTPRequestHandler, HTTPServer
|
||||
from typing import Any, Dict, Optional, Tuple
|
||||
from typing import Any, Dict, Optional, Tuple, Union
|
||||
from urllib.parse import parse_qs, urlencode, urlparse
|
||||
|
||||
import httpx
|
||||
|
|
@ -17,7 +17,7 @@ import httpx
|
|||
from litellm._logging import verbose_logger
|
||||
from litellm.constants import XAI_API_BASE
|
||||
from litellm.exceptions import AuthenticationError
|
||||
from litellm.llms.custom_httpx.http_handler import _get_httpx_client
|
||||
from litellm.llms.custom_httpx.http_handler import HTTPHandler, _get_httpx_client
|
||||
from litellm.llms.xai.chat.transformation import XAIChatConfig
|
||||
from litellm.llms.xai.responses.transformation import XAIResponsesAPIConfig
|
||||
from litellm.secret_managers.main import get_secret_str
|
||||
|
|
@ -92,7 +92,9 @@ class _CallbackServer(HTTPServer):
|
|||
|
||||
|
||||
class XAIOAuthAuthenticator:
|
||||
def __init__(self, http_client: Optional[httpx.Client] = None) -> None:
|
||||
def __init__(
|
||||
self, http_client: Optional[Union[httpx.Client, HTTPHandler]] = None
|
||||
) -> None:
|
||||
self.token_dir = get_secret_str("XAI_OAUTH_TOKEN_DIR") or os.path.expanduser(
|
||||
"~/.config/litellm/xai_oauth"
|
||||
)
|
||||
|
|
@ -188,7 +190,7 @@ class XAIOAuthAuthenticator:
|
|||
self._write_auth_file(auth_data)
|
||||
return auth_data
|
||||
|
||||
def _client(self) -> httpx.Client:
|
||||
def _client(self) -> Union[httpx.Client, HTTPHandler]:
|
||||
return self.http_client or _get_httpx_client()
|
||||
|
||||
def _ensure_token_dir(self) -> None:
|
||||
|
|
|
|||
12
ui/litellm-dashboard/src/lib/http/schema.d.ts
generated
vendored
12
ui/litellm-dashboard/src/lib/http/schema.d.ts
generated
vendored
|
|
@ -43119,13 +43119,13 @@ export interface operations {
|
|||
/**
|
||||
* @description Unified rate-limit error.
|
||||
*
|
||||
* Every rate-limit condition surfaced by litellm — whether it originated from
|
||||
* an upstream LLM provider, a vendor batch endpoint, or one of litellm's own
|
||||
* proxy-side limiters (parallel-requests, dynamic-rate, batch-rate, budget,
|
||||
* max-iterations, etc.) — is raised as an instance of this class.
|
||||
* Every rate-limit condition surfaced by litellm — whether it originated from
|
||||
* an upstream LLM provider, a vendor batch endpoint, or one of litellm's own
|
||||
* proxy-side limiters (parallel-requests, dynamic-rate, batch-rate, budget,
|
||||
* max-iterations, etc.) — is raised as an instance of this class.
|
||||
*
|
||||
* The :attr:`category` attribute lets callers distinguish the source. See
|
||||
* :class:`RateLimitErrorCategory` for the available values.
|
||||
* The :attr:`category` attribute lets callers distinguish the source. See
|
||||
* :class:`RateLimitErrorCategory` for the available values.
|
||||
*/
|
||||
429: {
|
||||
headers: {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue