node-llama-cpp
Version:
Run AI models locally on your machine with node.js bindings for llama.cpp. Enforce a JSON schema on the model output on the generation level
11 lines (10 loc) • 415 B
TypeScript
type UnionToIntersection<U> = (U extends any ? ((k: U) => void) : never) extends ((k: infer I) => void) ? I : never;
type DistributeUnion<U> = {
[K in keyof U]: U[K];
};
type OptionalDistributeUnion<U> = {
[K in keyof U]?: U[K];
};
export type MergeUnionTypes<T> = DistributeUnion<UnionToIntersection<T>>;
export type MergeOptionalUnionTypes<T> = OptionalDistributeUnion<UnionToIntersection<T>>;
export {};