Skip to content

Commit ff6c8e2

Browse files
committed
header updated
1 parent 519f76a commit ff6c8e2

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/unstract/llmwhisperer/client_v2.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
from typing import IO
2626

2727
import requests
28+
from typing import Optional, Dict
2829

2930
BASE_URL_V2 = "https://llmwhisperer-api.us-central.unstract.com/api/v2"
3031

@@ -76,6 +77,7 @@ def __init__(
7677
base_url: str = "",
7778
api_key: str = "",
7879
logging_level: str = "",
80+
custom_headers: Optional[Dict[str, str]] = None,
7981
):
8082
"""Initializes the LLMWhispererClient with the given parameters.
8183
@@ -92,6 +94,12 @@ def __init__(
9294
value of the LLMWHISPERER_LOGGING_LEVEL
9395
environment variable, or "DEBUG" if the
9496
environment variable is not set.
97+
custom_headers (Optional[Dict[str, str]], optional): Custom headers to add to
98+
every request. These will
99+
be merged with default
100+
headers, with custom
101+
headers taking precedence.
102+
Defaults to None.
95103
"""
96104
if logging_level == "":
97105
logging_level = os.getenv("LLMWHISPERER_LOGGING_LEVEL", "DEBUG")
@@ -117,6 +125,8 @@ def __init__(
117125
self.api_key = api_key
118126

119127
self.headers = {"unstract-key": self.api_key}
128+
if custom_headers:
129+
self.headers.update(custom_headers)
120130
# For test purpose
121131
# self.headers = {
122132
# "Subscription-Id": "python-client",

0 commit comments

Comments
 (0)