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
1import type * as errors from "./errors.js";2import type * as schemas from "./schemas.js";3import type { Class } from "./util.js";4////////////////////////////// CONSTRUCTORS ///////////////////////////////////////5 6type ZodTrait = { _zod: { def: any; [k: string]: any } };7export interface $constructor<T extends ZodTrait, D = T["_zod"]["def"]> {8 new (def: D): T;9 init(inst: T, def: D): asserts inst is T;10}11 12/** A special constant with type `never` */13export const NEVER: never = /*@__PURE__*/ Object.freeze({14 status: "aborted",15}) as never;16 17export /*@__NO_SIDE_EFFECTS__*/ function $constructor<T extends ZodTrait, D = T["_zod"]["def"]>(18 name: string,19 initializer: (inst: T, def: D) => void,20 params?: { Parent?: typeof Class }21): $constructor<T, D> {22 function init(inst: T, def: D) {23 if (!inst._zod) {24 Object.defineProperty(inst, "_zod", {25 value: {26 def,27 constr: _,28 traits: new Set(),29 },30 enumerable: false,31 });32 }33 34 if (inst._zod.traits.has(name)) {35 return;36 }37 38 inst._zod.traits.add(name);39 40 initializer(inst, def);41 42 // support prototype modifications43 const proto = _.prototype;44 const keys = Object.keys(proto);45 for (let i = 0; i < keys.length; i++) {46 const k = keys[i]!;47 if (!(k in inst)) {48 (inst as any)[k] = proto[k].bind(inst);49 }50 }51 }52 53 // doesn't work if Parent has a constructor with arguments54 const Parent = params?.Parent ?? Object;55 class Definition extends Parent {}56 Object.defineProperty(Definition, "name", { value: name });57 58 function _(this: any, def: D) {59 const inst = params?.Parent ? new Definition() : this;60 init(inst, def);61 inst._zod.deferred ??= [];62 for (const fn of inst._zod.deferred) {63 fn();64 }65 return inst;66 }67 68 Object.defineProperty(_, "init", { value: init });69 Object.defineProperty(_, Symbol.hasInstance, {70 value: (inst: any) => {71 if (params?.Parent && inst instanceof params.Parent) return true;72 return inst?._zod?.traits?.has(name);73 },74 });75 Object.defineProperty(_, "name", { value: name });76 return _ as any;77}78 79////////////////////////////// UTILITIES ///////////////////////////////////////80export const $brand: unique symbol = Symbol("zod_brand");81export type $brand<T extends string | number | symbol = string | number | symbol> = {82 [$brand]: { [k in T]: true };83};84 85export type $ZodBranded<86 T extends schemas.SomeType,87 Brand extends string | number | symbol,88 Dir extends "in" | "out" | "inout" = "out",89> = T &90 (Dir extends "inout"91 ? { _zod: { input: input<T> & $brand<Brand>; output: output<T> & $brand<Brand> } }92 : Dir extends "in"93 ? { _zod: { input: input<T> & $brand<Brand> } }94 : { _zod: { output: output<T> & $brand<Brand> } });95 96export type $ZodNarrow<T extends schemas.SomeType, Out> = T & { _zod: { output: Out } };97 98export class $ZodAsyncError extends Error {99 constructor() {100 super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`);101 }102}103 104export class $ZodEncodeError extends Error {105 constructor(name: string) {106 super(`Encountered unidirectional transform during encode: ${name}`);107 this.name = "ZodEncodeError";108 }109}110 111//////////////////////////// TYPE HELPERS ///////////////////////////////////112 113// export type input<T extends schemas.$ZodType> = T["_zod"]["input"];114// export type output<T extends schemas.$ZodType> = T["_zod"]["output"];115// export type input<T extends schemas.$ZodType> = T["_zod"]["input"];116// export type output<T extends schemas.$ZodType> = T["_zod"]["output"];117export type input<T> = T extends { _zod: { input: any } } ? T["_zod"]["input"] : unknown;118export type output<T> = T extends { _zod: { output: any } } ? T["_zod"]["output"] : unknown;119 120export type { output as infer };121 122////////////////////////////// CONFIG ///////////////////////////////////////123 124export interface $ZodConfig {125 /** Custom error map. Overrides `config().localeError`. */126 customError?: errors.$ZodErrorMap | undefined;127 /** Localized error map. Lowest priority. */128 localeError?: errors.$ZodErrorMap | undefined;129 /** Disable JIT schema compilation. Useful in environments that disallow `eval`. */130 jitless?: boolean | undefined;131}132 133interface GlobalThisWithConfig {134 /**135 * The globalConfig instance shared across both CommonJS and ESM builds.136 * Attached to `globalThis` (mirroring `__zod_globalRegistry`) so that a137 * single config object is used regardless of how Zod is loaded — CJS,138 * ESM, multiple bundles in a monorepo, etc. This means `z.config(...)`139 * applied against any one instance is observed by all of them, and140 * pre-populating it before Zod loads (e.g. `globalThis.__zod_globalConfig141 * = { jitless: true }` in an inline script) takes effect immediately on142 * import.143 */144 __zod_globalConfig?: $ZodConfig;145}146 147(globalThis as GlobalThisWithConfig).__zod_globalConfig ??= {};148export const globalConfig: $ZodConfig = (globalThis as GlobalThisWithConfig).__zod_globalConfig!;149 150export function config(newConfig?: Partial<$ZodConfig>): $ZodConfig {151 if (newConfig) Object.assign(globalConfig, newConfig);152 return globalConfig;153}154 