llm-json-fix
Version:
Fix malformed JSON outputs from Large Language Models (LLMs)
58 lines • 1.52 kB
TypeScript
/**
* A circular buffer for efficient streaming operations
*/
export declare class StreamBuffer {
readonly capacity: number;
private buffer;
private position;
private size;
/**
* Create a new StreamBuffer with a specified maximum size
*/
constructor(capacity: number);
/**
* Reset the buffer to its initial state
*/
reset(): void;
/**
* Get number of characters in the buffer
*/
getSize(): number;
/**
* Get the specified number of characters starting at the given index
*/
substr(start: number, length: number): string;
/**
* Get the last `length` characters of the buffer
*/
getLastChars(length: number): string;
/**
* Get the first `length` characters of the buffer
*/
getFirstChars(length: number): string;
/**
* Get a character at the specified position
*/
charAt(index: number): string;
/**
* Append a chunk of text to the buffer
*/
append(text: string): void;
/**
* Check if the buffer includes the given string
*/
includes(str: string): boolean;
/**
* Find the position of a string in the buffer
*/
indexOf(str: string, fromIndex?: number): number;
/**
* Replace part of the buffer with a new string
*/
replace(start: number, length: number, replacement: string): void;
/**
* Get the entire content of the buffer
*/
toString(): string;
}
//# sourceMappingURL=streamBuffer.d.ts.map