llm-ie 0.3.4__py3-none-any.whl → 0.3.5__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
llm_ie/extractors.py CHANGED
@@ -1,6 +1,7 @@
1
1
  import abc
2
2
  import re
3
3
  import json
4
+ import json_repair
4
5
  import inspect
5
6
  import importlib.resources
6
7
  import warnings
@@ -117,7 +118,12 @@ class Extractor:
117
118
  dict_obj = json.loads(dict_str)
118
119
  out.append(dict_obj)
119
120
  except json.JSONDecodeError:
120
- warnings.warn(f'Post-processing failed:\n{dict_str}', RuntimeWarning)
121
+ dict_obj = json_repair.repair_json(dict_str, skip_json_loads=True, return_objects=True)
122
+ if dict_obj:
123
+ warnings.warn(f'JSONDecodeError detected, fixed with repair_json:\n{dict_str}', RuntimeWarning)
124
+ out.append(dict_obj)
125
+ else:
126
+ warnings.warn(f'JSONDecodeError could not be fixed:\n{dict_str}', RuntimeWarning)
121
127
  return out
122
128
 
123
129
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: llm-ie
3
- Version: 0.3.4
3
+ Version: 0.3.5
4
4
  Summary: An LLM-powered tool that transforms everyday language into robust information extraction pipelines.
5
5
  License: MIT
6
6
  Author: Enshuo (David) Hsu
@@ -10,6 +10,7 @@ Classifier: Programming Language :: Python :: 3
10
10
  Classifier: Programming Language :: Python :: 3.11
11
11
  Classifier: Programming Language :: Python :: 3.12
12
12
  Requires-Dist: colorama (>=0.4.6,<0.5.0)
13
+ Requires-Dist: json_repair (>=0.30,<0.31)
13
14
  Requires-Dist: nltk (>=3.8,<4.0)
14
15
  Description-Content-Type: text/markdown
15
16
 
@@ -16,8 +16,8 @@ llm_ie/asset/prompt_guide/SentenceFrameExtractor_prompt_guide.txt,sha256=oKH_QeD
16
16
  llm_ie/asset/prompt_guide/SentenceReviewFrameExtractor_prompt_guide.txt,sha256=oKH_QeDgpw771ZdHk3L7DYz2Jvfm7OolUoTiJyMJI30,9541
17
17
  llm_ie/data_types.py,sha256=hPz3WOeAzfn2QKmb0CxHmRdQWZQ4G9zq8U-RJBVFdYk,14329
18
18
  llm_ie/engines.py,sha256=PTYs7s_iCPmI-yFUCVCPY_cMGS77ma2VGoz4rdNkODI,9308
19
- llm_ie/extractors.py,sha256=j9L9USybJBmYZM4RAjGO6DR4StYBgzhqCN6nEFZZQVQ,64523
19
+ llm_ie/extractors.py,sha256=WM-9ZmhGYCYzXLPiShfF42grezjRz42JbgXwueixZRI,64870
20
20
  llm_ie/prompt_editor.py,sha256=Xc5ZHsEnM8-YYITokIsM6BVsf2Ec_8ajJDaldPf-P8U,8577
21
- llm_ie-0.3.4.dist-info/METADATA,sha256=-5Tf9TCWczCVOsdMavkBZ-KnYPGnbNrV1rsU-pMHfPA,41266
22
- llm_ie-0.3.4.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
23
- llm_ie-0.3.4.dist-info/RECORD,,
21
+ llm_ie-0.3.5.dist-info/METADATA,sha256=y5nABgPeeMPEkZ58WoOBR3sgFrKOE_mF4fqaHK59K1w,41308
22
+ llm_ie-0.3.5.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
23
+ llm_ie-0.3.5.dist-info/RECORD,,
File without changes