@kybernesis/brain-embed-openai 0.14.0 → 0.15.0
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/dist/index.d.ts +41 -7
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +101 -7
- package/dist/index.js.map +1 -1
- package/package.json +6 -6
package/dist/index.d.ts
CHANGED
|
@@ -28,7 +28,7 @@ export interface OpenAILike {
|
|
|
28
28
|
embeddings: {
|
|
29
29
|
create(args: {
|
|
30
30
|
model: string;
|
|
31
|
-
input: string;
|
|
31
|
+
input: string | string[];
|
|
32
32
|
}): Promise<{
|
|
33
33
|
data: Array<{
|
|
34
34
|
embedding: number[];
|
|
@@ -36,21 +36,50 @@ export interface OpenAILike {
|
|
|
36
36
|
}>;
|
|
37
37
|
};
|
|
38
38
|
}
|
|
39
|
+
/** OpenAI accepts up to 2048 inputs per embeddings request; stay under it. */
|
|
40
|
+
export declare const MAX_EMBED_BATCH = 2048;
|
|
39
41
|
/** Build an OpenAI-like client from a resolved key. May be async (the default dynamic-imports `openai`). */
|
|
40
42
|
export type OpenAIClientFactory = (apiKey: string) => OpenAILike | Promise<OpenAILike>;
|
|
41
|
-
/**
|
|
42
|
-
|
|
43
|
+
/**
|
|
44
|
+
* Where a swallowed embedding failure happened.
|
|
45
|
+
* - `sdk-load` — the `openai` SDK failed to import / construct.
|
|
46
|
+
* - `api-call` — the embeddings request threw (network, 4xx/5xx other than quota).
|
|
47
|
+
* - `timeout` — the request exceeded `timeoutMs` (belt-and-braces guard, KYB-180).
|
|
48
|
+
* - `quota` — HTTP 429 `insufficient_quota` (billing/quota exhausted) — the
|
|
49
|
+
* exact failure that silently killed embeddings for ~2 weeks.
|
|
50
|
+
*/
|
|
51
|
+
export type EmbedErrorStage = 'sdk-load' | 'api-call' | 'timeout' | 'quota';
|
|
52
|
+
/** Default per-request timeout. Was the SDK default 600_000ms — far too slack for an ingest path. */
|
|
53
|
+
export declare const DEFAULT_EMBED_TIMEOUT_MS = 30000;
|
|
54
|
+
/** Default retry budget. Was the SDK default 2 — one retry keeps the slow path bounded. */
|
|
55
|
+
export declare const DEFAULT_EMBED_MAX_RETRIES = 1;
|
|
56
|
+
/** Cumulative embed health, readable by the host (KYB-180 seed for KYB-183 telemetry). */
|
|
57
|
+
export interface EmbedStats {
|
|
58
|
+
ok: number;
|
|
59
|
+
failed: number;
|
|
60
|
+
byStage: Record<EmbedErrorStage, number>;
|
|
61
|
+
}
|
|
43
62
|
export interface OpenAIEmbedderOptions {
|
|
44
63
|
/** Inject a client factory (tests pass a fake; default dynamically imports `openai`). */
|
|
45
64
|
clientFactory?: OpenAIClientFactory;
|
|
46
65
|
/** Override the embedding model (default `text-embedding-3-small`). */
|
|
47
66
|
model?: string;
|
|
67
|
+
/**
|
|
68
|
+
* Per-request timeout in ms (default 30_000). Bounds both the SDK client
|
|
69
|
+
* (`new OpenAI({ timeout })`) and a belt-and-braces `withTimeout` wrapper, so
|
|
70
|
+
* a hung socket the SDK misses still rejects promptly instead of stalling
|
|
71
|
+
* ingestion for minutes.
|
|
72
|
+
*/
|
|
73
|
+
timeoutMs?: number;
|
|
74
|
+
/** SDK retry budget (default 1). Lower than the SDK default of 2 to keep the slow path bounded. */
|
|
75
|
+
maxRetries?: number;
|
|
48
76
|
/**
|
|
49
77
|
* Optional failure hook. Without it, failures degrade silently to `null`
|
|
50
78
|
* (the contract's "no embedding" path) — which is operationally blind: a
|
|
51
|
-
* missing `openai` SDK, a revoked key,
|
|
52
|
-
* Wire this to your logger to tell them
|
|
53
|
-
* error; do not log it somewhere that would
|
|
79
|
+
* missing `openai` SDK, a revoked key, quota exhaustion, a timeout, and a
|
|
80
|
+
* network error all look the same. Wire this to your logger to tell them
|
|
81
|
+
* apart. The hook receives the raw error; do not log it somewhere that would
|
|
82
|
+
* expose request headers.
|
|
54
83
|
*/
|
|
55
84
|
onError?: (info: {
|
|
56
85
|
stage: EmbedErrorStage;
|
|
@@ -58,6 +87,11 @@ export interface OpenAIEmbedderOptions {
|
|
|
58
87
|
error: unknown;
|
|
59
88
|
}) => void;
|
|
60
89
|
}
|
|
90
|
+
/** The embedder plus a host-readable health snapshot. Assignable to `EmbeddingProvider`. */
|
|
91
|
+
export interface OpenAIEmbedder extends EmbeddingProvider {
|
|
92
|
+
/** Cumulative embed health since construction — so a silent outage becomes observable. */
|
|
93
|
+
stats(): EmbedStats;
|
|
94
|
+
}
|
|
61
95
|
/** Resolve the OpenAI key for a tenant: `<home>/.env` first, then `process.env`. */
|
|
62
96
|
export declare function resolveOpenAIKey(t: TenantContext): string | null;
|
|
63
97
|
/**
|
|
@@ -65,5 +99,5 @@ export declare function resolveOpenAIKey(t: TenantContext): string | null;
|
|
|
65
99
|
* cached per `t.slug`; tenants without a key degrade to `null` (brain-core
|
|
66
100
|
* treats that as "no embedding" — indexChunk no-ops, semanticSearch returns []).
|
|
67
101
|
*/
|
|
68
|
-
export declare function createOpenAIEmbedder(opts?: OpenAIEmbedderOptions):
|
|
102
|
+
export declare function createOpenAIEmbedder(opts?: OpenAIEmbedderOptions): OpenAIEmbedder;
|
|
69
103
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAIH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AACjE,OAAO,EAAE,eAAe,EAAsC,MAAM,6BAA6B,CAAC;AAClG,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAIhE,OAAO,EAAE,eAAe,EAAE,CAAC;AAE3B,sFAAsF;AACtF,MAAM,WAAW,UAAU;IACzB,UAAU,EAAE;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;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,EAAE,MAAM,CAAC;IACnB,mGAAmG;IACnG,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;;;;;;OAOG;IACH,OAAO,CAAC,EAAE,CAAC,IAAI,EAAE;QAAE,KAAK,EAAE,eAAe,CAAC;QAAC,UAAU,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,OAAO,CAAA;KAAE,KAAK,IAAI,CAAC;CAC1F;AAED,4FAA4F;AAC5F,MAAM,WAAW,cAAe,SAAQ,iBAAiB;IACvD,0FAA0F;IAC1F,KAAK,IAAI,UAAU,CAAC;CACrB;AAqED,oFAAoF;AACpF,wBAAgB,gBAAgB,CAAC,CAAC,EAAE,aAAa,GAAG,MAAM,GAAG,IAAI,CAKhE;AAqBD;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,IAAI,GAAE,qBAA0B,GAAG,cAAc,CA8FrF"}
|
package/dist/index.js
CHANGED
|
@@ -25,6 +25,45 @@ import { EMBEDDING_MODEL, EMBEDDING_DIM, EMBEDDING_INPUT_CAP } from '@kybernesis
|
|
|
25
25
|
// Single source of truth for these lives in brain-contracts (the schema-binding
|
|
26
26
|
// invariants). Re-export the model alias for convenience; never redeclare them.
|
|
27
27
|
export { EMBEDDING_MODEL };
|
|
28
|
+
/** OpenAI accepts up to 2048 inputs per embeddings request; stay under it. */
|
|
29
|
+
export const MAX_EMBED_BATCH = 2048;
|
|
30
|
+
/** Default per-request timeout. Was the SDK default 600_000ms — far too slack for an ingest path. */
|
|
31
|
+
export const DEFAULT_EMBED_TIMEOUT_MS = 30_000;
|
|
32
|
+
/** Default retry budget. Was the SDK default 2 — one retry keeps the slow path bounded. */
|
|
33
|
+
export const DEFAULT_EMBED_MAX_RETRIES = 1;
|
|
34
|
+
/** Sentinel so the belt-and-braces timeout is classifiable as `stage: 'timeout'` (vs a generic api-call). */
|
|
35
|
+
class EmbedTimeoutError extends Error {
|
|
36
|
+
constructor(ms) {
|
|
37
|
+
super(`embedding timed out after ${ms}ms`);
|
|
38
|
+
this.name = 'EmbedTimeoutError';
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Reject `p` after `ms` if it hasn't settled. Belt-and-braces over the SDK's own
|
|
43
|
+
* `timeout` — a half-open socket / black-holed proxy the SDK misses still frees
|
|
44
|
+
* the request slot. Note: like all JS timeouts this does NOT cancel the
|
|
45
|
+
* underlying request; it just stops us awaiting it.
|
|
46
|
+
*/
|
|
47
|
+
function withTimeout(p, ms) {
|
|
48
|
+
return new Promise((resolve, reject) => {
|
|
49
|
+
const timer = setTimeout(() => reject(new EmbedTimeoutError(ms)), ms);
|
|
50
|
+
timer.unref?.();
|
|
51
|
+
p.then((v) => { clearTimeout(timer); resolve(v); }, (e) => { clearTimeout(timer); reject(e); });
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
/** Best-effort stage classification for a caught embed error. */
|
|
55
|
+
function classifyError(error) {
|
|
56
|
+
if (error instanceof EmbedTimeoutError)
|
|
57
|
+
return 'timeout';
|
|
58
|
+
const e = error;
|
|
59
|
+
const code = e?.code ?? e?.error?.code;
|
|
60
|
+
const msg = e?.message ?? '';
|
|
61
|
+
if (code === 'insufficient_quota' || /insufficient_quota/i.test(msg))
|
|
62
|
+
return 'quota';
|
|
63
|
+
if (e?.status === 429 && /quota|billing/i.test(msg))
|
|
64
|
+
return 'quota';
|
|
65
|
+
return 'api-call';
|
|
66
|
+
}
|
|
28
67
|
/**
|
|
29
68
|
* Parse `<home>/.env` into a key→value map. Trivial KEY=VALUE parser (strips
|
|
30
69
|
* `#` comments and surrounding quotes) — we only need OPENAI_API_KEY, so a full
|
|
@@ -67,7 +106,7 @@ export function resolveOpenAIKey(t) {
|
|
|
67
106
|
return fromProc && fromProc.trim().length > 0 ? fromProc.trim() : null;
|
|
68
107
|
}
|
|
69
108
|
let _openaiModule = null;
|
|
70
|
-
async function defaultClientFactory(apiKey) {
|
|
109
|
+
async function defaultClientFactory(apiKey, bounds) {
|
|
71
110
|
if (!_openaiModule) {
|
|
72
111
|
// Dynamic import keeps `openai` an OPTIONAL peer — the host provides it.
|
|
73
112
|
_openaiModule = await import('openai');
|
|
@@ -76,7 +115,10 @@ async function defaultClientFactory(apiKey) {
|
|
|
76
115
|
const OpenAI = mod.default ?? mod.OpenAI;
|
|
77
116
|
if (!OpenAI)
|
|
78
117
|
throw new Error('openai SDK has no default/OpenAI export');
|
|
79
|
-
|
|
118
|
+
// Explicit bounds: SDK defaults are timeout 600_000ms / maxRetries 2 — far
|
|
119
|
+
// too slack for an ingest path (a 429/hung call × retries blows past the
|
|
120
|
+
// host's per-file ingest timeout and stalls a whole agent).
|
|
121
|
+
return new OpenAI({ apiKey, timeout: bounds.timeout, maxRetries: bounds.maxRetries });
|
|
80
122
|
}
|
|
81
123
|
/**
|
|
82
124
|
* Create a tenant-aware OpenAI `EmbeddingProvider`. One client is resolved and
|
|
@@ -85,9 +127,24 @@ async function defaultClientFactory(apiKey) {
|
|
|
85
127
|
*/
|
|
86
128
|
export function createOpenAIEmbedder(opts = {}) {
|
|
87
129
|
const model = opts.model ?? EMBEDDING_MODEL;
|
|
88
|
-
const
|
|
130
|
+
const timeoutMs = opts.timeoutMs && opts.timeoutMs > 0 ? opts.timeoutMs : DEFAULT_EMBED_TIMEOUT_MS;
|
|
131
|
+
const maxRetries = opts.maxRetries !== undefined && opts.maxRetries >= 0 ? opts.maxRetries : DEFAULT_EMBED_MAX_RETRIES;
|
|
132
|
+
// A custom clientFactory takes the key alone; the default also gets the bounds.
|
|
133
|
+
const makeClient = opts.clientFactory
|
|
134
|
+
?? ((key) => defaultClientFactory(key, { timeout: timeoutMs, maxRetries }));
|
|
89
135
|
const onError = opts.onError;
|
|
90
136
|
const clients = new Map(); // by t.slug; null = resolved-no-key
|
|
137
|
+
const stats = {
|
|
138
|
+
ok: 0,
|
|
139
|
+
failed: 0,
|
|
140
|
+
byStage: { 'sdk-load': 0, 'api-call': 0, timeout: 0, quota: 0 },
|
|
141
|
+
};
|
|
142
|
+
/** Record a failure once, in both the counter and the host hook. */
|
|
143
|
+
function reportFailure(stage, tenantSlug, error) {
|
|
144
|
+
stats.failed += 1;
|
|
145
|
+
stats.byStage[stage] += 1;
|
|
146
|
+
onError?.({ stage, tenantSlug, error });
|
|
147
|
+
}
|
|
91
148
|
async function getClient(t) {
|
|
92
149
|
if (clients.has(t.slug))
|
|
93
150
|
return clients.get(t.slug) ?? null;
|
|
@@ -102,28 +159,65 @@ export function createOpenAIEmbedder(opts = {}) {
|
|
|
102
159
|
return client;
|
|
103
160
|
}
|
|
104
161
|
catch (error) {
|
|
105
|
-
|
|
162
|
+
reportFailure('sdk-load', t.slug, error);
|
|
106
163
|
clients.set(t.slug, null);
|
|
107
164
|
return null;
|
|
108
165
|
}
|
|
109
166
|
}
|
|
110
167
|
return {
|
|
168
|
+
stats: () => ({ ok: stats.ok, failed: stats.failed, byStage: { ...stats.byStage } }),
|
|
111
169
|
async embed(t, text) {
|
|
112
170
|
const client = await getClient(t);
|
|
113
171
|
if (!client)
|
|
114
|
-
return null;
|
|
172
|
+
return null; // resolved-no-key: not a failure, just "no embedding"
|
|
115
173
|
try {
|
|
116
|
-
|
|
174
|
+
// Belt-and-braces: the SDK client already has `timeout`, but a hung
|
|
175
|
+
// socket it misses is still bounded here so ingestion never stalls.
|
|
176
|
+
const res = await withTimeout(Promise.resolve(client.embeddings.create({ model, input: text.slice(0, EMBEDDING_INPUT_CAP) })), timeoutMs);
|
|
117
177
|
const vec = res.data?.[0]?.embedding ?? null;
|
|
118
178
|
if (!vec || vec.length !== EMBEDDING_DIM)
|
|
119
179
|
return null;
|
|
180
|
+
stats.ok += 1;
|
|
120
181
|
return vec;
|
|
121
182
|
}
|
|
122
183
|
catch (error) {
|
|
123
|
-
|
|
184
|
+
reportFailure(classifyError(error), t.slug, error);
|
|
124
185
|
return null;
|
|
125
186
|
}
|
|
126
187
|
},
|
|
188
|
+
async embedBatch(t, texts) {
|
|
189
|
+
if (texts.length === 0)
|
|
190
|
+
return [];
|
|
191
|
+
const client = await getClient(t);
|
|
192
|
+
if (!client)
|
|
193
|
+
return texts.map(() => null); // resolved-no-key
|
|
194
|
+
const capped = texts.map((x) => x.slice(0, EMBEDDING_INPUT_CAP));
|
|
195
|
+
const out = [];
|
|
196
|
+
// Split into ≤MAX_EMBED_BATCH windows; one create() call per window.
|
|
197
|
+
for (let start = 0; start < capped.length; start += MAX_EMBED_BATCH) {
|
|
198
|
+
const window = capped.slice(start, start + MAX_EMBED_BATCH);
|
|
199
|
+
try {
|
|
200
|
+
const res = await withTimeout(Promise.resolve(client.embeddings.create({ model, input: window })), timeoutMs);
|
|
201
|
+
for (let j = 0; j < window.length; j++) {
|
|
202
|
+
const vec = res.data?.[j]?.embedding ?? null;
|
|
203
|
+
if (vec && vec.length === EMBEDDING_DIM) {
|
|
204
|
+
stats.ok += 1;
|
|
205
|
+
out.push(vec);
|
|
206
|
+
}
|
|
207
|
+
else {
|
|
208
|
+
out.push(null);
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
catch (error) {
|
|
213
|
+
// One failed request fails its whole window; report once, null the items.
|
|
214
|
+
reportFailure(classifyError(error), t.slug, error);
|
|
215
|
+
for (let j = 0; j < window.length; j++)
|
|
216
|
+
out.push(null);
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
return out;
|
|
220
|
+
},
|
|
127
221
|
};
|
|
128
222
|
}
|
|
129
223
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACnD,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,OAAO,EAAE,eAAe,EAAE,aAAa,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,C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AAI,CAAC,CAAC;wBACjB,CAAC;oBACH,CAAC;gBACH,CAAC;gBAAC,OAAO,KAAK,EAAE,CAAC;oBACf,0EAA0E;oBAC1E,aAAa,CAAC,aAAa,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;oBACnD,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,CAAC,EAAE;wBAAE,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;gBACzD,CAAC;YACH,CAAC;YACD,OAAO,GAAG,CAAC;QACb,CAAC;KACF,CAAC;AACJ,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kybernesis/brain-embed-openai",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.15.0",
|
|
4
4
|
"description": "OpenAI text-embedding provider for brain-core (inference-plane EmbeddingProvider)",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "David Cruwys (AppyDave)",
|
|
@@ -28,8 +28,8 @@
|
|
|
28
28
|
],
|
|
29
29
|
"peerDependencies": {
|
|
30
30
|
"openai": ">=4",
|
|
31
|
-
"@kybernesis/brain-
|
|
32
|
-
"@kybernesis/brain-
|
|
31
|
+
"@kybernesis/brain-contracts": "0.15.0",
|
|
32
|
+
"@kybernesis/brain-core": "0.15.0"
|
|
33
33
|
},
|
|
34
34
|
"peerDependenciesMeta": {
|
|
35
35
|
"openai": {
|
|
@@ -37,9 +37,9 @@
|
|
|
37
37
|
}
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|
|
40
|
-
"@kybernesis/brain-
|
|
41
|
-
"@kybernesis/brain-
|
|
42
|
-
"@kybernesis/brain-core": "0.
|
|
40
|
+
"@kybernesis/brain-contracts": "0.15.0",
|
|
41
|
+
"@kybernesis/brain-testkit": "0.15.0",
|
|
42
|
+
"@kybernesis/brain-core": "0.15.0"
|
|
43
43
|
},
|
|
44
44
|
"publishConfig": {
|
|
45
45
|
"access": "public"
|