@solvers-hub/llm-json 0.1.1 → 0.1.2
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.
- package/README.md +4 -3
- package/docs/.nojekyll +1 -0
- package/docs/assets/highlight.css +78 -0
- package/docs/assets/icons.js +15 -0
- package/docs/assets/icons.svg +1 -0
- package/docs/assets/main.js +59 -0
- package/docs/assets/navigation.js +1 -0
- package/docs/assets/search.js +1 -0
- package/docs/assets/style.css +1412 -0
- package/docs/classes/LlmJson.html +20 -0
- package/docs/index.html +23 -0
- package/docs/interfaces/ExtractOptions.html +6 -0
- package/docs/interfaces/ExtractResult.html +6 -0
- package/docs/interfaces/JsonBlock.html +12 -0
- package/docs/interfaces/JsonParseError.html +8 -0
- package/docs/modules.html +7 -0
- package/docs-md/.nojekyll +1 -0
- package/docs-md/README.md +59 -0
- package/docs-md/classes/LlmJson.md +147 -0
- package/docs-md/interfaces/ExtractOptions.md +29 -0
- package/docs-md/interfaces/ExtractResult.md +36 -0
- package/docs-md/interfaces/JsonBlock.md +75 -0
- package/docs-md/interfaces/JsonParseError.md +49 -0
- package/docs-md/modules.md +26 -0
- package/package.json +12 -7
@@ -0,0 +1,36 @@
|
|
1
|
+
[@solvers-hub/llm-json](../README.md) / [Exports](../modules.md) / ExtractResult
|
2
|
+
|
3
|
+
# Interface: ExtractResult
|
4
|
+
|
5
|
+
Result of the JSON extraction.
|
6
|
+
|
7
|
+
## Table of contents
|
8
|
+
|
9
|
+
### Properties
|
10
|
+
|
11
|
+
- [json](ExtractResult.md#json)
|
12
|
+
- [text](ExtractResult.md#text)
|
13
|
+
|
14
|
+
## Properties
|
15
|
+
|
16
|
+
### json
|
17
|
+
|
18
|
+
• **json**: `any`[]
|
19
|
+
|
20
|
+
Array of parsed JSON objects extracted from the input.
|
21
|
+
|
22
|
+
#### Defined in
|
23
|
+
|
24
|
+
[types.ts:24](https://github.com/solvers-hub/llm-json/blob/4d60f7fa6cdcace0d353b33e3d79c6fd33db1860/src/types.ts#L24)
|
25
|
+
|
26
|
+
___
|
27
|
+
|
28
|
+
### text
|
29
|
+
|
30
|
+
• **text**: `string`[]
|
31
|
+
|
32
|
+
Array of text blocks extracted from the input.
|
33
|
+
|
34
|
+
#### Defined in
|
35
|
+
|
36
|
+
[types.ts:19](https://github.com/solvers-hub/llm-json/blob/4d60f7fa6cdcace0d353b33e3d79c6fd33db1860/src/types.ts#L19)
|
@@ -0,0 +1,75 @@
|
|
1
|
+
[@solvers-hub/llm-json](../README.md) / [Exports](../modules.md) / JsonBlock
|
2
|
+
|
3
|
+
# Interface: JsonBlock
|
4
|
+
|
5
|
+
Information about a detected JSON block.
|
6
|
+
|
7
|
+
## Table of contents
|
8
|
+
|
9
|
+
### Properties
|
10
|
+
|
11
|
+
- [endIndex](JsonBlock.md#endindex)
|
12
|
+
- [parsed](JsonBlock.md#parsed)
|
13
|
+
- [raw](JsonBlock.md#raw)
|
14
|
+
- [startIndex](JsonBlock.md#startindex)
|
15
|
+
- [wasCorrected](JsonBlock.md#wascorrected)
|
16
|
+
|
17
|
+
## Properties
|
18
|
+
|
19
|
+
### endIndex
|
20
|
+
|
21
|
+
• **endIndex**: `number`
|
22
|
+
|
23
|
+
The end index of the JSON block in the input string.
|
24
|
+
|
25
|
+
#### Defined in
|
26
|
+
|
27
|
+
[types.ts:44](https://github.com/solvers-hub/llm-json/blob/4d60f7fa6cdcace0d353b33e3d79c6fd33db1860/src/types.ts#L44)
|
28
|
+
|
29
|
+
___
|
30
|
+
|
31
|
+
### parsed
|
32
|
+
|
33
|
+
• `Optional` **parsed**: `any`
|
34
|
+
|
35
|
+
The parsed JSON object.
|
36
|
+
|
37
|
+
#### Defined in
|
38
|
+
|
39
|
+
[types.ts:54](https://github.com/solvers-hub/llm-json/blob/4d60f7fa6cdcace0d353b33e3d79c6fd33db1860/src/types.ts#L54)
|
40
|
+
|
41
|
+
___
|
42
|
+
|
43
|
+
### raw
|
44
|
+
|
45
|
+
• **raw**: `string`
|
46
|
+
|
47
|
+
The raw JSON string.
|
48
|
+
|
49
|
+
#### Defined in
|
50
|
+
|
51
|
+
[types.ts:34](https://github.com/solvers-hub/llm-json/blob/4d60f7fa6cdcace0d353b33e3d79c6fd33db1860/src/types.ts#L34)
|
52
|
+
|
53
|
+
___
|
54
|
+
|
55
|
+
### startIndex
|
56
|
+
|
57
|
+
• **startIndex**: `number`
|
58
|
+
|
59
|
+
The start index of the JSON block in the input string.
|
60
|
+
|
61
|
+
#### Defined in
|
62
|
+
|
63
|
+
[types.ts:39](https://github.com/solvers-hub/llm-json/blob/4d60f7fa6cdcace0d353b33e3d79c6fd33db1860/src/types.ts#L39)
|
64
|
+
|
65
|
+
___
|
66
|
+
|
67
|
+
### wasCorrected
|
68
|
+
|
69
|
+
• `Optional` **wasCorrected**: `boolean`
|
70
|
+
|
71
|
+
Whether the JSON was corrected.
|
72
|
+
|
73
|
+
#### Defined in
|
74
|
+
|
75
|
+
[types.ts:49](https://github.com/solvers-hub/llm-json/blob/4d60f7fa6cdcace0d353b33e3d79c6fd33db1860/src/types.ts#L49)
|
@@ -0,0 +1,49 @@
|
|
1
|
+
[@solvers-hub/llm-json](../README.md) / [Exports](../modules.md) / JsonParseError
|
2
|
+
|
3
|
+
# Interface: JsonParseError
|
4
|
+
|
5
|
+
Error information for JSON parsing failures.
|
6
|
+
|
7
|
+
## Table of contents
|
8
|
+
|
9
|
+
### Properties
|
10
|
+
|
11
|
+
- [message](JsonParseError.md#message)
|
12
|
+
- [position](JsonParseError.md#position)
|
13
|
+
- [raw](JsonParseError.md#raw)
|
14
|
+
|
15
|
+
## Properties
|
16
|
+
|
17
|
+
### message
|
18
|
+
|
19
|
+
• **message**: `string`
|
20
|
+
|
21
|
+
The original error message.
|
22
|
+
|
23
|
+
#### Defined in
|
24
|
+
|
25
|
+
[types.ts:64](https://github.com/solvers-hub/llm-json/blob/4d60f7fa6cdcace0d353b33e3d79c6fd33db1860/src/types.ts#L64)
|
26
|
+
|
27
|
+
___
|
28
|
+
|
29
|
+
### position
|
30
|
+
|
31
|
+
• `Optional` **position**: `number`
|
32
|
+
|
33
|
+
The position in the JSON string where the error occurred.
|
34
|
+
|
35
|
+
#### Defined in
|
36
|
+
|
37
|
+
[types.ts:74](https://github.com/solvers-hub/llm-json/blob/4d60f7fa6cdcace0d353b33e3d79c6fd33db1860/src/types.ts#L74)
|
38
|
+
|
39
|
+
___
|
40
|
+
|
41
|
+
### raw
|
42
|
+
|
43
|
+
• **raw**: `string`
|
44
|
+
|
45
|
+
The raw JSON string that failed to parse.
|
46
|
+
|
47
|
+
#### Defined in
|
48
|
+
|
49
|
+
[types.ts:69](https://github.com/solvers-hub/llm-json/blob/4d60f7fa6cdcace0d353b33e3d79c6fd33db1860/src/types.ts#L69)
|
@@ -0,0 +1,26 @@
|
|
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
|
+
|
22
|
+
## References
|
23
|
+
|
24
|
+
### default
|
25
|
+
|
26
|
+
Renames and re-exports [LlmJson](classes/LlmJson.md)
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@solvers-hub/llm-json",
|
3
|
-
"version": "0.1.
|
3
|
+
"version": "0.1.2",
|
4
4
|
"description": "A TypeScript SDK to extract and correct JSON from LLM outputs",
|
5
5
|
"main": "dist/index.js",
|
6
6
|
"types": "dist/index.d.ts",
|
@@ -14,12 +14,13 @@
|
|
14
14
|
"test": "jest",
|
15
15
|
"test:coverage": "jest --coverage",
|
16
16
|
"lint": "eslint src/**/*.ts",
|
17
|
-
"prepublishOnly": "npm run build",
|
17
|
+
"prepublishOnly": "npm run build && npm run docs",
|
18
18
|
"example": "ts-node examples/example.ts",
|
19
19
|
"build:example": "tsc && node dist/examples/example.js",
|
20
|
-
"docs": "typedoc"
|
20
|
+
"docs": "typedoc --out docs src",
|
21
|
+
"docs:md": "typedoc --out docs-md --plugin typedoc-plugin-markdown src"
|
21
22
|
},
|
22
|
-
"
|
23
|
+
"repository": {
|
23
24
|
"type": "git",
|
24
25
|
"url": "https://github.com/solvers-hub/llm-json.git"
|
25
26
|
},
|
@@ -38,10 +39,14 @@
|
|
38
39
|
"@types/node": "^18.15.11",
|
39
40
|
"jest": "^29.5.0",
|
40
41
|
"ts-jest": "^29.1.0",
|
41
|
-
"
|
42
|
-
"
|
42
|
+
"ts-node": "^10.9.1",
|
43
|
+
"typedoc": "^0.25.12",
|
44
|
+
"typedoc-plugin-markdown": "^3.17.1",
|
45
|
+
"typescript": "^5.0.4"
|
43
46
|
},
|
44
47
|
"files": [
|
45
|
-
"dist/**/*"
|
48
|
+
"dist/**/*",
|
49
|
+
"docs/**/*",
|
50
|
+
"docs-md/**/*"
|
46
51
|
]
|
47
52
|
}
|