llm-to-json 0.0.23__tar.gz → 0.0.26__tar.gz

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.
@@ -1,13 +1,13 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: llm-to-json
3
- Version: 0.0.23
3
+ Version: 0.0.26
4
4
  Summary: Tiny wrapper exposing Prompture helpers to convert LLM output into JSON.
5
5
  Author-email: Juan Denis <juan@vene.co>
6
6
  License: MIT
7
7
  Keywords: llm,json,prompt,structured-output
8
8
  Requires-Python: >=3.10
9
9
  Description-Content-Type: text/markdown
10
- Requires-Dist: prompture>=0.0.1
10
+ Requires-Dist: prompture>=0.0.26
11
11
 
12
12
  # llm-to-json
13
13
 
@@ -0,0 +1,23 @@
1
+ # packages/llm_to_json/__init__.py
2
+ try:
3
+ from prompture import extract_and_jsonify as _extract_and_jsonify
4
+ from prompture.drivers import OllamaDriver
5
+ except Exception:
6
+ from prompture.core import extract_and_jsonify as _extract_and_jsonify
7
+ from prompture.drivers import OllamaDriver
8
+
9
+ def from_llm_text(text: str, schema: dict, driver: dict | None = None):
10
+ """Extract JSON from text using LLM.
11
+
12
+ Args:
13
+ text: Text to extract JSON from
14
+ schema: JSON schema to validate against
15
+ driver: Optional LLM driver (defaults to local Ollama if not provided)
16
+
17
+ Returns:
18
+ Extracted and validated JSON object
19
+ """
20
+ if driver is None:
21
+ driver = OllamaDriver(endpoint="http://localhost:11434", model="gemma:latest")
22
+ result = _extract_and_jsonify(driver, text, schema)
23
+ return result["json_object"]
@@ -1,13 +1,13 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: llm-to-json
3
- Version: 0.0.23
3
+ Version: 0.0.26
4
4
  Summary: Tiny wrapper exposing Prompture helpers to convert LLM output into JSON.
5
5
  Author-email: Juan Denis <juan@vene.co>
6
6
  License: MIT
7
7
  Keywords: llm,json,prompt,structured-output
8
8
  Requires-Python: >=3.10
9
9
  Description-Content-Type: text/markdown
10
- Requires-Dist: prompture>=0.0.1
10
+ Requires-Dist: prompture>=0.0.26
11
11
 
12
12
  # llm-to-json
13
13
 
@@ -0,0 +1 @@
1
+ prompture>=0.0.26
@@ -4,12 +4,12 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "llm-to-json"
7
- version = "0.0.23"
7
+ version = "0.0.26"
8
8
  description = "Tiny wrapper exposing Prompture helpers to convert LLM output into JSON."
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.10"
11
11
  keywords = [ "llm", "json", "prompt", "structured-output",]
12
- dependencies = [ "prompture>=0.0.1",]
12
+ dependencies = [ "prompture>=0.0.26",]
13
13
  [[project.authors]]
14
14
  name = "Juan Denis"
15
15
  email = "juan@vene.co"
@@ -1,13 +0,0 @@
1
- # packages/llm_to_json/__init__.py
2
- try:
3
- from prompture import extract_and_jsonify as _extract_and_jsonify
4
- from prompture.drivers.mock_driver import MockDriver
5
- except Exception:
6
- from prompture.core import extract_and_jsonify as _extract_and_jsonify
7
- from prompture.drivers.mock_driver import MockDriver
8
-
9
- def from_llm_text(text: str, schema: dict, driver: dict | None = None):
10
- if driver is None:
11
- driver = MockDriver()
12
- result = _extract_and_jsonify(driver, text, schema)
13
- return result["json_object"]
@@ -1 +0,0 @@
1
- prompture>=0.0.1
File without changes
File without changes