@solvers-hub/llm-json 0.1.5 → 0.1.6
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 +58 -0
- package/dist/src/array-extractor.js +6 -1
- package/dist/src/extractor.d.ts +9 -1
- package/dist/src/extractor.js +26 -5
- package/dist/src/types.d.ts +44 -0
- package/dist/src/validator.d.ts +27 -0
- package/dist/src/validator.js +73 -0
- package/docs/assets/navigation.js +1 -1
- package/docs/assets/search.js +1 -1
- package/docs/classes/LlmJson.html +5 -5
- package/docs/index.html +5 -1
- package/docs/interfaces/ExtractOptions.html +7 -2
- package/docs/interfaces/ExtractResult.html +5 -3
- package/docs/interfaces/JsonBlock.html +6 -6
- package/docs/interfaces/JsonParseError.html +4 -4
- package/docs/interfaces/SchemaDefinition.html +6 -0
- package/docs/interfaces/ValidationResult.html +10 -0
- package/docs/modules.html +2 -0
- package/package.json +5 -1
package/README.md
CHANGED
@@ -15,6 +15,7 @@ LLM-JSON is a lightweight library designed to parse and extract JSON objects fro
|
|
15
15
|
- **Multiple JSON Support**: Extracts multiple JSON objects or arrays from a single input
|
16
16
|
- **JSON Validation & Correction**: Automatically fixes common JSON formatting errors from LLMs
|
17
17
|
- **Code Block Support**: Extracts JSON from markdown code blocks (```json)
|
18
|
+
- **Schema Validation**: Validates extracted JSON against provided schemas
|
18
19
|
- **TypeScript Support**: Written in TypeScript with full type definitions
|
19
20
|
|
20
21
|
## Quick Start
|
@@ -45,6 +46,63 @@ console.log(text); // ['Here\'s some text followed by JSON:']
|
|
45
46
|
console.log(json); // [{ name: 'John', age: 30, skills: ['JavaScript', 'TypeScript', 'React'] }]
|
46
47
|
```
|
47
48
|
|
49
|
+
### Schema Validation
|
50
|
+
|
51
|
+
You can validate extracted JSON against schemas:
|
52
|
+
|
53
|
+
```typescript
|
54
|
+
import { LlmJson } from '@solvers-hub/llm-json';
|
55
|
+
|
56
|
+
const schemas = [
|
57
|
+
{
|
58
|
+
name: 'person',
|
59
|
+
schema: {
|
60
|
+
type: 'object',
|
61
|
+
properties: {
|
62
|
+
name: { type: 'string' },
|
63
|
+
age: { type: 'integer' }
|
64
|
+
},
|
65
|
+
required: ['name', 'age']
|
66
|
+
}
|
67
|
+
}
|
68
|
+
];
|
69
|
+
|
70
|
+
const llmJson = new LlmJson({
|
71
|
+
attemptCorrection: true,
|
72
|
+
schemas
|
73
|
+
});
|
74
|
+
|
75
|
+
const llmOutput = `Here's a person: {"name": "John", "age": 30}
|
76
|
+
And some other data: {"title": "Meeting notes"}`;
|
77
|
+
const result = llmJson.extract(llmOutput);
|
78
|
+
|
79
|
+
// Note: All extracted JSON objects are included in the json array
|
80
|
+
console.log(result.json);
|
81
|
+
// [
|
82
|
+
// { name: 'John', age: 30 },
|
83
|
+
// { title: 'Meeting notes' }
|
84
|
+
// ]
|
85
|
+
|
86
|
+
// The validatedJson array includes validation results for each JSON object
|
87
|
+
console.log(result.validatedJson);
|
88
|
+
// [
|
89
|
+
// {
|
90
|
+
// json: { name: 'John', age: 30 },
|
91
|
+
// matchedSchema: 'person',
|
92
|
+
// isValid: true
|
93
|
+
// },
|
94
|
+
// {
|
95
|
+
// json: { title: 'Meeting notes' },
|
96
|
+
// matchedSchema: null,
|
97
|
+
// isValid: false,
|
98
|
+
// validationErrors: [...] // Validation errors
|
99
|
+
// }
|
100
|
+
// ]
|
101
|
+
|
102
|
+
// Always check isValid and matchedSchema to determine if JSON matched a schema
|
103
|
+
const validJsonObjects = result.validatedJson.filter(item => item.isValid);
|
104
|
+
```
|
105
|
+
|
48
106
|
## License
|
49
107
|
|
50
108
|
MIT © 2023
|
@@ -164,9 +164,14 @@ class JsonArrayExtractor extends extractor_1.JsonExtractor {
|
|
164
164
|
// Extract text blocks and clean them up
|
165
165
|
const rawTextBlocks = this.extractTextBlocks(input, visibleJsonBlocks);
|
166
166
|
const cleanedTextBlocks = this.cleanTextBlocks(rawTextBlocks);
|
167
|
+
// Combine filtered objects and standalone arrays
|
168
|
+
const combinedJson = [...filteredObjects, ...standaloneArrays];
|
169
|
+
// Apply schema validation if schemas are provided
|
170
|
+
const validatedJson = this.validateJson(combinedJson);
|
167
171
|
return {
|
168
172
|
text: cleanedTextBlocks,
|
169
|
-
json:
|
173
|
+
json: combinedJson,
|
174
|
+
...(validatedJson.length > 0 && { validatedJson })
|
170
175
|
};
|
171
176
|
}
|
172
177
|
}
|
package/dist/src/extractor.d.ts
CHANGED
@@ -1,9 +1,11 @@
|
|
1
|
-
import { ExtractOptions, ExtractResult, JsonBlock } from './types';
|
1
|
+
import { ExtractOptions, ExtractResult, JsonBlock, ValidationResult } from './types';
|
2
|
+
import { SchemaValidator } from './validator';
|
2
3
|
/**
|
3
4
|
* JsonExtractor class for extracting JSON from text input.
|
4
5
|
*/
|
5
6
|
export declare class JsonExtractor {
|
6
7
|
protected options: ExtractOptions;
|
8
|
+
protected schemaValidator: SchemaValidator | null;
|
7
9
|
/**
|
8
10
|
* Creates a new instance of JsonExtractor.
|
9
11
|
* @param options - Configuration options for extraction.
|
@@ -15,6 +17,12 @@ export declare class JsonExtractor {
|
|
15
17
|
* @returns An object containing arrays of extracted text and JSON.
|
16
18
|
*/
|
17
19
|
extract(input: string): ExtractResult;
|
20
|
+
/**
|
21
|
+
* Validates JSON objects against provided schemas.
|
22
|
+
* @param jsonObjects - The JSON objects to validate.
|
23
|
+
* @returns Array of validation results.
|
24
|
+
*/
|
25
|
+
protected validateJson(jsonObjects: any[]): ValidationResult[];
|
18
26
|
/**
|
19
27
|
* Extract JSON from markdown code blocks.
|
20
28
|
* @param input - The input string that may contain code blocks.
|
package/dist/src/extractor.js
CHANGED
@@ -2,6 +2,7 @@
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
exports.JsonExtractor = void 0;
|
4
4
|
const corrector_1 = require("./corrector");
|
5
|
+
const validator_1 = require("./validator");
|
5
6
|
/**
|
6
7
|
* JsonExtractor class for extracting JSON from text input.
|
7
8
|
*/
|
@@ -11,10 +12,15 @@ class JsonExtractor {
|
|
11
12
|
* @param options - Configuration options for extraction.
|
12
13
|
*/
|
13
14
|
constructor(options = {}) {
|
15
|
+
this.schemaValidator = null;
|
14
16
|
this.options = {
|
15
17
|
attemptCorrection: false,
|
16
18
|
...options
|
17
19
|
};
|
20
|
+
// Initialize schema validator if schemas are provided
|
21
|
+
if (this.options.schemas && this.options.schemas.length > 0) {
|
22
|
+
this.schemaValidator = new validator_1.SchemaValidator();
|
23
|
+
}
|
18
24
|
}
|
19
25
|
/**
|
20
26
|
* Extract JSON and text from a string input.
|
@@ -41,9 +47,12 @@ class JsonExtractor {
|
|
41
47
|
let parsed;
|
42
48
|
try {
|
43
49
|
parsed = JSON.parse(correctionResult.corrected);
|
50
|
+
// Apply schema validation if schemas are provided
|
51
|
+
const validatedJson = this.validateJson([parsed]);
|
44
52
|
return {
|
45
53
|
text: [],
|
46
|
-
json: [parsed]
|
54
|
+
json: [parsed],
|
55
|
+
...(validatedJson.length > 0 && { validatedJson })
|
47
56
|
};
|
48
57
|
}
|
49
58
|
catch (e) {
|
@@ -57,11 +66,26 @@ class JsonExtractor {
|
|
57
66
|
// Process the found JSON blocks
|
58
67
|
const parsedBlocks = this.parseJsonBlocks(jsonBlocks);
|
59
68
|
const textBlocks = this.extractTextBlocks(input, jsonBlocks);
|
69
|
+
const extractedJson = parsedBlocks.map(block => block.parsed).filter(Boolean);
|
70
|
+
// Apply schema validation if schemas are provided
|
71
|
+
const validatedJson = this.validateJson(extractedJson);
|
60
72
|
return {
|
61
73
|
text: textBlocks,
|
62
|
-
json:
|
74
|
+
json: extractedJson,
|
75
|
+
...(validatedJson.length > 0 && { validatedJson })
|
63
76
|
};
|
64
77
|
}
|
78
|
+
/**
|
79
|
+
* Validates JSON objects against provided schemas.
|
80
|
+
* @param jsonObjects - The JSON objects to validate.
|
81
|
+
* @returns Array of validation results.
|
82
|
+
*/
|
83
|
+
validateJson(jsonObjects) {
|
84
|
+
if (!this.schemaValidator || !this.options.schemas || !jsonObjects.length) {
|
85
|
+
return [];
|
86
|
+
}
|
87
|
+
return this.schemaValidator.validateAll(jsonObjects, this.options.schemas);
|
88
|
+
}
|
65
89
|
/**
|
66
90
|
* Extract JSON from markdown code blocks.
|
67
91
|
* @param input - The input string that may contain code blocks.
|
@@ -240,9 +264,6 @@ class JsonExtractor {
|
|
240
264
|
if (inBetweenText) {
|
241
265
|
textBlocks.push(inBetweenText);
|
242
266
|
}
|
243
|
-
else {
|
244
|
-
textBlocks.push(''); // Add empty segment to maintain expected count
|
245
|
-
}
|
246
267
|
}
|
247
268
|
}
|
248
269
|
}
|
package/dist/src/types.d.ts
CHANGED
@@ -7,6 +7,46 @@ export interface ExtractOptions {
|
|
7
7
|
* @default false
|
8
8
|
*/
|
9
9
|
attemptCorrection?: boolean;
|
10
|
+
/**
|
11
|
+
* JSON schemas to validate extracted JSON against.
|
12
|
+
* If provided, the extracted JSON will be validated against these schemas.
|
13
|
+
* @default undefined
|
14
|
+
*/
|
15
|
+
schemas?: SchemaDefinition[];
|
16
|
+
}
|
17
|
+
/**
|
18
|
+
* Definition of a JSON schema for validation.
|
19
|
+
*/
|
20
|
+
export interface SchemaDefinition {
|
21
|
+
/**
|
22
|
+
* A unique name for the schema to identify which schema matched.
|
23
|
+
*/
|
24
|
+
name: string;
|
25
|
+
/**
|
26
|
+
* The JSON schema object conforming to JSON Schema specification.
|
27
|
+
*/
|
28
|
+
schema: object;
|
29
|
+
}
|
30
|
+
/**
|
31
|
+
* Result of schema validation for a JSON object.
|
32
|
+
*/
|
33
|
+
export interface ValidationResult {
|
34
|
+
/**
|
35
|
+
* The JSON object that was validated.
|
36
|
+
*/
|
37
|
+
json: any;
|
38
|
+
/**
|
39
|
+
* The name of the schema that matched, or null if no schema matched.
|
40
|
+
*/
|
41
|
+
matchedSchema: string | null;
|
42
|
+
/**
|
43
|
+
* Whether the JSON is valid according to the matched schema.
|
44
|
+
*/
|
45
|
+
isValid: boolean;
|
46
|
+
/**
|
47
|
+
* Validation errors if any, or undefined if validation passed.
|
48
|
+
*/
|
49
|
+
validationErrors?: any[];
|
10
50
|
}
|
11
51
|
/**
|
12
52
|
* Result of the JSON extraction.
|
@@ -20,6 +60,10 @@ export interface ExtractResult {
|
|
20
60
|
* Array of parsed JSON objects extracted from the input.
|
21
61
|
*/
|
22
62
|
json: any[];
|
63
|
+
/**
|
64
|
+
* Array of validated JSON results, only present if schemas were provided.
|
65
|
+
*/
|
66
|
+
validatedJson?: ValidationResult[];
|
23
67
|
}
|
24
68
|
/**
|
25
69
|
* Information about a detected JSON block.
|
@@ -0,0 +1,27 @@
|
|
1
|
+
import { SchemaDefinition, ValidationResult } from './types';
|
2
|
+
/**
|
3
|
+
* SchemaValidator class for validating JSON against schemas.
|
4
|
+
*/
|
5
|
+
export declare class SchemaValidator {
|
6
|
+
private ajv;
|
7
|
+
/**
|
8
|
+
* Creates a new instance of SchemaValidator.
|
9
|
+
*/
|
10
|
+
constructor();
|
11
|
+
/**
|
12
|
+
* Validates a JSON object against a set of schemas.
|
13
|
+
*
|
14
|
+
* @param json - The JSON object to validate.
|
15
|
+
* @param schemas - The schemas to validate against.
|
16
|
+
* @returns A validation result with matched schema information.
|
17
|
+
*/
|
18
|
+
validate(json: any, schemas: SchemaDefinition[]): ValidationResult;
|
19
|
+
/**
|
20
|
+
* Validates an array of JSON objects against a set of schemas.
|
21
|
+
*
|
22
|
+
* @param jsonObjects - The JSON objects to validate.
|
23
|
+
* @param schemas - The schemas to validate against.
|
24
|
+
* @returns An array of validation results.
|
25
|
+
*/
|
26
|
+
validateAll(jsonObjects: any[], schemas: SchemaDefinition[]): ValidationResult[];
|
27
|
+
}
|
@@ -0,0 +1,73 @@
|
|
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
|
+
exports.SchemaValidator = void 0;
|
7
|
+
const ajv_1 = __importDefault(require("ajv"));
|
8
|
+
/**
|
9
|
+
* SchemaValidator class for validating JSON against schemas.
|
10
|
+
*/
|
11
|
+
class SchemaValidator {
|
12
|
+
/**
|
13
|
+
* Creates a new instance of SchemaValidator.
|
14
|
+
*/
|
15
|
+
constructor() {
|
16
|
+
this.ajv = new ajv_1.default({
|
17
|
+
allErrors: true,
|
18
|
+
verbose: true
|
19
|
+
});
|
20
|
+
}
|
21
|
+
/**
|
22
|
+
* Validates a JSON object against a set of schemas.
|
23
|
+
*
|
24
|
+
* @param json - The JSON object to validate.
|
25
|
+
* @param schemas - The schemas to validate against.
|
26
|
+
* @returns A validation result with matched schema information.
|
27
|
+
*/
|
28
|
+
validate(json, schemas) {
|
29
|
+
if (!json || !schemas || schemas.length === 0) {
|
30
|
+
return {
|
31
|
+
json,
|
32
|
+
matchedSchema: null,
|
33
|
+
isValid: false
|
34
|
+
};
|
35
|
+
}
|
36
|
+
// Try each schema until one matches
|
37
|
+
for (const schemaObj of schemas) {
|
38
|
+
const validate = this.ajv.compile(schemaObj.schema);
|
39
|
+
const isValid = validate(json);
|
40
|
+
if (isValid) {
|
41
|
+
return {
|
42
|
+
json,
|
43
|
+
matchedSchema: schemaObj.name,
|
44
|
+
isValid: true
|
45
|
+
};
|
46
|
+
}
|
47
|
+
}
|
48
|
+
// If we reach here, none of the schemas matched
|
49
|
+
// Return the validation errors from the first schema as a fallback
|
50
|
+
const firstTry = this.ajv.compile(schemas[0].schema);
|
51
|
+
firstTry(json);
|
52
|
+
return {
|
53
|
+
json,
|
54
|
+
matchedSchema: null,
|
55
|
+
isValid: false,
|
56
|
+
validationErrors: firstTry.errors || []
|
57
|
+
};
|
58
|
+
}
|
59
|
+
/**
|
60
|
+
* Validates an array of JSON objects against a set of schemas.
|
61
|
+
*
|
62
|
+
* @param jsonObjects - The JSON objects to validate.
|
63
|
+
* @param schemas - The schemas to validate against.
|
64
|
+
* @returns An array of validation results.
|
65
|
+
*/
|
66
|
+
validateAll(jsonObjects, schemas) {
|
67
|
+
if (!jsonObjects || jsonObjects.length === 0 || !schemas || schemas.length === 0) {
|
68
|
+
return [];
|
69
|
+
}
|
70
|
+
return jsonObjects.map(json => this.validate(json, schemas));
|
71
|
+
}
|
72
|
+
}
|
73
|
+
exports.SchemaValidator = SchemaValidator;
|
@@ -1 +1 @@
|
|
1
|
-
window.navigationData = "data:application/octet-stream;base64,
|
1
|
+
window.navigationData = "data:application/octet-stream;base64,H4sIAAAAAAAACoXQywrCMBAF0H+JW/FRq2iXYjciKApuxMWQTmlomkhmBEH8d6lKax/W9b33kMzpLhhvLAIRYQxXzaIvLsCJCERmo6tGGiSc6V6ZpspEIvDHC38y8h/9Yr/R2ZqsKfdSAxHS8BO8nGI/9uZf2/DGDiRvL6ysoZJQhtHFIJGG1UoV86azJrZHqnynab0bXVT+7qW2Mm1livQfsQNHGDpn3U+nrHRhB5lgBiuMlVH5HVq5eqkLPIJWEeStjnPVS03w/AQ1H01DRwIAAA=="
|
package/docs/assets/search.js
CHANGED
@@ -1 +1 @@
|
|
1
|
-
window.searchData = "data:application/octet-stream;base64,
|
1
|
+
window.searchData = "data:application/octet-stream;base64,H4sIAAAAAAAACq1Y227bOBD9F/pVTTwj27H9tpc+tFhgF1ugL4KxYCUmUauLISqXhZF/X1CSxaE8VJh0n4JY58wZzhmOKJ5EUz9psU9O4kdeZWIPuI1EJUsl9uKPovys60pE4qEpxF6khdRa6evh96v7tixEdP5Z7IV4icY4S1yNgfJKt7JK1WykBUHZkK3OPuT6w7HJH2VrHh1lo6qWZGc1cbmyyd+p9lOQrAski5nVWgOOUmld6bZ5SNu6mZdygaFSTinrb99V2n58bhv5ut4l+H2FdTKQTSP/DUzgAvs/GKv6cPPCFhRaZU7jl6IIkulxoUor2K3ipS1opm7lQ2EXVNbZQ6F0r2AfstsM15sxzlDnP49tXld6DJdXrWpuZar0tYsI37+ybVV5bH+rm0alhhsYfMER+TJNkvckotN7VcrQtS0s/I2itKxfuiC/q9u8yn1rn2LCS9v9CY24GND8ai4SnS1iuOiIf7MsLeNXWeSZNIC/labtTvSnmPAyfte8MWzExYDm13ORqEeylG16r7Iv3mry2lPazyWR6w4ZLm8JPyf8OOI+Nk3dsFuSz4BhvjkVZuz5u8oBhLdUq54Dwy0G6OyQmS+nr38ZsdnmDRIbHFDZ53DVKedt8tQvE+DXok5/cMrjw3CfGvn0eqRFj+Kzthn5JmYrm/ZTlannACUH/E5BVWWhcgT6TrEnqYcXtGIHyURwAn+n6FE2OkhuBIYLTbvtLxOiGzY+PYsI77tSaS3v2Jc3E3Jh4f6FkETf3uxTwdc6/nWxY629Jx5OkeDDZA+RyLve3Z/Eo2q04e4FXsVXOxGJ21wVmfk2PR+S0rosTaDD8OyrMl8VBtFDrpciSpZRDFer3e5wiJIzo3vQ/dDBQEQJcDBwYCiiBDkYOrBYREnMwWIHthJRsuJgKwe2FlGy5mBrB7YRUbLhYBsHdiOi5IaD3TiwrYiSLQfbOrCdiJIdB9u55TXVBtYHmBjROcFb4XoBpubAugGuHWDKDqwh4DoCpvLAegKuKWCKD6wt4PoCpv6wiXBzFe/ARbrWgLEAWHPAdQeMC8D6A65BYIwA1iJwPUJjBLIeoesRGiOQ9Qgn+wW9a0fXIzRGIL+3XI/QGIGsm+h6hMYIXLHqrkdojEDWTXQ9QmMEsvsMXY/QGIGsm+h6hMYIZN1E16O484h1M3Y9io0RMetm7HoUo7dK8WSsdXON9T3uPeqm96NqWjWcQMwc7m58lL3xOYl/hhG/Pr9XTmIt9qeXFzvQzX9GYLguSMl1geXD0gaApSeCc8NmubGlxh7meNFiWVvL2npYqsp6MKHhxvLwxkc8X1BZHqFt5lnS3DdZ4o0lviJXn++GLHlnybt5cjN8YZGVEkvQZ8mdau3NLuESqofJ0YA0gY+mH/tPXMIiVoLPy/7DipCIIdA5Egn05WrI3/qvGrJG0ne4mmF2h1zVn1AJnXgT+8pbFOU0ceKKjzXcQpyvdsiiSTOBr5vGsyzZYUQ09jnTn+OIGKkP+DZmf4nNjpSVpfuqe/58IFUlvYC+lrdHWbJE0nuxL9vu1E3ESIq47nso9vUQ4wahg2+JPS0jF5QkANlmMK/rTAWg+8xnZ/elezn+yKBH3yDrb0wIieihT2+8g5g2PNJh4nPG3jup4d6JLJfsNPD1hA1wOQmBLBp8r7cnqVP75UzSJ3sO2el0iMQxP6oir5TYJ4eXl/8AZUE3hrgbAAA=";
|
@@ -1,5 +1,5 @@
|
|
1
1
|
<!DOCTYPE html><html class="default" lang="en"><head><meta charSet="utf-8"/><meta http-equiv="x-ua-compatible" content="IE=edge"/><title>LlmJson | @solvers-hub/llm-json</title><meta name="description" content="Documentation for @solvers-hub/llm-json"/><meta name="viewport" content="width=device-width, initial-scale=1"/><link rel="stylesheet" href="../assets/style.css"/><link rel="stylesheet" href="../assets/highlight.css"/><script defer src="../assets/main.js"></script><script async src="../assets/icons.js" id="tsd-icons-script"></script><script async src="../assets/search.js" id="tsd-search-script"></script><script async src="../assets/navigation.js" id="tsd-nav-script"></script></head><body><script>document.documentElement.dataset.theme = localStorage.getItem("tsd-theme") || "os";document.body.style.display="none";setTimeout(() => app?app.showPage():document.body.style.removeProperty("display"),500)</script><header class="tsd-page-toolbar"><div class="tsd-toolbar-contents container"><div class="table-cell" id="tsd-search" data-base=".."><div class="field"><label for="tsd-search-field" class="tsd-widget tsd-toolbar-icon search no-caption"><svg width="16" height="16" viewBox="0 0 16 16" fill="none"><use href="../assets/icons.svg#icon-search"></use></svg></label><input type="text" id="tsd-search-field" aria-label="Search"/></div><div class="field"><div id="tsd-toolbar-links"></div></div><ul class="results"><li class="state loading">Preparing search index...</li><li class="state failure">The search index is not available</li></ul><a href="../index.html" class="title">@solvers-hub/llm-json</a></div><div class="table-cell" id="tsd-widgets"><a href="#" class="tsd-widget tsd-toolbar-icon menu no-caption" data-toggle="menu" aria-label="Menu"><svg width="16" height="16" viewBox="0 0 16 16" fill="none"><use href="../assets/icons.svg#icon-menu"></use></svg></a></div></div></header><div class="container container-main"><div class="col-content"><div class="tsd-page-title"><ul class="tsd-breadcrumb"><li><a href="../modules.html">@solvers-hub/llm-json</a></li><li><a href="LlmJson.html">LlmJson</a></li></ul><h1>Class LlmJson</h1></div><section class="tsd-panel tsd-comment"><div class="tsd-comment tsd-typography"><p>Main factory class for the LLM-JSON extractor SDK.</p>
|
2
|
-
</div><div class="tsd-comment tsd-typography"></div></section><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/solvers-hub/llm-json/blob/
|
2
|
+
</div><div class="tsd-comment tsd-typography"></div></section><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/solvers-hub/llm-json/blob/de4fb5a4209b6f115ef863cd3e7016e7b565b262/src/index.ts#L8">index.ts:8</a></li></ul></aside><section class="tsd-panel-group tsd-index-group"><section class="tsd-panel tsd-index-panel"><details class="tsd-index-content tsd-index-accordion" open><summary class="tsd-accordion-summary tsd-index-summary"><h5 class="tsd-index-heading uppercase" role="button" aria-expanded="false" tabIndex="0"><svg width="16" height="16" viewBox="0 0 16 16" fill="none"><use href="../assets/icons.svg#icon-chevronSmall"></use></svg> Index</h5></summary><div class="tsd-accordion-details"><section class="tsd-index-section"><h3 class="tsd-index-heading">Constructors</h3><div class="tsd-index-list"><a href="LlmJson.html#constructor" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-512"></use></svg><span>constructor</span></a>
|
3
3
|
</div></section><section class="tsd-index-section"><h3 class="tsd-index-heading">Properties</h3><div class="tsd-index-list"><a href="LlmJson.html#arrayExtractor" class="tsd-index-link tsd-is-private"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-1024"></use></svg><span>array<wbr/>Extractor</span></a>
|
4
4
|
<a href="LlmJson.html#objectExtractor" class="tsd-index-link tsd-is-private"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-1024"></use></svg><span>object<wbr/>Extractor</span></a>
|
5
5
|
<a href="LlmJson.html#instance" class="tsd-index-link tsd-is-private"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-1024"></use></svg><span>instance</span></a>
|
@@ -8,13 +8,13 @@
|
|
8
8
|
<a href="LlmJson.html#getInstance" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-2048"></use></svg><span>get<wbr/>Instance</span></a>
|
9
9
|
</div></section></div></details></section></section><section class="tsd-panel-group tsd-member-group"><h2>Constructors</h2><section class="tsd-panel tsd-member"><a id="constructor" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>constructor</span><a href="#constructor" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class="tsd-signature tsd-anchor-link"><a id="constructor.new_LlmJson" class="tsd-anchor"></a><span class="tsd-kind-constructor-signature">new <wbr/>Llm<wbr/>Json</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">options</span><span class="tsd-signature-symbol">?</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><a href="LlmJson.html" class="tsd-signature-type tsd-kind-class">LlmJson</a><a href="#constructor.new_LlmJson" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></li><li class="tsd-description"><div class="tsd-comment tsd-typography"><p>Creates a new LlmJson instance with the specified options.</p>
|
10
10
|
</div><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">options</span>: <a href="../interfaces/ExtractOptions.html" class="tsd-signature-type tsd-kind-interface">ExtractOptions</a><span class="tsd-signature-symbol"> = {}</span></span><div class="tsd-comment tsd-typography"><p>Configuration options for extraction.</p>
|
11
|
-
</div><div class="tsd-comment tsd-typography"></div></li></ul></div><h4 class="tsd-returns-title">Returns <a href="LlmJson.html" class="tsd-signature-type tsd-kind-class">LlmJson</a></h4><div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/solvers-hub/llm-json/blob/
|
11
|
+
</div><div class="tsd-comment tsd-typography"></div></li></ul></div><h4 class="tsd-returns-title">Returns <a href="LlmJson.html" class="tsd-signature-type tsd-kind-class">LlmJson</a></h4><div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/solvers-hub/llm-json/blob/de4fb5a4209b6f115ef863cd3e7016e7b565b262/src/index.ts#L17">index.ts:17</a></li></ul></aside></li></ul></section></section><section class="tsd-panel-group tsd-member-group"><h2>Properties</h2><section class="tsd-panel tsd-member tsd-is-private"><a id="arrayExtractor" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><code class="tsd-tag ts-flagPrivate">Private</code> <span>array<wbr/>Extractor</span><a href="#arrayExtractor" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><div class="tsd-signature"><span class="tsd-kind-property">array<wbr/>Extractor</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">JsonArrayExtractor</span></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/solvers-hub/llm-json/blob/de4fb5a4209b6f115ef863cd3e7016e7b565b262/src/index.ts#L11">index.ts:11</a></li></ul></aside></section><section class="tsd-panel tsd-member tsd-is-private"><a id="objectExtractor" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><code class="tsd-tag ts-flagPrivate">Private</code> <span>object<wbr/>Extractor</span><a href="#objectExtractor" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><div class="tsd-signature"><span class="tsd-kind-property">object<wbr/>Extractor</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">JsonExtractor</span></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/solvers-hub/llm-json/blob/de4fb5a4209b6f115ef863cd3e7016e7b565b262/src/index.ts#L10">index.ts:10</a></li></ul></aside></section><section class="tsd-panel tsd-member tsd-is-private"><a id="instance" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><code class="tsd-tag ts-flagStatic">Static</code> <code class="tsd-tag ts-flagPrivate">Private</code> <span>instance</span><a href="#instance" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><div class="tsd-signature"><span class="tsd-kind-property">instance</span><span class="tsd-signature-symbol">:</span> <a href="LlmJson.html" class="tsd-signature-type tsd-kind-class">LlmJson</a></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/solvers-hub/llm-json/blob/de4fb5a4209b6f115ef863cd3e7016e7b565b262/src/index.ts#L9">index.ts:9</a></li></ul></aside></section></section><section class="tsd-panel-group tsd-member-group"><h2>Methods</h2><section class="tsd-panel tsd-member"><a id="extract" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>extract</span><a href="#extract" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class="tsd-signature tsd-anchor-link"><a id="extract.extract-1" class="tsd-anchor"></a><span class="tsd-kind-call-signature">extract</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">input</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><a href="../interfaces/ExtractResult.html" class="tsd-signature-type tsd-kind-interface">ExtractResult</a><a href="#extract.extract-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></li><li class="tsd-description"><div class="tsd-comment tsd-typography"><p>Extract JSON objects and text from a string input.</p>
|
12
12
|
</div><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">input</span>: <span class="tsd-signature-type">string</span></span><div class="tsd-comment tsd-typography"><p>The input string that may contain JSON.</p>
|
13
13
|
</div><div class="tsd-comment tsd-typography"></div></li></ul></div><h4 class="tsd-returns-title">Returns <a href="../interfaces/ExtractResult.html" class="tsd-signature-type tsd-kind-interface">ExtractResult</a></h4><p>An object containing arrays of extracted text and JSON.</p>
|
14
|
-
<div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/solvers-hub/llm-json/blob/
|
14
|
+
<div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/solvers-hub/llm-json/blob/de4fb5a4209b6f115ef863cd3e7016e7b565b262/src/index.ts#L39">index.ts:39</a></li></ul></aside></li></ul></section><section class="tsd-panel tsd-member"><a id="extractAll" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>extract<wbr/>All</span><a href="#extractAll" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class="tsd-signature tsd-anchor-link"><a id="extractAll.extractAll-1" class="tsd-anchor"></a><span class="tsd-kind-call-signature">extract<wbr/>All</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">input</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><a href="../interfaces/ExtractResult.html" class="tsd-signature-type tsd-kind-interface">ExtractResult</a><a href="#extractAll.extractAll-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></li><li class="tsd-description"><div class="tsd-comment tsd-typography"><p>Extract JSON objects, arrays, and text from a string input.</p>
|
15
15
|
</div><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">input</span>: <span class="tsd-signature-type">string</span></span><div class="tsd-comment tsd-typography"><p>The input string that may contain JSON.</p>
|
16
16
|
</div><div class="tsd-comment tsd-typography"></div></li></ul></div><h4 class="tsd-returns-title">Returns <a href="../interfaces/ExtractResult.html" class="tsd-signature-type tsd-kind-interface">ExtractResult</a></h4><p>An object containing arrays of extracted text and JSON.</p>
|
17
|
-
<div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/solvers-hub/llm-json/blob/
|
17
|
+
<div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/solvers-hub/llm-json/blob/de4fb5a4209b6f115ef863cd3e7016e7b565b262/src/index.ts#L48">index.ts:48</a></li></ul></aside></li></ul></section><section class="tsd-panel tsd-member"><a id="getInstance" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><code class="tsd-tag ts-flagStatic">Static</code> <span>get<wbr/>Instance</span><a href="#getInstance" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class="tsd-signature tsd-anchor-link"><a id="getInstance.getInstance-1" class="tsd-anchor"></a><span class="tsd-kind-call-signature">get<wbr/>Instance</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">options</span><span class="tsd-signature-symbol">?</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><a href="LlmJson.html" class="tsd-signature-type tsd-kind-class">LlmJson</a><a href="#getInstance.getInstance-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></li><li class="tsd-description"><div class="tsd-comment tsd-typography"><p>Get or create a singleton instance of LlmJson.</p>
|
18
18
|
</div><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">options</span>: <a href="../interfaces/ExtractOptions.html" class="tsd-signature-type tsd-kind-interface">ExtractOptions</a><span class="tsd-signature-symbol"> = {}</span></span><div class="tsd-comment tsd-typography"><p>Configuration options for extraction.</p>
|
19
19
|
</div><div class="tsd-comment tsd-typography"></div></li></ul></div><h4 class="tsd-returns-title">Returns <a href="LlmJson.html" class="tsd-signature-type tsd-kind-class">LlmJson</a></h4><p>The LlmJson singleton instance.</p>
|
20
|
-
<div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/solvers-hub/llm-json/blob/
|
20
|
+
<div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/solvers-hub/llm-json/blob/de4fb5a4209b6f115ef863cd3e7016e7b565b262/src/index.ts#L27">index.ts:27</a></li></ul></aside></li></ul></section></section></div><div class="col-sidebar"><div class="page-menu"><div class="tsd-navigation settings"><details class="tsd-index-accordion"><summary class="tsd-accordion-summary"><h3><svg width="20" height="20" viewBox="0 0 24 24" fill="none"><use href="../assets/icons.svg#icon-chevronDown"></use></svg>Settings</h3></summary><div class="tsd-accordion-details"><div class="tsd-filter-visibility"><h4 class="uppercase">Member Visibility</h4><form><ul id="tsd-filter-options"><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-protected" name="protected"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Protected</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-private" name="private"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Private</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-inherited" name="inherited" checked/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Inherited</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-external" name="external"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>External</span></label></li></ul></form></div><div class="tsd-theme-toggle"><h4 class="uppercase">Theme</h4><select id="tsd-theme"><option value="os">OS</option><option value="light">Light</option><option value="dark">Dark</option></select></div></div></details></div><details open class="tsd-index-accordion tsd-page-navigation"><summary class="tsd-accordion-summary"><h3><svg width="20" height="20" viewBox="0 0 24 24" fill="none"><use href="../assets/icons.svg#icon-chevronDown"></use></svg>On This Page</h3></summary><div class="tsd-accordion-details"><a href="#constructor" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-512"></use></svg><span>constructor</span></a><a href="#arrayExtractor" class="tsd-is-private"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-1024"></use></svg><span>array<wbr/>Extractor</span></a><a href="#objectExtractor" class="tsd-is-private"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-1024"></use></svg><span>object<wbr/>Extractor</span></a><a href="#instance" class="tsd-is-private"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-1024"></use></svg><span>instance</span></a><a href="#extract" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-2048"></use></svg><span>extract</span></a><a href="#extractAll" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-2048"></use></svg><span>extract<wbr/>All</span></a><a href="#getInstance" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-2048"></use></svg><span>get<wbr/>Instance</span></a></div></details></div><div class="site-menu"><nav class="tsd-navigation"><a href="../modules.html"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-1"></use></svg><span>@solvers-hub/llm-json</span></a><ul class="tsd-small-nested-navigation" id="tsd-nav-container" data-base=".."><li>Loading...</li></ul></nav></div></div></div><footer><p class="tsd-generator">Generated using <a href="https://typedoc.org/" target="_blank">TypeDoc</a></p></footer><div class="overlay"></div></body></html>
|
package/docs/index.html
CHANGED
@@ -7,11 +7,15 @@
|
|
7
7
|
<li><strong>Multiple JSON Support</strong>: Extracts multiple JSON objects or arrays from a single input</li>
|
8
8
|
<li><strong>JSON Validation & Correction</strong>: Automatically fixes common JSON formatting errors from LLMs</li>
|
9
9
|
<li><strong>Code Block Support</strong>: Extracts JSON from markdown code blocks (```json)</li>
|
10
|
+
<li><strong>Schema Validation</strong>: Validates extracted JSON against provided schemas</li>
|
10
11
|
<li><strong>TypeScript Support</strong>: Written in TypeScript with full type definitions</li>
|
11
12
|
</ul>
|
12
13
|
<a id="md:quick-start" class="tsd-anchor"></a><h2><a href="#md:quick-start">Quick Start</a></h2><a id="md:installation" class="tsd-anchor"></a><h3><a href="#md:installation">Installation</a></h3><pre><code class="language-bash"><span class="hl-0">npm</span><span class="hl-1"> </span><span class="hl-2">install</span><span class="hl-1"> </span><span class="hl-2">@solvers-hub/llm-json</span>
|
13
14
|
</code><button>Copy</button></pre>
|
14
15
|
<a id="md:basic-usage" class="tsd-anchor"></a><h3><a href="#md:basic-usage">Basic Usage</a></h3><pre><code class="language-typescript"><span class="hl-3">import</span><span class="hl-1"> { </span><span class="hl-4">LlmJson</span><span class="hl-1"> } </span><span class="hl-3">from</span><span class="hl-1"> </span><span class="hl-2">'@solvers-hub/llm-json'</span><span class="hl-1">;</span><br/><br/><span class="hl-5">const</span><span class="hl-1"> </span><span class="hl-6">llmOutput</span><span class="hl-1"> = </span><span class="hl-2">`Here's some text followed by JSON:</span><br/><br/><span class="hl-2">{</span><br/><span class="hl-2"> "name": "John",</span><br/><span class="hl-2"> "age": 30,</span><br/><span class="hl-2"> "skills": ["JavaScript", "TypeScript", "React"]</span><br/><span class="hl-2">}`</span><span class="hl-1">;</span><br/><br/><span class="hl-5">const</span><span class="hl-1"> </span><span class="hl-6">llmJson</span><span class="hl-1"> = </span><span class="hl-5">new</span><span class="hl-1"> </span><span class="hl-0">LlmJson</span><span class="hl-1">({ </span><span class="hl-4">attemptCorrection:</span><span class="hl-1"> </span><span class="hl-5">true</span><span class="hl-1"> });</span><br/><span class="hl-5">const</span><span class="hl-1"> { </span><span class="hl-6">text</span><span class="hl-1">, </span><span class="hl-6">json</span><span class="hl-1"> } = </span><span class="hl-4">llmJson</span><span class="hl-1">.</span><span class="hl-0">extract</span><span class="hl-1">(</span><span class="hl-4">llmOutput</span><span class="hl-1">);</span><br/><br/><span class="hl-4">console</span><span class="hl-1">.</span><span class="hl-0">log</span><span class="hl-1">(</span><span class="hl-4">text</span><span class="hl-1">); </span><span class="hl-7">// ['Here\'s some text followed by JSON:']</span><br/><span class="hl-4">console</span><span class="hl-1">.</span><span class="hl-0">log</span><span class="hl-1">(</span><span class="hl-4">json</span><span class="hl-1">); </span><span class="hl-7">// [{ name: 'John', age: 30, skills: ['JavaScript', 'TypeScript', 'React'] }]</span>
|
15
16
|
</code><button>Copy</button></pre>
|
17
|
+
<a id="md:schema-validation" class="tsd-anchor"></a><h3><a href="#md:schema-validation">Schema Validation</a></h3><p>You can validate extracted JSON against schemas:</p>
|
18
|
+
<pre><code class="language-typescript"><span class="hl-3">import</span><span class="hl-1"> { </span><span class="hl-4">LlmJson</span><span class="hl-1"> } </span><span class="hl-3">from</span><span class="hl-1"> </span><span class="hl-2">'@solvers-hub/llm-json'</span><span class="hl-1">;</span><br/><br/><span class="hl-5">const</span><span class="hl-1"> </span><span class="hl-6">schemas</span><span class="hl-1"> = [</span><br/><span class="hl-1"> {</span><br/><span class="hl-1"> </span><span class="hl-4">name:</span><span class="hl-1"> </span><span class="hl-2">'person'</span><span class="hl-1">,</span><br/><span class="hl-1"> </span><span class="hl-4">schema:</span><span class="hl-1"> {</span><br/><span class="hl-1"> </span><span class="hl-4">type:</span><span class="hl-1"> </span><span class="hl-2">'object'</span><span class="hl-1">,</span><br/><span class="hl-1"> </span><span class="hl-4">properties:</span><span class="hl-1"> {</span><br/><span class="hl-1"> </span><span class="hl-4">name:</span><span class="hl-1"> { </span><span class="hl-4">type:</span><span class="hl-1"> </span><span class="hl-2">'string'</span><span class="hl-1"> },</span><br/><span class="hl-1"> </span><span class="hl-4">age:</span><span class="hl-1"> { </span><span class="hl-4">type:</span><span class="hl-1"> </span><span class="hl-2">'integer'</span><span class="hl-1"> }</span><br/><span class="hl-1"> },</span><br/><span class="hl-1"> </span><span class="hl-4">required:</span><span class="hl-1"> [</span><span class="hl-2">'name'</span><span class="hl-1">, </span><span class="hl-2">'age'</span><span class="hl-1">]</span><br/><span class="hl-1"> }</span><br/><span class="hl-1"> }</span><br/><span class="hl-1">];</span><br/><br/><span class="hl-5">const</span><span class="hl-1"> </span><span class="hl-6">llmJson</span><span class="hl-1"> = </span><span class="hl-5">new</span><span class="hl-1"> </span><span class="hl-0">LlmJson</span><span class="hl-1">({ </span><br/><span class="hl-1"> </span><span class="hl-4">attemptCorrection:</span><span class="hl-1"> </span><span class="hl-5">true</span><span class="hl-1">,</span><br/><span class="hl-1"> </span><span class="hl-4">schemas</span><br/><span class="hl-1">});</span><br/><br/><span class="hl-5">const</span><span class="hl-1"> </span><span class="hl-6">llmOutput</span><span class="hl-1"> = </span><span class="hl-2">`Here's a person: {"name": "John", "age": 30}</span><br/><span class="hl-2">And some other data: {"title": "Meeting notes"}`</span><span class="hl-1">;</span><br/><span class="hl-5">const</span><span class="hl-1"> </span><span class="hl-6">result</span><span class="hl-1"> = </span><span class="hl-4">llmJson</span><span class="hl-1">.</span><span class="hl-0">extract</span><span class="hl-1">(</span><span class="hl-4">llmOutput</span><span class="hl-1">);</span><br/><br/><span class="hl-7">// Note: All extracted JSON objects are included in the json array</span><br/><span class="hl-4">console</span><span class="hl-1">.</span><span class="hl-0">log</span><span class="hl-1">(</span><span class="hl-4">result</span><span class="hl-1">.</span><span class="hl-4">json</span><span class="hl-1">);</span><br/><span class="hl-7">// [</span><br/><span class="hl-7">// { name: 'John', age: 30 },</span><br/><span class="hl-7">// { title: 'Meeting notes' }</span><br/><span class="hl-7">// ]</span><br/><br/><span class="hl-7">// The validatedJson array includes validation results for each JSON object</span><br/><span class="hl-4">console</span><span class="hl-1">.</span><span class="hl-0">log</span><span class="hl-1">(</span><span class="hl-4">result</span><span class="hl-1">.</span><span class="hl-4">validatedJson</span><span class="hl-1">);</span><br/><span class="hl-7">// [</span><br/><span class="hl-7">// {</span><br/><span class="hl-7">// json: { name: 'John', age: 30 },</span><br/><span class="hl-7">// matchedSchema: 'person',</span><br/><span class="hl-7">// isValid: true</span><br/><span class="hl-7">// },</span><br/><span class="hl-7">// {</span><br/><span class="hl-7">// json: { title: 'Meeting notes' },</span><br/><span class="hl-7">// matchedSchema: null,</span><br/><span class="hl-7">// isValid: false,</span><br/><span class="hl-7">// validationErrors: [...] // Validation errors</span><br/><span class="hl-7">// }</span><br/><span class="hl-7">// ]</span><br/><br/><span class="hl-7">// Always check isValid and matchedSchema to determine if JSON matched a schema</span><br/><span class="hl-5">const</span><span class="hl-1"> </span><span class="hl-6">validJsonObjects</span><span class="hl-1"> = </span><span class="hl-4">result</span><span class="hl-1">.</span><span class="hl-4">validatedJson</span><span class="hl-1">.</span><span class="hl-0">filter</span><span class="hl-1">(</span><span class="hl-4">item</span><span class="hl-1"> </span><span class="hl-5">=></span><span class="hl-1"> </span><span class="hl-4">item</span><span class="hl-1">.</span><span class="hl-4">isValid</span><span class="hl-1">);</span>
|
19
|
+
</code><button>Copy</button></pre>
|
16
20
|
<a id="md:license" class="tsd-anchor"></a><h2><a href="#md:license">License</a></h2><p>MIT © 2023</p>
|
17
|
-
</div></div><div class="col-sidebar"><div class="page-menu"><div class="tsd-navigation settings"><details class="tsd-index-accordion"><summary class="tsd-accordion-summary"><h3><svg width="20" height="20" viewBox="0 0 24 24" fill="none"><use href="assets/icons.svg#icon-chevronDown"></use></svg>Settings</h3></summary><div class="tsd-accordion-details"><div class="tsd-filter-visibility"><h4 class="uppercase">Member Visibility</h4><form><ul id="tsd-filter-options"><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-protected" name="protected"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Protected</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-private" name="private"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Private</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-inherited" name="inherited" checked/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Inherited</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-external" name="external"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>External</span></label></li></ul></form></div><div class="tsd-theme-toggle"><h4 class="uppercase">Theme</h4><select id="tsd-theme"><option value="os">OS</option><option value="light">Light</option><option value="dark">Dark</option></select></div></div></details></div><details open class="tsd-index-accordion tsd-page-navigation"><summary class="tsd-accordion-summary"><h3><svg width="20" height="20" viewBox="0 0 24 24" fill="none"><use href="assets/icons.svg#icon-chevronDown"></use></svg>On This Page</h3></summary><div class="tsd-accordion-details"><a href="#md:llm-json-extractor"><span>LLM-<wbr/>JSON <wbr/>Extractor</span></a><ul><li><a href="#md:overview"><span>Overview</span></a></li><li><a href="#md:key-features"><span>Key <wbr/>Features</span></a></li><li><a href="#md:quick-start"><span>Quick <wbr/>Start</span></a></li><li><ul><li><a href="#md:installation"><span>Installation</span></a></li><li><a href="#md:basic-usage"><span>Basic <wbr/>Usage</span></a></li></ul></li><li><a href="#md:license"><span>License</span></a></li></ul></div></details></div><div class="site-menu"><nav class="tsd-navigation"><a href="modules.html" class="current"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="assets/icons.svg#icon-1"></use></svg><span>@solvers-hub/llm-json</span></a><ul class="tsd-small-nested-navigation" id="tsd-nav-container" data-base="."><li>Loading...</li></ul></nav></div></div></div><footer><p class="tsd-generator">Generated using <a href="https://typedoc.org/" target="_blank">TypeDoc</a></p></footer><div class="overlay"></div></body></html>
|
21
|
+
</div></div><div class="col-sidebar"><div class="page-menu"><div class="tsd-navigation settings"><details class="tsd-index-accordion"><summary class="tsd-accordion-summary"><h3><svg width="20" height="20" viewBox="0 0 24 24" fill="none"><use href="assets/icons.svg#icon-chevronDown"></use></svg>Settings</h3></summary><div class="tsd-accordion-details"><div class="tsd-filter-visibility"><h4 class="uppercase">Member Visibility</h4><form><ul id="tsd-filter-options"><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-protected" name="protected"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Protected</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-private" name="private"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Private</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-inherited" name="inherited" checked/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Inherited</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-external" name="external"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>External</span></label></li></ul></form></div><div class="tsd-theme-toggle"><h4 class="uppercase">Theme</h4><select id="tsd-theme"><option value="os">OS</option><option value="light">Light</option><option value="dark">Dark</option></select></div></div></details></div><details open class="tsd-index-accordion tsd-page-navigation"><summary class="tsd-accordion-summary"><h3><svg width="20" height="20" viewBox="0 0 24 24" fill="none"><use href="assets/icons.svg#icon-chevronDown"></use></svg>On This Page</h3></summary><div class="tsd-accordion-details"><a href="#md:llm-json-extractor"><span>LLM-<wbr/>JSON <wbr/>Extractor</span></a><ul><li><a href="#md:overview"><span>Overview</span></a></li><li><a href="#md:key-features"><span>Key <wbr/>Features</span></a></li><li><a href="#md:quick-start"><span>Quick <wbr/>Start</span></a></li><li><ul><li><a href="#md:installation"><span>Installation</span></a></li><li><a href="#md:basic-usage"><span>Basic <wbr/>Usage</span></a></li><li><a href="#md:schema-validation"><span>Schema <wbr/>Validation</span></a></li></ul></li><li><a href="#md:license"><span>License</span></a></li></ul></div></details></div><div class="site-menu"><nav class="tsd-navigation"><a href="modules.html" class="current"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="assets/icons.svg#icon-1"></use></svg><span>@solvers-hub/llm-json</span></a><ul class="tsd-small-nested-navigation" id="tsd-nav-container" data-base="."><li>Loading...</li></ul></nav></div></div></div><footer><p class="tsd-generator">Generated using <a href="https://typedoc.org/" target="_blank">TypeDoc</a></p></footer><div class="overlay"></div></body></html>
|
@@ -1,6 +1,11 @@
|
|
1
1
|
<!DOCTYPE html><html class="default" lang="en"><head><meta charSet="utf-8"/><meta http-equiv="x-ua-compatible" content="IE=edge"/><title>ExtractOptions | @solvers-hub/llm-json</title><meta name="description" content="Documentation for @solvers-hub/llm-json"/><meta name="viewport" content="width=device-width, initial-scale=1"/><link rel="stylesheet" href="../assets/style.css"/><link rel="stylesheet" href="../assets/highlight.css"/><script defer src="../assets/main.js"></script><script async src="../assets/icons.js" id="tsd-icons-script"></script><script async src="../assets/search.js" id="tsd-search-script"></script><script async src="../assets/navigation.js" id="tsd-nav-script"></script></head><body><script>document.documentElement.dataset.theme = localStorage.getItem("tsd-theme") || "os";document.body.style.display="none";setTimeout(() => app?app.showPage():document.body.style.removeProperty("display"),500)</script><header class="tsd-page-toolbar"><div class="tsd-toolbar-contents container"><div class="table-cell" id="tsd-search" data-base=".."><div class="field"><label for="tsd-search-field" class="tsd-widget tsd-toolbar-icon search no-caption"><svg width="16" height="16" viewBox="0 0 16 16" fill="none"><use href="../assets/icons.svg#icon-search"></use></svg></label><input type="text" id="tsd-search-field" aria-label="Search"/></div><div class="field"><div id="tsd-toolbar-links"></div></div><ul class="results"><li class="state loading">Preparing search index...</li><li class="state failure">The search index is not available</li></ul><a href="../index.html" class="title">@solvers-hub/llm-json</a></div><div class="table-cell" id="tsd-widgets"><a href="#" class="tsd-widget tsd-toolbar-icon menu no-caption" data-toggle="menu" aria-label="Menu"><svg width="16" height="16" viewBox="0 0 16 16" fill="none"><use href="../assets/icons.svg#icon-menu"></use></svg></a></div></div></header><div class="container container-main"><div class="col-content"><div class="tsd-page-title"><ul class="tsd-breadcrumb"><li><a href="../modules.html">@solvers-hub/llm-json</a></li><li><a href="ExtractOptions.html">ExtractOptions</a></li></ul><h1>Interface ExtractOptions</h1></div><section class="tsd-panel tsd-comment"><div class="tsd-comment tsd-typography"><p>Options for JSON extraction.</p>
|
2
|
-
</div><div class="tsd-comment tsd-typography"></div></section><div class="tsd-signature"><span class="tsd-signature-keyword">interface </span><span class="tsd-kind-interface">ExtractOptions</span> <span class="tsd-signature-symbol">{ </span><br/><span> </span><a class="tsd-kind-property" href="ExtractOptions.html#attemptCorrection">attemptCorrection</a><span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">boolean</span><span class="tsd-signature-symbol">; </span><br/><span class="tsd-signature-symbol">}</span></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/solvers-hub/llm-json/blob/
|
2
|
+
</div><div class="tsd-comment tsd-typography"></div></section><div class="tsd-signature"><span class="tsd-signature-keyword">interface </span><span class="tsd-kind-interface">ExtractOptions</span> <span class="tsd-signature-symbol">{ </span><br/><span> </span><a class="tsd-kind-property" href="ExtractOptions.html#attemptCorrection">attemptCorrection</a><span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">boolean</span><span class="tsd-signature-symbol">; </span><br/><span> </span><a class="tsd-kind-property" href="ExtractOptions.html#schemas">schemas</a><span class="tsd-signature-symbol">?: </span><a href="SchemaDefinition.html" class="tsd-signature-type tsd-kind-interface">SchemaDefinition</a><span class="tsd-signature-symbol">[]</span><span class="tsd-signature-symbol">; </span><br/><span class="tsd-signature-symbol">}</span></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/solvers-hub/llm-json/blob/de4fb5a4209b6f115ef863cd3e7016e7b565b262/src/types.ts#L4">types.ts:4</a></li></ul></aside><section class="tsd-panel-group tsd-index-group"><section class="tsd-panel tsd-index-panel"><details class="tsd-index-content tsd-index-accordion" open><summary class="tsd-accordion-summary tsd-index-summary"><h5 class="tsd-index-heading uppercase" role="button" aria-expanded="false" tabIndex="0"><svg width="16" height="16" viewBox="0 0 16 16" fill="none"><use href="../assets/icons.svg#icon-chevronSmall"></use></svg> Index</h5></summary><div class="tsd-accordion-details"><section class="tsd-index-section"><h3 class="tsd-index-heading">Properties</h3><div class="tsd-index-list"><a href="ExtractOptions.html#attemptCorrection" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-1024"></use></svg><span>attempt<wbr/>Correction?</span></a>
|
3
|
+
<a href="ExtractOptions.html#schemas" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-1024"></use></svg><span>schemas?</span></a>
|
3
4
|
</div></section></div></details></section></section><section class="tsd-panel-group tsd-member-group"><h2>Properties</h2><section class="tsd-panel tsd-member"><a id="attemptCorrection" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><code class="tsd-tag ts-flagOptional">Optional</code> <span>attempt<wbr/>Correction</span><a href="#attemptCorrection" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><div class="tsd-signature"><span class="tsd-kind-property">attempt<wbr/>Correction</span><span class="tsd-signature-symbol">?:</span> <span class="tsd-signature-type">boolean</span></div><div class="tsd-comment tsd-typography"><p>Whether to attempt to correct malformed JSON.</p>
|
4
5
|
</div><div class="tsd-comment tsd-typography"><h4>Default</h4><pre><code class="language-ts"><span class="hl-5">false</span>
|
5
6
|
</code><button>Copy</button></pre>
|
6
|
-
</div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/solvers-hub/llm-json/blob/
|
7
|
+
</div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/solvers-hub/llm-json/blob/de4fb5a4209b6f115ef863cd3e7016e7b565b262/src/types.ts#L9">types.ts:9</a></li></ul></aside></section><section class="tsd-panel tsd-member"><a id="schemas" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><code class="tsd-tag ts-flagOptional">Optional</code> <span>schemas</span><a href="#schemas" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><div class="tsd-signature"><span class="tsd-kind-property">schemas</span><span class="tsd-signature-symbol">?:</span> <a href="SchemaDefinition.html" class="tsd-signature-type tsd-kind-interface">SchemaDefinition</a><span class="tsd-signature-symbol">[]</span></div><div class="tsd-comment tsd-typography"><p>JSON schemas to validate extracted JSON against.
|
8
|
+
If provided, the extracted JSON will be validated against these schemas.</p>
|
9
|
+
</div><div class="tsd-comment tsd-typography"><h4>Default</h4><pre><code class="language-ts"><span class="hl-5">undefined</span>
|
10
|
+
</code><button>Copy</button></pre>
|
11
|
+
</div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/solvers-hub/llm-json/blob/de4fb5a4209b6f115ef863cd3e7016e7b565b262/src/types.ts#L16">types.ts:16</a></li></ul></aside></section></section></div><div class="col-sidebar"><div class="page-menu"><div class="tsd-navigation settings"><details class="tsd-index-accordion"><summary class="tsd-accordion-summary"><h3><svg width="20" height="20" viewBox="0 0 24 24" fill="none"><use href="../assets/icons.svg#icon-chevronDown"></use></svg>Settings</h3></summary><div class="tsd-accordion-details"><div class="tsd-filter-visibility"><h4 class="uppercase">Member Visibility</h4><form><ul id="tsd-filter-options"><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-protected" name="protected"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Protected</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-private" name="private"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Private</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-inherited" name="inherited" checked/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Inherited</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-external" name="external"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>External</span></label></li></ul></form></div><div class="tsd-theme-toggle"><h4 class="uppercase">Theme</h4><select id="tsd-theme"><option value="os">OS</option><option value="light">Light</option><option value="dark">Dark</option></select></div></div></details></div><details open class="tsd-index-accordion tsd-page-navigation"><summary class="tsd-accordion-summary"><h3><svg width="20" height="20" viewBox="0 0 24 24" fill="none"><use href="../assets/icons.svg#icon-chevronDown"></use></svg>On This Page</h3></summary><div class="tsd-accordion-details"><a href="#attemptCorrection" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-1024"></use></svg><span>attempt<wbr/>Correction</span></a><a href="#schemas" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-1024"></use></svg><span>schemas</span></a></div></details></div><div class="site-menu"><nav class="tsd-navigation"><a href="../modules.html"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-1"></use></svg><span>@solvers-hub/llm-json</span></a><ul class="tsd-small-nested-navigation" id="tsd-nav-container" data-base=".."><li>Loading...</li></ul></nav></div></div></div><footer><p class="tsd-generator">Generated using <a href="https://typedoc.org/" target="_blank">TypeDoc</a></p></footer><div class="overlay"></div></body></html>
|
@@ -1,6 +1,8 @@
|
|
1
1
|
<!DOCTYPE html><html class="default" lang="en"><head><meta charSet="utf-8"/><meta http-equiv="x-ua-compatible" content="IE=edge"/><title>ExtractResult | @solvers-hub/llm-json</title><meta name="description" content="Documentation for @solvers-hub/llm-json"/><meta name="viewport" content="width=device-width, initial-scale=1"/><link rel="stylesheet" href="../assets/style.css"/><link rel="stylesheet" href="../assets/highlight.css"/><script defer src="../assets/main.js"></script><script async src="../assets/icons.js" id="tsd-icons-script"></script><script async src="../assets/search.js" id="tsd-search-script"></script><script async src="../assets/navigation.js" id="tsd-nav-script"></script></head><body><script>document.documentElement.dataset.theme = localStorage.getItem("tsd-theme") || "os";document.body.style.display="none";setTimeout(() => app?app.showPage():document.body.style.removeProperty("display"),500)</script><header class="tsd-page-toolbar"><div class="tsd-toolbar-contents container"><div class="table-cell" id="tsd-search" data-base=".."><div class="field"><label for="tsd-search-field" class="tsd-widget tsd-toolbar-icon search no-caption"><svg width="16" height="16" viewBox="0 0 16 16" fill="none"><use href="../assets/icons.svg#icon-search"></use></svg></label><input type="text" id="tsd-search-field" aria-label="Search"/></div><div class="field"><div id="tsd-toolbar-links"></div></div><ul class="results"><li class="state loading">Preparing search index...</li><li class="state failure">The search index is not available</li></ul><a href="../index.html" class="title">@solvers-hub/llm-json</a></div><div class="table-cell" id="tsd-widgets"><a href="#" class="tsd-widget tsd-toolbar-icon menu no-caption" data-toggle="menu" aria-label="Menu"><svg width="16" height="16" viewBox="0 0 16 16" fill="none"><use href="../assets/icons.svg#icon-menu"></use></svg></a></div></div></header><div class="container container-main"><div class="col-content"><div class="tsd-page-title"><ul class="tsd-breadcrumb"><li><a href="../modules.html">@solvers-hub/llm-json</a></li><li><a href="ExtractResult.html">ExtractResult</a></li></ul><h1>Interface ExtractResult</h1></div><section class="tsd-panel tsd-comment"><div class="tsd-comment tsd-typography"><p>Result of the JSON extraction.</p>
|
2
|
-
</div><div class="tsd-comment tsd-typography"></div></section><div class="tsd-signature"><span class="tsd-signature-keyword">interface </span><span class="tsd-kind-interface">ExtractResult</span> <span class="tsd-signature-symbol">{ </span><br/><span> </span><a class="tsd-kind-property" href="ExtractResult.html#json">json</a><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">[]</span><span class="tsd-signature-symbol">; </span><br/><span> </span><a class="tsd-kind-property" href="ExtractResult.html#text">text</a><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">[]</span><span class="tsd-signature-symbol">; </span><br/><span class="tsd-signature-symbol">}</span></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/solvers-hub/llm-json/blob/
|
2
|
+
</div><div class="tsd-comment tsd-typography"></div></section><div class="tsd-signature"><span class="tsd-signature-keyword">interface </span><span class="tsd-kind-interface">ExtractResult</span> <span class="tsd-signature-symbol">{ </span><br/><span> </span><a class="tsd-kind-property" href="ExtractResult.html#json">json</a><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">[]</span><span class="tsd-signature-symbol">; </span><br/><span> </span><a class="tsd-kind-property" href="ExtractResult.html#text">text</a><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">[]</span><span class="tsd-signature-symbol">; </span><br/><span> </span><a class="tsd-kind-property" href="ExtractResult.html#validatedJson">validatedJson</a><span class="tsd-signature-symbol">?: </span><a href="ValidationResult.html" class="tsd-signature-type tsd-kind-interface">ValidationResult</a><span class="tsd-signature-symbol">[]</span><span class="tsd-signature-symbol">; </span><br/><span class="tsd-signature-symbol">}</span></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/solvers-hub/llm-json/blob/de4fb5a4209b6f115ef863cd3e7016e7b565b262/src/types.ts#L62">types.ts:62</a></li></ul></aside><section class="tsd-panel-group tsd-index-group"><section class="tsd-panel tsd-index-panel"><details class="tsd-index-content tsd-index-accordion" open><summary class="tsd-accordion-summary tsd-index-summary"><h5 class="tsd-index-heading uppercase" role="button" aria-expanded="false" tabIndex="0"><svg width="16" height="16" viewBox="0 0 16 16" fill="none"><use href="../assets/icons.svg#icon-chevronSmall"></use></svg> Index</h5></summary><div class="tsd-accordion-details"><section class="tsd-index-section"><h3 class="tsd-index-heading">Properties</h3><div class="tsd-index-list"><a href="ExtractResult.html#json" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-1024"></use></svg><span>json</span></a>
|
3
3
|
<a href="ExtractResult.html#text" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-1024"></use></svg><span>text</span></a>
|
4
|
+
<a href="ExtractResult.html#validatedJson" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-1024"></use></svg><span>validated<wbr/>Json?</span></a>
|
4
5
|
</div></section></div></details></section></section><section class="tsd-panel-group tsd-member-group"><h2>Properties</h2><section class="tsd-panel tsd-member"><a id="json" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>json</span><a href="#json" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><div class="tsd-signature"><span class="tsd-kind-property">json</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">[]</span></div><div class="tsd-comment tsd-typography"><p>Array of parsed JSON objects extracted from the input.</p>
|
5
|
-
</div><div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/solvers-hub/llm-json/blob/
|
6
|
-
</div><div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/solvers-hub/llm-json/blob/
|
6
|
+
</div><div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/solvers-hub/llm-json/blob/de4fb5a4209b6f115ef863cd3e7016e7b565b262/src/types.ts#L71">types.ts:71</a></li></ul></aside></section><section class="tsd-panel tsd-member"><a id="text" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>text</span><a href="#text" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><div class="tsd-signature"><span class="tsd-kind-property">text</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">[]</span></div><div class="tsd-comment tsd-typography"><p>Array of text blocks extracted from the input.</p>
|
7
|
+
</div><div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/solvers-hub/llm-json/blob/de4fb5a4209b6f115ef863cd3e7016e7b565b262/src/types.ts#L66">types.ts:66</a></li></ul></aside></section><section class="tsd-panel tsd-member"><a id="validatedJson" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><code class="tsd-tag ts-flagOptional">Optional</code> <span>validated<wbr/>Json</span><a href="#validatedJson" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><div class="tsd-signature"><span class="tsd-kind-property">validated<wbr/>Json</span><span class="tsd-signature-symbol">?:</span> <a href="ValidationResult.html" class="tsd-signature-type tsd-kind-interface">ValidationResult</a><span class="tsd-signature-symbol">[]</span></div><div class="tsd-comment tsd-typography"><p>Array of validated JSON results, only present if schemas were provided.</p>
|
8
|
+
</div><div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/solvers-hub/llm-json/blob/de4fb5a4209b6f115ef863cd3e7016e7b565b262/src/types.ts#L76">types.ts:76</a></li></ul></aside></section></section></div><div class="col-sidebar"><div class="page-menu"><div class="tsd-navigation settings"><details class="tsd-index-accordion"><summary class="tsd-accordion-summary"><h3><svg width="20" height="20" viewBox="0 0 24 24" fill="none"><use href="../assets/icons.svg#icon-chevronDown"></use></svg>Settings</h3></summary><div class="tsd-accordion-details"><div class="tsd-filter-visibility"><h4 class="uppercase">Member Visibility</h4><form><ul id="tsd-filter-options"><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-protected" name="protected"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Protected</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-private" name="private"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Private</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-inherited" name="inherited" checked/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Inherited</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-external" name="external"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>External</span></label></li></ul></form></div><div class="tsd-theme-toggle"><h4 class="uppercase">Theme</h4><select id="tsd-theme"><option value="os">OS</option><option value="light">Light</option><option value="dark">Dark</option></select></div></div></details></div><details open class="tsd-index-accordion tsd-page-navigation"><summary class="tsd-accordion-summary"><h3><svg width="20" height="20" viewBox="0 0 24 24" fill="none"><use href="../assets/icons.svg#icon-chevronDown"></use></svg>On This Page</h3></summary><div class="tsd-accordion-details"><a href="#json" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-1024"></use></svg><span>json</span></a><a href="#text" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-1024"></use></svg><span>text</span></a><a href="#validatedJson" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-1024"></use></svg><span>validated<wbr/>Json</span></a></div></details></div><div class="site-menu"><nav class="tsd-navigation"><a href="../modules.html"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-1"></use></svg><span>@solvers-hub/llm-json</span></a><ul class="tsd-small-nested-navigation" id="tsd-nav-container" data-base=".."><li>Loading...</li></ul></nav></div></div></div><footer><p class="tsd-generator">Generated using <a href="https://typedoc.org/" target="_blank">TypeDoc</a></p></footer><div class="overlay"></div></body></html>
|
@@ -1,12 +1,12 @@
|
|
1
1
|
<!DOCTYPE html><html class="default" lang="en"><head><meta charSet="utf-8"/><meta http-equiv="x-ua-compatible" content="IE=edge"/><title>JsonBlock | @solvers-hub/llm-json</title><meta name="description" content="Documentation for @solvers-hub/llm-json"/><meta name="viewport" content="width=device-width, initial-scale=1"/><link rel="stylesheet" href="../assets/style.css"/><link rel="stylesheet" href="../assets/highlight.css"/><script defer src="../assets/main.js"></script><script async src="../assets/icons.js" id="tsd-icons-script"></script><script async src="../assets/search.js" id="tsd-search-script"></script><script async src="../assets/navigation.js" id="tsd-nav-script"></script></head><body><script>document.documentElement.dataset.theme = localStorage.getItem("tsd-theme") || "os";document.body.style.display="none";setTimeout(() => app?app.showPage():document.body.style.removeProperty("display"),500)</script><header class="tsd-page-toolbar"><div class="tsd-toolbar-contents container"><div class="table-cell" id="tsd-search" data-base=".."><div class="field"><label for="tsd-search-field" class="tsd-widget tsd-toolbar-icon search no-caption"><svg width="16" height="16" viewBox="0 0 16 16" fill="none"><use href="../assets/icons.svg#icon-search"></use></svg></label><input type="text" id="tsd-search-field" aria-label="Search"/></div><div class="field"><div id="tsd-toolbar-links"></div></div><ul class="results"><li class="state loading">Preparing search index...</li><li class="state failure">The search index is not available</li></ul><a href="../index.html" class="title">@solvers-hub/llm-json</a></div><div class="table-cell" id="tsd-widgets"><a href="#" class="tsd-widget tsd-toolbar-icon menu no-caption" data-toggle="menu" aria-label="Menu"><svg width="16" height="16" viewBox="0 0 16 16" fill="none"><use href="../assets/icons.svg#icon-menu"></use></svg></a></div></div></header><div class="container container-main"><div class="col-content"><div class="tsd-page-title"><ul class="tsd-breadcrumb"><li><a href="../modules.html">@solvers-hub/llm-json</a></li><li><a href="JsonBlock.html">JsonBlock</a></li></ul><h1>Interface JsonBlock</h1></div><section class="tsd-panel tsd-comment"><div class="tsd-comment tsd-typography"><p>Information about a detected JSON block.</p>
|
2
|
-
</div><div class="tsd-comment tsd-typography"></div></section><div class="tsd-signature"><span class="tsd-signature-keyword">interface </span><span class="tsd-kind-interface">JsonBlock</span> <span class="tsd-signature-symbol">{ </span><br/><span> </span><a class="tsd-kind-property" href="JsonBlock.html#endIndex">endIndex</a><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">; </span><br/><span> </span><a class="tsd-kind-property" href="JsonBlock.html#parsed">parsed</a><span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">; </span><br/><span> </span><a class="tsd-kind-property" href="JsonBlock.html#raw">raw</a><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">; </span><br/><span> </span><a class="tsd-kind-property" href="JsonBlock.html#startIndex">startIndex</a><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">; </span><br/><span> </span><a class="tsd-kind-property" href="JsonBlock.html#wasCorrected">wasCorrected</a><span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">boolean</span><span class="tsd-signature-symbol">; </span><br/><span class="tsd-signature-symbol">}</span></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/solvers-hub/llm-json/blob/
|
2
|
+
</div><div class="tsd-comment tsd-typography"></div></section><div class="tsd-signature"><span class="tsd-signature-keyword">interface </span><span class="tsd-kind-interface">JsonBlock</span> <span class="tsd-signature-symbol">{ </span><br/><span> </span><a class="tsd-kind-property" href="JsonBlock.html#endIndex">endIndex</a><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">; </span><br/><span> </span><a class="tsd-kind-property" href="JsonBlock.html#parsed">parsed</a><span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">; </span><br/><span> </span><a class="tsd-kind-property" href="JsonBlock.html#raw">raw</a><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">; </span><br/><span> </span><a class="tsd-kind-property" href="JsonBlock.html#startIndex">startIndex</a><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">; </span><br/><span> </span><a class="tsd-kind-property" href="JsonBlock.html#wasCorrected">wasCorrected</a><span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">boolean</span><span class="tsd-signature-symbol">; </span><br/><span class="tsd-signature-symbol">}</span></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/solvers-hub/llm-json/blob/de4fb5a4209b6f115ef863cd3e7016e7b565b262/src/types.ts#L82">types.ts:82</a></li></ul></aside><section class="tsd-panel-group tsd-index-group"><section class="tsd-panel tsd-index-panel"><details class="tsd-index-content tsd-index-accordion" open><summary class="tsd-accordion-summary tsd-index-summary"><h5 class="tsd-index-heading uppercase" role="button" aria-expanded="false" tabIndex="0"><svg width="16" height="16" viewBox="0 0 16 16" fill="none"><use href="../assets/icons.svg#icon-chevronSmall"></use></svg> Index</h5></summary><div class="tsd-accordion-details"><section class="tsd-index-section"><h3 class="tsd-index-heading">Properties</h3><div class="tsd-index-list"><a href="JsonBlock.html#endIndex" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-1024"></use></svg><span>end<wbr/>Index</span></a>
|
3
3
|
<a href="JsonBlock.html#parsed" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-1024"></use></svg><span>parsed?</span></a>
|
4
4
|
<a href="JsonBlock.html#raw" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-1024"></use></svg><span>raw</span></a>
|
5
5
|
<a href="JsonBlock.html#startIndex" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-1024"></use></svg><span>start<wbr/>Index</span></a>
|
6
6
|
<a href="JsonBlock.html#wasCorrected" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-1024"></use></svg><span>was<wbr/>Corrected?</span></a>
|
7
7
|
</div></section></div></details></section></section><section class="tsd-panel-group tsd-member-group"><h2>Properties</h2><section class="tsd-panel tsd-member"><a id="endIndex" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>end<wbr/>Index</span><a href="#endIndex" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><div class="tsd-signature"><span class="tsd-kind-property">end<wbr/>Index</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">number</span></div><div class="tsd-comment tsd-typography"><p>The end index of the JSON block in the input string.</p>
|
8
|
-
</div><div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/solvers-hub/llm-json/blob/
|
9
|
-
</div><div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/solvers-hub/llm-json/blob/
|
10
|
-
</div><div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/solvers-hub/llm-json/blob/
|
11
|
-
</div><div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/solvers-hub/llm-json/blob/
|
12
|
-
</div><div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/solvers-hub/llm-json/blob/
|
8
|
+
</div><div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/solvers-hub/llm-json/blob/de4fb5a4209b6f115ef863cd3e7016e7b565b262/src/types.ts#L96">types.ts:96</a></li></ul></aside></section><section class="tsd-panel tsd-member"><a id="parsed" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><code class="tsd-tag ts-flagOptional">Optional</code> <span>parsed</span><a href="#parsed" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><div class="tsd-signature"><span class="tsd-kind-property">parsed</span><span class="tsd-signature-symbol">?:</span> <span class="tsd-signature-type">any</span></div><div class="tsd-comment tsd-typography"><p>The parsed JSON object.</p>
|
9
|
+
</div><div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/solvers-hub/llm-json/blob/de4fb5a4209b6f115ef863cd3e7016e7b565b262/src/types.ts#L106">types.ts:106</a></li></ul></aside></section><section class="tsd-panel tsd-member"><a id="raw" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>raw</span><a href="#raw" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><div class="tsd-signature"><span class="tsd-kind-property">raw</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span></div><div class="tsd-comment tsd-typography"><p>The raw JSON string.</p>
|
10
|
+
</div><div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/solvers-hub/llm-json/blob/de4fb5a4209b6f115ef863cd3e7016e7b565b262/src/types.ts#L86">types.ts:86</a></li></ul></aside></section><section class="tsd-panel tsd-member"><a id="startIndex" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>start<wbr/>Index</span><a href="#startIndex" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><div class="tsd-signature"><span class="tsd-kind-property">start<wbr/>Index</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">number</span></div><div class="tsd-comment tsd-typography"><p>The start index of the JSON block in the input string.</p>
|
11
|
+
</div><div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/solvers-hub/llm-json/blob/de4fb5a4209b6f115ef863cd3e7016e7b565b262/src/types.ts#L91">types.ts:91</a></li></ul></aside></section><section class="tsd-panel tsd-member"><a id="wasCorrected" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><code class="tsd-tag ts-flagOptional">Optional</code> <span>was<wbr/>Corrected</span><a href="#wasCorrected" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><div class="tsd-signature"><span class="tsd-kind-property">was<wbr/>Corrected</span><span class="tsd-signature-symbol">?:</span> <span class="tsd-signature-type">boolean</span></div><div class="tsd-comment tsd-typography"><p>Whether the JSON was corrected.</p>
|
12
|
+
</div><div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/solvers-hub/llm-json/blob/de4fb5a4209b6f115ef863cd3e7016e7b565b262/src/types.ts#L101">types.ts:101</a></li></ul></aside></section></section></div><div class="col-sidebar"><div class="page-menu"><div class="tsd-navigation settings"><details class="tsd-index-accordion"><summary class="tsd-accordion-summary"><h3><svg width="20" height="20" viewBox="0 0 24 24" fill="none"><use href="../assets/icons.svg#icon-chevronDown"></use></svg>Settings</h3></summary><div class="tsd-accordion-details"><div class="tsd-filter-visibility"><h4 class="uppercase">Member Visibility</h4><form><ul id="tsd-filter-options"><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-protected" name="protected"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Protected</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-private" name="private"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Private</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-inherited" name="inherited" checked/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Inherited</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-external" name="external"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>External</span></label></li></ul></form></div><div class="tsd-theme-toggle"><h4 class="uppercase">Theme</h4><select id="tsd-theme"><option value="os">OS</option><option value="light">Light</option><option value="dark">Dark</option></select></div></div></details></div><details open class="tsd-index-accordion tsd-page-navigation"><summary class="tsd-accordion-summary"><h3><svg width="20" height="20" viewBox="0 0 24 24" fill="none"><use href="../assets/icons.svg#icon-chevronDown"></use></svg>On This Page</h3></summary><div class="tsd-accordion-details"><a href="#endIndex" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-1024"></use></svg><span>end<wbr/>Index</span></a><a href="#parsed" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-1024"></use></svg><span>parsed</span></a><a href="#raw" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-1024"></use></svg><span>raw</span></a><a href="#startIndex" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-1024"></use></svg><span>start<wbr/>Index</span></a><a href="#wasCorrected" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-1024"></use></svg><span>was<wbr/>Corrected</span></a></div></details></div><div class="site-menu"><nav class="tsd-navigation"><a href="../modules.html"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-1"></use></svg><span>@solvers-hub/llm-json</span></a><ul class="tsd-small-nested-navigation" id="tsd-nav-container" data-base=".."><li>Loading...</li></ul></nav></div></div></div><footer><p class="tsd-generator">Generated using <a href="https://typedoc.org/" target="_blank">TypeDoc</a></p></footer><div class="overlay"></div></body></html>
|
@@ -1,8 +1,8 @@
|
|
1
1
|
<!DOCTYPE html><html class="default" lang="en"><head><meta charSet="utf-8"/><meta http-equiv="x-ua-compatible" content="IE=edge"/><title>JsonParseError | @solvers-hub/llm-json</title><meta name="description" content="Documentation for @solvers-hub/llm-json"/><meta name="viewport" content="width=device-width, initial-scale=1"/><link rel="stylesheet" href="../assets/style.css"/><link rel="stylesheet" href="../assets/highlight.css"/><script defer src="../assets/main.js"></script><script async src="../assets/icons.js" id="tsd-icons-script"></script><script async src="../assets/search.js" id="tsd-search-script"></script><script async src="../assets/navigation.js" id="tsd-nav-script"></script></head><body><script>document.documentElement.dataset.theme = localStorage.getItem("tsd-theme") || "os";document.body.style.display="none";setTimeout(() => app?app.showPage():document.body.style.removeProperty("display"),500)</script><header class="tsd-page-toolbar"><div class="tsd-toolbar-contents container"><div class="table-cell" id="tsd-search" data-base=".."><div class="field"><label for="tsd-search-field" class="tsd-widget tsd-toolbar-icon search no-caption"><svg width="16" height="16" viewBox="0 0 16 16" fill="none"><use href="../assets/icons.svg#icon-search"></use></svg></label><input type="text" id="tsd-search-field" aria-label="Search"/></div><div class="field"><div id="tsd-toolbar-links"></div></div><ul class="results"><li class="state loading">Preparing search index...</li><li class="state failure">The search index is not available</li></ul><a href="../index.html" class="title">@solvers-hub/llm-json</a></div><div class="table-cell" id="tsd-widgets"><a href="#" class="tsd-widget tsd-toolbar-icon menu no-caption" data-toggle="menu" aria-label="Menu"><svg width="16" height="16" viewBox="0 0 16 16" fill="none"><use href="../assets/icons.svg#icon-menu"></use></svg></a></div></div></header><div class="container container-main"><div class="col-content"><div class="tsd-page-title"><ul class="tsd-breadcrumb"><li><a href="../modules.html">@solvers-hub/llm-json</a></li><li><a href="JsonParseError.html">JsonParseError</a></li></ul><h1>Interface JsonParseError</h1></div><section class="tsd-panel tsd-comment"><div class="tsd-comment tsd-typography"><p>Error information for JSON parsing failures.</p>
|
2
|
-
</div><div class="tsd-comment tsd-typography"></div></section><div class="tsd-signature"><span class="tsd-signature-keyword">interface </span><span class="tsd-kind-interface">JsonParseError</span> <span class="tsd-signature-symbol">{ </span><br/><span> </span><a class="tsd-kind-property" href="JsonParseError.html#message">message</a><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">; </span><br/><span> </span><a class="tsd-kind-property" href="JsonParseError.html#position">position</a><span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">; </span><br/><span> </span><a class="tsd-kind-property" href="JsonParseError.html#raw">raw</a><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">; </span><br/><span class="tsd-signature-symbol">}</span></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/solvers-hub/llm-json/blob/
|
2
|
+
</div><div class="tsd-comment tsd-typography"></div></section><div class="tsd-signature"><span class="tsd-signature-keyword">interface </span><span class="tsd-kind-interface">JsonParseError</span> <span class="tsd-signature-symbol">{ </span><br/><span> </span><a class="tsd-kind-property" href="JsonParseError.html#message">message</a><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">; </span><br/><span> </span><a class="tsd-kind-property" href="JsonParseError.html#position">position</a><span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">; </span><br/><span> </span><a class="tsd-kind-property" href="JsonParseError.html#raw">raw</a><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">; </span><br/><span class="tsd-signature-symbol">}</span></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/solvers-hub/llm-json/blob/de4fb5a4209b6f115ef863cd3e7016e7b565b262/src/types.ts#L112">types.ts:112</a></li></ul></aside><section class="tsd-panel-group tsd-index-group"><section class="tsd-panel tsd-index-panel"><details class="tsd-index-content tsd-index-accordion" open><summary class="tsd-accordion-summary tsd-index-summary"><h5 class="tsd-index-heading uppercase" role="button" aria-expanded="false" tabIndex="0"><svg width="16" height="16" viewBox="0 0 16 16" fill="none"><use href="../assets/icons.svg#icon-chevronSmall"></use></svg> Index</h5></summary><div class="tsd-accordion-details"><section class="tsd-index-section"><h3 class="tsd-index-heading">Properties</h3><div class="tsd-index-list"><a href="JsonParseError.html#message" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-1024"></use></svg><span>message</span></a>
|
3
3
|
<a href="JsonParseError.html#position" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-1024"></use></svg><span>position?</span></a>
|
4
4
|
<a href="JsonParseError.html#raw" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-1024"></use></svg><span>raw</span></a>
|
5
5
|
</div></section></div></details></section></section><section class="tsd-panel-group tsd-member-group"><h2>Properties</h2><section class="tsd-panel tsd-member"><a id="message" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>message</span><a href="#message" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><div class="tsd-signature"><span class="tsd-kind-property">message</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span></div><div class="tsd-comment tsd-typography"><p>The original error message.</p>
|
6
|
-
</div><div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/solvers-hub/llm-json/blob/
|
7
|
-
</div><div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/solvers-hub/llm-json/blob/
|
8
|
-
</div><div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/solvers-hub/llm-json/blob/
|
6
|
+
</div><div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/solvers-hub/llm-json/blob/de4fb5a4209b6f115ef863cd3e7016e7b565b262/src/types.ts#L116">types.ts:116</a></li></ul></aside></section><section class="tsd-panel tsd-member"><a id="position" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><code class="tsd-tag ts-flagOptional">Optional</code> <span>position</span><a href="#position" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><div class="tsd-signature"><span class="tsd-kind-property">position</span><span class="tsd-signature-symbol">?:</span> <span class="tsd-signature-type">number</span></div><div class="tsd-comment tsd-typography"><p>The position in the JSON string where the error occurred.</p>
|
7
|
+
</div><div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/solvers-hub/llm-json/blob/de4fb5a4209b6f115ef863cd3e7016e7b565b262/src/types.ts#L126">types.ts:126</a></li></ul></aside></section><section class="tsd-panel tsd-member"><a id="raw" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>raw</span><a href="#raw" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><div class="tsd-signature"><span class="tsd-kind-property">raw</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span></div><div class="tsd-comment tsd-typography"><p>The raw JSON string that failed to parse.</p>
|
8
|
+
</div><div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/solvers-hub/llm-json/blob/de4fb5a4209b6f115ef863cd3e7016e7b565b262/src/types.ts#L121">types.ts:121</a></li></ul></aside></section></section></div><div class="col-sidebar"><div class="page-menu"><div class="tsd-navigation settings"><details class="tsd-index-accordion"><summary class="tsd-accordion-summary"><h3><svg width="20" height="20" viewBox="0 0 24 24" fill="none"><use href="../assets/icons.svg#icon-chevronDown"></use></svg>Settings</h3></summary><div class="tsd-accordion-details"><div class="tsd-filter-visibility"><h4 class="uppercase">Member Visibility</h4><form><ul id="tsd-filter-options"><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-protected" name="protected"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Protected</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-private" name="private"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Private</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-inherited" name="inherited" checked/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Inherited</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-external" name="external"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>External</span></label></li></ul></form></div><div class="tsd-theme-toggle"><h4 class="uppercase">Theme</h4><select id="tsd-theme"><option value="os">OS</option><option value="light">Light</option><option value="dark">Dark</option></select></div></div></details></div><details open class="tsd-index-accordion tsd-page-navigation"><summary class="tsd-accordion-summary"><h3><svg width="20" height="20" viewBox="0 0 24 24" fill="none"><use href="../assets/icons.svg#icon-chevronDown"></use></svg>On This Page</h3></summary><div class="tsd-accordion-details"><a href="#message" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-1024"></use></svg><span>message</span></a><a href="#position" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-1024"></use></svg><span>position</span></a><a href="#raw" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-1024"></use></svg><span>raw</span></a></div></details></div><div class="site-menu"><nav class="tsd-navigation"><a href="../modules.html"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-1"></use></svg><span>@solvers-hub/llm-json</span></a><ul class="tsd-small-nested-navigation" id="tsd-nav-container" data-base=".."><li>Loading...</li></ul></nav></div></div></div><footer><p class="tsd-generator">Generated using <a href="https://typedoc.org/" target="_blank">TypeDoc</a></p></footer><div class="overlay"></div></body></html>
|
@@ -0,0 +1,6 @@
|
|
1
|
+
<!DOCTYPE html><html class="default" lang="en"><head><meta charSet="utf-8"/><meta http-equiv="x-ua-compatible" content="IE=edge"/><title>SchemaDefinition | @solvers-hub/llm-json</title><meta name="description" content="Documentation for @solvers-hub/llm-json"/><meta name="viewport" content="width=device-width, initial-scale=1"/><link rel="stylesheet" href="../assets/style.css"/><link rel="stylesheet" href="../assets/highlight.css"/><script defer src="../assets/main.js"></script><script async src="../assets/icons.js" id="tsd-icons-script"></script><script async src="../assets/search.js" id="tsd-search-script"></script><script async src="../assets/navigation.js" id="tsd-nav-script"></script></head><body><script>document.documentElement.dataset.theme = localStorage.getItem("tsd-theme") || "os";document.body.style.display="none";setTimeout(() => app?app.showPage():document.body.style.removeProperty("display"),500)</script><header class="tsd-page-toolbar"><div class="tsd-toolbar-contents container"><div class="table-cell" id="tsd-search" data-base=".."><div class="field"><label for="tsd-search-field" class="tsd-widget tsd-toolbar-icon search no-caption"><svg width="16" height="16" viewBox="0 0 16 16" fill="none"><use href="../assets/icons.svg#icon-search"></use></svg></label><input type="text" id="tsd-search-field" aria-label="Search"/></div><div class="field"><div id="tsd-toolbar-links"></div></div><ul class="results"><li class="state loading">Preparing search index...</li><li class="state failure">The search index is not available</li></ul><a href="../index.html" class="title">@solvers-hub/llm-json</a></div><div class="table-cell" id="tsd-widgets"><a href="#" class="tsd-widget tsd-toolbar-icon menu no-caption" data-toggle="menu" aria-label="Menu"><svg width="16" height="16" viewBox="0 0 16 16" fill="none"><use href="../assets/icons.svg#icon-menu"></use></svg></a></div></div></header><div class="container container-main"><div class="col-content"><div class="tsd-page-title"><ul class="tsd-breadcrumb"><li><a href="../modules.html">@solvers-hub/llm-json</a></li><li><a href="SchemaDefinition.html">SchemaDefinition</a></li></ul><h1>Interface SchemaDefinition</h1></div><section class="tsd-panel tsd-comment"><div class="tsd-comment tsd-typography"><p>Definition of a JSON schema for validation.</p>
|
2
|
+
</div><div class="tsd-comment tsd-typography"></div></section><div class="tsd-signature"><span class="tsd-signature-keyword">interface </span><span class="tsd-kind-interface">SchemaDefinition</span> <span class="tsd-signature-symbol">{ </span><br/><span> </span><a class="tsd-kind-property" href="SchemaDefinition.html#name">name</a><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">; </span><br/><span> </span><a class="tsd-kind-property" href="SchemaDefinition.html#schema">schema</a><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">object</span><span class="tsd-signature-symbol">; </span><br/><span class="tsd-signature-symbol">}</span></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/solvers-hub/llm-json/blob/de4fb5a4209b6f115ef863cd3e7016e7b565b262/src/types.ts#L22">types.ts:22</a></li></ul></aside><section class="tsd-panel-group tsd-index-group"><section class="tsd-panel tsd-index-panel"><details class="tsd-index-content tsd-index-accordion" open><summary class="tsd-accordion-summary tsd-index-summary"><h5 class="tsd-index-heading uppercase" role="button" aria-expanded="false" tabIndex="0"><svg width="16" height="16" viewBox="0 0 16 16" fill="none"><use href="../assets/icons.svg#icon-chevronSmall"></use></svg> Index</h5></summary><div class="tsd-accordion-details"><section class="tsd-index-section"><h3 class="tsd-index-heading">Properties</h3><div class="tsd-index-list"><a href="SchemaDefinition.html#name" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-1024"></use></svg><span>name</span></a>
|
3
|
+
<a href="SchemaDefinition.html#schema" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-1024"></use></svg><span>schema</span></a>
|
4
|
+
</div></section></div></details></section></section><section class="tsd-panel-group tsd-member-group"><h2>Properties</h2><section class="tsd-panel tsd-member"><a id="name" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>name</span><a href="#name" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><div class="tsd-signature"><span class="tsd-kind-property">name</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span></div><div class="tsd-comment tsd-typography"><p>A unique name for the schema to identify which schema matched.</p>
|
5
|
+
</div><div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/solvers-hub/llm-json/blob/de4fb5a4209b6f115ef863cd3e7016e7b565b262/src/types.ts#L26">types.ts:26</a></li></ul></aside></section><section class="tsd-panel tsd-member"><a id="schema" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>schema</span><a href="#schema" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><div class="tsd-signature"><span class="tsd-kind-property">schema</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">object</span></div><div class="tsd-comment tsd-typography"><p>The JSON schema object conforming to JSON Schema specification.</p>
|
6
|
+
</div><div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/solvers-hub/llm-json/blob/de4fb5a4209b6f115ef863cd3e7016e7b565b262/src/types.ts#L31">types.ts:31</a></li></ul></aside></section></section></div><div class="col-sidebar"><div class="page-menu"><div class="tsd-navigation settings"><details class="tsd-index-accordion"><summary class="tsd-accordion-summary"><h3><svg width="20" height="20" viewBox="0 0 24 24" fill="none"><use href="../assets/icons.svg#icon-chevronDown"></use></svg>Settings</h3></summary><div class="tsd-accordion-details"><div class="tsd-filter-visibility"><h4 class="uppercase">Member Visibility</h4><form><ul id="tsd-filter-options"><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-protected" name="protected"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Protected</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-private" name="private"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Private</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-inherited" name="inherited" checked/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Inherited</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-external" name="external"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>External</span></label></li></ul></form></div><div class="tsd-theme-toggle"><h4 class="uppercase">Theme</h4><select id="tsd-theme"><option value="os">OS</option><option value="light">Light</option><option value="dark">Dark</option></select></div></div></details></div><details open class="tsd-index-accordion tsd-page-navigation"><summary class="tsd-accordion-summary"><h3><svg width="20" height="20" viewBox="0 0 24 24" fill="none"><use href="../assets/icons.svg#icon-chevronDown"></use></svg>On This Page</h3></summary><div class="tsd-accordion-details"><a href="#name" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-1024"></use></svg><span>name</span></a><a href="#schema" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-1024"></use></svg><span>schema</span></a></div></details></div><div class="site-menu"><nav class="tsd-navigation"><a href="../modules.html"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-1"></use></svg><span>@solvers-hub/llm-json</span></a><ul class="tsd-small-nested-navigation" id="tsd-nav-container" data-base=".."><li>Loading...</li></ul></nav></div></div></div><footer><p class="tsd-generator">Generated using <a href="https://typedoc.org/" target="_blank">TypeDoc</a></p></footer><div class="overlay"></div></body></html>
|
@@ -0,0 +1,10 @@
|
|
1
|
+
<!DOCTYPE html><html class="default" lang="en"><head><meta charSet="utf-8"/><meta http-equiv="x-ua-compatible" content="IE=edge"/><title>ValidationResult | @solvers-hub/llm-json</title><meta name="description" content="Documentation for @solvers-hub/llm-json"/><meta name="viewport" content="width=device-width, initial-scale=1"/><link rel="stylesheet" href="../assets/style.css"/><link rel="stylesheet" href="../assets/highlight.css"/><script defer src="../assets/main.js"></script><script async src="../assets/icons.js" id="tsd-icons-script"></script><script async src="../assets/search.js" id="tsd-search-script"></script><script async src="../assets/navigation.js" id="tsd-nav-script"></script></head><body><script>document.documentElement.dataset.theme = localStorage.getItem("tsd-theme") || "os";document.body.style.display="none";setTimeout(() => app?app.showPage():document.body.style.removeProperty("display"),500)</script><header class="tsd-page-toolbar"><div class="tsd-toolbar-contents container"><div class="table-cell" id="tsd-search" data-base=".."><div class="field"><label for="tsd-search-field" class="tsd-widget tsd-toolbar-icon search no-caption"><svg width="16" height="16" viewBox="0 0 16 16" fill="none"><use href="../assets/icons.svg#icon-search"></use></svg></label><input type="text" id="tsd-search-field" aria-label="Search"/></div><div class="field"><div id="tsd-toolbar-links"></div></div><ul class="results"><li class="state loading">Preparing search index...</li><li class="state failure">The search index is not available</li></ul><a href="../index.html" class="title">@solvers-hub/llm-json</a></div><div class="table-cell" id="tsd-widgets"><a href="#" class="tsd-widget tsd-toolbar-icon menu no-caption" data-toggle="menu" aria-label="Menu"><svg width="16" height="16" viewBox="0 0 16 16" fill="none"><use href="../assets/icons.svg#icon-menu"></use></svg></a></div></div></header><div class="container container-main"><div class="col-content"><div class="tsd-page-title"><ul class="tsd-breadcrumb"><li><a href="../modules.html">@solvers-hub/llm-json</a></li><li><a href="ValidationResult.html">ValidationResult</a></li></ul><h1>Interface ValidationResult</h1></div><section class="tsd-panel tsd-comment"><div class="tsd-comment tsd-typography"><p>Result of schema validation for a JSON object.</p>
|
2
|
+
</div><div class="tsd-comment tsd-typography"></div></section><div class="tsd-signature"><span class="tsd-signature-keyword">interface </span><span class="tsd-kind-interface">ValidationResult</span> <span class="tsd-signature-symbol">{ </span><br/><span> </span><a class="tsd-kind-property" href="ValidationResult.html#isValid">isValid</a><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">boolean</span><span class="tsd-signature-symbol">; </span><br/><span> </span><a class="tsd-kind-property" href="ValidationResult.html#json">json</a><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">; </span><br/><span> </span><a class="tsd-kind-property" href="ValidationResult.html#matchedSchema">matchedSchema</a><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">null</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">; </span><br/><span> </span><a class="tsd-kind-property" href="ValidationResult.html#validationErrors">validationErrors</a><span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">[]</span><span class="tsd-signature-symbol">; </span><br/><span class="tsd-signature-symbol">}</span></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/solvers-hub/llm-json/blob/de4fb5a4209b6f115ef863cd3e7016e7b565b262/src/types.ts#L37">types.ts:37</a></li></ul></aside><section class="tsd-panel-group tsd-index-group"><section class="tsd-panel tsd-index-panel"><details class="tsd-index-content tsd-index-accordion" open><summary class="tsd-accordion-summary tsd-index-summary"><h5 class="tsd-index-heading uppercase" role="button" aria-expanded="false" tabIndex="0"><svg width="16" height="16" viewBox="0 0 16 16" fill="none"><use href="../assets/icons.svg#icon-chevronSmall"></use></svg> Index</h5></summary><div class="tsd-accordion-details"><section class="tsd-index-section"><h3 class="tsd-index-heading">Properties</h3><div class="tsd-index-list"><a href="ValidationResult.html#isValid" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-1024"></use></svg><span>is<wbr/>Valid</span></a>
|
3
|
+
<a href="ValidationResult.html#json" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-1024"></use></svg><span>json</span></a>
|
4
|
+
<a href="ValidationResult.html#matchedSchema" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-1024"></use></svg><span>matched<wbr/>Schema</span></a>
|
5
|
+
<a href="ValidationResult.html#validationErrors" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-1024"></use></svg><span>validation<wbr/>Errors?</span></a>
|
6
|
+
</div></section></div></details></section></section><section class="tsd-panel-group tsd-member-group"><h2>Properties</h2><section class="tsd-panel tsd-member"><a id="isValid" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>is<wbr/>Valid</span><a href="#isValid" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><div class="tsd-signature"><span class="tsd-kind-property">is<wbr/>Valid</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">boolean</span></div><div class="tsd-comment tsd-typography"><p>Whether the JSON is valid according to the matched schema.</p>
|
7
|
+
</div><div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/solvers-hub/llm-json/blob/de4fb5a4209b6f115ef863cd3e7016e7b565b262/src/types.ts#L51">types.ts:51</a></li></ul></aside></section><section class="tsd-panel tsd-member"><a id="json" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>json</span><a href="#json" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><div class="tsd-signature"><span class="tsd-kind-property">json</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">any</span></div><div class="tsd-comment tsd-typography"><p>The JSON object that was validated.</p>
|
8
|
+
</div><div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/solvers-hub/llm-json/blob/de4fb5a4209b6f115ef863cd3e7016e7b565b262/src/types.ts#L41">types.ts:41</a></li></ul></aside></section><section class="tsd-panel tsd-member"><a id="matchedSchema" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>matched<wbr/>Schema</span><a href="#matchedSchema" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><div class="tsd-signature"><span class="tsd-kind-property">matched<wbr/>Schema</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">null</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">string</span></div><div class="tsd-comment tsd-typography"><p>The name of the schema that matched, or null if no schema matched.</p>
|
9
|
+
</div><div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/solvers-hub/llm-json/blob/de4fb5a4209b6f115ef863cd3e7016e7b565b262/src/types.ts#L46">types.ts:46</a></li></ul></aside></section><section class="tsd-panel tsd-member"><a id="validationErrors" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><code class="tsd-tag ts-flagOptional">Optional</code> <span>validation<wbr/>Errors</span><a href="#validationErrors" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><div class="tsd-signature"><span class="tsd-kind-property">validation<wbr/>Errors</span><span class="tsd-signature-symbol">?:</span> <span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">[]</span></div><div class="tsd-comment tsd-typography"><p>Validation errors if any, or undefined if validation passed.</p>
|
10
|
+
</div><div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/solvers-hub/llm-json/blob/de4fb5a4209b6f115ef863cd3e7016e7b565b262/src/types.ts#L56">types.ts:56</a></li></ul></aside></section></section></div><div class="col-sidebar"><div class="page-menu"><div class="tsd-navigation settings"><details class="tsd-index-accordion"><summary class="tsd-accordion-summary"><h3><svg width="20" height="20" viewBox="0 0 24 24" fill="none"><use href="../assets/icons.svg#icon-chevronDown"></use></svg>Settings</h3></summary><div class="tsd-accordion-details"><div class="tsd-filter-visibility"><h4 class="uppercase">Member Visibility</h4><form><ul id="tsd-filter-options"><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-protected" name="protected"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Protected</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-private" name="private"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Private</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-inherited" name="inherited" checked/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Inherited</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-external" name="external"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>External</span></label></li></ul></form></div><div class="tsd-theme-toggle"><h4 class="uppercase">Theme</h4><select id="tsd-theme"><option value="os">OS</option><option value="light">Light</option><option value="dark">Dark</option></select></div></div></details></div><details open class="tsd-index-accordion tsd-page-navigation"><summary class="tsd-accordion-summary"><h3><svg width="20" height="20" viewBox="0 0 24 24" fill="none"><use href="../assets/icons.svg#icon-chevronDown"></use></svg>On This Page</h3></summary><div class="tsd-accordion-details"><a href="#isValid" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-1024"></use></svg><span>is<wbr/>Valid</span></a><a href="#json" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-1024"></use></svg><span>json</span></a><a href="#matchedSchema" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-1024"></use></svg><span>matched<wbr/>Schema</span></a><a href="#validationErrors" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-1024"></use></svg><span>validation<wbr/>Errors</span></a></div></details></div><div class="site-menu"><nav class="tsd-navigation"><a href="../modules.html"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-1"></use></svg><span>@solvers-hub/llm-json</span></a><ul class="tsd-small-nested-navigation" id="tsd-nav-container" data-base=".."><li>Loading...</li></ul></nav></div></div></div><footer><p class="tsd-generator">Generated using <a href="https://typedoc.org/" target="_blank">TypeDoc</a></p></footer><div class="overlay"></div></body></html>
|
package/docs/modules.html
CHANGED
@@ -4,4 +4,6 @@
|
|
4
4
|
<a href="interfaces/ExtractResult.html" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="assets/icons.svg#icon-256"></use></svg><span>Extract<wbr/>Result</span></a>
|
5
5
|
<a href="interfaces/JsonBlock.html" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="assets/icons.svg#icon-256"></use></svg><span>Json<wbr/>Block</span></a>
|
6
6
|
<a href="interfaces/JsonParseError.html" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="assets/icons.svg#icon-256"></use></svg><span>Json<wbr/>Parse<wbr/>Error</span></a>
|
7
|
+
<a href="interfaces/SchemaDefinition.html" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="assets/icons.svg#icon-256"></use></svg><span>Schema<wbr/>Definition</span></a>
|
8
|
+
<a href="interfaces/ValidationResult.html" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="assets/icons.svg#icon-256"></use></svg><span>Validation<wbr/>Result</span></a>
|
7
9
|
</div></section></div></details></section></section><section class="tsd-panel-group tsd-member-group"><h2>References</h2><section class="tsd-panel tsd-member"><a id="default" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>default</span><a href="#default" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="assets/icons.svg#icon-anchor"></use></svg></a></h3>Renames and re-exports <a href="classes/LlmJson.html">LlmJson</a></section></section></div><div class="col-sidebar"><div class="page-menu"><div class="tsd-navigation settings"><details class="tsd-index-accordion"><summary class="tsd-accordion-summary"><h3><svg width="20" height="20" viewBox="0 0 24 24" fill="none"><use href="assets/icons.svg#icon-chevronDown"></use></svg>Settings</h3></summary><div class="tsd-accordion-details"><div class="tsd-filter-visibility"><h4 class="uppercase">Member Visibility</h4><form><ul id="tsd-filter-options"><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-protected" name="protected"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Protected</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-private" name="private"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Private</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-inherited" name="inherited" checked/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Inherited</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-external" name="external"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>External</span></label></li></ul></form></div><div class="tsd-theme-toggle"><h4 class="uppercase">Theme</h4><select id="tsd-theme"><option value="os">OS</option><option value="light">Light</option><option value="dark">Dark</option></select></div></div></details></div><details open class="tsd-index-accordion tsd-page-navigation"><summary class="tsd-accordion-summary"><h3><svg width="20" height="20" viewBox="0 0 24 24" fill="none"><use href="assets/icons.svg#icon-chevronDown"></use></svg>On This Page</h3></summary><div class="tsd-accordion-details"><a href="#default" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="assets/icons.svg#icon-4194304"></use></svg><span>default</span></a></div></details></div><div class="site-menu"><nav class="tsd-navigation"><a href="modules.html" class="current"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="assets/icons.svg#icon-1"></use></svg><span>@solvers-hub/llm-json</span></a><ul class="tsd-small-nested-navigation" id="tsd-nav-container" data-base="."><li>Loading...</li></ul></nav></div></div></div><footer><p class="tsd-generator">Generated using <a href="https://typedoc.org/" target="_blank">TypeDoc</a></p></footer><div class="overlay"></div></body></html>
|
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.6",
|
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",
|
@@ -13,6 +13,7 @@
|
|
13
13
|
"lint": "eslint src/**/*.ts",
|
14
14
|
"prepublishOnly": "npm run build && npm run docs",
|
15
15
|
"example": "ts-node examples/example.ts",
|
16
|
+
"example:schema": "ts-node examples/schema-validation-example.ts",
|
16
17
|
"build:example": "tsc && node dist/examples/example.js",
|
17
18
|
"docs": "typedoc --out docs src",
|
18
19
|
"docs:md": "typedoc --out docs-md --plugin typedoc-plugin-markdown src"
|
@@ -41,6 +42,9 @@
|
|
41
42
|
"typedoc-plugin-markdown": "^3.17.1",
|
42
43
|
"typescript": "^5.0.4"
|
43
44
|
},
|
45
|
+
"dependencies": {
|
46
|
+
"ajv": "^8.17.1"
|
47
|
+
},
|
44
48
|
"files": [
|
45
49
|
"dist/**/*",
|
46
50
|
"docs/**/*",
|