Skip to content

Commit 8a4951c

Browse files
FIX: Changes for new highlight (#124)
* Changes for new highlight * SDK version bump
1 parent 20b23cc commit 8a4951c

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

src/unstract/sdk/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
__version__ = "0.53.1"
1+
__version__ = "0.53.2"
22

33

44
def get_sdk_version():

src/unstract/sdk/llm.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -95,18 +95,18 @@ def complete(
9595
try:
9696
response: CompletionResponse = self._llm_instance.complete(prompt, **kwargs)
9797
process_text_output = {}
98+
if extract_json:
99+
match = LLM.json_regex.search(response.text)
100+
if match:
101+
response.text = match.group(0)
98102
if process_text:
99103
try:
100-
process_text_output = process_text(response, LLM.json_regex)
104+
process_text_output = process_text(response, extract_json)
101105
if not isinstance(process_text_output, dict):
102106
process_text_output = {}
103107
except Exception as e:
104108
logger.error(f"Error occured inside function 'process_text': {e}")
105109
process_text_output = {}
106-
if extract_json:
107-
match = LLM.json_regex.search(response.text)
108-
if match:
109-
response.text = match.group(0)
110110
return {LLM.RESPONSE: response, **process_text_output}
111111
except Exception as e:
112112
raise parse_llm_err(e) from e

0 commit comments

Comments
 (0)