langroid 0.16.4__py3-none-any.whl → 0.16.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.
@@ -60,13 +60,11 @@ def parse_imperfect_json(json_string: str) -> Union[Dict[str, Any], List[Any]]:
60
60
  except (ValueError, SyntaxError):
61
61
  pass
62
62
 
63
- # If ast.literal_eval fails or returns non-dict/list, try json.loads
64
- try:
65
- json_string = repair_json(json_string)
66
- result = json.loads(json_string)
67
- if isinstance(result, (dict, list)):
68
- return result
69
- except json.JSONDecodeError:
63
+ # If ast.literal_eval fails or returns non-dict/list, try repair_json
64
+ json_repaired_obj = repair_json(json_string, return_objects=True)
65
+ if isinstance(json_repaired_obj, (dict, list)):
66
+ return json_repaired_obj
67
+ else:
70
68
  try:
71
69
  # fallback on yaml
72
70
  yaml_result = yaml.safe_load(json_string)
@@ -86,9 +84,14 @@ def try_repair_json_yaml(s: str) -> str | None:
86
84
  NOTE - replacing \n with space will result in format loss,
87
85
  which may matter in generated code (e.g. python, toml, etc)
88
86
  """
89
- s_repaired = repair_json(s)
90
- if s_repaired != "":
91
- return s_repaired # type: ignore
87
+ s_repaired_obj = repair_json(s, return_objects=True)
88
+ if isinstance(s_repaired_obj, list):
89
+ if len(s_repaired_obj) > 0:
90
+ s_repaired_obj = s_repaired_obj[0]
91
+ else:
92
+ s_repaired_obj = None
93
+ if s_repaired_obj is not None:
94
+ return json.dumps(s_repaired_obj) # type: ignore
92
95
  else:
93
96
  try:
94
97
  yaml_result = yaml.safe_load(s)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: langroid
3
- Version: 0.16.4
3
+ Version: 0.16.5
4
4
  Summary: Harness LLMs with Multi-Agent Programming
5
5
  License: MIT
6
6
  Author: Prasad Chalasani
@@ -55,7 +55,7 @@ Requires-Dist: grpcio (>=1.62.1,<2.0.0)
55
55
  Requires-Dist: halo (>=0.0.31,<0.0.32)
56
56
  Requires-Dist: huggingface-hub (>=0.21.2,<0.22.0) ; extra == "hf-transformers" or extra == "all" or extra == "transformers"
57
57
  Requires-Dist: jinja2 (>=3.1.2,<4.0.0)
58
- Requires-Dist: json-repair (>=0.27.0,<0.28.0)
58
+ Requires-Dist: json-repair (>=0.29.0,<0.30.0)
59
59
  Requires-Dist: lancedb (>=0.8.2,<0.9.0) ; extra == "vecdbs" or extra == "lancedb"
60
60
  Requires-Dist: litellm (>=1.30.1,<2.0.0) ; extra == "all" or extra == "litellm"
61
61
  Requires-Dist: lxml (>=4.9.3,<5.0.0)
@@ -87,7 +87,7 @@ langroid/parsing/config.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
87
87
  langroid/parsing/document_parser.py,sha256=WGnA5ADwMHliGJt6WW9rc4RiFXQcKU33b5zdPiGrtEY,24265
88
88
  langroid/parsing/image_text.py,sha256=sbLIQ5nHe2UnYUksBaQsmZGaX-X0qgEpPd7CEzi_z5M,910
89
89
  langroid/parsing/para_sentence_split.py,sha256=AJBzZojP3zpB-_IMiiHismhqcvkrVBQ3ZINoQyx_bE4,2000
90
- langroid/parsing/parse_json.py,sha256=8jqBLSZ0TWPI8d4h2FZv4898dqV5N-hFtxgYXlocm-w,4568
90
+ langroid/parsing/parse_json.py,sha256=aADo38bAHQhC8on4aWZZzVzSDy-dK35vRLZsFI2ewh8,4756
91
91
  langroid/parsing/parser.py,sha256=AgtmlVUvrkSG1l7-YZPX8rlldgXjh_HqXAMqpXkBxUo,11746
92
92
  langroid/parsing/repo_loader.py,sha256=3GjvPJS6Vf5L6gV2zOU8s-Tf1oq_fZm-IB_RL_7CTsY,29373
93
93
  langroid/parsing/routing.py,sha256=-FcnlqldzL4ZoxuDwXjQPNHgBe9F9-F4R6q7b_z9CvI,1232
@@ -138,8 +138,8 @@ langroid/vector_store/meilisearch.py,sha256=6frB7GFWeWmeKzRfLZIvzRjllniZ1cYj3Hmh
138
138
  langroid/vector_store/momento.py,sha256=qR-zBF1RKVHQZPZQYW_7g-XpTwr46p8HJuYPCkfJbM4,10534
139
139
  langroid/vector_store/qdrant_cloud.py,sha256=3im4Mip0QXLkR6wiqVsjV1QvhSElfxdFSuDKddBDQ-4,188
140
140
  langroid/vector_store/qdrantdb.py,sha256=v88lqFkepADvlN6lByUj9I4NEKa9X9lWH16uTPPbYrE,17457
141
- pyproject.toml,sha256=pWAWRj717icmsn0pbIcuLGcBCijdiCmR7Tyys3QqMV0,7157
142
- langroid-0.16.4.dist-info/LICENSE,sha256=EgVbvA6VSYgUlvC3RvPKehSg7MFaxWDsFuzLOsPPfJg,1065
143
- langroid-0.16.4.dist-info/METADATA,sha256=MGx_fZMWdPlv08_QKRecIwH2Q9Oc0aIOd4pyUojkjcU,56165
144
- langroid-0.16.4.dist-info/WHEEL,sha256=FMvqSimYX_P7y0a7UY-_Mc83r5zkBZsCYPm7Lr0Bsq4,88
145
- langroid-0.16.4.dist-info/RECORD,,
141
+ pyproject.toml,sha256=CziUU2MWpGqVP_a5LNAgkBacE8VmtsfTPZeoKlR31es,7157
142
+ langroid-0.16.5.dist-info/LICENSE,sha256=EgVbvA6VSYgUlvC3RvPKehSg7MFaxWDsFuzLOsPPfJg,1065
143
+ langroid-0.16.5.dist-info/METADATA,sha256=D61Of4YYZzlKZfw9qAM_3J8sOKV1dbhTQXz1XAUGvHg,56165
144
+ langroid-0.16.5.dist-info/WHEEL,sha256=FMvqSimYX_P7y0a7UY-_Mc83r5zkBZsCYPm7Lr0Bsq4,88
145
+ langroid-0.16.5.dist-info/RECORD,,
pyproject.toml CHANGED
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "langroid"
3
- version = "0.16.4"
3
+ version = "0.16.5"
4
4
  description = "Harness LLMs with Multi-Agent Programming"
5
5
  authors = ["Prasad Chalasani <pchalasani@gmail.com>"]
6
6
  readme = "README.md"
@@ -87,7 +87,7 @@ nest-asyncio = "^1.6.0"
87
87
  async-generator = "^1.10"
88
88
 
89
89
  python-magic = "^0.4.27"
90
- json-repair = "^0.27.0"
90
+ json-repair = "^0.29.0"
91
91
  cerebras-cloud-sdk = "^1.1.0"
92
92
 
93
93