Skip to content

Commit c6e1b50

Browse files
changed encoder to encoding and added encoding to whisper_status
1 parent 5846fc5 commit c6e1b50

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/unstract/llmwhisperer/client.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ def whisper(
169169
ocr_provider: str = "advanced",
170170
line_splitter_tolerance: float = 0.4,
171171
horizontal_stretch_factor: float = 1.0,
172-
encoder = "ISO-8859-1"
172+
encoding: str = "utf-8"
173173
) -> dict:
174174
"""
175175
Sends a request to the LLMWhisperer API to process a document.
@@ -270,7 +270,7 @@ def generate():
270270
prepared = req.prepare()
271271
s = requests.Session()
272272
response = s.send(prepared, timeout=self.api_timeout, stream=should_stream)
273-
response.encoding = encoder
273+
response.encoding = encoding
274274
if response.status_code != 200 and response.status_code != 202:
275275
message = json.loads(response.text)
276276
message["status_code"] = response.status_code
@@ -285,7 +285,7 @@ def generate():
285285
"whisper_hash": response.headers["whisper-hash"],
286286
}
287287

288-
def whisper_status(self, whisper_hash: str) -> dict:
288+
def whisper_status(self, whisper_hash: str, encoding: str = "utf-8") -> dict:
289289
"""Retrieves the status of the whisper operation from the LLMWhisperer
290290
API.
291291
@@ -313,6 +313,7 @@ def whisper_status(self, whisper_hash: str) -> dict:
313313
prepared = req.prepare()
314314
s = requests.Session()
315315
response = s.send(prepared, timeout=self.api_timeout)
316+
response.encoding = encoding
316317
if response.status_code != 200:
317318
err = json.loads(response.text)
318319
err["status_code"] = response.status_code

0 commit comments

Comments
 (0)