Skip to content

Commit 886af3c

Browse files
[Client] Add Auth headers to the python async routes (#434)
* add Auth headers to the async routes * bump version
1 parent 5585d8e commit 886af3c

File tree

4 files changed

+10
-6
lines changed

4 files changed

+10
-6
lines changed

clients/python/llmengine/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15-
__version__ = "0.0.0b24"
15+
__version__ = "0.0.0b25"
1616

1717
import os
1818
from typing import Sequence

clients/python/llmengine/api_engine.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
from urllib.parse import urljoin
99

1010
import requests
11-
from aiohttp import ClientSession, ClientTimeout
11+
from aiohttp import BasicAuth, ClientSession, ClientTimeout
1212
from llmengine.errors import parse_error
1313

1414
SPELLBOOK_API_URL = "https://api.spellbook.scale.com/llm-engine/"
@@ -163,7 +163,9 @@ async def apost_sync(
163163
) -> Dict[str, Any]:
164164
api_key = get_api_key()
165165
async with ClientSession(
166-
timeout=ClientTimeout(timeout), headers={"x-api-key": api_key}
166+
timeout=ClientTimeout(timeout),
167+
headers={"x-api-key": api_key},
168+
auth=BasicAuth(api_key, ""),
167169
) as session:
168170
async with session.post(
169171
urljoin(LLM_ENGINE_BASE_PATH, resource_name), json=data
@@ -179,7 +181,9 @@ async def apost_stream(
179181
) -> AsyncIterable[Dict[str, Any]]:
180182
api_key = get_api_key()
181183
async with ClientSession(
182-
timeout=ClientTimeout(timeout), headers={"x-api-key": api_key}
184+
timeout=ClientTimeout(timeout),
185+
headers={"x-api-key": api_key},
186+
auth=BasicAuth(api_key, ""),
183187
) as session:
184188
async with session.post(
185189
urljoin(LLM_ENGINE_BASE_PATH, resource_name), json=data

clients/python/pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.poetry]
22
name = "scale-llm-engine"
3-
version = "0.0.0.beta24"
3+
version = "0.0.0.beta25"
44
description = "Scale LLM Engine Python client"
55
license = "Apache-2.0"
66
authors = ["Phil Chen <[email protected]>"]

clients/python/setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@
33
setup(
44
name="scale-llm-engine",
55
python_requires=">=3.7",
6-
version="0.0.0.beta24",
6+
version="0.0.0.beta25",
77
packages=find_packages(),
88
)

0 commit comments

Comments
 (0)