Team Ai
Datasetpublic

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.

sourceHugging Faceupdated 2mo agoView on Hugging Face
0likes3.1kdownloads
index.js119 linesDownload Raw Back to zwitch
1/**2 * @callback Handler3 *   Handle a value, with a certain ID field set to a certain value.4 *   The ID field is passed to `zwitch`, and it’s value is this function’s5 *   place on the `handlers` record.6 * @param {...any} parameters7 *   Arbitrary parameters passed to the zwitch.8 *   The first will be an object with a certain ID field set to a certain value.9 * @returns {any}10 *   Anything!11 */12 13/**14 * @callback UnknownHandler15 *   Handle values that do have a certain ID field, but it’s set to a value16 *   that is not listed in the `handlers` record.17 * @param {unknown} value18 *   An object with a certain ID field set to an unknown value.19 * @param {...any} rest20 *   Arbitrary parameters passed to the zwitch.21 * @returns {any}22 *   Anything!23 */24 25/**26 * @callback InvalidHandler27 *   Handle values that do not have a certain ID field.28 * @param {unknown} value29 *   Any unknown value.30 * @param {...any} rest31 *   Arbitrary parameters passed to the zwitch.32 * @returns {void|null|undefined|never}33 *   This should crash or return nothing.34 */35 36/**37 * @template {InvalidHandler} [Invalid=InvalidHandler]38 * @template {UnknownHandler} [Unknown=UnknownHandler]39 * @template {Record<string, Handler>} [Handlers=Record<string, Handler>]40 * @typedef Options41 *   Configuration (required).42 * @property {Invalid} [invalid]43 *   Handler to use for invalid values.44 * @property {Unknown} [unknown]45 *   Handler to use for unknown values.46 * @property {Handlers} [handlers]47 *   Handlers to use.48 */49 50const own = {}.hasOwnProperty51 52/**53 * Handle values based on a field.54 *55 * @template {InvalidHandler} [Invalid=InvalidHandler]56 * @template {UnknownHandler} [Unknown=UnknownHandler]57 * @template {Record<string, Handler>} [Handlers=Record<string, Handler>]58 * @param {string} key59 *   Field to switch on.60 * @param {Options<Invalid, Unknown, Handlers>} [options]61 *   Configuration (required).62 * @returns {{unknown: Unknown, invalid: Invalid, handlers: Handlers, (...parameters: Parameters<Handlers[keyof Handlers]>): ReturnType<Handlers[keyof Handlers]>, (...parameters: Parameters<Unknown>): ReturnType<Unknown>}}63 */64export function zwitch(key, options) {65  const settings = options || {}66 67  /**68   * Handle one value.69   *70   * Based on the bound `key`, a respective handler will be called.71   * If `value` is not an object, or doesn’t have a `key` property, the special72   * “invalid” handler will be called.73   * If `value` has an unknown `key`, the special “unknown” handler will be74   * called.75   *76   * All arguments, and the context object, are passed through to the handler,77   * and it’s result is returned.78   *79   * @this {unknown}80   *   Any context object.81   * @param {unknown} [value]82   *   Any value.83   * @param {...unknown} parameters84   *   Arbitrary parameters passed to the zwitch.85   * @property {Handler} invalid86   *   Handle for values that do not have a certain ID field.87   * @property {Handler} unknown88   *   Handle values that do have a certain ID field, but it’s set to a value89   *   that is not listed in the `handlers` record.90   * @property {Handlers} handlers91   *   Record of handlers.92   * @returns {unknown}93   *   Anything.94   */95  function one(value, ...parameters) {96    /** @type {Handler|undefined} */97    let fn = one.invalid98    const handlers = one.handlers99 100    if (value && own.call(value, key)) {101      // @ts-expect-error Indexable.102      const id = String(value[key])103      // @ts-expect-error Indexable.104      fn = own.call(handlers, id) ? handlers[id] : one.unknown105    }106 107    if (fn) {108      return fn.call(this, value, ...parameters)109    }110  }111 112  one.handlers = settings.handlers || {}113  one.invalid = settings.invalid114  one.unknown = settings.unknown115 116  // @ts-expect-error: matches!117  return one118}119 
Brunobkr/llama.cpp_AlgMor24_github · Team Ai