Skip to content

Commit be02721

Browse files
added encoding to whisper_retrieve and removed it from whisper_status
1 parent f681656 commit be02721

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/unstract/llmwhisperer/client.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -285,7 +285,7 @@ def generate():
285285
"whisper_hash": response.headers["whisper-hash"],
286286
}
287287

288-
def whisper_status(self, whisper_hash: str, encoding: str = "utf-8") -> dict:
288+
def whisper_status(self, whisper_hash: str) -> dict:
289289
"""Retrieves the status of the whisper operation from the LLMWhisperer
290290
API.
291291
@@ -296,7 +296,6 @@ def whisper_status(self, whisper_hash: str, encoding: str = "utf-8") -> dict:
296296
297297
Args:
298298
whisper_hash (str): The hash of the whisper (returned by whisper method)
299-
encoding (str): The character encoding to use for processing the text. Defaults to "utf-8".
300299
301300
Returns:
302301
dict: A dictionary containing the status of the whisper operation. The keys in the
@@ -314,7 +313,6 @@ def whisper_status(self, whisper_hash: str, encoding: str = "utf-8") -> dict:
314313
prepared = req.prepare()
315314
s = requests.Session()
316315
response = s.send(prepared, timeout=self.api_timeout)
317-
response.encoding = encoding
318316
if response.status_code != 200:
319317
err = json.loads(response.text)
320318
err["status_code"] = response.status_code
@@ -323,7 +321,7 @@ def whisper_status(self, whisper_hash: str, encoding: str = "utf-8") -> dict:
323321
message["status_code"] = response.status_code
324322
return message
325323

326-
def whisper_retrieve(self, whisper_hash: str) -> dict:
324+
def whisper_retrieve(self, whisper_hash: str, encoding: str = "utf-8") -> dict:
327325
"""Retrieves the result of the whisper operation from the LLMWhisperer
328326
API.
329327
@@ -334,6 +332,7 @@ def whisper_retrieve(self, whisper_hash: str) -> dict:
334332
335333
Args:
336334
whisper_hash (str): The hash of the whisper operation.
335+
encoding (str): The character encoding to use for processing the text. Defaults to "utf-8".
337336
338337
Returns:
339338
dict: A dictionary containing the status code and the extracted text from the whisper operation.
@@ -350,6 +349,7 @@ def whisper_retrieve(self, whisper_hash: str) -> dict:
350349
prepared = req.prepare()
351350
s = requests.Session()
352351
response = s.send(prepared, timeout=self.api_timeout)
352+
response.encoding = encoding
353353
if response.status_code != 200:
354354
err = json.loads(response.text)
355355
err["status_code"] = response.status_code

0 commit comments

Comments
 (0)