new sdk v0.1.85 (#2421)

This commit is contained in:
Shuchang Zheng
2025-05-21 21:31:10 -07:00
committed by GitHub
parent 0b21f1accb
commit 83f8dca159
49 changed files with 2510 additions and 463 deletions

View File

@@ -7,16 +7,8 @@ from .http_client import AsyncHttpClient
class BaseClientWrapper:
def __init__(
self,
*,
api_key: typing.Optional[str] = None,
authorization: typing.Optional[str] = None,
base_url: str,
timeout: typing.Optional[float] = None,
):
def __init__(self, *, api_key: typing.Optional[str] = None, base_url: str, timeout: typing.Optional[float] = None):
self._api_key = api_key
self._authorization = authorization
self._base_url = base_url
self._timeout = timeout
@@ -28,8 +20,6 @@ class BaseClientWrapper:
}
if self._api_key is not None:
headers["x-api-key"] = self._api_key
if self._authorization is not None:
headers["authorization"] = self._authorization
return headers
def get_base_url(self) -> str:
@@ -44,12 +34,11 @@ class SyncClientWrapper(BaseClientWrapper):
self,
*,
api_key: typing.Optional[str] = None,
authorization: typing.Optional[str] = None,
base_url: str,
timeout: typing.Optional[float] = None,
httpx_client: httpx.Client,
):
super().__init__(api_key=api_key, authorization=authorization, base_url=base_url, timeout=timeout)
super().__init__(api_key=api_key, base_url=base_url, timeout=timeout)
self.httpx_client = HttpClient(
httpx_client=httpx_client,
base_headers=self.get_headers,
@@ -63,12 +52,11 @@ class AsyncClientWrapper(BaseClientWrapper):
self,
*,
api_key: typing.Optional[str] = None,
authorization: typing.Optional[str] = None,
base_url: str,
timeout: typing.Optional[float] = None,
httpx_client: httpx.AsyncClient,
):
super().__init__(api_key=api_key, authorization=authorization, base_url=base_url, timeout=timeout)
super().__init__(api_key=api_key, base_url=base_url, timeout=timeout)
self.httpx_client = AsyncHttpClient(
httpx_client=httpx_client,
base_headers=self.get_headers,