File tree Expand file tree Collapse file tree 1 file changed +3
-0
lines changed
src/unstract/llmwhisperer Expand file tree Collapse file tree 1 file changed +3
-0
lines changed Original file line number Diff line number Diff line change @@ -169,6 +169,7 @@ def whisper(
169
169
ocr_provider : str = "advanced" ,
170
170
line_splitter_tolerance : float = 0.4 ,
171
171
horizontal_stretch_factor : float = 1.0 ,
172
+ encoder = "ISO-8859-1"
172
173
) -> dict :
173
174
"""
174
175
Sends a request to the LLMWhisperer API to process a document.
@@ -190,6 +191,7 @@ def whisper(
190
191
ocr_provider (str, optional): The OCR provider. Can be "advanced" or "basic". Defaults to "advanced".
191
192
line_splitter_tolerance (float, optional): The line splitter tolerance. Defaults to 0.4.
192
193
horizontal_stretch_factor (float, optional): The horizontal stretch factor. Defaults to 1.0.
194
+ encoder (str): The character encoding to use for processing the text. Defaults to "ISO-8859-1".
193
195
194
196
Returns:
195
197
dict: The response from the API as a dictionary.
@@ -268,6 +270,7 @@ def generate():
268
270
prepared = req .prepare ()
269
271
s = requests .Session ()
270
272
response = s .send (prepared , timeout = self .api_timeout , stream = should_stream )
273
+ response .encoding = encoder
271
274
if response .status_code != 200 and response .status_code != 202 :
272
275
message = json .loads (response .text )
273
276
message ["status_code" ] = response .status_code
You can’t perform that action at this time.
0 commit comments