@hebo-ai/gateway 0.4.0-beta.3 → 0.4.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 (92) hide show
  1. package/README.md +40 -5
  2. package/dist/config.js +21 -7
  3. package/dist/endpoints/chat-completions/converters.d.ts +3 -3
  4. package/dist/endpoints/chat-completions/converters.js +16 -8
  5. package/dist/endpoints/chat-completions/handler.js +34 -27
  6. package/dist/endpoints/chat-completions/otel.d.ts +6 -0
  7. package/dist/endpoints/chat-completions/otel.js +127 -0
  8. package/dist/endpoints/embeddings/handler.js +19 -10
  9. package/dist/endpoints/embeddings/otel.d.ts +6 -0
  10. package/dist/endpoints/embeddings/otel.js +35 -0
  11. package/dist/endpoints/models/handler.js +3 -4
  12. package/dist/errors/gateway.d.ts +1 -1
  13. package/dist/errors/gateway.js +3 -4
  14. package/dist/errors/openai.js +11 -12
  15. package/dist/errors/utils.d.ts +3 -4
  16. package/dist/errors/utils.js +6 -6
  17. package/dist/gateway.js +1 -1
  18. package/dist/lifecycle.js +71 -29
  19. package/dist/middleware/matcher.js +1 -1
  20. package/dist/models/amazon/presets.d.ts +37 -37
  21. package/dist/models/amazon/presets.js +1 -1
  22. package/dist/models/anthropic/presets.d.ts +56 -56
  23. package/dist/models/cohere/presets.d.ts +54 -54
  24. package/dist/models/cohere/presets.js +2 -2
  25. package/dist/models/google/presets.d.ts +31 -31
  26. package/dist/models/google/presets.js +1 -1
  27. package/dist/models/meta/presets.d.ts +42 -42
  28. package/dist/models/openai/presets.d.ts +96 -96
  29. package/dist/models/openai/presets.js +1 -1
  30. package/dist/models/types.d.ts +1 -1
  31. package/dist/models/voyage/presets.d.ts +92 -92
  32. package/dist/models/voyage/presets.js +1 -1
  33. package/dist/providers/registry.js +2 -2
  34. package/dist/telemetry/baggage.d.ts +1 -0
  35. package/dist/telemetry/baggage.js +24 -0
  36. package/dist/telemetry/fetch.d.ts +2 -1
  37. package/dist/telemetry/fetch.js +13 -3
  38. package/dist/telemetry/gen-ai.d.ts +5 -0
  39. package/dist/telemetry/gen-ai.js +60 -0
  40. package/dist/telemetry/http.d.ts +3 -0
  41. package/dist/telemetry/http.js +57 -0
  42. package/dist/telemetry/memory.d.ts +2 -0
  43. package/dist/telemetry/memory.js +27 -0
  44. package/dist/telemetry/span.d.ts +6 -3
  45. package/dist/telemetry/span.js +24 -36
  46. package/dist/telemetry/stream.d.ts +3 -7
  47. package/dist/telemetry/stream.js +26 -29
  48. package/dist/types.d.ts +16 -15
  49. package/dist/utils/headers.d.ts +1 -1
  50. package/dist/utils/headers.js +7 -9
  51. package/dist/utils/request.d.ts +0 -4
  52. package/dist/utils/request.js +0 -9
  53. package/dist/utils/response.js +1 -1
  54. package/package.json +5 -2
  55. package/src/config.ts +28 -7
  56. package/src/endpoints/chat-completions/converters.ts +18 -11
  57. package/src/endpoints/chat-completions/handler.ts +46 -28
  58. package/src/endpoints/chat-completions/otel.ts +161 -0
  59. package/src/endpoints/embeddings/handler.test.ts +2 -2
  60. package/src/endpoints/embeddings/handler.ts +28 -10
  61. package/src/endpoints/embeddings/otel.ts +56 -0
  62. package/src/endpoints/models/handler.ts +3 -5
  63. package/src/errors/gateway.ts +5 -5
  64. package/src/errors/openai.ts +25 -17
  65. package/src/errors/utils.ts +6 -7
  66. package/src/gateway.ts +1 -1
  67. package/src/lifecycle.ts +85 -32
  68. package/src/middleware/matcher.ts +1 -1
  69. package/src/models/amazon/presets.ts +1 -1
  70. package/src/models/cohere/presets.ts +2 -2
  71. package/src/models/google/presets.ts +1 -1
  72. package/src/models/openai/presets.ts +1 -1
  73. package/src/models/types.ts +1 -1
  74. package/src/models/voyage/presets.ts +1 -1
  75. package/src/providers/registry.ts +2 -2
  76. package/src/telemetry/baggage.ts +27 -0
  77. package/src/telemetry/fetch.ts +15 -3
  78. package/src/telemetry/gen-ai.ts +88 -0
  79. package/src/telemetry/http.ts +65 -0
  80. package/src/telemetry/memory.ts +36 -0
  81. package/src/telemetry/span.ts +28 -40
  82. package/src/telemetry/stream.ts +36 -40
  83. package/src/types.ts +18 -18
  84. package/src/utils/headers.ts +8 -19
  85. package/src/utils/request.ts +0 -11
  86. package/src/utils/response.ts +1 -1
  87. package/dist/telemetry/otel.d.ts +0 -2
  88. package/dist/telemetry/otel.js +0 -50
  89. package/dist/telemetry/utils.d.ts +0 -4
  90. package/dist/telemetry/utils.js +0 -223
  91. package/src/telemetry/otel.ts +0 -91
  92. package/src/telemetry/utils.ts +0 -273
@@ -17,23 +17,22 @@ export class OpenAIError {
17
17
  this.error = { message, type, code: code?.toLowerCase(), param };
18
18
  }
19
19
  }
20
+ const mapType = (status) => (status < 500 ? "invalid_request_error" : "server_error");
21
+ const maybeMaskMessage = (meta, requestId) => {
22
+ // FUTURE: consider masking all upstream errors, also 4xx
23
+ if (!(isProduction() && meta.status >= 500)) {
24
+ return meta.message;
25
+ }
26
+ // FUTURE: always attach requestId to errors (masked and unmasked)
27
+ return `${STATUS_CODE(meta.status)} (${requestId ?? "see requestId in response headers"})`;
28
+ };
20
29
  export function toOpenAIError(error) {
21
30
  const meta = getErrorMeta(error);
22
- return new OpenAIError(meta.message, meta.type, meta.code);
31
+ return new OpenAIError(maybeMaskMessage(meta), mapType(meta.status), meta.code);
23
32
  }
24
33
  export function toOpenAIErrorResponse(error, responseInit) {
25
34
  const meta = getErrorMeta(error);
26
- const shouldMask = isProduction() && (meta.status >= 500 || meta.code.includes("UPSTREAM"));
27
- let message;
28
- if (shouldMask) {
29
- const requestId = resolveRequestId(responseInit);
30
- // FUTURE: always attach requestId to errors (masked and unmasked)
31
- message = `${STATUS_CODE(meta.status)} (${requestId})`;
32
- }
33
- else {
34
- message = meta.message;
35
- }
36
- return toResponse(new OpenAIError(message, meta.type, meta.code), {
35
+ return toResponse(new OpenAIError(maybeMaskMessage(meta, resolveRequestId(responseInit)), mapType(meta.status), meta.code), {
37
36
  ...responseInit,
38
37
  status: meta.status,
39
38
  statusText: meta.code,
@@ -8,16 +8,15 @@ export declare const STATUS_CODES: {
8
8
  readonly 409: "CONFLICT";
9
9
  readonly 422: "UNPROCESSABLE_ENTITY";
10
10
  readonly 429: "TOO_MANY_REQUESTS";
11
+ readonly 499: "CLIENT_CLOSED_REQUEST";
11
12
  readonly 500: "INTERNAL_SERVER_ERROR";
12
13
  readonly 502: "BAD_GATEWAY";
13
14
  readonly 503: "SERVICE_UNAVAILABLE";
14
15
  readonly 504: "GATEWAY_TIMEOUT";
15
16
  };
16
- export declare const STATUS_CODE: (status: number) => "BAD_REQUEST" | "UNAUTHORIZED" | "PAYMENT_REQUIRED" | "FORBIDDEN" | "NOT_FOUND" | "METHOD_NOT_ALLOWED" | "CONFLICT" | "UNPROCESSABLE_ENTITY" | "TOO_MANY_REQUESTS" | "INTERNAL_SERVER_ERROR" | "BAD_GATEWAY" | "SERVICE_UNAVAILABLE" | "GATEWAY_TIMEOUT";
17
+ export declare const STATUS_CODE: (status: number) => "BAD_REQUEST" | "UNAUTHORIZED" | "PAYMENT_REQUIRED" | "FORBIDDEN" | "NOT_FOUND" | "METHOD_NOT_ALLOWED" | "CONFLICT" | "UNPROCESSABLE_ENTITY" | "TOO_MANY_REQUESTS" | "CLIENT_CLOSED_REQUEST" | "INTERNAL_SERVER_ERROR" | "BAD_GATEWAY" | "SERVICE_UNAVAILABLE" | "GATEWAY_TIMEOUT";
17
18
  export declare function getErrorMeta(error: unknown): {
18
- code: string;
19
19
  status: number;
20
- param: string;
21
- type: string;
20
+ code: string;
22
21
  message: string;
23
22
  };
@@ -10,6 +10,7 @@ export const STATUS_CODES = {
10
10
  409: "CONFLICT",
11
11
  422: "UNPROCESSABLE_ENTITY",
12
12
  429: "TOO_MANY_REQUESTS",
13
+ 499: "CLIENT_CLOSED_REQUEST",
13
14
  500: "INTERNAL_SERVER_ERROR",
14
15
  502: "BAD_GATEWAY",
15
16
  503: "SERVICE_UNAVAILABLE",
@@ -21,24 +22,23 @@ export const STATUS_CODE = (status) => {
21
22
  return label;
22
23
  return status >= 400 && status < 500 ? STATUS_CODES[400] : STATUS_CODES[500];
23
24
  };
25
+ // FUTURE: always return a wrapped GatewayError?
24
26
  export function getErrorMeta(error) {
25
27
  const message = error instanceof Error ? error.message : String(error);
26
- let code;
27
28
  let status;
28
- let param = "";
29
+ let code;
29
30
  if (error instanceof GatewayError) {
30
- ({ code, status } = error);
31
+ ({ status, code } = error);
31
32
  }
32
33
  else {
33
34
  const normalized = normalizeAiSdkError(error);
34
35
  if (normalized) {
35
- ({ code, status } = normalized);
36
+ ({ status, code } = normalized);
36
37
  }
37
38
  else {
38
39
  status = 500;
39
40
  code = STATUS_CODE(status);
40
41
  }
41
42
  }
42
- const type = status < 500 ? "invalid_request_error" : "server_error";
43
- return { code, status, param, type, message };
43
+ return { status, code, message };
44
44
  }
package/dist/gateway.js CHANGED
@@ -22,7 +22,7 @@ export function gateway(config) {
22
22
  if (basePath && pathname.startsWith(basePath)) {
23
23
  pathname = pathname.slice(basePath.length);
24
24
  }
25
- logger.debug(`[gateway] ${req.method} ${pathname}`);
25
+ logger.info(`[gateway] ${req.method} ${pathname}`);
26
26
  for (const [route, endpoint] of routeEntries) {
27
27
  if (pathname === route || pathname.startsWith(route + "/")) {
28
28
  return endpoint.handler(req, state);
package/dist/lifecycle.js CHANGED
@@ -1,28 +1,81 @@
1
1
  import { parseConfig } from "./config";
2
+ import { GatewayError } from "./errors/gateway";
2
3
  import { toOpenAIErrorResponse } from "./errors/openai";
3
4
  import { logger } from "./logger";
4
- import { withOtel } from "./telemetry/otel";
5
- import { addSpanEvent, recordSpanError } from "./telemetry/span";
5
+ import { getBaggageAttributes } from "./telemetry/baggage";
6
+ import { initFetch } from "./telemetry/fetch";
7
+ import { getRequestAttributes, getResponseAttributes } from "./telemetry/http";
8
+ import { recordV8jsMemory } from "./telemetry/memory";
9
+ import { addSpanEvent, setSpanEventsEnabled, setSpanTracer, startSpan } from "./telemetry/span";
10
+ import { wrapStream } from "./telemetry/stream";
6
11
  import { resolveRequestId } from "./utils/headers";
7
12
  import { maybeApplyRequestPatch, prepareRequestHeaders } from "./utils/request";
8
13
  import { prepareResponseInit, toResponse } from "./utils/response";
9
14
  export const winterCgHandler = (run, config) => {
10
15
  const parsedConfig = parseConfig(config);
11
- const core = async (ctx) => {
16
+ if (parsedConfig.telemetry?.enabled) {
17
+ setSpanTracer(parsedConfig.telemetry?.tracer);
18
+ setSpanEventsEnabled(parsedConfig.telemetry?.signals?.hebo);
19
+ initFetch(parsedConfig.telemetry?.signals?.hebo);
20
+ }
21
+ return async (request, state) => {
22
+ const ctx = {
23
+ request,
24
+ state: state ?? {},
25
+ providers: parsedConfig.providers,
26
+ models: parsedConfig.models,
27
+ };
28
+ const headers = prepareRequestHeaders(ctx.request);
29
+ if (headers)
30
+ ctx.request = new Request(ctx.request, { headers });
31
+ const span = startSpan(ctx.request.url);
32
+ span.setAttributes(getBaggageAttributes(ctx.request));
33
+ if (!span.isExisting) {
34
+ span.setAttributes(getRequestAttributes(ctx.request, parsedConfig.telemetry?.signals?.http));
35
+ }
36
+ const finalize = (status, reason) => {
37
+ if (ctx.operation) {
38
+ span.updateName(`${ctx.operation}${ctx.modelId ? ` ${ctx.modelId}` : ""}`);
39
+ }
40
+ if (!span.isExisting) {
41
+ // FUTURE add http.server.request.duration
42
+ span.setAttributes(getResponseAttributes(ctx.response, parsedConfig.telemetry?.signals?.http));
43
+ }
44
+ let realStatus = status;
45
+ if (ctx.request.signal.aborted)
46
+ realStatus = 499;
47
+ else if (status === 200 && ctx.response?.status)
48
+ realStatus = ctx.response.status;
49
+ if (realStatus !== 200) {
50
+ (realStatus >= 500 ? logger.error : logger.warn)({
51
+ requestId: resolveRequestId(ctx.request),
52
+ err: reason ?? ctx.request.signal.reason,
53
+ });
54
+ if (realStatus >= 500)
55
+ span.recordError(reason);
56
+ }
57
+ span.setAttributes({ "http.response.status_code_effective": realStatus });
58
+ recordV8jsMemory(parsedConfig.telemetry?.signals?.hebo);
59
+ span.finish();
60
+ };
12
61
  try {
13
62
  if (parsedConfig.hooks?.onRequest) {
14
63
  const onRequest = await parsedConfig.hooks.onRequest(ctx);
15
64
  addSpanEvent("hebo.hooks.on_request.completed");
16
- if (onRequest) {
17
- if (onRequest instanceof Response) {
18
- ctx.response = onRequest;
19
- return;
20
- }
65
+ if (onRequest instanceof Response) {
66
+ ctx.response = onRequest;
67
+ }
68
+ else if (onRequest) {
21
69
  ctx.request = maybeApplyRequestPatch(ctx.request, onRequest);
22
70
  }
23
71
  }
24
- ctx.result = (await run(ctx));
25
- ctx.response = toResponse(ctx.result, prepareResponseInit(ctx.request));
72
+ if (!ctx.response) {
73
+ ctx.result = (await span.runWithContext(() => run(ctx)));
74
+ if (ctx.result instanceof ReadableStream) {
75
+ ctx.result = wrapStream(ctx.result, { onDone: finalize });
76
+ }
77
+ ctx.response = toResponse(ctx.result, prepareResponseInit(ctx.request));
78
+ }
26
79
  if (parsedConfig.hooks?.onResponse) {
27
80
  const onResponse = await parsedConfig.hooks.onResponse(ctx);
28
81
  addSpanEvent("hebo.hooks.on_response.completed");
@@ -30,28 +83,17 @@ export const winterCgHandler = (run, config) => {
30
83
  ctx.response = onResponse;
31
84
  }
32
85
  }
86
+ // FUTURE: this can leak if onResponse removed wrapper from response.body
87
+ if (!(ctx.result instanceof ReadableStream)) {
88
+ finalize(ctx.response.status);
89
+ }
33
90
  }
34
91
  catch (error) {
35
- recordSpanError(error);
36
- logger.error({
37
- requestId: resolveRequestId(ctx.request),
38
- err: error instanceof Error ? error : new Error(String(error)),
39
- });
40
- ctx.response = toOpenAIErrorResponse(error, prepareResponseInit(ctx.request));
92
+ ctx.response = toOpenAIErrorResponse(ctx.request.signal.aborted
93
+ ? new GatewayError(error ?? ctx.request.signal.reason, 499)
94
+ : error, prepareResponseInit(ctx.request));
95
+ finalize(ctx.response.status, error);
41
96
  }
42
- };
43
- const handler = parsedConfig.telemetry?.enabled ? withOtel(core, parsedConfig) : core;
44
- return async (request, state) => {
45
- const ctx = {
46
- request,
47
- state: state ?? {},
48
- providers: parsedConfig.providers,
49
- models: parsedConfig.models,
50
- };
51
- const headers = prepareRequestHeaders(ctx.request);
52
- if (headers)
53
- ctx.request = new Request(ctx.request, { headers });
54
- await handler(ctx);
55
97
  return ctx.response ?? new Response("Internal Server Error", { status: 500 });
56
98
  };
57
99
  };
@@ -83,7 +83,7 @@ class ModelMiddlewareMatcher {
83
83
  break;
84
84
  }
85
85
  logger.warn(`[middleware] cache eviction`);
86
- addSpanEvent("hebo.middelware.cache.evicted");
86
+ addSpanEvent("hebo.middleware.cache.evicted");
87
87
  }
88
88
  this.cache.set(key, out);
89
89
  return out;
@@ -4,7 +4,7 @@ export declare const novaMicro: <const O extends {
4
4
  knowledge?: string | undefined;
5
5
  modalities?: {
6
6
  input?: readonly ("text" | "file" | "image" | "audio" | "video" | "pdf")[] | undefined;
7
- output?: readonly ("text" | "image" | "audio" | "video" | "embeddings")[] | undefined;
7
+ output?: readonly ("text" | "embedding" | "image" | "audio" | "video")[] | undefined;
8
8
  } | undefined;
9
9
  context?: number | undefined;
10
10
  capabilities?: readonly ("temperature" | "reasoning" | "attachments" | "tool_call" | "structured_output")[] | undefined;
@@ -82,7 +82,7 @@ export declare const novaLite: <const O extends {
82
82
  knowledge?: string | undefined;
83
83
  modalities?: {
84
84
  input?: readonly ("text" | "file" | "image" | "audio" | "video" | "pdf")[] | undefined;
85
- output?: readonly ("text" | "image" | "audio" | "video" | "embeddings")[] | undefined;
85
+ output?: readonly ("text" | "embedding" | "image" | "audio" | "video")[] | undefined;
86
86
  } | undefined;
87
87
  context?: number | undefined;
88
88
  capabilities?: readonly ("temperature" | "reasoning" | "attachments" | "tool_call" | "structured_output")[] | undefined;
@@ -160,7 +160,7 @@ export declare const novaPro: <const O extends {
160
160
  knowledge?: string | undefined;
161
161
  modalities?: {
162
162
  input?: readonly ("text" | "file" | "image" | "audio" | "video" | "pdf")[] | undefined;
163
- output?: readonly ("text" | "image" | "audio" | "video" | "embeddings")[] | undefined;
163
+ output?: readonly ("text" | "embedding" | "image" | "audio" | "video")[] | undefined;
164
164
  } | undefined;
165
165
  context?: number | undefined;
166
166
  capabilities?: readonly ("temperature" | "reasoning" | "attachments" | "tool_call" | "structured_output")[] | undefined;
@@ -238,7 +238,7 @@ export declare const novaPremier: <const O extends {
238
238
  knowledge?: string | undefined;
239
239
  modalities?: {
240
240
  input?: readonly ("text" | "file" | "image" | "audio" | "video" | "pdf")[] | undefined;
241
- output?: readonly ("text" | "image" | "audio" | "video" | "embeddings")[] | undefined;
241
+ output?: readonly ("text" | "embedding" | "image" | "audio" | "video")[] | undefined;
242
242
  } | undefined;
243
243
  context?: number | undefined;
244
244
  capabilities?: readonly ("temperature" | "reasoning" | "attachments" | "tool_call" | "structured_output")[] | undefined;
@@ -316,7 +316,7 @@ export declare const nova2Lite: <const O extends {
316
316
  knowledge?: string | undefined;
317
317
  modalities?: {
318
318
  input?: readonly ("text" | "file" | "image" | "audio" | "video" | "pdf")[] | undefined;
319
- output?: readonly ("text" | "image" | "audio" | "video" | "embeddings")[] | undefined;
319
+ output?: readonly ("text" | "embedding" | "image" | "audio" | "video")[] | undefined;
320
320
  } | undefined;
321
321
  context?: number | undefined;
322
322
  capabilities?: readonly ("temperature" | "reasoning" | "attachments" | "tool_call" | "structured_output")[] | undefined;
@@ -394,7 +394,7 @@ export declare const nova2MultimodalEmbeddings: <const O extends {
394
394
  knowledge?: string | undefined;
395
395
  modalities?: {
396
396
  input?: readonly ("text" | "file" | "image" | "audio" | "video" | "pdf")[] | undefined;
397
- output?: readonly ("text" | "image" | "audio" | "video" | "embeddings")[] | undefined;
397
+ output?: readonly ("text" | "embedding" | "image" | "audio" | "video")[] | undefined;
398
398
  } | undefined;
399
399
  context?: number | undefined;
400
400
  capabilities?: readonly ("temperature" | "reasoning" | "attachments" | "tool_call" | "structured_output")[] | undefined;
@@ -460,7 +460,7 @@ export declare const nova2MultimodalEmbeddings: <const O extends {
460
460
  context: number;
461
461
  modalities: {
462
462
  input: readonly ["text", "image", "audio", "video", "pdf"];
463
- output: readonly ["embeddings"];
463
+ output: readonly ["embedding"];
464
464
  };
465
465
  providers: readonly ["bedrock"];
466
466
  } & O>;
@@ -471,7 +471,7 @@ export declare const nova: {
471
471
  knowledge?: string | undefined;
472
472
  modalities?: {
473
473
  input?: readonly ("text" | "file" | "image" | "audio" | "video" | "pdf")[] | undefined;
474
- output?: readonly ("text" | "image" | "audio" | "video" | "embeddings")[] | undefined;
474
+ output?: readonly ("text" | "embedding" | "image" | "audio" | "video")[] | undefined;
475
475
  } | undefined;
476
476
  context?: number | undefined;
477
477
  capabilities?: readonly ("temperature" | "reasoning" | "attachments" | "tool_call" | "structured_output")[] | undefined;
@@ -548,7 +548,7 @@ export declare const nova: {
548
548
  knowledge?: string | undefined;
549
549
  modalities?: {
550
550
  input?: readonly ("text" | "file" | "image" | "audio" | "video" | "pdf")[] | undefined;
551
- output?: readonly ("text" | "image" | "audio" | "video" | "embeddings")[] | undefined;
551
+ output?: readonly ("text" | "embedding" | "image" | "audio" | "video")[] | undefined;
552
552
  } | undefined;
553
553
  context?: number | undefined;
554
554
  capabilities?: readonly ("temperature" | "reasoning" | "attachments" | "tool_call" | "structured_output")[] | undefined;
@@ -625,7 +625,7 @@ export declare const nova: {
625
625
  knowledge?: string | undefined;
626
626
  modalities?: {
627
627
  input?: readonly ("text" | "file" | "image" | "audio" | "video" | "pdf")[] | undefined;
628
- output?: readonly ("text" | "image" | "audio" | "video" | "embeddings")[] | undefined;
628
+ output?: readonly ("text" | "embedding" | "image" | "audio" | "video")[] | undefined;
629
629
  } | undefined;
630
630
  context?: number | undefined;
631
631
  capabilities?: readonly ("temperature" | "reasoning" | "attachments" | "tool_call" | "structured_output")[] | undefined;
@@ -702,7 +702,7 @@ export declare const nova: {
702
702
  knowledge?: string | undefined;
703
703
  modalities?: {
704
704
  input?: readonly ("text" | "file" | "image" | "audio" | "video" | "pdf")[] | undefined;
705
- output?: readonly ("text" | "image" | "audio" | "video" | "embeddings")[] | undefined;
705
+ output?: readonly ("text" | "embedding" | "image" | "audio" | "video")[] | undefined;
706
706
  } | undefined;
707
707
  context?: number | undefined;
708
708
  capabilities?: readonly ("temperature" | "reasoning" | "attachments" | "tool_call" | "structured_output")[] | undefined;
@@ -779,7 +779,7 @@ export declare const nova: {
779
779
  knowledge?: string | undefined;
780
780
  modalities?: {
781
781
  input?: readonly ("text" | "file" | "image" | "audio" | "video" | "pdf")[] | undefined;
782
- output?: readonly ("text" | "image" | "audio" | "video" | "embeddings")[] | undefined;
782
+ output?: readonly ("text" | "embedding" | "image" | "audio" | "video")[] | undefined;
783
783
  } | undefined;
784
784
  context?: number | undefined;
785
785
  capabilities?: readonly ("temperature" | "reasoning" | "attachments" | "tool_call" | "structured_output")[] | undefined;
@@ -856,7 +856,7 @@ export declare const nova: {
856
856
  knowledge?: string | undefined;
857
857
  modalities?: {
858
858
  input?: readonly ("text" | "file" | "image" | "audio" | "video" | "pdf")[] | undefined;
859
- output?: readonly ("text" | "image" | "audio" | "video" | "embeddings")[] | undefined;
859
+ output?: readonly ("text" | "embedding" | "image" | "audio" | "video")[] | undefined;
860
860
  } | undefined;
861
861
  context?: number | undefined;
862
862
  capabilities?: readonly ("temperature" | "reasoning" | "attachments" | "tool_call" | "structured_output")[] | undefined;
@@ -922,7 +922,7 @@ export declare const nova: {
922
922
  context: number;
923
923
  modalities: {
924
924
  input: readonly ["text", "image", "audio", "video", "pdf"];
925
- output: readonly ["embeddings"];
925
+ output: readonly ["embedding"];
926
926
  };
927
927
  providers: readonly ["bedrock"];
928
928
  } & O>];
@@ -932,7 +932,7 @@ export declare const nova: {
932
932
  knowledge?: string | undefined;
933
933
  modalities?: {
934
934
  input?: readonly ("text" | "file" | "image" | "audio" | "video" | "pdf")[] | undefined;
935
- output?: readonly ("text" | "image" | "audio" | "video" | "embeddings")[] | undefined;
935
+ output?: readonly ("text" | "embedding" | "image" | "audio" | "video")[] | undefined;
936
936
  } | undefined;
937
937
  context?: number | undefined;
938
938
  capabilities?: readonly ("temperature" | "reasoning" | "attachments" | "tool_call" | "structured_output")[] | undefined;
@@ -998,7 +998,7 @@ export declare const nova: {
998
998
  context: number;
999
999
  modalities: {
1000
1000
  input: readonly ["text", "image", "audio", "video", "pdf"];
1001
- output: readonly ["embeddings"];
1001
+ output: readonly ["embedding"];
1002
1002
  };
1003
1003
  providers: readonly ["bedrock"];
1004
1004
  } & O>];
@@ -1008,7 +1008,7 @@ export declare const nova: {
1008
1008
  knowledge?: string | undefined;
1009
1009
  modalities?: {
1010
1010
  input?: readonly ("text" | "file" | "image" | "audio" | "video" | "pdf")[] | undefined;
1011
- output?: readonly ("text" | "image" | "audio" | "video" | "embeddings")[] | undefined;
1011
+ output?: readonly ("text" | "embedding" | "image" | "audio" | "video")[] | undefined;
1012
1012
  } | undefined;
1013
1013
  context?: number | undefined;
1014
1014
  capabilities?: readonly ("temperature" | "reasoning" | "attachments" | "tool_call" | "structured_output")[] | undefined;
@@ -1085,7 +1085,7 @@ export declare const nova: {
1085
1085
  knowledge?: string | undefined;
1086
1086
  modalities?: {
1087
1087
  input?: readonly ("text" | "file" | "image" | "audio" | "video" | "pdf")[] | undefined;
1088
- output?: readonly ("text" | "image" | "audio" | "video" | "embeddings")[] | undefined;
1088
+ output?: readonly ("text" | "embedding" | "image" | "audio" | "video")[] | undefined;
1089
1089
  } | undefined;
1090
1090
  context?: number | undefined;
1091
1091
  capabilities?: readonly ("temperature" | "reasoning" | "attachments" | "tool_call" | "structured_output")[] | undefined;
@@ -1162,7 +1162,7 @@ export declare const nova: {
1162
1162
  knowledge?: string | undefined;
1163
1163
  modalities?: {
1164
1164
  input?: readonly ("text" | "file" | "image" | "audio" | "video" | "pdf")[] | undefined;
1165
- output?: readonly ("text" | "image" | "audio" | "video" | "embeddings")[] | undefined;
1165
+ output?: readonly ("text" | "embedding" | "image" | "audio" | "video")[] | undefined;
1166
1166
  } | undefined;
1167
1167
  context?: number | undefined;
1168
1168
  capabilities?: readonly ("temperature" | "reasoning" | "attachments" | "tool_call" | "structured_output")[] | undefined;
@@ -1239,7 +1239,7 @@ export declare const nova: {
1239
1239
  knowledge?: string | undefined;
1240
1240
  modalities?: {
1241
1241
  input?: readonly ("text" | "file" | "image" | "audio" | "video" | "pdf")[] | undefined;
1242
- output?: readonly ("text" | "image" | "audio" | "video" | "embeddings")[] | undefined;
1242
+ output?: readonly ("text" | "embedding" | "image" | "audio" | "video")[] | undefined;
1243
1243
  } | undefined;
1244
1244
  context?: number | undefined;
1245
1245
  capabilities?: readonly ("temperature" | "reasoning" | "attachments" | "tool_call" | "structured_output")[] | undefined;
@@ -1316,7 +1316,7 @@ export declare const nova: {
1316
1316
  knowledge?: string | undefined;
1317
1317
  modalities?: {
1318
1318
  input?: readonly ("text" | "file" | "image" | "audio" | "video" | "pdf")[] | undefined;
1319
- output?: readonly ("text" | "image" | "audio" | "video" | "embeddings")[] | undefined;
1319
+ output?: readonly ("text" | "embedding" | "image" | "audio" | "video")[] | undefined;
1320
1320
  } | undefined;
1321
1321
  context?: number | undefined;
1322
1322
  capabilities?: readonly ("temperature" | "reasoning" | "attachments" | "tool_call" | "structured_output")[] | undefined;
@@ -1393,7 +1393,7 @@ export declare const nova: {
1393
1393
  knowledge?: string | undefined;
1394
1394
  modalities?: {
1395
1395
  input?: readonly ("text" | "file" | "image" | "audio" | "video" | "pdf")[] | undefined;
1396
- output?: readonly ("text" | "image" | "audio" | "video" | "embeddings")[] | undefined;
1396
+ output?: readonly ("text" | "embedding" | "image" | "audio" | "video")[] | undefined;
1397
1397
  } | undefined;
1398
1398
  context?: number | undefined;
1399
1399
  capabilities?: readonly ("temperature" | "reasoning" | "attachments" | "tool_call" | "structured_output")[] | undefined;
@@ -1459,7 +1459,7 @@ export declare const nova: {
1459
1459
  context: number;
1460
1460
  modalities: {
1461
1461
  input: readonly ["text", "image", "audio", "video", "pdf"];
1462
- output: readonly ["embeddings"];
1462
+ output: readonly ["embedding"];
1463
1463
  };
1464
1464
  providers: readonly ["bedrock"];
1465
1465
  } & O>))[];
@@ -1469,7 +1469,7 @@ export declare const nova: {
1469
1469
  knowledge?: string | undefined;
1470
1470
  modalities?: {
1471
1471
  input?: readonly ("text" | "file" | "image" | "audio" | "video" | "pdf")[] | undefined;
1472
- output?: readonly ("text" | "image" | "audio" | "video" | "embeddings")[] | undefined;
1472
+ output?: readonly ("text" | "embedding" | "image" | "audio" | "video")[] | undefined;
1473
1473
  } | undefined;
1474
1474
  context?: number | undefined;
1475
1475
  capabilities?: readonly ("temperature" | "reasoning" | "attachments" | "tool_call" | "structured_output")[] | undefined;
@@ -1546,7 +1546,7 @@ export declare const nova: {
1546
1546
  knowledge?: string | undefined;
1547
1547
  modalities?: {
1548
1548
  input?: readonly ("text" | "file" | "image" | "audio" | "video" | "pdf")[] | undefined;
1549
- output?: readonly ("text" | "image" | "audio" | "video" | "embeddings")[] | undefined;
1549
+ output?: readonly ("text" | "embedding" | "image" | "audio" | "video")[] | undefined;
1550
1550
  } | undefined;
1551
1551
  context?: number | undefined;
1552
1552
  capabilities?: readonly ("temperature" | "reasoning" | "attachments" | "tool_call" | "structured_output")[] | undefined;
@@ -1623,7 +1623,7 @@ export declare const nova: {
1623
1623
  knowledge?: string | undefined;
1624
1624
  modalities?: {
1625
1625
  input?: readonly ("text" | "file" | "image" | "audio" | "video" | "pdf")[] | undefined;
1626
- output?: readonly ("text" | "image" | "audio" | "video" | "embeddings")[] | undefined;
1626
+ output?: readonly ("text" | "embedding" | "image" | "audio" | "video")[] | undefined;
1627
1627
  } | undefined;
1628
1628
  context?: number | undefined;
1629
1629
  capabilities?: readonly ("temperature" | "reasoning" | "attachments" | "tool_call" | "structured_output")[] | undefined;
@@ -1700,7 +1700,7 @@ export declare const nova: {
1700
1700
  knowledge?: string | undefined;
1701
1701
  modalities?: {
1702
1702
  input?: readonly ("text" | "file" | "image" | "audio" | "video" | "pdf")[] | undefined;
1703
- output?: readonly ("text" | "image" | "audio" | "video" | "embeddings")[] | undefined;
1703
+ output?: readonly ("text" | "embedding" | "image" | "audio" | "video")[] | undefined;
1704
1704
  } | undefined;
1705
1705
  context?: number | undefined;
1706
1706
  capabilities?: readonly ("temperature" | "reasoning" | "attachments" | "tool_call" | "structured_output")[] | undefined;
@@ -1778,7 +1778,7 @@ export declare const nova: {
1778
1778
  knowledge?: string | undefined;
1779
1779
  modalities?: {
1780
1780
  input?: readonly ("text" | "file" | "image" | "audio" | "video" | "pdf")[] | undefined;
1781
- output?: readonly ("text" | "image" | "audio" | "video" | "embeddings")[] | undefined;
1781
+ output?: readonly ("text" | "embedding" | "image" | "audio" | "video")[] | undefined;
1782
1782
  } | undefined;
1783
1783
  context?: number | undefined;
1784
1784
  capabilities?: readonly ("temperature" | "reasoning" | "attachments" | "tool_call" | "structured_output")[] | undefined;
@@ -1855,7 +1855,7 @@ export declare const nova: {
1855
1855
  knowledge?: string | undefined;
1856
1856
  modalities?: {
1857
1857
  input?: readonly ("text" | "file" | "image" | "audio" | "video" | "pdf")[] | undefined;
1858
- output?: readonly ("text" | "image" | "audio" | "video" | "embeddings")[] | undefined;
1858
+ output?: readonly ("text" | "embedding" | "image" | "audio" | "video")[] | undefined;
1859
1859
  } | undefined;
1860
1860
  context?: number | undefined;
1861
1861
  capabilities?: readonly ("temperature" | "reasoning" | "attachments" | "tool_call" | "structured_output")[] | undefined;
@@ -1921,7 +1921,7 @@ export declare const nova: {
1921
1921
  context: number;
1922
1922
  modalities: {
1923
1923
  input: readonly ["text", "image", "audio", "video", "pdf"];
1924
- output: readonly ["embeddings"];
1924
+ output: readonly ["embedding"];
1925
1925
  };
1926
1926
  providers: readonly ["bedrock"];
1927
1927
  } & O>];
@@ -1931,7 +1931,7 @@ export declare const nova: {
1931
1931
  knowledge?: string | undefined;
1932
1932
  modalities?: {
1933
1933
  input?: readonly ("text" | "file" | "image" | "audio" | "video" | "pdf")[] | undefined;
1934
- output?: readonly ("text" | "image" | "audio" | "video" | "embeddings")[] | undefined;
1934
+ output?: readonly ("text" | "embedding" | "image" | "audio" | "video")[] | undefined;
1935
1935
  } | undefined;
1936
1936
  context?: number | undefined;
1937
1937
  capabilities?: readonly ("temperature" | "reasoning" | "attachments" | "tool_call" | "structured_output")[] | undefined;
@@ -2008,7 +2008,7 @@ export declare const nova: {
2008
2008
  knowledge?: string | undefined;
2009
2009
  modalities?: {
2010
2010
  input?: readonly ("text" | "file" | "image" | "audio" | "video" | "pdf")[] | undefined;
2011
- output?: readonly ("text" | "image" | "audio" | "video" | "embeddings")[] | undefined;
2011
+ output?: readonly ("text" | "embedding" | "image" | "audio" | "video")[] | undefined;
2012
2012
  } | undefined;
2013
2013
  context?: number | undefined;
2014
2014
  capabilities?: readonly ("temperature" | "reasoning" | "attachments" | "tool_call" | "structured_output")[] | undefined;
@@ -2085,7 +2085,7 @@ export declare const nova: {
2085
2085
  knowledge?: string | undefined;
2086
2086
  modalities?: {
2087
2087
  input?: readonly ("text" | "file" | "image" | "audio" | "video" | "pdf")[] | undefined;
2088
- output?: readonly ("text" | "image" | "audio" | "video" | "embeddings")[] | undefined;
2088
+ output?: readonly ("text" | "embedding" | "image" | "audio" | "video")[] | undefined;
2089
2089
  } | undefined;
2090
2090
  context?: number | undefined;
2091
2091
  capabilities?: readonly ("temperature" | "reasoning" | "attachments" | "tool_call" | "structured_output")[] | undefined;
@@ -2162,7 +2162,7 @@ export declare const nova: {
2162
2162
  knowledge?: string | undefined;
2163
2163
  modalities?: {
2164
2164
  input?: readonly ("text" | "file" | "image" | "audio" | "video" | "pdf")[] | undefined;
2165
- output?: readonly ("text" | "image" | "audio" | "video" | "embeddings")[] | undefined;
2165
+ output?: readonly ("text" | "embedding" | "image" | "audio" | "video")[] | undefined;
2166
2166
  } | undefined;
2167
2167
  context?: number | undefined;
2168
2168
  capabilities?: readonly ("temperature" | "reasoning" | "attachments" | "tool_call" | "structured_output")[] | undefined;
@@ -2240,7 +2240,7 @@ export declare const nova: {
2240
2240
  knowledge?: string | undefined;
2241
2241
  modalities?: {
2242
2242
  input?: readonly ("text" | "file" | "image" | "audio" | "video" | "pdf")[] | undefined;
2243
- output?: readonly ("text" | "image" | "audio" | "video" | "embeddings")[] | undefined;
2243
+ output?: readonly ("text" | "embedding" | "image" | "audio" | "video")[] | undefined;
2244
2244
  } | undefined;
2245
2245
  context?: number | undefined;
2246
2246
  capabilities?: readonly ("temperature" | "reasoning" | "attachments" | "tool_call" | "structured_output")[] | undefined;
@@ -2317,7 +2317,7 @@ export declare const nova: {
2317
2317
  knowledge?: string | undefined;
2318
2318
  modalities?: {
2319
2319
  input?: readonly ("text" | "file" | "image" | "audio" | "video" | "pdf")[] | undefined;
2320
- output?: readonly ("text" | "image" | "audio" | "video" | "embeddings")[] | undefined;
2320
+ output?: readonly ("text" | "embedding" | "image" | "audio" | "video")[] | undefined;
2321
2321
  } | undefined;
2322
2322
  context?: number | undefined;
2323
2323
  capabilities?: readonly ("temperature" | "reasoning" | "attachments" | "tool_call" | "structured_output")[] | undefined;
@@ -2383,7 +2383,7 @@ export declare const nova: {
2383
2383
  context: number;
2384
2384
  modalities: {
2385
2385
  input: readonly ["text", "image", "audio", "video", "pdf"];
2386
- output: readonly ["embeddings"];
2386
+ output: readonly ["embedding"];
2387
2387
  };
2388
2388
  providers: readonly ["bedrock"];
2389
2389
  } & O>];
@@ -18,7 +18,7 @@ const NOVA_MULTIMODAL_BASE = {
18
18
  const NOVA_EMBEDDINGS_BASE = {
19
19
  modalities: {
20
20
  input: ["text", "image", "audio", "video", "pdf"],
21
- output: ["embeddings"],
21
+ output: ["embedding"],
22
22
  },
23
23
  providers: ["bedrock"],
24
24
  };