@solvers-hub/llm-json
Version:
A TypeScript SDK to extract and correct JSON from LLM outputs
35 lines (34 loc) • 1.23 kB
TypeScript
import { ExtractOptions, ExtractResult } from './types';
/**
* Main factory class for the LLM-JSON extractor SDK.
*/
export declare class LlmJson {
private static instance;
private objectExtractor;
private arrayExtractor;
/**
* Creates a new LlmJson instance with the specified options.
* @param options - Configuration options for extraction.
*/
constructor(options?: ExtractOptions);
/**
* Get or create a singleton instance of LlmJson.
* @param options - Configuration options for extraction.
* @returns The LlmJson singleton instance.
*/
static getInstance(options?: ExtractOptions): LlmJson;
/**
* Extract JSON objects and text from a string input.
* @param input - The input string that may contain JSON.
* @returns An object containing arrays of extracted text and JSON.
*/
extract(input: string): ExtractResult;
/**
* Extract JSON objects, arrays, and text from a string input.
* @param input - The input string that may contain JSON.
* @returns An object containing arrays of extracted text and JSON.
*/
extractAll(input: string): ExtractResult;
}
export * from './types';
export default LlmJson;