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 25
25
from typing import IO
26
26
27
27
import requests
28
+ from typing import Optional , Dict
28
29
29
30
BASE_URL_V2 = "https://llmwhisperer-api.us-central.unstract.com/api/v2"
30
31
@@ -76,6 +77,7 @@ def __init__(
76
77
base_url : str = "" ,
77
78
api_key : str = "" ,
78
79
logging_level : str = "" ,
80
+ custom_headers : Optional [Dict [str , str ]] = None ,
79
81
):
80
82
"""Initializes the LLMWhispererClient with the given parameters.
81
83
@@ -92,6 +94,12 @@ def __init__(
92
94
value of the LLMWHISPERER_LOGGING_LEVEL
93
95
environment variable, or "DEBUG" if the
94
96
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.
95
103
"""
96
104
if logging_level == "" :
97
105
logging_level = os .getenv ("LLMWHISPERER_LOGGING_LEVEL" , "DEBUG" )
@@ -117,6 +125,8 @@ def __init__(
117
125
self .api_key = api_key
118
126
119
127
self .headers = {"unstract-key" : self .api_key }
128
+ if custom_headers :
129
+ self .headers .update (custom_headers )
120
130
# For test purpose
121
131
# self.headers = {
122
132
# "Subscription-Id": "python-client",
You can’t perform that action at this time.
0 commit comments