@solvers-hub/llm-json 0.1.7 → 0.1.8

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.
Files changed (34) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +1 -0
  3. package/docs/classes/LlmJson.html +5 -5
  4. package/docs/index.html +2 -1
  5. package/docs/interfaces/ExtractOptions.html +3 -3
  6. package/docs/interfaces/ExtractResult.html +4 -4
  7. package/docs/interfaces/JsonBlock.html +6 -6
  8. package/docs/interfaces/JsonParseError.html +4 -4
  9. package/docs/interfaces/SchemaDefinition.html +3 -3
  10. package/docs/interfaces/ValidationResult.html +5 -5
  11. package/docs-md/README.md +55 -55
  12. package/docs-md/classes/LlmJson.md +147 -147
  13. package/docs-md/interfaces/ExtractOptions.md +48 -48
  14. package/docs-md/interfaces/ExtractResult.md +49 -49
  15. package/docs-md/interfaces/JsonBlock.md +75 -75
  16. package/docs-md/interfaces/JsonParseError.md +49 -49
  17. package/docs-md/interfaces/SchemaDefinition.md +36 -36
  18. package/docs-md/interfaces/ValidationResult.md +62 -62
  19. package/docs-md/modules.md +28 -28
  20. package/package.json +52 -52
  21. package/dist/examples/example.d.ts +0 -1
  22. package/dist/examples/example.js +0 -96
  23. /package/dist/{src/array-extractor.d.ts → array-extractor.d.ts} +0 -0
  24. /package/dist/{src/array-extractor.js → array-extractor.js} +0 -0
  25. /package/dist/{src/corrector.d.ts → corrector.d.ts} +0 -0
  26. /package/dist/{src/corrector.js → corrector.js} +0 -0
  27. /package/dist/{src/extractor.d.ts → extractor.d.ts} +0 -0
  28. /package/dist/{src/extractor.js → extractor.js} +0 -0
  29. /package/dist/{src/index.d.ts → index.d.ts} +0 -0
  30. /package/dist/{src/index.js → index.js} +0 -0
  31. /package/dist/{src/types.d.ts → types.d.ts} +0 -0
  32. /package/dist/{src/types.js → types.js} +0 -0
  33. /package/dist/{src/validator.d.ts → validator.d.ts} +0 -0
  34. /package/dist/{src/validator.js → validator.js} +0 -0
@@ -1,28 +1,28 @@
1
- [@solvers-hub/llm-json](README.md) / Exports
2
-
3
- # @solvers-hub/llm-json
4
-
5
- ## Table of contents
6
-
7
- ### References
8
-
9
- - [default](modules.md#default)
10
-
11
- ### Classes
12
-
13
- - [LlmJson](classes/LlmJson.md)
14
-
15
- ### Interfaces
16
-
17
- - [ExtractOptions](interfaces/ExtractOptions.md)
18
- - [ExtractResult](interfaces/ExtractResult.md)
19
- - [JsonBlock](interfaces/JsonBlock.md)
20
- - [JsonParseError](interfaces/JsonParseError.md)
21
- - [SchemaDefinition](interfaces/SchemaDefinition.md)
22
- - [ValidationResult](interfaces/ValidationResult.md)
23
-
24
- ## References
25
-
26
- ### default
27
-
28
- Renames and re-exports [LlmJson](classes/LlmJson.md)
1
+ [@solvers-hub/llm-json](README.md) / Exports
2
+
3
+ # @solvers-hub/llm-json
4
+
5
+ ## Table of contents
6
+
7
+ ### References
8
+
9
+ - [default](modules.md#default)
10
+
11
+ ### Classes
12
+
13
+ - [LlmJson](classes/LlmJson.md)
14
+
15
+ ### Interfaces
16
+
17
+ - [ExtractOptions](interfaces/ExtractOptions.md)
18
+ - [ExtractResult](interfaces/ExtractResult.md)
19
+ - [JsonBlock](interfaces/JsonBlock.md)
20
+ - [JsonParseError](interfaces/JsonParseError.md)
21
+ - [SchemaDefinition](interfaces/SchemaDefinition.md)
22
+ - [ValidationResult](interfaces/ValidationResult.md)
23
+
24
+ ## References
25
+
26
+ ### default
27
+
28
+ Renames and re-exports [LlmJson](classes/LlmJson.md)
package/package.json CHANGED
@@ -1,53 +1,53 @@
1
- {
2
- "name": "@solvers-hub/llm-json",
3
- "version": "0.1.7",
4
- "description": "A TypeScript SDK to extract and correct JSON from LLM outputs",
5
- "main": "dist/index.js",
6
- "types": "dist/index.d.ts",
7
- "author": "Solvers Hub",
8
- "license": "MIT",
9
- "scripts": {
10
- "build": "tsc",
11
- "test": "jest",
12
- "test:coverage": "jest --coverage",
13
- "lint": "eslint src/**/*.ts",
14
- "prepublishOnly": "npm run build && npm run docs",
15
- "example:run": "ts-node",
16
- "docs": "typedoc --out docs src",
17
- "docs:md": "typedoc --out docs-md --plugin typedoc-plugin-markdown src"
18
- },
19
- "repository": {
20
- "type": "git",
21
- "url": "https://github.com/solvers-hub/llm-json.git"
22
- },
23
- "bugs": {
24
- "url": "https://github.com/solvers-hub/llm-json/issues"
25
- },
26
- "homepage": "https://github.com/solvers-hub/llm-json#readme",
27
- "keywords": [
28
- "llm",
29
- "json",
30
- "extractor",
31
- "parser"
32
- ],
33
- "devDependencies": {
34
- "@types/jest": "^29.5.0",
35
- "@types/node": "^18.15.11",
36
- "jest": "^29.5.0",
37
- "ts-jest": "^29.1.0",
38
- "ts-node": "^10.9.1",
39
- "typedoc": "^0.25.12",
40
- "typedoc-plugin-markdown": "^3.17.1",
41
- "typescript": "^5.0.4"
42
- },
43
- "dependencies": {
44
- "ajv": "^8.17.1",
45
- "ajv-formats": "^3.0.1"
46
- },
47
- "files": [
48
- "dist/**/*",
49
- "docs/**/*",
50
- "docs-md/**/*",
51
- "examples/**/*"
52
- ]
1
+ {
2
+ "name": "@solvers-hub/llm-json",
3
+ "version": "0.1.8",
4
+ "description": "A TypeScript SDK to extract and correct JSON from LLM outputs",
5
+ "main": "dist/index.js",
6
+ "types": "dist/index.d.ts",
7
+ "author": "Solvers Hub",
8
+ "license": "MIT",
9
+ "scripts": {
10
+ "build": "tsc",
11
+ "test": "jest",
12
+ "test:coverage": "jest --coverage",
13
+ "lint": "eslint src/**/*.ts",
14
+ "prepublishOnly": "npm run build && npm run docs",
15
+ "example:run": "ts-node",
16
+ "docs": "typedoc --out docs src",
17
+ "docs:md": "typedoc --out docs-md --plugin typedoc-plugin-markdown src"
18
+ },
19
+ "repository": {
20
+ "type": "git",
21
+ "url": "https://github.com/solvers-hub/llm-json.git"
22
+ },
23
+ "bugs": {
24
+ "url": "https://github.com/solvers-hub/llm-json/issues"
25
+ },
26
+ "homepage": "https://github.com/solvers-hub/llm-json#readme",
27
+ "keywords": [
28
+ "llm",
29
+ "json",
30
+ "extractor",
31
+ "parser"
32
+ ],
33
+ "devDependencies": {
34
+ "@types/jest": "^29.5.0",
35
+ "@types/node": "^18.15.11",
36
+ "jest": "^29.5.0",
37
+ "ts-jest": "^29.1.0",
38
+ "ts-node": "^10.9.1",
39
+ "typedoc": "^0.25.12",
40
+ "typedoc-plugin-markdown": "^3.17.1",
41
+ "typescript": "^5.0.4"
42
+ },
43
+ "dependencies": {
44
+ "ajv": "^8.17.1",
45
+ "ajv-formats": "^3.0.1"
46
+ },
47
+ "files": [
48
+ "dist/**/*",
49
+ "docs/**/*",
50
+ "docs-md/**/*",
51
+ "examples/**/*"
52
+ ]
53
53
  }
@@ -1 +0,0 @@
1
- export {};
@@ -1,96 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- const index_1 = __importDefault(require("../src/index"));
7
- /**
8
- * Example demonstrating how to use the LLM-JSON library.
9
- */
10
- function runExample() {
11
- // Create an instance with auto-correction enabled
12
- const llmJson = new index_1.default({ attemptCorrection: true });
13
- // Example from the requirements
14
- const input = `<research_planning>
15
- a. Summary: The given organization is unnamed and works in the area of "something new," which suggests an innovative or emerging field. This could involve novel technologies, fresh market approaches, or unexplored domains. Without specific details, assumptions about the sector or industry may involve startups, tech innovation, or trendsetting industries. The focus and goals may lean toward exploration, user adoption, and refinement of novel concepts.
16
-
17
- b. Potential Product Features:
18
- - Exploration of new technologies (VR/AR interfaces, IoT integration)
19
- - User onboarding and education tools
20
- - Novel interaction models or user interfaces
21
- - Feedback and improvement loops
22
- - Community engagement and collaboration spaces
23
-
24
- c. User Persona: Considering the organization's innovative nature, the primary user could be an early adopter, tech-savvy individual who is curious and willing to explore new technologies. This persona is likely someone who enjoys experimenting with novel ideas and is motivated by the excitement of participating in pioneering efforts.
25
- Study Name: "Demo - Innovator Insight"
26
-
27
- d. Potential Research Objectives:
28
- - Evaluate user onboarding process effectiveness in helping users understand the product's novel features.
29
- - Assess user engagement with community collaboration spaces to identify areas for increased interaction.
30
- - Verify the intuitiveness of new interaction models and user interfaces.
31
- - Explore user satisfaction with feedback and improvement loops.
32
- - Measure the impact of educational tools on user empowerment and confidence.
33
- - Analyze user behavior patterns to refine product workflows.
34
- - Investigate potential barriers to user adoption and retention.
35
-
36
- e. Narrowing Down Objectives:
37
- After considering the potential research objectives, the focus shifted towards objectives that can be directly evaluated through a live web application. The final objectives chosen were geared towards user onboarding, interaction intuitiveness, and community engagement, as they align with the persona of an early adopter and focus on improving user experience in areas relevant to the organization's innovative nature.
38
- </research_planning>
39
-
40
- \`\`\`json
41
- {
42
- "studyName": "Demo - Innovator Insight",
43
- "userPersona": "Tech-savvy early adopter exploring new innovations.",
44
- "objectives": [
45
- {
46
- "objectiveTitle": "Onboarding Process Evaluation",
47
- "objectiveDescription": "Assess the effectiveness of the user onboarding process in enabling users to grasp the novel features of the product quickly and efficiently, ensuring that it enhances initial user engagement and reduces learning curves."
48
- },
49
- {
50
- "objectiveTitle": "Community Interaction Analysis",
51
- "objectiveDescription": "Investigate user engagement within community collaboration spaces, identifying potential improvements to foster more interaction, sharing, and collaboration among users, enhancing overall community dynamics."
52
- },
53
- {
54
- "objectiveTitle": "Interface Intuition Verification",
55
- "objectiveDescription": "Verify the intuitiveness of new interaction models and user interfaces, focusing on how users adapt and navigate through the product, aiming to identify any areas needing refinement for better usability."
56
- }
57
- ]
58
- }
59
- \`\`\``;
60
- // Extract JSON and text
61
- const result = llmJson.extract(input);
62
- console.log("Extracted text:");
63
- console.log("------------------");
64
- result.text.forEach((text, index) => {
65
- console.log(`Text block ${index + 1}:`);
66
- console.log(text);
67
- console.log();
68
- });
69
- console.log("Extracted JSON:");
70
- console.log("------------------");
71
- result.json.forEach((json, index) => {
72
- console.log(`JSON object ${index + 1}:`);
73
- console.log(JSON.stringify(json, null, 2));
74
- console.log();
75
- });
76
- // Example with malformed JSON
77
- console.log("\nExample with malformed JSON:");
78
- console.log("---------------------------");
79
- const malformedInput = `Here is some information:
80
-
81
- {
82
- name: "John",
83
- age: 30,
84
- skills: ["JavaScript", "TypeScript"],
85
- preferences: {
86
- theme: "dark",
87
- notifications: true,
88
- }
89
- }`;
90
- const malformedResult = llmJson.extract(malformedInput);
91
- console.log("Text:");
92
- console.log(malformedResult.text[0]);
93
- console.log("\nCorrected JSON:");
94
- console.log(JSON.stringify(malformedResult.json[0], null, 2));
95
- }
96
- runExample();
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes