@abhishek944/pi-embeddings 0.0.0-stage → 0.2.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.
Files changed (51) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +97 -2
  3. package/dist/errors.d.ts +21 -0
  4. package/dist/errors.js +41 -0
  5. package/dist/execute.d.ts +25 -0
  6. package/dist/execute.js +264 -0
  7. package/dist/extension.d.ts +2 -0
  8. package/dist/extension.js +164 -0
  9. package/dist/index.d.ts +5 -0
  10. package/dist/index.js +4 -0
  11. package/dist/local-runtime.d.ts +14 -0
  12. package/dist/local-runtime.js +246 -0
  13. package/dist/mcp-cli.d.ts +2 -0
  14. package/dist/mcp-cli.js +46 -0
  15. package/dist/mcp-server.d.ts +23 -0
  16. package/dist/mcp-server.js +141 -0
  17. package/dist/provider-http.d.ts +11 -0
  18. package/dist/provider-http.js +60 -0
  19. package/dist/provider-types.d.ts +30 -0
  20. package/dist/provider-types.js +1 -0
  21. package/dist/providers.d.ts +25 -0
  22. package/dist/providers.js +415 -0
  23. package/dist/response.d.ts +17 -0
  24. package/dist/response.js +105 -0
  25. package/dist/runtime.d.ts +39 -0
  26. package/dist/runtime.js +130 -0
  27. package/dist/schemas.d.ts +758 -0
  28. package/dist/schemas.js +244 -0
  29. package/dist/settings-write.d.ts +9 -0
  30. package/dist/settings-write.js +77 -0
  31. package/dist/settings.d.ts +8 -0
  32. package/dist/settings.js +99 -0
  33. package/dist/tool-contracts.d.ts +343 -0
  34. package/dist/tool-contracts.js +10 -0
  35. package/package.json +83 -4
  36. package/src/errors.ts +52 -0
  37. package/src/execute.ts +300 -0
  38. package/src/extension.ts +210 -0
  39. package/src/index.ts +36 -0
  40. package/src/local-runtime.ts +273 -0
  41. package/src/mcp-cli.ts +52 -0
  42. package/src/mcp-server.ts +187 -0
  43. package/src/provider-http.ts +67 -0
  44. package/src/provider-types.ts +33 -0
  45. package/src/providers.ts +517 -0
  46. package/src/response.ts +125 -0
  47. package/src/runtime.ts +184 -0
  48. package/src/schemas.ts +368 -0
  49. package/src/settings-write.ts +96 -0
  50. package/src/settings.ts +119 -0
  51. package/src/tool-contracts.ts +22 -0
package/src/execute.ts ADDED
@@ -0,0 +1,300 @@
1
+ import { randomUUID } from 'node:crypto';
2
+ import { EmbeddingsError, codeOf, isFallbackError } from './errors.js';
3
+ import type { AcquiredProvider } from './providers.js';
4
+ import type { PreparedInput } from './provider-types.js';
5
+ import {
6
+ EMBEDDINGS_PROTOCOL_VERSION,
7
+ EMBEDDING_NORMALIZATION_VERSION,
8
+ type EmbeddingAttempt,
9
+ type EmbeddingCompareEntry,
10
+ type EmbeddingCompareResult,
11
+ type EmbeddingContext,
12
+ type EmbeddingErrorCode,
13
+ type EmbeddingGeneration,
14
+ type EmbeddingOutcome,
15
+ type EmbeddingRequest,
16
+ type EmbeddingResult,
17
+ type EmbeddingRoute,
18
+ } from './schemas.js';
19
+
20
+ type Pending = Readonly<{ readonly index: number; readonly input: PreparedInput }>;
21
+
22
+ type ExecuteArgs = Readonly<{
23
+ routes: readonly EmbeddingRoute[];
24
+ request: EmbeddingRequest;
25
+ context: EmbeddingContext | undefined;
26
+ signal: AbortSignal;
27
+ allowFallback: boolean;
28
+ acquire: (route: EmbeddingRoute, signal: AbortSignal) => Promise<AcquiredProvider>;
29
+ idPrefix?: string;
30
+ }>;
31
+
32
+ const cancelled = (index: number): EmbeddingOutcome => ({
33
+ status: 'error',
34
+ index,
35
+ code: 'cancelled',
36
+ attemptId: null,
37
+ });
38
+
39
+ const unstarted = (index: number): EmbeddingOutcome => ({
40
+ status: 'error',
41
+ index,
42
+ code: 'unstarted',
43
+ attemptId: null,
44
+ });
45
+
46
+ const preparedTokenCount = (input: PreparedInput): number =>
47
+ input.kind === 'tokens' ? input.tokens.length : (input.tokenCount ?? 0);
48
+
49
+ const generationKey = (generation: EmbeddingGeneration): string =>
50
+ `${generation.provider}\u0000${generation.model}\u0000${JSON.stringify(generation.space)}`;
51
+
52
+ /**
53
+ * Record the complete set of actual generations. Singular metadata is set only when one generation
54
+ * produced every vector; a mixed fallback never collapses into a guessed route or space.
55
+ */
56
+ const generationsOf = (outcomes: readonly EmbeddingOutcome[]): EmbeddingGeneration[] => {
57
+ const byKey = new Map<string, EmbeddingGeneration>();
58
+ for (const outcome of outcomes) {
59
+ if (outcome.status !== 'success') continue;
60
+ const generation: EmbeddingGeneration = {
61
+ provider: outcome.route,
62
+ model: outcome.model,
63
+ space: outcome.space,
64
+ };
65
+ byKey.set(generationKey(generation), generation);
66
+ }
67
+ return [...byKey.values()];
68
+ };
69
+
70
+ const resultMetadata = (outcomes: readonly EmbeddingOutcome[]) => {
71
+ const generations = generationsOf(outcomes);
72
+ const only = generations.length === 1 ? generations[0] : undefined;
73
+ return {
74
+ provider: only?.provider ?? null,
75
+ model: only?.model ?? null,
76
+ space: only?.space ?? null,
77
+ generations,
78
+ };
79
+ };
80
+
81
+ /**
82
+ * Runs one ordinary call or one explicit comparison entry. Successful inputs are never replayed on a
83
+ * fallback route; only unfinished inputs continue. Every input keeps its original zero-based index.
84
+ */
85
+ export async function executeEmbeddings(args: ExecuteArgs): Promise<EmbeddingResult> {
86
+ const prefix = args.idPrefix ?? randomUUID();
87
+ const outcomes = new Array<EmbeddingOutcome | undefined>(args.request.inputs.length);
88
+ const attempts: EmbeddingAttempt[] = [];
89
+ const failureByIndex = new Map<number, { readonly code: EmbeddingErrorCode; readonly attemptId: string | null }>();
90
+ let remaining = args.request.inputs.map((_input, index) => index);
91
+
92
+ for (const [routeIndex, route] of args.routes.entries()) {
93
+ if (remaining.length === 0) break;
94
+ if (args.signal.aborted) {
95
+ for (const index of remaining) outcomes[index] = cancelled(index);
96
+ remaining = [];
97
+ break;
98
+ }
99
+
100
+ let acquired: AcquiredProvider | undefined;
101
+ try {
102
+ acquired = await args.acquire(route, args.signal);
103
+ } catch (error) {
104
+ const code = codeOf(error);
105
+ const attemptId = `${prefix}-${routeIndex}-${attempts.length}`;
106
+ attempts.push({
107
+ id: attemptId,
108
+ route: route.provider,
109
+ model: route.model,
110
+ routeIndex,
111
+ status: 'error',
112
+ usage: null,
113
+ errorCode: code,
114
+ });
115
+ for (const index of remaining) failureByIndex.set(index, { code, attemptId });
116
+ if (args.allowFallback && isFallbackError(error)) continue;
117
+ for (const index of remaining) outcomes[index] = { status: 'error', index, code, attemptId };
118
+ remaining = [];
119
+ continue;
120
+ }
121
+
122
+ const unfinished: number[] = [];
123
+ {
124
+ const provider = acquired.provider;
125
+ const prepared: Pending[] = [];
126
+ for (const index of remaining) {
127
+ if (args.signal.aborted) {
128
+ outcomes[index] = cancelled(index);
129
+ continue;
130
+ }
131
+ try {
132
+ const input = await provider.prepare(args.request.inputs[index] ?? '', args.signal);
133
+ prepared.push({ index, input });
134
+ } catch (error) {
135
+ if (args.signal.aborted) outcomes[index] = cancelled(index);
136
+ else {
137
+ const code = codeOf(error);
138
+ failureByIndex.set(index, { code, attemptId: null });
139
+ outcomes[index] = { status: 'error', index, code, attemptId: null };
140
+ }
141
+ }
142
+ }
143
+
144
+ let batch: Pending[] = [];
145
+ let tokens = 0;
146
+ const flush = async (): Promise<void> => {
147
+ if (batch.length === 0) return;
148
+ const captured = batch;
149
+ batch = [];
150
+ tokens = 0;
151
+ const attemptId = `${prefix}-${routeIndex}-${attempts.length}`;
152
+ const preparedForBatch = captured.reduce((sum, entry) => sum + preparedTokenCount(entry.input), 0);
153
+ const attempt: EmbeddingAttempt = {
154
+ id: attemptId,
155
+ route: route.provider,
156
+ model: provider.model,
157
+ routeIndex,
158
+ status: 'success',
159
+ usage: {
160
+ providerReportedInputTokens: null,
161
+ preparedInputTokens: preparedForBatch > 0 ? preparedForBatch : null,
162
+ billedTokens: null,
163
+ },
164
+ };
165
+ attempts.push(attempt);
166
+ if (args.signal.aborted) {
167
+ attempt.status = 'cancelled';
168
+ for (const entry of captured) outcomes[entry.index] = cancelled(entry.index);
169
+ unfinished.push(...captured.map((entry) => entry.index));
170
+ return;
171
+ }
172
+ try {
173
+ const result = await provider.embed(
174
+ captured.map((entry) => entry.input),
175
+ args.signal,
176
+ args.context
177
+ );
178
+ attempt.usage = result.usage;
179
+ if (result.vectors.length !== captured.length)
180
+ throw new EmbeddingsError('provider-response-mismatch');
181
+ for (const [offset, entry] of captured.entries()) {
182
+ const vector = result.vectors[offset];
183
+ if (vector === undefined) throw new EmbeddingsError('provider-response-mismatch');
184
+ outcomes[entry.index] = {
185
+ status: 'success',
186
+ index: entry.index,
187
+ vector: [...vector],
188
+ route: route.provider,
189
+ model: provider.model,
190
+ space: provider.space,
191
+ attemptId,
192
+ normalization: EMBEDDING_NORMALIZATION_VERSION,
193
+ };
194
+ }
195
+ } catch (error) {
196
+ const code = codeOf(error);
197
+ attempt.status = 'error';
198
+ attempt.errorCode = code;
199
+ const known = error instanceof EmbeddingsError ? error.knownUsage : undefined;
200
+ if (known !== undefined && attempt.usage !== null)
201
+ attempt.usage = {
202
+ providerReportedInputTokens: known.providerReportedInputTokens ?? attempt.usage.providerReportedInputTokens,
203
+ preparedInputTokens: known.preparedInputTokens ?? attempt.usage.preparedInputTokens,
204
+ billedTokens: null,
205
+ };
206
+ for (const entry of captured) failureByIndex.set(entry.index, { code, attemptId });
207
+ if (args.signal.aborted || code === 'cancelled') {
208
+ for (const entry of captured) outcomes[entry.index] = cancelled(entry.index);
209
+ } else if (args.allowFallback && isFallbackError(error)) {
210
+ unfinished.push(...captured.map((entry) => entry.index));
211
+ } else {
212
+ for (const entry of captured)
213
+ outcomes[entry.index] = { status: 'error', index: entry.index, code, attemptId };
214
+ }
215
+ }
216
+ };
217
+
218
+ for (const entry of prepared) {
219
+ const count = preparedTokenCount(entry.input);
220
+ if (batch.length > 0 && (batch.length + 1 > provider.maxRequestInputs || tokens + count > provider.maxRequestTokens))
221
+ await flush();
222
+ batch = [...batch, entry];
223
+ tokens += count;
224
+ }
225
+ await flush();
226
+ }
227
+ remaining = unfinished;
228
+ }
229
+
230
+ for (const index of remaining) {
231
+ if (outcomes[index] === undefined)
232
+ outcomes[index] = args.signal.aborted
233
+ ? cancelled(index)
234
+ : failureByIndex.get(index) === undefined
235
+ ? unstarted(index)
236
+ : {
237
+ status: 'error',
238
+ index,
239
+ code: failureByIndex.get(index)?.code ?? 'unstarted',
240
+ attemptId: failureByIndex.get(index)?.attemptId ?? null,
241
+ };
242
+ }
243
+ const allOutcomes = outcomes.map((outcome, index) => outcome ?? unstarted(index));
244
+ return {
245
+ schemaVersion: EMBEDDINGS_PROTOCOL_VERSION,
246
+ ...resultMetadata(allOutcomes),
247
+ outcomes: allOutcomes,
248
+ attempts,
249
+ };
250
+ }
251
+
252
+ /** Explicit comparison: configured entries only, no fallback, no ranking and no default mutation. */
253
+ export async function executeCompare(args: {
254
+ routes: readonly EmbeddingRoute[];
255
+ request: EmbeddingRequest;
256
+ context: EmbeddingContext | undefined;
257
+ signal: AbortSignal;
258
+ acquire: (route: EmbeddingRoute, signal: AbortSignal) => Promise<AcquiredProvider>;
259
+ }): Promise<EmbeddingCompareResult> {
260
+ const entries: EmbeddingCompareEntry[] = [];
261
+ for (const [index, route] of args.routes.entries()) {
262
+ if (args.signal.aborted) {
263
+ entries.push({
264
+ route: route.provider,
265
+ model: route.model,
266
+ status: 'cancelled',
267
+ result: {
268
+ schemaVersion: EMBEDDINGS_PROTOCOL_VERSION,
269
+ provider: null,
270
+ model: null,
271
+ space: null,
272
+ generations: [],
273
+ outcomes: args.request.inputs.map((_input, offset) => cancelled(offset)),
274
+ attempts: [],
275
+ },
276
+ });
277
+ continue;
278
+ }
279
+ const result = await executeEmbeddings({
280
+ routes: [route],
281
+ request: args.request,
282
+ context: args.context,
283
+ signal: args.signal,
284
+ allowFallback: false,
285
+ acquire: args.acquire,
286
+ idPrefix: `compare-${index}-${randomUUID()}`,
287
+ });
288
+ entries.push({
289
+ route: route.provider,
290
+ model: route.model,
291
+ status: result.outcomes.every((outcome) => outcome.status === 'success')
292
+ ? 'success'
293
+ : args.signal.aborted
294
+ ? 'cancelled'
295
+ : 'error',
296
+ result,
297
+ });
298
+ }
299
+ return { schemaVersion: EMBEDDINGS_PROTOCOL_VERSION, entries };
300
+ }
@@ -0,0 +1,210 @@
1
+ import { isProjectTrusted } from '@amaster.ai/pi-shared/settings';
2
+ import {
3
+ defineTool,
4
+ type ExtensionAPI,
5
+ type ExtensionContext,
6
+ } from '@earendil-works/pi-coding-agent';
7
+ import { EmbeddingsError } from './errors.js';
8
+ import {
9
+ createEmbeddingsRuntimeWithDiagnostics,
10
+ type EmbeddingsRuntimeWithDiagnostics,
11
+ } from './runtime.js';
12
+ import { loadEmbeddingSettings, validateEmbeddingSettings } from './settings.js';
13
+ import { updateProjectEmbeddingSettings } from './settings-write.js';
14
+ import {
15
+ EMBEDDINGS_SETTINGS_KEY,
16
+ type EmbeddingRoute,
17
+ type EmbeddingSettings,
18
+ } from './schemas.js';
19
+ import {
20
+ EMBED_COMPARE_TOOL,
21
+ EMBED_TOOL,
22
+ EMBED_COMPARE_TOOL_DESCRIPTION,
23
+ EMBED_TOOL_DESCRIPTION,
24
+ embedCompareOutput,
25
+ embedCompareParameters,
26
+ embedOutput,
27
+ embedParameters,
28
+ } from './tool-contracts.js';
29
+
30
+ const summary = (result: {
31
+ outcomes: readonly { readonly status: string; readonly route?: string; readonly model?: string }[];
32
+ }): string => {
33
+ const successes = result.outcomes.filter((outcome) => outcome.status === 'success');
34
+ const routes = [...new Set(successes.map((outcome) => `${outcome.route}:${outcome.model}`))].join(', ');
35
+ return `Embedded ${successes.length}/${result.outcomes.length} input(s)${routes === '' ? '' : ` via ${routes}`}.`;
36
+ };
37
+
38
+ const codeOf = (error: unknown): string =>
39
+ error instanceof EmbeddingsError ? error.code : 'configuration-invalid';
40
+
41
+ const signalOptions = (signal: AbortSignal | undefined) =>
42
+ signal === undefined ? {} : { signal };
43
+
44
+ export default function piEmbeddingsExtension(pi: ExtensionAPI): void {
45
+ let settings: EmbeddingSettings | undefined;
46
+ let runtime: EmbeddingsRuntimeWithDiagnostics | undefined;
47
+ let cwd = process.cwd();
48
+
49
+ const refresh = async (next: EmbeddingSettings, nextCwd = cwd): Promise<void> => {
50
+ await runtime?.close();
51
+ settings = next;
52
+ cwd = nextCwd;
53
+ runtime = createEmbeddingsRuntimeWithDiagnostics({ settings: next, cwd: nextCwd });
54
+ };
55
+
56
+ const currentRuntime = (ctx: ExtensionContext): EmbeddingsRuntimeWithDiagnostics => {
57
+ if (runtime === undefined || cwd !== ctx.cwd)
58
+ throw new EmbeddingsError('configuration-invalid');
59
+ return runtime;
60
+ };
61
+
62
+ pi.on('session_start', async (_event: unknown, ctx: ExtensionContext) => {
63
+ await refresh(loadEmbeddingSettings(ctx.cwd, isProjectTrusted(ctx)), ctx.cwd);
64
+ });
65
+
66
+ pi.on('session_shutdown', async () => {
67
+ await runtime?.close();
68
+ runtime = undefined;
69
+ });
70
+
71
+ pi.registerTool(
72
+ defineTool({
73
+ name: EMBED_TOOL,
74
+ label: 'Embed text',
75
+ description: EMBED_TOOL_DESCRIPTION,
76
+ promptSnippet:
77
+ 'Return text vectors and their actual generating space using the configured embedding route; full input text is preserved and the package owns provider batching.',
78
+ promptGuidelines: [
79
+ 'Provider, model, credentials and caller storage policy are fixed by trusted settings and cannot be overridden through this tool.',
80
+ 'Use embed_compare only when the user explicitly asks to compare configured embedding routes.',
81
+ 'The embed result reports the actual generating provider, model and space, including mixed fallback generations.',
82
+ ],
83
+ parameters: embedParameters,
84
+ outputSchema: embedOutput,
85
+ annotations: { readOnlyHint: true, destructiveHint: false, openWorldHint: true },
86
+ async execute(_id, params, signal, _onUpdate, ctx) {
87
+ try {
88
+ const result = await currentRuntime(ctx).embed(params, signalOptions(signal ?? undefined));
89
+ return {
90
+ content: [{ type: 'text', text: summary(result) }],
91
+ details: result,
92
+ structuredContent: result,
93
+ };
94
+ } catch (error) {
95
+ throw new Error(codeOf(error));
96
+ }
97
+ },
98
+ })
99
+ );
100
+
101
+ pi.registerTool(
102
+ defineTool({
103
+ name: EMBED_COMPARE_TOOL,
104
+ label: 'Compare embedding routes',
105
+ description: EMBED_COMPARE_TOOL_DESCRIPTION,
106
+ promptSnippet:
107
+ 'Compare configured embedding routes only on explicit user request; each entry is labeled and may incur charges.',
108
+ promptGuidelines: [
109
+ 'Never use comparison to recover from an ordinary embedding failure.',
110
+ 'Each configured entry is an independent request with its own usage and generating space; results are not merged or ranked.',
111
+ ],
112
+ parameters: embedCompareParameters,
113
+ outputSchema: embedCompareOutput,
114
+ annotations: { readOnlyHint: true, destructiveHint: false, openWorldHint: true },
115
+ async execute(_id, params, signal, _onUpdate, ctx) {
116
+ try {
117
+ const result = await currentRuntime(ctx).compare(params, signalOptions(signal ?? undefined));
118
+ return {
119
+ content: [
120
+ { type: 'text', text: `Compared ${result.entries.length} configured embedding route(s).` },
121
+ ],
122
+ details: result,
123
+ structuredContent: result,
124
+ };
125
+ } catch (error) {
126
+ throw new Error(codeOf(error));
127
+ }
128
+ },
129
+ })
130
+ );
131
+
132
+ pi.registerCommand('embeddings', {
133
+ description:
134
+ 'Embeddings: /embeddings list | doctor | reload | use <provider> <model> | compare <text>. list and doctor make no inference calls.',
135
+ handler: async (args: string | undefined, ctx: ExtensionContext) => {
136
+ const raw = (args ?? '').trim();
137
+ const parts = raw.split(/\s+/).filter(Boolean);
138
+ const command = parts[0] ?? 'list';
139
+ try {
140
+ if (command === 'list' || command === 'doctor' || command === 'status') {
141
+ if (parts.length !== 1) throw new EmbeddingsError('configuration-invalid');
142
+ const active = currentRuntime(ctx);
143
+ const described = active.describe();
144
+ if (command === 'doctor') {
145
+ reply(
146
+ pi,
147
+ ctx,
148
+ described.diagnostics.length === 0
149
+ ? 'Embeddings settings are valid. No provider call was made.'
150
+ : described.diagnostics.map((entry) => `${entry.severity}: ${entry.code}`).join('\n')
151
+ );
152
+ return;
153
+ }
154
+ reply(
155
+ pi,
156
+ ctx,
157
+ JSON.stringify(
158
+ {
159
+ selected: described.selected,
160
+ space: described.space,
161
+ default: described.default,
162
+ fallback: described.fallback,
163
+ compare: described.compare,
164
+ ready: described.ready,
165
+ },
166
+ null,
167
+ 2
168
+ )
169
+ );
170
+ return;
171
+ }
172
+ if (command === 'reload') {
173
+ if (parts.length !== 1) throw new EmbeddingsError('configuration-invalid');
174
+ const next = loadEmbeddingSettings(ctx.cwd, isProjectTrusted(ctx));
175
+ await refresh(next, ctx.cwd);
176
+ reply(pi, ctx, `${EMBEDDINGS_SETTINGS_KEY} settings reloaded. No inference was run.`);
177
+ return;
178
+ }
179
+ if (command === 'use') {
180
+ if (parts.length !== 3) throw new EmbeddingsError('configuration-invalid');
181
+ const route: EmbeddingRoute = { provider: parts[1] as EmbeddingRoute['provider'], model: parts[2] ?? '' };
182
+ validateEmbeddingSettings({ default: route });
183
+ await updateProjectEmbeddingSettings({
184
+ cwd: ctx.cwd,
185
+ projectTrusted: isProjectTrusted(ctx),
186
+ route,
187
+ });
188
+ await refresh(loadEmbeddingSettings(ctx.cwd, isProjectTrusted(ctx)), ctx.cwd);
189
+ reply(pi, ctx, `Selected ${route.provider}/${route.model} in trusted project settings.`);
190
+ return;
191
+ }
192
+ if (command === 'compare') {
193
+ const text = raw.slice('compare'.length).trim();
194
+ if (text === '') throw new EmbeddingsError('configuration-invalid');
195
+ const result = await currentRuntime(ctx).compare({ inputs: [text] }, signalOptions(ctx.signal ?? undefined));
196
+ reply(pi, ctx, `Compared ${result.entries.length} configured route(s).\n${summary(result.entries[0]?.result ?? { outcomes: [] })}`);
197
+ return;
198
+ }
199
+ reply(pi, ctx, 'Usage: /embeddings list | doctor | reload | use <provider> <model> | compare <text>');
200
+ } catch (error) {
201
+ reply(pi, ctx, `Embeddings command failed: ${codeOf(error)}`);
202
+ }
203
+ },
204
+ });
205
+ }
206
+
207
+ function reply(pi: ExtensionAPI, ctx: ExtensionContext, text: string): void {
208
+ if (ctx.hasUI) ctx.ui.notify(text, 'info');
209
+ else pi.sendMessage({ customType: 'pi-embeddings', content: text, display: true }, { triggerTurn: false });
210
+ }
package/src/index.ts ADDED
@@ -0,0 +1,36 @@
1
+ export { createEmbeddingsRuntime, type EmbeddingsRuntime } from './runtime.js';
2
+ export {
3
+ loadEmbeddingSettings,
4
+ validateEmbeddingSettings,
5
+ configuredDefault,
6
+ configuredRoutes,
7
+ isEmbeddingSettings,
8
+ } from './settings.js';
9
+ export { EmbeddingsError } from './errors.js';
10
+ export {
11
+ EMBEDDINGS_SETTINGS_KEY,
12
+ EMBEDDINGS_PROTOCOL_VERSION,
13
+ EMBEDDING_FORMAT_VERSION,
14
+ EMBEDDING_DOCUMENT_PREFIX,
15
+ EMBEDDING_NORMALIZATION_VERSION,
16
+ EMBEDDING_CONTEXT_META_KEY,
17
+ EMBEDDING_ROUTE_IDS,
18
+ GATEWAY_EMBEDDING_MODELS,
19
+ EMBEDDING_ERROR_CODES,
20
+ } from './schemas.js';
21
+ export type {
22
+ EmbeddingSettings,
23
+ EmbeddingRoute,
24
+ EmbeddingRouteId,
25
+ EmbeddingSpace,
26
+ EmbeddingRequest,
27
+ EmbeddingContext,
28
+ EmbeddingUsage,
29
+ EmbeddingAttempt,
30
+ EmbeddingOutcome,
31
+ EmbeddingGeneration,
32
+ EmbeddingResult,
33
+ EmbeddingCompareEntry,
34
+ EmbeddingCompareResult,
35
+ EmbeddingErrorCode,
36
+ } from './schemas.js';