Skip to content
This repository was archived by the owner on Aug 1, 2024. It is now read-only.

Commit 50d8328

Browse files
committed
move authorization to use Bearer with api key
1 parent cbf628f commit 50d8328

File tree

3 files changed

+7
-9
lines changed

3 files changed

+7
-9
lines changed

src/vendi/completions/completions.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ def create(
9797
data["stop"] = stop
9898

9999
_res = self.__client.post(
100-
uri=f"/v1/chat/completions/",
100+
uri=f"/v1/chat/completions",
101101
json_data=data,
102102
headers=extra_headers
103103
)
@@ -154,7 +154,7 @@ async def acreate(
154154
data["stop"] = stop
155155

156156
_res = await self.__aclient.post(
157-
path=f"/v1/chat/completions/",
157+
path=f"/v1/chat/completions",
158158
json=data,
159159
headers=extra_headers
160160
)
@@ -263,7 +263,7 @@ async def arun_batch_job(
263263
poll_interval: int = 5,
264264
) -> BatchInference:
265265
_res = await self.__aclient.post(
266-
path="/platform/v1/inference/batch/",
266+
path="/platform/v1/inference/batch",
267267
json={
268268
"dataset_id": str(dataset_id),
269269
"model_parameters": [{**i.model_dump(), **i.model_extra} for i in model_parameters]

src/vendi/core/ahttp_client.py

+2-5
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,8 @@ def __init__(self, base_url: str, timeout: int = 60):
99
"content-type": "application/json",
1010
}
1111

12-
def set_auth_header(self, access_key: str | None = None, jwt: str | None = None):
13-
if access_key:
14-
self.headers["x-api-key"] = access_key
15-
if jwt:
16-
self.headers["Authorization"] = f"Bearer {jwt}"
12+
def set_auth_header(self, api_key: str):
13+
self.headers["Authorization"] = f"Bearer {api_key}"
1714

1815
async def get(self, path: str, params: dict = None) -> dict:
1916
url = self.base_url + path

src/vendi/core/http_client.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,8 @@ def post(
4646

4747
def _set_headers(self, headers: Dict[str, str]) -> Dict[str, str]:
4848
_headers = {
49-
"x-api-key": self.__api_key,
49+
"Content-Type": "application/json",
50+
"Authorization": f"Bearer {self.__api_key}",
5051
}
5152
if headers:
5253
_headers.update(headers)

0 commit comments

Comments
 (0)