File tree Expand file tree Collapse file tree 1 file changed +10
-0
lines changed
src/unstract/llmwhisperer Expand file tree Collapse file tree 1 file changed +10
-0
lines changed Original file line number Diff line number Diff line change 2525from typing import IO
2626
2727import requests
28+ from typing import Optional , Dict
2829
2930BASE_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",
You can’t perform that action at this time.
0 commit comments