@codemem/embeddings 0.44.0-alpha.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Adam Kunicki
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,25 @@
1
+ export interface EmbeddingRuntimeRequest {
2
+ model: string;
3
+ revision?: string;
4
+ }
5
+ export interface EmbeddingRuntimeIdentity {
6
+ readonly package: "@huggingface/transformers";
7
+ readonly version: string;
8
+ readonly model: string;
9
+ readonly revision: string;
10
+ readonly requestedRevision?: string;
11
+ readonly dtype: "fp32";
12
+ readonly device: "cpu";
13
+ readonly pooling: "mean";
14
+ readonly normalization: "l2";
15
+ readonly dimensions: number;
16
+ }
17
+ export interface EmbeddingClient {
18
+ readonly model: string;
19
+ readonly dimensions: number;
20
+ readonly identity: EmbeddingRuntimeIdentity;
21
+ embed(texts: string[]): Promise<Float32Array[]>;
22
+ }
23
+ export type EmbeddingRuntimeFactory = (request: EmbeddingRuntimeRequest) => Promise<EmbeddingClient | null>;
24
+ export declare function createEmbeddingRuntime({ model, revision: revisionRequest, }: EmbeddingRuntimeRequest): Promise<EmbeddingClient>;
25
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,uBAAuB;IACvC,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,wBAAwB;IACxC,QAAQ,CAAC,OAAO,EAAE,2BAA2B,CAAC;IAC9C,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,iBAAiB,CAAC,EAAE,MAAM,CAAC;IACpC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,MAAM,EAAE,KAAK,CAAC;IACvB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,aAAa,EAAE,IAAI,CAAC;IAC7B,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;CAC5B;AAED,MAAM,WAAW,eAAe;IAC/B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,QAAQ,EAAE,wBAAwB,CAAC;IAC5C,KAAK,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,YAAY,EAAE,CAAC,CAAC;CAChD;AAED,MAAM,MAAM,uBAAuB,GAAG,CACrC,OAAO,EAAE,uBAAuB,KAC5B,OAAO,CAAC,eAAe,GAAG,IAAI,CAAC,CAAC;AA4HrC,wBAAsB,sBAAsB,CAAC,EAC5C,KAAK,EACL,QAAQ,EAAE,eAAe,GACzB,EAAE,uBAAuB,GAAG,OAAO,CAAC,eAAe,CAAC,CA+DpD"}
package/dist/index.js ADDED
@@ -0,0 +1,97 @@
1
+ //#region src/index.ts
2
+ var e = "Xenova/bge-small-en-v1.5", t = "ea104dacec62c0de699686887e3f920caeb4f3e3", n = /^[0-9a-f]{40}$/, r;
3
+ function i() {
4
+ let e = process.env.CODEMEM_EMBEDDING_OFFLINE?.toLowerCase();
5
+ return e === "1" || e === "true" || e === "yes";
6
+ }
7
+ function a(e) {
8
+ if (i()) {
9
+ r ??= e.allowRemoteModels, e.allowRemoteModels = !1;
10
+ return;
11
+ }
12
+ r !== void 0 && (e.allowRemoteModels = r, r = void 0);
13
+ }
14
+ function o(e) {
15
+ return e.startsWith(".") || e.startsWith("/") || e.startsWith("~") || e.includes("\\") || e.split("/").length > 2;
16
+ }
17
+ function s(r, i, a) {
18
+ if ((r !== e || i !== t) && !(i && n.test(i) && (o(r) || !a))) return i;
19
+ }
20
+ async function c(e, t, r) {
21
+ let i = r.remotePathTemplate.replaceAll("{model}", e.split("/").map(encodeURIComponent).join("/")).replaceAll("{revision}", encodeURIComponent(t)), a = `${r.remoteHost.replace(/\/+$/, "")}/${i.replace(/^\/+|\/+$/g, "")}/config.json`, o = new Headers(), s = new URL(a).hostname;
22
+ if (s === "huggingface.co" || s === "hf.co") {
23
+ let e = process.env.HF_TOKEN ?? process.env.HF_ACCESS_TOKEN;
24
+ e && o.set("Authorization", `Bearer ${e}`);
25
+ }
26
+ let c = await r.fetch(a, {
27
+ method: "HEAD",
28
+ redirect: "follow",
29
+ headers: o,
30
+ signal: AbortSignal.timeout(1e4)
31
+ });
32
+ if (!c.ok) throw TypeError(`Unable to resolve Hugging Face model ${e}@${t}: HTTP ${c.status}`);
33
+ let l = c.headers.get("x-repo-commit")?.trim().toLowerCase();
34
+ if (!l || !n.test(l)) throw TypeError(`Hugging Face did not return a canonical commit for model ${e}@${t}`);
35
+ return l;
36
+ }
37
+ function l(e, t, n) {
38
+ if (e.dims?.length !== 2 || e.dims?.length === 2 && (e.dims[0] !== t || e.dims[1] !== n) || e.data.length !== t * n) throw TypeError("Embedding model returned an invalid tensor shape or value count");
39
+ let r = Array.from({ length: t }, () => new Float32Array(n));
40
+ for (let t = 0; t < e.data.length; t++) {
41
+ let i = e.data[t], a = typeof i == "number" ? Math.fround(i) : NaN;
42
+ if (!Number.isFinite(a)) throw TypeError(`Embedding model returned non-finite data at index ${t}`);
43
+ let o = r[Math.floor(t / n)];
44
+ if (!o) throw TypeError("Embedding model returned an invalid tensor row");
45
+ o[t % n] = a;
46
+ }
47
+ return r;
48
+ }
49
+ async function u({ model: n, revision: r }) {
50
+ let i = r?.trim();
51
+ if (n !== e && !i) throw TypeError("A revision is required when creating a runtime for a custom model");
52
+ let { env: u, pipeline: d } = await import("@huggingface/transformers");
53
+ a(u);
54
+ let f = i || t, p = f, m = s(n, i, u.allowRemoteModels);
55
+ if (m) {
56
+ if (o(n)) throw TypeError("Local embedding models require a 40-character revision identity");
57
+ if (u.allowRemoteModels) p = await c(n, m, u);
58
+ else throw TypeError(`Cannot resolve mutable embedding revision ${m} while remote models are disabled`);
59
+ }
60
+ let h = await d("feature-extraction", n, {
61
+ revision: p,
62
+ device: "cpu",
63
+ dtype: "fp32"
64
+ }), g = {
65
+ pooling: "mean",
66
+ normalize: !0
67
+ }, _ = await h(["probe"], g), v = _.dims?.at(-1);
68
+ if (typeof v != "number" || !Number.isInteger(v) || v <= 0) throw TypeError("Embedding model returned invalid dimensions");
69
+ return l(_, 1, v), {
70
+ model: n,
71
+ dimensions: v,
72
+ identity: {
73
+ package: "@huggingface/transformers",
74
+ version: "4.2.0",
75
+ model: n,
76
+ revision: p,
77
+ requestedRevision: f,
78
+ dtype: "fp32",
79
+ device: "cpu",
80
+ pooling: "mean",
81
+ normalization: "l2",
82
+ dimensions: v
83
+ },
84
+ async embed(e) {
85
+ let t = [];
86
+ for (let n = 0; n < e.length; n += 32) {
87
+ let r = e.slice(n, n + 32);
88
+ t.push(...l(await h(r, g), r.length, v));
89
+ }
90
+ return t;
91
+ }
92
+ };
93
+ }
94
+ //#endregion
95
+ export { u as createEmbeddingRuntime };
96
+
97
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","names":[],"sources":["../src/index.ts"],"sourcesContent":["export interface EmbeddingRuntimeRequest {\n\tmodel: string;\n\trevision?: string;\n}\n\nexport interface EmbeddingRuntimeIdentity {\n\treadonly package: \"@huggingface/transformers\";\n\treadonly version: string;\n\treadonly model: string;\n\treadonly revision: string;\n\treadonly requestedRevision?: string;\n\treadonly dtype: \"fp32\";\n\treadonly device: \"cpu\";\n\treadonly pooling: \"mean\";\n\treadonly normalization: \"l2\";\n\treadonly dimensions: number;\n}\n\nexport interface EmbeddingClient {\n\treadonly model: string;\n\treadonly dimensions: number;\n\treadonly identity: EmbeddingRuntimeIdentity;\n\tembed(texts: string[]): Promise<Float32Array[]>;\n}\n\nexport type EmbeddingRuntimeFactory = (\n\trequest: EmbeddingRuntimeRequest,\n) => Promise<EmbeddingClient | null>;\n\ninterface Tensor {\n\tdata: ArrayLike<number | bigint>;\n\tdims?: number[];\n}\n\ntype Extractor = (\n\ttexts: string[],\n\toptions: { pooling: \"mean\"; normalize: true },\n) => Promise<Tensor>;\n\nconst DEFAULT_MODEL = \"Xenova/bge-small-en-v1.5\";\nconst DEFAULT_REVISION = \"ea104dacec62c0de699686887e3f920caeb4f3e3\";\nconst CANONICAL_REVISION_PATTERN = /^[0-9a-f]{40}$/;\nlet allowRemoteModelsBeforeOffline: boolean | undefined;\n\nfunction isEmbeddingOffline(): boolean {\n\tconst value = process.env.CODEMEM_EMBEDDING_OFFLINE?.toLowerCase();\n\treturn value === \"1\" || value === \"true\" || value === \"yes\";\n}\n\nfunction configureRemoteModelAccess(env: HubEnvironment): void {\n\tif (isEmbeddingOffline()) {\n\t\tallowRemoteModelsBeforeOffline ??= env.allowRemoteModels;\n\t\tenv.allowRemoteModels = false;\n\t\treturn;\n\t}\n\tif (allowRemoteModelsBeforeOffline === undefined) return;\n\tenv.allowRemoteModels = allowRemoteModelsBeforeOffline;\n\tallowRemoteModelsBeforeOffline = undefined;\n}\n\ninterface HubEnvironment {\n\tremoteHost: string;\n\tremotePathTemplate: string;\n\tallowRemoteModels: boolean;\n\tfetch(input: string | URL, init?: RequestInit): Promise<Response>;\n}\n\nfunction isLocalModelPath(model: string): boolean {\n\t// Transformers.js accepts at most owner/name as a Hub repository ID; other path forms are local.\n\treturn (\n\t\tmodel.startsWith(\".\") ||\n\t\tmodel.startsWith(\"/\") ||\n\t\tmodel.startsWith(\"~\") ||\n\t\tmodel.includes(\"\\\\\") ||\n\t\tmodel.split(\"/\").length > 2\n\t);\n}\n\nfunction configuredRevisionToResolve(\n\tmodel: string,\n\tconfiguredRevision: string | undefined,\n\tallowRemoteModels: boolean,\n): string | undefined {\n\tif (model === DEFAULT_MODEL && configuredRevision === DEFAULT_REVISION) return undefined;\n\tif (\n\t\tconfiguredRevision &&\n\t\tCANONICAL_REVISION_PATTERN.test(configuredRevision) &&\n\t\t(isLocalModelPath(model) || !allowRemoteModels)\n\t) {\n\t\treturn undefined;\n\t}\n\treturn configuredRevision;\n}\n\nasync function resolveCanonicalRevision(\n\tmodel: string,\n\trevision: string,\n\tenv: HubEnvironment,\n): Promise<string> {\n\tconst remotePath = env.remotePathTemplate\n\t\t.replaceAll(\"{model}\", model.split(\"/\").map(encodeURIComponent).join(\"/\"))\n\t\t.replaceAll(\"{revision}\", encodeURIComponent(revision));\n\tconst url = `${env.remoteHost.replace(/\\/+$/, \"\")}/${remotePath.replace(/^\\/+|\\/+$/g, \"\")}/config.json`;\n\tconst headers = new Headers();\n\tconst hostname = new URL(url).hostname;\n\tif (hostname === \"huggingface.co\" || hostname === \"hf.co\") {\n\t\tconst token = process.env.HF_TOKEN ?? process.env.HF_ACCESS_TOKEN;\n\t\tif (token) headers.set(\"Authorization\", `Bearer ${token}`);\n\t}\n\tconst response = await env.fetch(url, {\n\t\tmethod: \"HEAD\",\n\t\tredirect: \"follow\",\n\t\theaders,\n\t\tsignal: AbortSignal.timeout(10_000),\n\t});\n\tif (!response.ok) {\n\t\tthrow new TypeError(\n\t\t\t`Unable to resolve Hugging Face model ${model}@${revision}: HTTP ${response.status}`,\n\t\t);\n\t}\n\tconst canonicalRevision = response.headers.get(\"x-repo-commit\")?.trim().toLowerCase();\n\tif (!canonicalRevision || !CANONICAL_REVISION_PATTERN.test(canonicalRevision)) {\n\t\tthrow new TypeError(\n\t\t\t`Hugging Face did not return a canonical commit for model ${model}@${revision}`,\n\t\t);\n\t}\n\treturn canonicalRevision;\n}\n\nfunction rows(output: Tensor, count: number, dimensions: number): Float32Array[] {\n\tif (\n\t\toutput.dims?.length !== 2 ||\n\t\t(output.dims?.length === 2 && (output.dims[0] !== count || output.dims[1] !== dimensions)) ||\n\t\toutput.data.length !== count * dimensions\n\t) {\n\t\tthrow new TypeError(\"Embedding model returned an invalid tensor shape or value count\");\n\t}\n\tconst result = Array.from({ length: count }, () => new Float32Array(dimensions));\n\tfor (let index = 0; index < output.data.length; index++) {\n\t\tconst value = output.data[index];\n\t\tconst number = typeof value === \"number\" ? Math.fround(value) : Number.NaN;\n\t\tif (!Number.isFinite(number)) {\n\t\t\tthrow new TypeError(`Embedding model returned non-finite data at index ${index}`);\n\t\t}\n\t\tconst row = result[Math.floor(index / dimensions)];\n\t\tif (!row) throw new TypeError(\"Embedding model returned an invalid tensor row\");\n\t\trow[index % dimensions] = number;\n\t}\n\treturn result;\n}\n\nexport async function createEmbeddingRuntime({\n\tmodel,\n\trevision: revisionRequest,\n}: EmbeddingRuntimeRequest): Promise<EmbeddingClient> {\n\tconst configuredRevision = revisionRequest?.trim();\n\tif (model !== DEFAULT_MODEL && !configuredRevision) {\n\t\tthrow new TypeError(\"A revision is required when creating a runtime for a custom model\");\n\t}\n\tconst { env, pipeline } = await import(\"@huggingface/transformers\");\n\tconfigureRemoteModelAccess(env);\n\tconst requestedRevision = configuredRevision || DEFAULT_REVISION;\n\tlet revision = requestedRevision;\n\tconst revisionToResolve = configuredRevisionToResolve(\n\t\tmodel,\n\t\tconfiguredRevision,\n\t\tenv.allowRemoteModels,\n\t);\n\tif (revisionToResolve) {\n\t\tif (isLocalModelPath(model)) {\n\t\t\tthrow new TypeError(\"Local embedding models require a 40-character revision identity\");\n\t\t} else if (!env.allowRemoteModels) {\n\t\t\tthrow new TypeError(\n\t\t\t\t`Cannot resolve mutable embedding revision ${revisionToResolve} while remote models are disabled`,\n\t\t\t);\n\t\t} else {\n\t\t\trevision = await resolveCanonicalRevision(model, revisionToResolve, env);\n\t\t}\n\t}\n\t// Runtime validation below guards the structural boundary hidden by upstream's broad pipeline type.\n\tconst extractor = (await pipeline(\"feature-extraction\", model, {\n\t\trevision,\n\t\tdevice: \"cpu\",\n\t\tdtype: \"fp32\",\n\t})) as unknown as Extractor;\n\tconst options = { pooling: \"mean\", normalize: true } as const;\n\tconst probe = await extractor([\"probe\"], options);\n\tconst dimensions = probe.dims?.at(-1);\n\tif (typeof dimensions !== \"number\" || !Number.isInteger(dimensions) || dimensions <= 0) {\n\t\tthrow new TypeError(\"Embedding model returned invalid dimensions\");\n\t}\n\trows(probe, 1, dimensions);\n\n\treturn {\n\t\tmodel,\n\t\tdimensions,\n\t\tidentity: {\n\t\t\tpackage: \"@huggingface/transformers\",\n\t\t\tversion: \"4.2.0\",\n\t\t\tmodel,\n\t\t\trevision,\n\t\t\trequestedRevision,\n\t\t\tdtype: \"fp32\",\n\t\t\tdevice: \"cpu\",\n\t\t\tpooling: \"mean\",\n\t\t\tnormalization: \"l2\",\n\t\t\tdimensions,\n\t\t},\n\t\tasync embed(texts) {\n\t\t\tconst result: Float32Array[] = [];\n\t\t\tfor (let offset = 0; offset < texts.length; offset += 32) {\n\t\t\t\tconst batch = texts.slice(offset, offset + 32);\n\t\t\t\t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,MAAM,OAAO;CACvC,EAA2B,CAAG;CAC9B,IAAM,IAAoB,KAAsB,GAC5C,IAAW,GACT,IAAoB,EACzB,GACA,GACA,EAAI,iBACL;CACA,IAAI,GAAmB;EACtB,IAAI,EAAiB,CAAK,GACzB,MAAU,UAAU,iEAAiE;EAC/E,IAAK,EAAI,mBAKf,IAAW,MAAM,EAAyB,GAAO,GAAmB,CAAG;OAJvE,MAAU,UACT,6CAA6C,EAAkB,kCAChE;CAIF;CAEA,IAAM,IAAa,MAAM,EAAS,sBAAsB,GAAO;EAC9D;EACA,QAAQ;EACR,OAAO;CACR,CAAC,GACK,IAAU;EAAE,SAAS;EAAQ,WAAW;CAAK,GAC7C,IAAQ,MAAM,EAAU,CAAC,OAAO,GAAG,CAAO,GAC1C,IAAa,EAAM,MAAM,GAAG,EAAE;CACpC,IAAI,OAAO,KAAe,YAAY,CAAC,OAAO,UAAU,CAAU,KAAK,KAAc,GACpF,MAAU,UAAU,6CAA6C;CAIlE,OAFA,EAAK,GAAO,GAAG,CAAU,GAElB;EACN;EACA;EACA,UAAU;GACT,SAAS;GACT,SAAS;GACT;GACA;GACA;GACA,OAAO;GACP,QAAQ;GACR,SAAS;GACT,eAAe;GACf;EACD;EACA,MAAM,MAAM,GAAO;GAClB,IAAM,IAAyB,CAAC;GAChC,KAAK,IAAI,IAAS,GAAG,IAAS,EAAM,QAAQ,KAAU,IAAI;IACzD,IAAM,IAAQ,EAAM,MAAM,GAAQ,IAAS,EAAE;IAC7C,EAAO,KAAK,GAAG,EAAK,MAAM,EAAU,GAAO,CAAO,GAAG,EAAM,QAAQ,CAAU,CAAC;GAC/E;GACA,OAAO;EACR;CACD;AACD"}
package/package.json ADDED
@@ -0,0 +1,43 @@
1
+ {
2
+ "name": "@codemem/embeddings",
3
+ "version": "0.44.0-alpha.1",
4
+ "type": "module",
5
+ "types": "./dist/index.d.ts",
6
+ "exports": {
7
+ ".": {
8
+ "source": "./src/index.ts",
9
+ "import": "./dist/index.js",
10
+ "types": "./dist/index.d.ts"
11
+ }
12
+ },
13
+ "files": [
14
+ "dist/"
15
+ ],
16
+ "dependencies": {
17
+ "@huggingface/transformers": "4.2.0"
18
+ },
19
+ "devDependencies": {
20
+ "typescript": "^7.0.2",
21
+ "vite": "^8.2.2",
22
+ "vitest": "^4.1.11"
23
+ },
24
+ "repository": {
25
+ "type": "git",
26
+ "url": "git+https://github.com/kunickiaj/codemem.git",
27
+ "directory": "packages/embeddings"
28
+ },
29
+ "engines": {
30
+ "node": ">=24.15.0"
31
+ },
32
+ "license": "MIT",
33
+ "publishConfig": {
34
+ "access": "public"
35
+ },
36
+ "scripts": {
37
+ "clean": "rm -rf dist tsconfig.tsbuildinfo",
38
+ "build": "pnpm exec vite build && pnpm exec tsc --build --force",
39
+ "typecheck": "pnpm exec tsc --noEmit",
40
+ "test": "pnpm exec vitest run",
41
+ "test:packed-runtime": "node ./scripts/packed-runtime-smoke.mjs"
42
+ }
43
+ }