@byte_fluffy/nexra-sdk 0.1.0-alpha.36 → 0.1.0-alpha.38
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/README.md +22 -0
- package/dist/catalog.d.ts +3 -2
- package/dist/catalog.js +2 -2
- package/dist/{chunk-UOM4JX4G.js → chunk-M4QBFDQB.js} +3833 -1588
- package/dist/{chunk-AAGTZN2G.js → chunk-SRXAHUYR.js} +2 -1
- package/dist/index.d.ts +4 -4
- package/dist/index.js +2 -2
- package/dist/language.d.ts +1 -1
- package/dist/language.js +34 -10
- package/dist/{media-geometry-DAVFGry1.d.ts → media-geometry-YD9Y_CFw.d.ts} +1 -0
- package/dist/media.js +1 -1
- package/dist/types.d.ts +2 -2
- package/dist/{voices-CFRCuodH.d.ts → voices-BMpkagio.d.ts} +3 -1
- package/package.json +1 -1
|
@@ -320,7 +320,7 @@ var PUBLIC_ERROR_CATALOG = {
|
|
|
320
320
|
permission_denied: { "zh-CN": "\u5F53\u524D\u8EAB\u4EFD\u65E0\u6743\u8BBF\u95EE\u8BE5\u8D44\u6E90\u6216\u6267\u884C\u6B64\u64CD\u4F5C\u3002\u8BF7\u786E\u8BA4\u8D44\u6E90\u5F52\u5C5E\uFF0C\u5E76\u8054\u7CFB\u7BA1\u7406\u5458\u6838\u5BF9\u8BBF\u95EE\u6743\u9650\u3002", en: "Your current identity cannot access this resource or perform this operation. Check resource ownership and ask an administrator to review your permissions." },
|
|
321
321
|
insufficient_balance: { "zh-CN": "\u8D26\u6237\u53EF\u7528\u4F59\u989D\u4E0D\u8DB3\u4EE5\u8986\u76D6\u672C\u6B21\u8BF7\u6C42\u3002\u8BF7\u6838\u5BF9\u4F59\u989D\u548C\u5DF2\u5360\u7528\u91D1\u989D\uFF0C\u5145\u503C\u6216\u964D\u4F4E\u8BF7\u6C42\u7528\u91CF\u3002", en: "Your available balance cannot cover this request. Review your balance and reserved funds, then add funds or reduce the requested usage." },
|
|
322
322
|
budget_exceeded: { "zh-CN": "\u9884\u7B97\u9650\u5236\u963B\u6B62\u4E86\u672C\u6B21\u8BF7\u6C42\u3002\u8BF7\u964D\u4F4E\u8BF7\u6C42\u7528\u91CF\uFF0C\u6216\u8054\u7CFB\u9884\u7B97\u7BA1\u7406\u8005\u6838\u5BF9\u9002\u7528\u989D\u5EA6\u3002", en: "A budget limit blocked this request. Reduce the requested usage or ask the budget owner to review the applicable limit." },
|
|
323
|
-
invalid_request: { "zh-CN": "\u8BF7\u6C42\u53C2\u6570\u4E0D\u7B26\u5408\u6B64\u63A5\u53E3\u6216\u6A21\u578B\u7684\u8981\u6C42\u3002\u8BF7\u5BF9\
|
|
323
|
+
invalid_request: { "zh-CN": "\u8BF7\u6C42\u53C2\u6570\u4E0D\u7B26\u5408\u6B64\u63A5\u53E3\u6216\u6A21\u578B\u7684\u8981\u6C42\u3002\u8BF7\u6838\u5BF9\u5FC5\u586B\u5B57\u6BB5\u548C\u53C2\u6570\u53D6\u503C\uFF1B\u542B\u53C2\u8003\u7D20\u6750\u65F6\uFF0C\u68C0\u67E5\u6587\u4EF6\u5927\u5C0F\u3001\u683C\u5F0F\u53CA\u94FE\u63A5\u662F\u5426\u53EF\u8BFB\u53D6\u3002", en: "The request parameters do not meet this endpoint or model's requirements. Check required fields and parameter values; for reference assets, check file size, format, and whether the URL is accessible." },
|
|
324
324
|
input_too_large: { "zh-CN": "\u8BF7\u6C42\u8F93\u5165\u8D85\u8FC7\u4E86\u6A21\u578B\u6216\u63A5\u53E3\u5141\u8BB8\u7684\u5927\u5C0F\u3002\u8BF7\u7F29\u77ED\u6587\u672C\u3001\u51CF\u5C11\u53C2\u8003\u7D20\u6750\u6216\u538B\u7F29\u8F93\u5165\u6587\u4EF6\u3002", en: "The input exceeds the model or endpoint's size limit. Shorten the text, use fewer reference assets, or compress the input files." },
|
|
325
325
|
unsupported_format: { "zh-CN": "\u6A21\u578B\u6216\u63A5\u53E3\u4E0D\u652F\u6301\u5F53\u524D\u8F93\u5165\u683C\u5F0F\u3002\u8BF7\u4F7F\u7528\u53C2\u6570\u6587\u6863\u4E2D\u652F\u6301\u7684\u6587\u4EF6\u683C\u5F0F\u6216\u5185\u5BB9\u7C7B\u578B\u3002", en: "The model or endpoint does not support this input format. Use a file format or content type listed in the parameter documentation." },
|
|
326
326
|
model_not_found: { "zh-CN": "\u6307\u5B9A\u7684\u6A21\u578B\u65E0\u6CD5\u901A\u8FC7\u5F53\u524D\u63A5\u53E3\u8BBF\u95EE\u3002\u8BF7\u6838\u5BF9\u8BE5\u63A5\u53E3\u4F7F\u7528\u7684\u5B8C\u6574 Model ID\uFF0C\u4EE5\u53CA\u6A21\u578B\u662F\u5426\u5DF2\u5F00\u653E\u7ED9\u5F53\u524D\u8D26\u6237\u3002", en: "The specified model is not accessible through this endpoint. Check the endpoint's full model ID and whether the model is available to your account." },
|
|
@@ -329,6 +329,7 @@ var PUBLIC_ERROR_CATALOG = {
|
|
|
329
329
|
rate_limited: { "zh-CN": "\u8BF7\u6C42\u89E6\u53D1\u4E86\u670D\u52A1\u7684\u9891\u7387\u9650\u5236\u3002\u8BF7\u964D\u4F4E\u8C03\u7528\u9891\u7387\u6216\u5E76\u53D1\u91CF\u3002", en: "The request hit a service rate limit. Reduce the request frequency or concurrency." },
|
|
330
330
|
capacity_exceeded: { "zh-CN": "\u5F53\u524D\u6CA1\u6709\u8DB3\u591F\u7684\u6267\u884C\u5BB9\u91CF\u5904\u7406\u6B64\u8BF7\u6C42\u3002\u8BF7\u964D\u4F4E\u5E76\u53D1\u91CF\u6216\u7B49\u5F85\u5BB9\u91CF\u91CA\u653E\uFF1B\u5DF2\u6709\u4EFB\u52A1\u8BF7\u67E5\u8BE2\u539F\u4EFB\u52A1\u72B6\u6001\u3002", en: "There is not enough execution capacity for this request. Reduce concurrency or wait for capacity to become available; check the original task if one already exists." },
|
|
331
331
|
upstream_timeout: { "zh-CN": "\u6A21\u578B\u670D\u52A1\u672A\u5728\u89C4\u5B9A\u65F6\u95F4\u5185\u54CD\u5E94\u3002\u5982\u5DF2\u6709\u8BF7\u6C42\u6216\u4EFB\u52A1 ID\uFF0C\u8BF7\u5148\u67E5\u8BE2\u539F\u8BF7\u6C42\u72B6\u6001\uFF0C\u786E\u8BA4\u7ED3\u679C\u524D\u4E0D\u8981\u91CD\u590D\u63D0\u4EA4\uFF1B\u6301\u7EED\u8D85\u65F6\u65F6\u51ED\u8BF7\u6C42 ID \u8054\u7CFB\u5E73\u53F0\u7BA1\u7406\u5458\u3002", en: "The model service did not respond within the time limit. If you have a request or task ID, check its status and do not submit again until the outcome is confirmed. Contact a platform administrator with the request ID if timeouts persist." },
|
|
332
|
+
upstream_busy: { "zh-CN": "\u6A21\u578B\u670D\u52A1\u5F53\u524D\u7E41\u5FD9\u3002\u8BF7\u7A0D\u540E\u518D\u8BD5\uFF1B\u5982\u5DF2\u6709\u8BF7\u6C42\u6216\u4EFB\u52A1 ID\uFF0C\u8BF7\u5148\u6838\u5BF9\u539F\u8BF7\u6C42\u72B6\u6001\uFF0C\u907F\u514D\u91CD\u590D\u63D0\u4EA4\u3002", en: "The model service is currently busy. Try again later; if a request or task ID already exists, check its status first to avoid duplicate submissions." },
|
|
332
333
|
upstream_unavailable: { "zh-CN": "\u672C\u6B21\u6A21\u578B\u670D\u52A1\u8C03\u7528\u6682\u65F6\u4E0D\u53EF\u7528\u3002\u5982\u4EFB\u52A1\u5DF2\u7ECF\u63D0\u4EA4\uFF0C\u8BF7\u5148\u67E5\u8BE2\u539F\u4EFB\u52A1\u72B6\u6001\uFF1B\u6301\u7EED\u5F02\u5E38\u65F6\u51ED\u8BF7\u6C42 ID \u8054\u7CFB\u5E73\u53F0\u7BA1\u7406\u5458\u6838\u5BF9\u4E0A\u6E38\u670D\u52A1\u3002", en: "This call to the model service is currently unavailable. If a task has already been submitted, check its status first. Contact a platform administrator with the request ID if the problem persists." },
|
|
333
334
|
upstream_response_invalid: { "zh-CN": "\u6A21\u578B\u670D\u52A1\u8FD4\u56DE\u7684\u54CD\u5E94\u4E0D\u7B26\u5408\u63A5\u53E3\u7EA6\u5B9A\uFF0C\u5E73\u53F0\u65E0\u6CD5\u53EF\u9760\u8BFB\u53D6\u7ED3\u679C\u3002\u8BF7\u67E5\u770B\u53EF\u7528\u7684\u4E0A\u6E38\u9519\u8BEF\u8BE6\u60C5\u548C\u539F\u8BF7\u6C42\u72B6\u6001\uFF0C\u5E76\u51ED\u8BF7\u6C42 ID \u8054\u7CFB\u5E73\u53F0\u7BA1\u7406\u5458\u3002", en: "The model service response does not meet the API contract, so the platform cannot read the result reliably. Check the available upstream error details and original request status, and contact a platform administrator with the request ID." },
|
|
334
335
|
upstream_error: { "zh-CN": "\u672C\u6B21\u6A21\u578B\u670D\u52A1\u8C03\u7528\u51FA\u73B0\u9519\u8BEF\uFF0C\u5177\u4F53\u539F\u56E0\u5C1A\u672A\u786E\u8BA4\u3002\u8BF7\u67E5\u770B\u53EF\u7528\u7684\u9519\u8BEF\u8BE6\u60C5\u548C\u539F\u8BF7\u6C42\u6216\u4EFB\u52A1\u72B6\u6001\uFF1B\u9700\u8981\u534F\u52A9\u65F6\u63D0\u4F9B\u8BF7\u6C42 ID\u3002", en: "This call to the model service encountered an error whose specific cause has not been confirmed. Check the available error details and the original request or task status, and provide the request ID when requesting assistance." },
|
package/dist/index.d.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
export { A as AssetImportRequest, a as AssetInput, b as AssetReference, c as AssetUploadOptions, M as MEDIA_KINDS, d as MediaAsset, e as MediaAssetStatus, f as MediaKind } from './assets-Cusrjj7_.js';
|
|
2
|
-
import { H as HttpTransport, M as ModelSearchParams, T as TaskModelSummary, a as TaskModel, b as ModelSchema, c as ModelResourceList, N as NexraClientOptions } from './media-geometry-
|
|
3
|
-
export { C as CreateNexraDisplayQuoteBatchRequest, d as CreateNexraQuoteRequest, F as FetchLike, e as MediaGeometryField, f as MediaGeometryProjection, g as ModelCapabilitySummary, h as ModelDateVersion, i as ModelEndpointSummary, j as ModelModality, k as ModelResourceOption, l as NexraBillingCurrency, m as NexraCatalogRevision, n as NexraDisplayQuoteBatch, o as NexraDisplayQuoteBatchEntry, p as NexraModelOperation, q as NexraModelSpec, r as NexraModelSpecFilter, s as NexraQuote, t as NexraSalePrice, u as NexraSalePriceList, v as NexraSettlement, U as UnifiedMediaGeometry, w as applyMediaGeometry, x as decodeMediaGeometry, y as encodeMediaGeometry, z as projectMediaGeometry } from './media-geometry-
|
|
2
|
+
import { H as HttpTransport, M as ModelSearchParams, T as TaskModelSummary, a as TaskModel, b as ModelSchema, c as ModelResourceList, N as NexraClientOptions } from './media-geometry-YD9Y_CFw.js';
|
|
3
|
+
export { C as CreateNexraDisplayQuoteBatchRequest, d as CreateNexraQuoteRequest, F as FetchLike, e as MediaGeometryField, f as MediaGeometryProjection, g as ModelCapabilitySummary, h as ModelDateVersion, i as ModelEndpointSummary, j as ModelModality, k as ModelResourceOption, l as NexraBillingCurrency, m as NexraCatalogRevision, n as NexraDisplayQuoteBatch, o as NexraDisplayQuoteBatchEntry, p as NexraModelOperation, q as NexraModelSpec, r as NexraModelSpecFilter, s as NexraQuote, t as NexraSalePrice, u as NexraSalePriceList, v as NexraSettlement, U as UnifiedMediaGeometry, w as applyMediaGeometry, x as decodeMediaGeometry, y as encodeMediaGeometry, z as projectMediaGeometry } from './media-geometry-YD9Y_CFw.js';
|
|
4
4
|
import { C as CursorPage, J as JsonValue } from './json-Cz0MkWQn.js';
|
|
5
5
|
export { a as JsonObject, b as JsonPrimitive } from './json-Cz0MkWQn.js';
|
|
6
6
|
import { N as NexraError, P as PublicErrorFields } from './errors-DZlSwyv8.js';
|
|
7
7
|
export { A as ApiErrorPayload, a as PublicError, b as PublicErrorContext } from './errors-DZlSwyv8.js';
|
|
8
|
-
import { V as Voice, C as CreateVoiceRequest, a as VoiceCreation, A as AssetsClient, T as TasksClient, R as RunTaskOptions, b as RunResult, c as TaskResult } from './voices-
|
|
9
|
-
export { d as CreateTaskOptions, e as CreateTaskRequest, f as RequestDetails, g as TASK_STATUSES, h as TaskCost, i as TaskError, j as TaskEvent, k as TaskEventType, l as TaskListParams, m as TaskPage, n as TaskProgress, o as TaskReceipt, p as TaskStatus, q as TaskTiming, r as TaskUsage, s as TaskWebhookConfig, t as TerminalTaskStatus, u as VerifyWebhookOptions, W as WaitTaskOptions, v as WatchTaskOptions, w as isTerminalTaskStatus, x as verifyWebhook } from './voices-
|
|
8
|
+
import { V as Voice, C as CreateVoiceRequest, a as VoiceCreation, A as AssetsClient, T as TasksClient, R as RunTaskOptions, b as RunResult, c as TaskResult } from './voices-BMpkagio.js';
|
|
9
|
+
export { d as CreateTaskOptions, e as CreateTaskRequest, f as RequestDetails, g as TASK_STATUSES, h as TaskCost, i as TaskError, j as TaskEvent, k as TaskEventType, l as TaskListParams, m as TaskPage, n as TaskProgress, o as TaskReceipt, p as TaskStatus, q as TaskTiming, r as TaskUsage, s as TaskWebhookConfig, t as TerminalTaskStatus, u as VerifyWebhookOptions, W as WaitTaskOptions, v as WatchTaskOptions, w as isTerminalTaskStatus, x as verifyWebhook } from './voices-BMpkagio.js';
|
|
10
10
|
import { CatalogClient } from './catalog.js';
|
|
11
11
|
export { formatModelDisplayName, getModelSpec, listModelSpecs } from './catalog.js';
|
|
12
12
|
export { ceilDecimal, multiplyDecimal } from './decimal.js';
|
package/dist/index.js
CHANGED
|
@@ -20,13 +20,13 @@ import {
|
|
|
20
20
|
projectMediaGeometry,
|
|
21
21
|
queryString,
|
|
22
22
|
sleep
|
|
23
|
-
} from "./chunk-
|
|
23
|
+
} from "./chunk-M4QBFDQB.js";
|
|
24
24
|
import {
|
|
25
25
|
MEDIA_KINDS,
|
|
26
26
|
TASK_STATUSES,
|
|
27
27
|
createTaskRequest,
|
|
28
28
|
isTerminalTaskStatus
|
|
29
|
-
} from "./chunk-
|
|
29
|
+
} from "./chunk-SRXAHUYR.js";
|
|
30
30
|
|
|
31
31
|
// src/assets.ts
|
|
32
32
|
var AssetsClient = class {
|
package/dist/language.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { APICallError, LanguageModelV4 } from '@ai-sdk/provider';
|
|
2
2
|
import { NexraLanguageProtocol } from './catalog.js';
|
|
3
3
|
export { NexraLanguageModelBinding } from './catalog.js';
|
|
4
|
-
import { F as FetchLike } from './media-geometry-
|
|
4
|
+
import { F as FetchLike } from './media-geometry-YD9Y_CFw.js';
|
|
5
5
|
import { N as NexraError } from './errors-DZlSwyv8.js';
|
|
6
6
|
import './json-Cz0MkWQn.js';
|
|
7
7
|
|
package/dist/language.js
CHANGED
|
@@ -6,12 +6,12 @@ import {
|
|
|
6
6
|
jsonBody,
|
|
7
7
|
parseServerSentEvents,
|
|
8
8
|
resolveNexraLanguageReasoning
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-M4QBFDQB.js";
|
|
10
10
|
import {
|
|
11
11
|
isPublicErrorCode,
|
|
12
12
|
publicErrorMessage,
|
|
13
13
|
resolvePublicErrorLocale
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-SRXAHUYR.js";
|
|
15
15
|
|
|
16
16
|
// src/language/index.ts
|
|
17
17
|
import { createAnthropic } from "@ai-sdk/anthropic";
|
|
@@ -38,7 +38,9 @@ function prepareLanguageReasoning(options, binding) {
|
|
|
38
38
|
if (!binding.endpoint.capabilities.includes("reasoning")) throw new Error(`Nexra model does not support reasoning: ${binding.spec.id}`);
|
|
39
39
|
const namespace = binding.endpoint.protocol === "openai-responses" ? "openai" : binding.endpoint.protocol === "anthropic-messages" ? "anthropic" : binding.endpoint.protocol === "gemini-generate-content" ? "google" : "nexra";
|
|
40
40
|
const current = object(options.providerOptions?.[namespace]);
|
|
41
|
-
if (current.thinking !== void 0 || current.reasoningEffort !== void 0 || current.reasoning_effort !== void 0 || object(current.thinkingConfig).thinkingLevel !== void 0 || object(current.thinkingConfig).thinkingBudget !== void 0)
|
|
41
|
+
if (current.thinking !== void 0 || current.reasoningEffort !== void 0 || current.reasoning_effort !== void 0 || object(current.thinkingConfig).thinkingLevel !== void 0 || object(current.thinkingConfig).thinkingBudget !== void 0) {
|
|
42
|
+
return binding.endpoint.protocol === "gemini-generate-content" ? { ...options, reasoning: void 0 } : options;
|
|
43
|
+
}
|
|
42
44
|
const nativeField = binding.endpoint.protocol === "openai-chat-completions" ? fields.reasoning_effort : binding.endpoint.protocol === "openai-responses" ? object(object(fields.reasoning).properties).effort : binding.endpoint.protocol === "gemini-generate-content" ? object(object(object(object(fields.generationConfig).properties).thinkingConfig).properties).thinkingLevel : void 0;
|
|
43
45
|
const values = object(nativeField).enum;
|
|
44
46
|
if (options.reasoning === "none") {
|
|
@@ -47,7 +49,13 @@ function prepareLanguageReasoning(options, binding) {
|
|
|
47
49
|
const desired = object(resolved.providerOptions[namespace]);
|
|
48
50
|
return { ...options, reasoning: void 0, providerOptions: { ...options.providerOptions, [namespace]: { ...desired, ...current } } };
|
|
49
51
|
}
|
|
50
|
-
if (Array.isArray(values) && !values.
|
|
52
|
+
if (Array.isArray(values) && !values.some((value) => typeof value === "string" && value.toLowerCase() === options.reasoning)) throw new Error(`Nexra reasoning effort is outside the native contract for ${binding.spec.id}: ${options.reasoning}`);
|
|
53
|
+
if (binding.endpoint.protocol === "gemini-generate-content" && Array.isArray(values)) {
|
|
54
|
+
return { ...options, reasoning: void 0, providerOptions: {
|
|
55
|
+
...options.providerOptions,
|
|
56
|
+
google: { ...current, thinkingConfig: { ...object(current.thinkingConfig), thinkingLevel: options.reasoning } }
|
|
57
|
+
} };
|
|
58
|
+
}
|
|
51
59
|
if (binding.endpoint.protocol === "openai-chat-completions") {
|
|
52
60
|
const thinkingType = object(object(object(fields.thinking).properties).type).enum;
|
|
53
61
|
return { ...options, providerOptions: { ...options.providerOptions, nexra: {
|
|
@@ -535,7 +543,11 @@ function createNexraLanguageModel(modelId, options) {
|
|
|
535
543
|
const common = { apiKey, headers: Object.fromEntries(headers), fetch };
|
|
536
544
|
let model;
|
|
537
545
|
if (binding.endpoint.protocol === "gemini-generate-content") {
|
|
538
|
-
|
|
546
|
+
const googleFetch = (input, init) => fetch(
|
|
547
|
+
input,
|
|
548
|
+
typeof init?.body === "string" ? { ...init, body: JSON.stringify(googleNativeBody(binding, JSON.parse(init.body))) } : init
|
|
549
|
+
);
|
|
550
|
+
model = createGoogleGenerativeAI({ ...common, name: "nexra.google", baseURL: `${root}/v1beta/models`, fetch: googleFetch })(binding.spec.id);
|
|
539
551
|
} else if (binding.endpoint.protocol === "openai-responses") {
|
|
540
552
|
const responsesFetch = (input, init) => fetch(
|
|
541
553
|
input,
|
|
@@ -558,13 +570,25 @@ function explicitResponsesMessages(value) {
|
|
|
558
570
|
return item.type === void 0 && ["system", "developer", "user", "assistant"].includes(String(item.role)) && (typeof item.content === "string" || Array.isArray(item.content)) ? { ...item, type: "message" } : value2;
|
|
559
571
|
}) };
|
|
560
572
|
}
|
|
561
|
-
function
|
|
562
|
-
|
|
573
|
+
function googleNativeBody(binding, value) {
|
|
574
|
+
const body = object3(value);
|
|
575
|
+
const config = object3(body.generationConfig);
|
|
576
|
+
const thinking = object3(config.thinkingConfig);
|
|
577
|
+
const fields = object3(binding.endpoint.inputSchema?.properties);
|
|
578
|
+
const nativeThinking = object3(object3(object3(object3(fields.generationConfig).properties).thinkingConfig).properties);
|
|
579
|
+
const values = object3(nativeThinking.thinkingLevel).enum;
|
|
580
|
+
const level = typeof thinking.thinkingLevel === "string" && Array.isArray(values) ? values.find((value2) => typeof value2 === "string" && value2.toLowerCase() === String(thinking.thinkingLevel).toLowerCase()) : void 0;
|
|
581
|
+
return level === void 0 || level === thinking.thinkingLevel ? value : { ...body, generationConfig: { ...config, thinkingConfig: { ...thinking, thinkingLevel: level } } };
|
|
582
|
+
}
|
|
583
|
+
function nativeRequest(binding, request, stream = false) {
|
|
584
|
+
if (!request) return request;
|
|
585
|
+
return binding.endpoint.protocol === "openai-responses" ? {
|
|
563
586
|
...request,
|
|
564
587
|
body: explicitResponsesMessages(stream ? { ...object3(request.body), stream: true } : request.body)
|
|
565
|
-
} : request;
|
|
588
|
+
} : binding.endpoint.protocol === "gemini-generate-content" ? { ...request, body: googleNativeBody(binding, request.body) } : request;
|
|
566
589
|
}
|
|
567
590
|
function prepare(options, binding, stream) {
|
|
591
|
+
binding = getLanguageModelBinding(binding.spec.id, { protocol: binding.endpoint.protocol, stream });
|
|
568
592
|
options = prepareLanguageReasoning(options, binding);
|
|
569
593
|
const properties = object3(binding.endpoint.inputSchema?.properties);
|
|
570
594
|
const tokenField = object3(binding.endpoint.protocol === "gemini-generate-content" ? object3(object3(properties.generationConfig).properties).maxOutputTokens : properties.max_output_tokens ?? properties.max_tokens);
|
|
@@ -638,7 +662,7 @@ function withNativeContract(model, binding) {
|
|
|
638
662
|
const raw = nativeUsage(binding.endpoint.protocol, result.response?.body);
|
|
639
663
|
return {
|
|
640
664
|
...result,
|
|
641
|
-
request: nativeRequest(binding
|
|
665
|
+
request: nativeRequest(binding, result.request),
|
|
642
666
|
...raw ? { usage: { ...result.usage, raw } } : {}
|
|
643
667
|
};
|
|
644
668
|
},
|
|
@@ -653,7 +677,7 @@ function withNativeContract(model, binding) {
|
|
|
653
677
|
const reasoningMetadata2 = /* @__PURE__ */ new Map();
|
|
654
678
|
return {
|
|
655
679
|
...result,
|
|
656
|
-
request: nativeRequest(binding
|
|
680
|
+
request: nativeRequest(binding, result.request, true),
|
|
657
681
|
stream: result.stream.pipeThrough(new TransformStream({
|
|
658
682
|
transform(part, controller) {
|
|
659
683
|
if (part.type === "raw") {
|
package/dist/media.js
CHANGED
package/dist/types.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { A as AssetImportRequest, a as AssetInput, b as AssetReference, c as AssetUploadOptions, d as MediaAsset, e as MediaAssetStatus, f as MediaKind } from './assets-Cusrjj7_.js';
|
|
2
|
-
export { C as CreateNexraDisplayQuoteBatchRequest, d as CreateNexraQuoteRequest, F as FetchLike, e as MediaGeometryField, f as MediaGeometryProjection, g as ModelCapabilitySummary, h as ModelDateVersion, i as ModelEndpointSummary, j as ModelModality, c as ModelResourceList, k as ModelResourceOption, b as ModelSchema, M as ModelSearchParams, l as NexraBillingCurrency, m as NexraCatalogRevision, N as NexraClientOptions, n as NexraDisplayQuoteBatch, o as NexraDisplayQuoteBatchEntry, p as NexraModelOperation, q as NexraModelSpec, r as NexraModelSpecFilter, s as NexraQuote, t as NexraSalePrice, u as NexraSalePriceList, v as NexraSettlement, a as TaskModel, T as TaskModelSummary, U as UnifiedMediaGeometry } from './media-geometry-
|
|
2
|
+
export { C as CreateNexraDisplayQuoteBatchRequest, d as CreateNexraQuoteRequest, F as FetchLike, e as MediaGeometryField, f as MediaGeometryProjection, g as ModelCapabilitySummary, h as ModelDateVersion, i as ModelEndpointSummary, j as ModelModality, c as ModelResourceList, k as ModelResourceOption, b as ModelSchema, M as ModelSearchParams, l as NexraBillingCurrency, m as NexraCatalogRevision, N as NexraClientOptions, n as NexraDisplayQuoteBatch, o as NexraDisplayQuoteBatchEntry, p as NexraModelOperation, q as NexraModelSpec, r as NexraModelSpecFilter, s as NexraQuote, t as NexraSalePrice, u as NexraSalePriceList, v as NexraSettlement, a as TaskModel, T as TaskModelSummary, U as UnifiedMediaGeometry } from './media-geometry-YD9Y_CFw.js';
|
|
3
3
|
export { C as CursorPage, a as JsonObject, b as JsonPrimitive, J as JsonValue } from './json-Cz0MkWQn.js';
|
|
4
4
|
export { A as ApiErrorPayload, N as NexraError, a as PublicError, b as PublicErrorContext, P as PublicErrorFields } from './errors-DZlSwyv8.js';
|
|
5
|
-
export { d as CreateTaskOptions, e as CreateTaskRequest, C as CreateVoiceRequest, f as RequestDetails, b as RunResult, R as RunTaskOptions, c as Task, h as TaskCost, i as TaskError, j as TaskEvent, k as TaskEventType, l as TaskListParams, m as TaskPage, n as TaskProgress, o as TaskReceipt, c as TaskResult, p as TaskStatus, q as TaskTiming, r as TaskUsage, s as TaskWebhookConfig, t as TerminalTaskStatus, u as VerifyWebhookOptions, V as Voice, a as VoiceCreation, W as WaitTaskOptions, v as WatchTaskOptions } from './voices-
|
|
5
|
+
export { d as CreateTaskOptions, e as CreateTaskRequest, C as CreateVoiceRequest, f as RequestDetails, b as RunResult, R as RunTaskOptions, c as Task, h as TaskCost, i as TaskError, j as TaskEvent, k as TaskEventType, l as TaskListParams, m as TaskPage, n as TaskProgress, o as TaskReceipt, c as TaskResult, p as TaskStatus, q as TaskTiming, r as TaskUsage, s as TaskWebhookConfig, t as TerminalTaskStatus, u as VerifyWebhookOptions, V as Voice, a as VoiceCreation, W as WaitTaskOptions, v as WatchTaskOptions } from './voices-BMpkagio.js';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { c as AssetUploadOptions, d as MediaAsset, A as AssetImportRequest, g as AssetCertificationRequest, h as AssetCertification, i as AssetCertificationWaitOptions } from './assets-Cusrjj7_.js';
|
|
2
|
-
import { H as HttpTransport, v as NexraSettlement } from './media-geometry-
|
|
2
|
+
import { H as HttpTransport, v as NexraSettlement } from './media-geometry-YD9Y_CFw.js';
|
|
3
3
|
import { a as JsonObject, J as JsonValue, C as CursorPage } from './json-Cz0MkWQn.js';
|
|
4
4
|
import { P as PublicErrorFields, a as PublicError, b as PublicErrorContext, N as NexraError } from './errors-DZlSwyv8.js';
|
|
5
5
|
|
|
@@ -115,6 +115,8 @@ interface TaskTiming {
|
|
|
115
115
|
generationMs: number | null;
|
|
116
116
|
/** Background: elapsed persistence stage until assets are ready; terminal: measured transfer. Null when unfinished or unavailable. */
|
|
117
117
|
storageMs: number | null;
|
|
118
|
+
/** First-response time outside measured preparation/generation and any pre-response storage; not a separately instrumented stage. */
|
|
119
|
+
responseOverheadMs?: number | null;
|
|
118
120
|
/** Start of in-progress background persistence, when a worker has claimed the output. */
|
|
119
121
|
storageStartedAt?: string;
|
|
120
122
|
/** Background persistence elapsed time from first response to durable asset readiness. */
|