Brunobkr/llama.cpp_AlgMor24_github
ΩFFFΣLLIa • llama.cpp • AlgMor24 ██████╗ ███████╗███████╗███████╗██╗ ██╗ ██╗ █████╗ ██╔═══██╗██╔════╝██╔════╝██╔════╝██║ ██║ ██║██╔══██╗ ██║ ██║█████╗ █████╗ █████╗ ██║ ██║ ██║███████║ ██║ ██║██╔══╝ ██╔══╝ ██╔══╝ ██║ ██║ ██║██╔══██║ ╚██████╔╝██║ ██║ ███████╗███████╗███████╗██║██║ ██║ ╚═════╝ ╚═╝ ╚═╝ ╚══════╝╚══════╝╚══════╝╚═╝╚═╝ ╚═╝ High-Performance LLM / VLM Inference & Autonomous Agentic Ecosystem… See the full description on the dataset page: https://huggingface.co/datasets/Brunobkr/llama.cpp_AlgMor24_github.
03.1k
1/**2 * Creates a new EventSource parser.3 *4 * @param config - Parser configuration. Accepts callbacks (see {@link ParserCallbacks})5 * and options like `maxBufferSize` (see {@link ParserConfig}).6 *7 * @returns A new EventSource parser, with `feed` and `reset` methods.8 * @public9 */10export declare function createParser(config: ParserConfig): EventSourceParser;11 12/**13 * The type of error that occurred.14 * @public15 */16export declare type ErrorType =17 | "invalid-retry"18 | "unknown-field"19 | "max-buffer-size-exceeded";20 21/**22 * A parsed EventSource message event23 *24 * @public25 */26export declare interface EventSourceMessage {27 /**28 * The event type sent from the server. Note that this differs from the browser `EventSource`29 * implementation in that browsers will default this to `message`, whereas this parser will30 * leave this as `undefined` if not explicitly declared.31 */32 event?: string | undefined;33 /**34 * ID of the message, if any was provided by the server. Can be used by clients to keep the35 * last received message ID in sync when reconnecting.36 */37 id?: string | undefined;38 /**39 * The data received for this message40 */41 data: string;42}43 44/**45 * EventSource parser instance.46 *47 * Needs to be reset between reconnections/when switching data source, using the `reset()` method.48 *49 * @public50 */51export declare interface EventSourceParser {52 /**53 * Feeds the parser another chunk. The method _does not_ return a parsed message.54 * Instead, callbacks passed when creating the parser will be triggered once we see enough data55 * for a valid/invalid parsing step (see {@link ParserCallbacks}).56 *57 * @param chunk - The chunk to parse. Can be a partial, eg in the case of streaming messages.58 * @public59 */60 feed(chunk: string): void;61 /**62 * Resets the parser state. This is required when you have a new stream of messages -63 * for instance in the case of a client being disconnected and reconnecting.64 *65 * Previously received, incomplete data will NOT be parsed unless you pass `consume: true`,66 * which tells the parser to attempt to consume any incomplete data as if it ended with a newline67 * character. This is useful for cases when a server sends a non-EventSource message that you68 * want to be able to react to in an `onError` callback.69 *70 * @public71 */72 reset(options?: { consume?: boolean }): void;73}74 75/**76 * Error thrown when encountering an issue during parsing.77 *78 * @public79 */80export declare class ParseError extends Error {81 /**82 * The type of error that occurred.83 */84 type: ErrorType;85 /**86 * In the case of an unknown field encountered in the stream, this will be the field name.87 */88 field?: string | undefined;89 /**90 * In the case of an unknown field encountered in the stream, this will be the value of the field.91 */92 value?: string | undefined;93 /**94 * The line that caused the error, if available.95 */96 line?: string | undefined;97 constructor(98 message: string,99 options: {100 type: ErrorType;101 field?: string;102 value?: string;103 line?: string;104 },105 );106}107 108/**109 * Callbacks that can be passed to the parser to handle different types of parsed messages110 * and errors.111 *112 * @public113 */114export declare interface ParserCallbacks {115 /**116 * Callback for when a new event/message is parsed from the stream.117 * This is the main callback that clients will use to handle incoming messages.118 *119 * @param event - The parsed event/message120 */121 onEvent?: ((event: EventSourceMessage) => void) | undefined;122 /**123 * Callback for when the server sends a new reconnection interval through the `retry` field.124 *125 * @param retry - The number of milliseconds to wait before reconnecting.126 */127 onRetry?: ((retry: number) => void) | undefined;128 /**129 * Callback for when a comment is encountered in the stream.130 *131 * @param comment - The comment encountered in the stream.132 */133 onComment?: ((comment: string) => void) | undefined;134 /**135 * Callback for when an error occurs during parsing. This is a catch-all for any errors136 * that occur during parsing, and can be used to handle them in a custom way. Most clients137 * tend to silently ignore any errors and instead retry, but it can be helpful to log/debug.138 *139 * @param error - The error that occurred during parsing140 */141 onError?: ((error: ParseError) => void) | undefined;142}143 144/**145 * Configuration accepted by {@link createParser}. Extends {@link ParserCallbacks} with146 * additional options that control parser behavior.147 *148 * @public149 */150export declare interface ParserConfig extends ParserCallbacks {151 /**152 * Maximum number of characters the parser is allowed to buffer across calls to `feed()`.153 *154 * Two unbounded surfaces exist in a streaming SSE parser:155 * - A partial line that has not yet been terminated by `\n`, `\r`, or `\r\n`.156 * - A multi-line event whose terminating blank line has not yet arrived (each `data:`157 * field gets appended to the buffered event).158 *159 * When the combined size of these buffers exceeds `maxBufferSize`, the parser emits a160 * `ParseError` with `type: 'max-buffer-size-exceeded'` to `onError` and becomes161 * terminated — subsequent calls to `feed()` will throw until `reset()` is called.162 * This protects against unbounded memory growth from malformed or malicious streams.163 *164 * @defaultValue `undefined` (unbounded)165 */166 maxBufferSize?: number | undefined;167}168 169export {};170 