ai 7.0.142 → 7.0.144
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/CHANGELOG.md +24 -0
- package/dist/index.d.ts +237 -204
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +211 -56
- package/dist/index.js.map +1 -1
- package/dist/internal/index.d.ts +26 -16
- package/dist/internal/index.d.ts.map +1 -1
- package/dist/internal/index.js +1 -1
- package/docs/03-ai-sdk-core/17-mcp-events.mdx +50 -0
- package/docs/03-ai-sdk-core/32-decisions.mdx +28 -13
- package/docs/03-ai-sdk-harnesses/05-harness-adapters.mdx +12 -12
- package/docs/07-reference/01-ai-sdk-core/02-stream-text-low-memory.mdx +105 -0
- package/docs/07-reference/01-ai-sdk-core/02-stream-text.mdx +6 -0
- package/docs/07-reference/01-ai-sdk-core/14-decide.mdx +24 -1
- package/docs/07-reference/02-ai-sdk-ui/01-use-chat.mdx +1 -1
- package/package.json +12 -12
- package/src/agent/tool-loop-agent.ts +6 -4
- package/src/decide/decision-result.ts +6 -1
- package/src/decide/validate-decision.ts +39 -4
- package/src/generate-text/index.ts +1 -0
- package/src/generate-text/stream-language-model-call.ts +32 -16
- package/src/generate-text/stream-text-single-consumer-result.ts +75 -0
- package/src/generate-text/stream-text.ts +219 -37
- package/src/ui/chat.ts +9 -4
package/dist/index.js
CHANGED
|
@@ -1174,7 +1174,7 @@ function cloneValue(value) {
|
|
|
1174
1174
|
}
|
|
1175
1175
|
//#endregion
|
|
1176
1176
|
//#region src/version.ts
|
|
1177
|
-
const VERSION = "7.0.
|
|
1177
|
+
const VERSION = "7.0.144";
|
|
1178
1178
|
//#endregion
|
|
1179
1179
|
//#region src/util/download/download.ts
|
|
1180
1180
|
/**
|
|
@@ -8132,6 +8132,46 @@ function invokeToolCallbacksFromStream({ stream, tools, stepInputMessages, abort
|
|
|
8132
8132
|
} }));
|
|
8133
8133
|
}
|
|
8134
8134
|
//#endregion
|
|
8135
|
+
//#region src/generate-text/stream-text-single-consumer-result.ts
|
|
8136
|
+
/** Expose only the stream and completion metadata for a single consumer. */
|
|
8137
|
+
function createSingleConsumerStreamTextResult(result) {
|
|
8138
|
+
return {
|
|
8139
|
+
get textStream() {
|
|
8140
|
+
return result.textStream;
|
|
8141
|
+
},
|
|
8142
|
+
get stream() {
|
|
8143
|
+
return result.stream;
|
|
8144
|
+
},
|
|
8145
|
+
get fullStream() {
|
|
8146
|
+
return result.fullStream;
|
|
8147
|
+
},
|
|
8148
|
+
get partialOutputStream() {
|
|
8149
|
+
return result.partialOutputStream;
|
|
8150
|
+
},
|
|
8151
|
+
get elementStream() {
|
|
8152
|
+
return result.elementStream;
|
|
8153
|
+
},
|
|
8154
|
+
get totalUsage() {
|
|
8155
|
+
return result.totalUsage;
|
|
8156
|
+
},
|
|
8157
|
+
get usage() {
|
|
8158
|
+
return result.usage;
|
|
8159
|
+
},
|
|
8160
|
+
get finishReason() {
|
|
8161
|
+
return result.finishReason;
|
|
8162
|
+
},
|
|
8163
|
+
get rawFinishReason() {
|
|
8164
|
+
return result.rawFinishReason;
|
|
8165
|
+
},
|
|
8166
|
+
consumeStream: result.consumeStream.bind(result),
|
|
8167
|
+
toUIMessageStream: result.toUIMessageStream.bind(result),
|
|
8168
|
+
toUIMessageStreamResponse: result.toUIMessageStreamResponse.bind(result),
|
|
8169
|
+
toTextStreamResponse: result.toTextStreamResponse.bind(result),
|
|
8170
|
+
pipeUIMessageStreamToResponse: result.pipeUIMessageStreamToResponse.bind(result),
|
|
8171
|
+
pipeTextStreamToResponse: result.pipeTextStreamToResponse.bind(result)
|
|
8172
|
+
};
|
|
8173
|
+
}
|
|
8174
|
+
//#endregion
|
|
8135
8175
|
//#region src/prompt/normalize-stream-provider-error.ts
|
|
8136
8176
|
/**
|
|
8137
8177
|
* Normalizes well-formed provider error payloads without changing existing
|
|
@@ -8259,7 +8299,7 @@ const originalGenerateCallId$8 = createIdGenerator$1({
|
|
|
8259
8299
|
*
|
|
8260
8300
|
* @returns A stream of model call parts together with request and response metadata when available.
|
|
8261
8301
|
*/
|
|
8262
|
-
async function streamLanguageModelCall({ model, tools, toolOrder, output, toolChoice, prompt, system, instructions, messages, allowSystemInMessages, download, abortSignal, headers, includeRawChunks, providerOptions, repairToolCall, refineToolInput, executeLanguageModelCallInTelemetryContext = async ({ execute }) => await execute(), callId, toolsContext, experimental_sandbox: sandbox, _internal: { generateId = originalGenerateId$3, generateCallId = originalGenerateCallId$8, now: now$3 = now } = {}, onStart, onLanguageModelCallStart, onLanguageModelCallEnd, ...callSettings }) {
|
|
8302
|
+
async function streamLanguageModelCall({ model, tools, toolOrder, output, toolChoice, prompt, system, instructions, messages, allowSystemInMessages, download, abortSignal, headers, includeRawChunks, providerOptions, repairToolCall, refineToolInput, executeLanguageModelCallInTelemetryContext = async ({ execute }) => await execute(), callId, toolsContext, experimental_sandbox: sandbox, _internal: { generateId = originalGenerateId$3, generateCallId = originalGenerateCallId$8, now: now$3 = now, collectContent = true } = {}, onStart, onLanguageModelCallStart, onLanguageModelCallEnd, ...callSettings }) {
|
|
8263
8303
|
const resolvedModel = resolveLanguageModel(model);
|
|
8264
8304
|
const effectiveCallId = callId ?? generateCallId();
|
|
8265
8305
|
const standardizedPrompt = await standardizePrompt({
|
|
@@ -8333,13 +8373,14 @@ async function streamLanguageModelCall({ model, tools, toolOrder, output, toolCh
|
|
|
8333
8373
|
generateId,
|
|
8334
8374
|
now: now$3,
|
|
8335
8375
|
callStartTimestampMs,
|
|
8336
|
-
onLanguageModelCallEnd
|
|
8376
|
+
onLanguageModelCallEnd,
|
|
8377
|
+
collectContent
|
|
8337
8378
|
}))),
|
|
8338
8379
|
response,
|
|
8339
8380
|
request
|
|
8340
8381
|
};
|
|
8341
8382
|
}
|
|
8342
|
-
function createLanguageModelV4StreamPartToLanguageModelStreamPartTransform({ tools, instructions, messages, repairToolCall, refineToolInput, abortSignal, callId, provider, modelId, toolChoice, generateId, now, callStartTimestampMs, onLanguageModelCallEnd }) {
|
|
8383
|
+
function createLanguageModelV4StreamPartToLanguageModelStreamPartTransform({ tools, instructions, messages, repairToolCall, refineToolInput, abortSignal, callId, provider, modelId, toolChoice, generateId, now, callStartTimestampMs, onLanguageModelCallEnd, collectContent }) {
|
|
8343
8384
|
const toolCallsByToolCallId = /* @__PURE__ */ new Map();
|
|
8344
8385
|
const modelCallContent = [];
|
|
8345
8386
|
const rawModelCallContent = [];
|
|
@@ -8368,6 +8409,7 @@ function createLanguageModelV4StreamPartToLanguageModelStreamPartTransform({ too
|
|
|
8368
8409
|
break;
|
|
8369
8410
|
case "text-start":
|
|
8370
8411
|
upsertTextContentPart({
|
|
8412
|
+
enabled: collectContent,
|
|
8371
8413
|
content: modelCallContent,
|
|
8372
8414
|
rawContent: rawModelCallContent,
|
|
8373
8415
|
partIndexes: textPartIndexes,
|
|
@@ -8380,6 +8422,7 @@ function createLanguageModelV4StreamPartToLanguageModelStreamPartTransform({ too
|
|
|
8380
8422
|
break;
|
|
8381
8423
|
case "text-delta":
|
|
8382
8424
|
upsertTextContentPart({
|
|
8425
|
+
enabled: collectContent,
|
|
8383
8426
|
content: modelCallContent,
|
|
8384
8427
|
rawContent: rawModelCallContent,
|
|
8385
8428
|
partIndexes: textPartIndexes,
|
|
@@ -8398,6 +8441,7 @@ function createLanguageModelV4StreamPartToLanguageModelStreamPartTransform({ too
|
|
|
8398
8441
|
break;
|
|
8399
8442
|
case "text-end":
|
|
8400
8443
|
upsertTextContentPart({
|
|
8444
|
+
enabled: collectContent,
|
|
8401
8445
|
content: modelCallContent,
|
|
8402
8446
|
rawContent: rawModelCallContent,
|
|
8403
8447
|
partIndexes: textPartIndexes,
|
|
@@ -8412,6 +8456,7 @@ function createLanguageModelV4StreamPartToLanguageModelStreamPartTransform({ too
|
|
|
8412
8456
|
break;
|
|
8413
8457
|
case "reasoning-start":
|
|
8414
8458
|
upsertTextContentPart({
|
|
8459
|
+
enabled: collectContent,
|
|
8415
8460
|
content: modelCallContent,
|
|
8416
8461
|
rawContent: rawModelCallContent,
|
|
8417
8462
|
partIndexes: reasoningPartIndexes,
|
|
@@ -8424,6 +8469,7 @@ function createLanguageModelV4StreamPartToLanguageModelStreamPartTransform({ too
|
|
|
8424
8469
|
break;
|
|
8425
8470
|
case "reasoning-delta":
|
|
8426
8471
|
upsertTextContentPart({
|
|
8472
|
+
enabled: collectContent,
|
|
8427
8473
|
content: modelCallContent,
|
|
8428
8474
|
rawContent: rawModelCallContent,
|
|
8429
8475
|
partIndexes: reasoningPartIndexes,
|
|
@@ -8442,6 +8488,7 @@ function createLanguageModelV4StreamPartToLanguageModelStreamPartTransform({ too
|
|
|
8442
8488
|
break;
|
|
8443
8489
|
case "reasoning-end":
|
|
8444
8490
|
upsertTextContentPart({
|
|
8491
|
+
enabled: collectContent,
|
|
8445
8492
|
content: modelCallContent,
|
|
8446
8493
|
rawContent: rawModelCallContent,
|
|
8447
8494
|
partIndexes: reasoningPartIndexes,
|
|
@@ -8463,12 +8510,12 @@ function createLanguageModelV4StreamPartToLanguageModelStreamPartTransform({ too
|
|
|
8463
8510
|
}),
|
|
8464
8511
|
mediaType: chunk.mediaType
|
|
8465
8512
|
});
|
|
8466
|
-
modelCallContent.push({
|
|
8513
|
+
if (collectContent) modelCallContent.push({
|
|
8467
8514
|
type: chunk.type,
|
|
8468
8515
|
file,
|
|
8469
8516
|
...chunk.providerMetadata != null ? { providerMetadata: chunk.providerMetadata } : {}
|
|
8470
8517
|
});
|
|
8471
|
-
rawModelCallContent.push(chunk);
|
|
8518
|
+
if (collectContent) rawModelCallContent.push(chunk);
|
|
8472
8519
|
controller.enqueue({
|
|
8473
8520
|
type: chunk.type,
|
|
8474
8521
|
file,
|
|
@@ -8540,7 +8587,7 @@ function createLanguageModelV4StreamPartToLanguageModelStreamPartTransform({ too
|
|
|
8540
8587
|
break;
|
|
8541
8588
|
}
|
|
8542
8589
|
case "tool-call":
|
|
8543
|
-
rawModelCallContent.push(chunk);
|
|
8590
|
+
if (collectContent) rawModelCallContent.push(chunk);
|
|
8544
8591
|
try {
|
|
8545
8592
|
const toolCall = await parseToolCall({
|
|
8546
8593
|
toolCall: chunk,
|
|
@@ -8553,7 +8600,7 @@ function createLanguageModelV4StreamPartToLanguageModelStreamPartTransform({ too
|
|
|
8553
8600
|
});
|
|
8554
8601
|
toolCallsByToolCallId.set(toolCall.toolCallId, toolCall);
|
|
8555
8602
|
controller.enqueue(toolCall);
|
|
8556
|
-
modelCallContent.push(toolCall);
|
|
8603
|
+
if (collectContent) modelCallContent.push(toolCall);
|
|
8557
8604
|
if (toolCall.invalid) {
|
|
8558
8605
|
if (!toolCall.providerExecuted) controller.enqueue({
|
|
8559
8606
|
type: "tool-error",
|
|
@@ -8575,7 +8622,7 @@ function createLanguageModelV4StreamPartToLanguageModelStreamPartTransform({ too
|
|
|
8575
8622
|
}
|
|
8576
8623
|
break;
|
|
8577
8624
|
case "tool-approval-request": {
|
|
8578
|
-
rawModelCallContent.push(chunk);
|
|
8625
|
+
if (collectContent) rawModelCallContent.push(chunk);
|
|
8579
8626
|
const toolCall = toolCallsByToolCallId.get(chunk.toolCallId);
|
|
8580
8627
|
if (toolCall == null) {
|
|
8581
8628
|
controller.enqueue({
|
|
@@ -8593,11 +8640,11 @@ function createLanguageModelV4StreamPartToLanguageModelStreamPartTransform({ too
|
|
|
8593
8640
|
toolCall
|
|
8594
8641
|
};
|
|
8595
8642
|
controller.enqueue(toolApprovalRequest);
|
|
8596
|
-
modelCallContent.push(toolApprovalRequest);
|
|
8643
|
+
if (collectContent) modelCallContent.push(toolApprovalRequest);
|
|
8597
8644
|
break;
|
|
8598
8645
|
}
|
|
8599
8646
|
case "tool-result": {
|
|
8600
|
-
rawModelCallContent.push(chunk);
|
|
8647
|
+
if (collectContent) rawModelCallContent.push(chunk);
|
|
8601
8648
|
const toolName = chunk.toolName;
|
|
8602
8649
|
const toolCall = toolCallsByToolCallId.get(chunk.toolCallId);
|
|
8603
8650
|
const toolResultPart = chunk.isError ? {
|
|
@@ -8622,7 +8669,7 @@ function createLanguageModelV4StreamPartToLanguageModelStreamPartTransform({ too
|
|
|
8622
8669
|
...toolCall?.toolMetadata != null ? { toolMetadata: toolCall.toolMetadata } : {}
|
|
8623
8670
|
};
|
|
8624
8671
|
controller.enqueue(toolResultPart);
|
|
8625
|
-
modelCallContent.push(toolResultPart);
|
|
8672
|
+
if (collectContent) modelCallContent.push(toolResultPart);
|
|
8626
8673
|
break;
|
|
8627
8674
|
}
|
|
8628
8675
|
case "tool-input-start": {
|
|
@@ -8653,8 +8700,8 @@ function createLanguageModelV4StreamPartToLanguageModelStreamPartTransform({ too
|
|
|
8653
8700
|
break;
|
|
8654
8701
|
default:
|
|
8655
8702
|
if (chunk.type === "custom" || chunk.type === "source") {
|
|
8656
|
-
modelCallContent.push(chunk);
|
|
8657
|
-
rawModelCallContent.push(chunk);
|
|
8703
|
+
if (collectContent) modelCallContent.push(chunk);
|
|
8704
|
+
if (collectContent) rawModelCallContent.push(chunk);
|
|
8658
8705
|
}
|
|
8659
8706
|
controller.enqueue(chunk);
|
|
8660
8707
|
}
|
|
@@ -8686,7 +8733,8 @@ function calculateNearestRankPercentile(sortedValues, percentile) {
|
|
|
8686
8733
|
/**
|
|
8687
8734
|
* Appends a text or reasoning content part into the content array and updates the part indexes.
|
|
8688
8735
|
*/
|
|
8689
|
-
function upsertTextContentPart({ content, rawContent, partIndexes, rawPartIndexes, id, type, textDelta, providerMetadata }) {
|
|
8736
|
+
function upsertTextContentPart({ enabled, content, rawContent, partIndexes, rawPartIndexes, id, type, textDelta, providerMetadata }) {
|
|
8737
|
+
if (!enabled) return;
|
|
8690
8738
|
let partIndex = partIndexes.get(id);
|
|
8691
8739
|
if (partIndex == null) {
|
|
8692
8740
|
partIndex = content.push({
|
|
@@ -8794,7 +8842,32 @@ const originalGenerateCallId$7 = createIdGenerator$1({
|
|
|
8794
8842
|
* @returns
|
|
8795
8843
|
* A result object for accessing different stream types and additional information.
|
|
8796
8844
|
*/
|
|
8797
|
-
function streamText(
|
|
8845
|
+
function streamText(options) {
|
|
8846
|
+
return streamTextInternal(options);
|
|
8847
|
+
}
|
|
8848
|
+
/**
|
|
8849
|
+
* Stream text with a single consumer, without replay or final-content getters.
|
|
8850
|
+
* Accepts the same options as streamText and uses the same execution engine.
|
|
8851
|
+
*/
|
|
8852
|
+
function streamTextLowMemory(options) {
|
|
8853
|
+
const telemetry = options.telemetry ?? options.experimental_telemetry;
|
|
8854
|
+
const integrations = telemetry?.integrations != null ? asArray(telemetry.integrations) : getGlobalTelemetryIntegrations();
|
|
8855
|
+
const collectContent = options.tools != null && Object.keys(options.tools).length > 0 || options.toolChoice != null || options.output != null || options.prepareStep != null || options.stopWhen != null || options.onEnd != null || options.onFinish != null || options.onStepEnd != null || options.onStepFinish != null || options.onAbort != null || options.onLanguageModelCallEnd != null || options.experimental_onLanguageModelCallEnd != null || telemetry?.isEnabled !== false && integrations.length > 0;
|
|
8856
|
+
return createSingleConsumerStreamTextResult(streamTextInternal({
|
|
8857
|
+
...options,
|
|
8858
|
+
_internal: {
|
|
8859
|
+
...options._internal,
|
|
8860
|
+
retention: {
|
|
8861
|
+
replay: false,
|
|
8862
|
+
collectContent
|
|
8863
|
+
}
|
|
8864
|
+
}
|
|
8865
|
+
}));
|
|
8866
|
+
}
|
|
8867
|
+
function streamTextInternal({ model, tools, toolChoice, instructions, system, prompt, messages, allowSystemInMessages, maxRetries, streamRetries, abortSignal, timeout, headers, stopWhen = isStepCount(1), experimental_sandbox: sandbox, output, toolApproval, experimental_toolCallers, experimental_toolApprovalSecret, experimental_telemetry, telemetry = experimental_telemetry, prepareStep, providerOptions, activeTools, toolOrder, toolCallConcurrency, experimental_repairToolCall, repairToolCall = experimental_repairToolCall, experimental_refineToolInput: refineToolInput, experimental_transform: transform, experimental_download: download, includeRawChunks, onChunk, onError: onErrorArg, onFinish, onEnd = onFinish, onAbort, onStepEnd, onStepFinish, onStart, experimental_onStart, onStepStart, experimental_onStepStart, onLanguageModelCallStart, experimental_onLanguageModelCallStart, onLanguageModelCallEnd, experimental_onLanguageModelCallEnd, onToolExecutionStart, onToolExecutionEnd, experimental_onToolCallStart, experimental_onToolCallFinish, runtimeContext = {}, toolsContext = {}, experimental_include, include = experimental_include, _internal: { now: now$2 = now, generateId = originalGenerateId$2, generateCallId = originalGenerateCallId$7, retention = {
|
|
8868
|
+
replay: true,
|
|
8869
|
+
collectContent: true
|
|
8870
|
+
} } = {}, ...settings }) {
|
|
8798
8871
|
const resolvedToolCallConcurrency = prepareToolCallConcurrency(toolCallConcurrency);
|
|
8799
8872
|
const totalTimeoutMs = getTotalTimeoutMs(timeout);
|
|
8800
8873
|
const stepTimeoutMs = getStepTimeoutMs(timeout);
|
|
@@ -8814,6 +8887,7 @@ function streamText({ model, tools, toolChoice, instructions, system, prompt, me
|
|
|
8814
8887
|
const resolvedOnToolExecutionEnd = onToolExecutionEnd ?? experimental_onToolCallFinish;
|
|
8815
8888
|
const resolvedOnStepEnd = onStepEnd ?? onStepFinish;
|
|
8816
8889
|
return new DefaultStreamTextResult({
|
|
8890
|
+
retention,
|
|
8817
8891
|
model: resolveLanguageModel(model),
|
|
8818
8892
|
telemetry,
|
|
8819
8893
|
headers,
|
|
@@ -8883,7 +8957,7 @@ async function markPromiseAsHandled$1(promise) {
|
|
|
8883
8957
|
await promise;
|
|
8884
8958
|
} catch {}
|
|
8885
8959
|
}
|
|
8886
|
-
function createOutputTransformStream(output) {
|
|
8960
|
+
function createOutputTransformStream(output, collectOutput = true) {
|
|
8887
8961
|
let firstTextChunkId = void 0;
|
|
8888
8962
|
let text = "";
|
|
8889
8963
|
let textChunk = "";
|
|
@@ -8917,6 +8991,13 @@ function createOutputTransformStream(output) {
|
|
|
8917
8991
|
textChunk = "";
|
|
8918
8992
|
}
|
|
8919
8993
|
return new TransformStream({ async transform(chunk, controller) {
|
|
8994
|
+
if (!collectOutput) {
|
|
8995
|
+
controller.enqueue(isStreamRetryBoundaryPart(chunk) ? chunk : {
|
|
8996
|
+
part: chunk,
|
|
8997
|
+
partialOutput: void 0
|
|
8998
|
+
});
|
|
8999
|
+
return;
|
|
9000
|
+
}
|
|
8920
9001
|
if (isStreamRetryBoundaryPart(chunk)) {
|
|
8921
9002
|
resetOutputState();
|
|
8922
9003
|
controller.enqueue(chunk);
|
|
@@ -9047,12 +9128,14 @@ function applyStreamTextTransforms({ stream, transforms, tools, stopStream }) {
|
|
|
9047
9128
|
});
|
|
9048
9129
|
}
|
|
9049
9130
|
var DefaultStreamTextResult = class {
|
|
9050
|
-
constructor({ model, telemetry, headers, settings, maxRetries: maxRetriesArg, streamRetries: streamRetriesArg, abortSignal, stepTimeoutMs, stepAbortController, firstChunkTimeoutMs, firstChunkAbortController, chunkTimeoutMs, chunkAbortController, instructions, system, prompt, messages, allowSystemInMessages, experimental_sandbox: sandbox, tools, toolChoice, transforms, activeTools, toolOrder, toolCallConcurrency, repairToolCall, refineToolInput, stopConditions, output, toolApproval, experimental_toolCallers, experimental_toolApprovalSecret, providerOptions, prepareStep, now, generateId, generateCallId, timeout, onChunk, onError, canRetryStreamViaOnError, onEnd, onAbort, onStepFinish, onStart, onStepStart, onLanguageModelCallStart, onLanguageModelCallEnd, onToolExecutionStart, onToolExecutionEnd, runtimeContext, toolsContext, download, include }) {
|
|
9131
|
+
constructor({ retention, model, telemetry, headers, settings, maxRetries: maxRetriesArg, streamRetries: streamRetriesArg, abortSignal, stepTimeoutMs, stepAbortController, firstChunkTimeoutMs, firstChunkAbortController, chunkTimeoutMs, chunkAbortController, instructions, system, prompt, messages, allowSystemInMessages, experimental_sandbox: sandbox, tools, toolChoice, transforms, activeTools, toolOrder, toolCallConcurrency, repairToolCall, refineToolInput, stopConditions, output, toolApproval, experimental_toolCallers, experimental_toolApprovalSecret, providerOptions, prepareStep, now, generateId, generateCallId, timeout, onChunk, onError, canRetryStreamViaOnError, onEnd, onAbort, onStepFinish, onStart, onStepStart, onLanguageModelCallStart, onLanguageModelCallEnd, onToolExecutionStart, onToolExecutionEnd, runtimeContext, toolsContext, download, include }) {
|
|
9051
9132
|
this._totalUsage = new DelayedPromise();
|
|
9052
9133
|
this._finishReason = new DelayedPromise();
|
|
9053
9134
|
this._rawFinishReason = new DelayedPromise();
|
|
9054
9135
|
this._steps = new DelayedPromise();
|
|
9055
9136
|
this._initialResponseMessages = new DelayedPromise();
|
|
9137
|
+
this.streamClaimed = false;
|
|
9138
|
+
this.retention = retention;
|
|
9056
9139
|
this.outputSpecification = output;
|
|
9057
9140
|
this.tools = tools;
|
|
9058
9141
|
const resolvedToolCallers = resolveToolCallerConfiguration({
|
|
@@ -9076,7 +9159,7 @@ var DefaultStreamTextResult = class {
|
|
|
9076
9159
|
let recordedRequest = {};
|
|
9077
9160
|
let recordedRequestMessages = [];
|
|
9078
9161
|
let recordedWarnings = [];
|
|
9079
|
-
|
|
9162
|
+
let recordedSteps = [];
|
|
9080
9163
|
const initialResponseMessages = [];
|
|
9081
9164
|
let stepMessagesForNextStep;
|
|
9082
9165
|
let currentStepMessages = [];
|
|
@@ -9134,14 +9217,16 @@ var DefaultStreamTextResult = class {
|
|
|
9134
9217
|
}
|
|
9135
9218
|
});
|
|
9136
9219
|
}
|
|
9137
|
-
if (part.type === "custom" || part.type === "source" || part.type === "tool-call" || part.type === "tool-approval-request" || part.type === "tool-approval-response" || part.type === "tool-error")
|
|
9220
|
+
if (part.type === "custom" || part.type === "source" || part.type === "tool-call" || part.type === "tool-approval-request" || part.type === "tool-approval-response" || part.type === "tool-error") {
|
|
9221
|
+
if (retention.collectContent) recordedContent.push(part);
|
|
9222
|
+
}
|
|
9138
9223
|
if (part.type === "text-start") {
|
|
9139
9224
|
activeTextContent[part.id] = {
|
|
9140
9225
|
type: "text",
|
|
9141
9226
|
text: "",
|
|
9142
9227
|
providerMetadata: part.providerMetadata
|
|
9143
9228
|
};
|
|
9144
|
-
recordedContent.push(activeTextContent[part.id]);
|
|
9229
|
+
if (retention.collectContent) recordedContent.push(activeTextContent[part.id]);
|
|
9145
9230
|
}
|
|
9146
9231
|
if (part.type === "text-delta") {
|
|
9147
9232
|
const activeText = activeTextContent[part.id];
|
|
@@ -9155,7 +9240,7 @@ var DefaultStreamTextResult = class {
|
|
|
9155
9240
|
});
|
|
9156
9241
|
return;
|
|
9157
9242
|
}
|
|
9158
|
-
activeText.text += part.text;
|
|
9243
|
+
if (retention.collectContent) activeText.text += part.text;
|
|
9159
9244
|
activeText.providerMetadata = part.providerMetadata ?? activeText.providerMetadata;
|
|
9160
9245
|
}
|
|
9161
9246
|
if (part.type === "text-end") {
|
|
@@ -9180,7 +9265,7 @@ var DefaultStreamTextResult = class {
|
|
|
9180
9265
|
text: "",
|
|
9181
9266
|
providerMetadata: part.providerMetadata
|
|
9182
9267
|
};
|
|
9183
|
-
recordedContent.push(activeReasoningContent[part.id]);
|
|
9268
|
+
if (retention.collectContent) recordedContent.push(activeReasoningContent[part.id]);
|
|
9184
9269
|
}
|
|
9185
9270
|
if (part.type === "reasoning-delta") {
|
|
9186
9271
|
const activeReasoning = activeReasoningContent[part.id];
|
|
@@ -9194,7 +9279,7 @@ var DefaultStreamTextResult = class {
|
|
|
9194
9279
|
});
|
|
9195
9280
|
return;
|
|
9196
9281
|
}
|
|
9197
|
-
activeReasoning.text += part.text;
|
|
9282
|
+
if (retention.collectContent) activeReasoning.text += part.text;
|
|
9198
9283
|
activeReasoning.providerMetadata = part.providerMetadata ?? activeReasoning.providerMetadata;
|
|
9199
9284
|
}
|
|
9200
9285
|
if (part.type === "reasoning-end") {
|
|
@@ -9212,12 +9297,16 @@ var DefaultStreamTextResult = class {
|
|
|
9212
9297
|
activeReasoning.providerMetadata = part.providerMetadata ?? activeReasoning.providerMetadata;
|
|
9213
9298
|
delete activeReasoningContent[part.id];
|
|
9214
9299
|
}
|
|
9215
|
-
if (part.type === "file" || part.type === "reasoning-file")
|
|
9216
|
-
|
|
9217
|
-
|
|
9218
|
-
|
|
9219
|
-
|
|
9220
|
-
|
|
9300
|
+
if (part.type === "file" || part.type === "reasoning-file") {
|
|
9301
|
+
if (retention.collectContent) recordedContent.push({
|
|
9302
|
+
type: part.type,
|
|
9303
|
+
file: part.file,
|
|
9304
|
+
...part.providerMetadata != null ? { providerMetadata: part.providerMetadata } : {}
|
|
9305
|
+
});
|
|
9306
|
+
}
|
|
9307
|
+
if (part.type === "tool-result" && !part.preliminary) {
|
|
9308
|
+
if (retention.collectContent) recordedContent.push(part);
|
|
9309
|
+
}
|
|
9221
9310
|
if (part.type === "start-step") {
|
|
9222
9311
|
recordedContent = [];
|
|
9223
9312
|
activeReasoningContent = createIdMap();
|
|
@@ -9284,7 +9373,7 @@ var DefaultStreamTextResult = class {
|
|
|
9284
9373
|
self._finishReason.resolve(finishReason);
|
|
9285
9374
|
self._rawFinishReason.resolve(recordedRawFinishReason);
|
|
9286
9375
|
self._totalUsage.resolve(totalUsage);
|
|
9287
|
-
self._steps.resolve(recordedSteps);
|
|
9376
|
+
self._steps.resolve(retention.replay ? recordedSteps : []);
|
|
9288
9377
|
if (isAborted) return;
|
|
9289
9378
|
const finalStep = recordedSteps[recordedSteps.length - 1];
|
|
9290
9379
|
const content = recordedSteps.flatMap((step) => step.content);
|
|
@@ -9298,7 +9387,7 @@ var DefaultStreamTextResult = class {
|
|
|
9298
9387
|
const dynamicToolResults = recordedSteps.flatMap((step) => step.dynamicToolResults);
|
|
9299
9388
|
const warnings = recordedSteps.flatMap((step) => step.warnings ?? []);
|
|
9300
9389
|
const onEndWithOutput = onEnd == null ? void 0 : async (event) => {
|
|
9301
|
-
const parsedOutput = output == null ? void 0 : await self.getOutputPromise().catch(() => void 0);
|
|
9390
|
+
const parsedOutput = output == null ? void 0 : await (retention.replay ? self.getOutputPromise() : self.parseOutput(finalStep)).catch(() => void 0);
|
|
9302
9391
|
await onEnd({
|
|
9303
9392
|
...event,
|
|
9304
9393
|
...output != null ? { output: parsedOutput } : {}
|
|
@@ -9343,6 +9432,16 @@ var DefaultStreamTextResult = class {
|
|
|
9343
9432
|
})]);
|
|
9344
9433
|
} catch (error) {
|
|
9345
9434
|
controller.error(error);
|
|
9435
|
+
} finally {
|
|
9436
|
+
if (!retention.replay) {
|
|
9437
|
+
recordedSteps = [];
|
|
9438
|
+
recordedContent = [];
|
|
9439
|
+
recordedRequestMessages = [];
|
|
9440
|
+
currentStepMessages = [];
|
|
9441
|
+
stepMessagesForNextStep = void 0;
|
|
9442
|
+
activeTextContent = createIdMap();
|
|
9443
|
+
activeReasoningContent = createIdMap();
|
|
9444
|
+
}
|
|
9346
9445
|
}
|
|
9347
9446
|
}
|
|
9348
9447
|
});
|
|
@@ -9421,7 +9520,7 @@ var DefaultStreamTextResult = class {
|
|
|
9421
9520
|
isRunning = false;
|
|
9422
9521
|
}
|
|
9423
9522
|
});
|
|
9424
|
-
this.baseStream = stream.pipeThrough(createOutputTransformStream(output ?? text())).pipeThrough(eventProcessor);
|
|
9523
|
+
this.baseStream = stream.pipeThrough(createOutputTransformStream(output ?? text(), retention.replay || output != null)).pipeThrough(eventProcessor);
|
|
9425
9524
|
const { maxRetries } = prepareRetries({
|
|
9426
9525
|
maxRetries: maxRetriesArg,
|
|
9427
9526
|
abortSignal
|
|
@@ -9765,7 +9864,10 @@ var DefaultStreamTextResult = class {
|
|
|
9765
9864
|
callbacks: [onStepStart, telemetryDispatcher.onStepStart]
|
|
9766
9865
|
});
|
|
9767
9866
|
},
|
|
9768
|
-
_internal: {
|
|
9867
|
+
_internal: {
|
|
9868
|
+
now,
|
|
9869
|
+
collectContent: retention.collectContent
|
|
9870
|
+
},
|
|
9769
9871
|
...stepCallSettings
|
|
9770
9872
|
})));
|
|
9771
9873
|
const initialLanguageModelCall = await callLanguageModel();
|
|
@@ -10197,7 +10299,7 @@ var DefaultStreamTextResult = class {
|
|
|
10197
10299
|
});
|
|
10198
10300
|
}
|
|
10199
10301
|
get steps() {
|
|
10200
|
-
this.consumeStream();
|
|
10302
|
+
if (this.retention.replay) this.consumeStream();
|
|
10201
10303
|
return this._steps.promise;
|
|
10202
10304
|
}
|
|
10203
10305
|
get finalStep() {
|
|
@@ -10258,15 +10360,15 @@ var DefaultStreamTextResult = class {
|
|
|
10258
10360
|
return Promise.all([this._initialResponseMessages.promise, this.steps]).then(([initialResponseMessages, steps]) => [...initialResponseMessages, ...steps.flatMap((step) => step.response.messages)]);
|
|
10259
10361
|
}
|
|
10260
10362
|
get totalUsage() {
|
|
10261
|
-
this.consumeStream();
|
|
10363
|
+
if (this.retention.replay) this.consumeStream();
|
|
10262
10364
|
return this._totalUsage.promise;
|
|
10263
10365
|
}
|
|
10264
10366
|
get finishReason() {
|
|
10265
|
-
this.consumeStream();
|
|
10367
|
+
if (this.retention.replay) this.consumeStream();
|
|
10266
10368
|
return this._finishReason.promise;
|
|
10267
10369
|
}
|
|
10268
10370
|
get rawFinishReason() {
|
|
10269
|
-
this.consumeStream();
|
|
10371
|
+
if (this.retention.replay) this.consumeStream();
|
|
10270
10372
|
return this._rawFinishReason.promise;
|
|
10271
10373
|
}
|
|
10272
10374
|
/**
|
|
@@ -10278,15 +10380,50 @@ var DefaultStreamTextResult = class {
|
|
|
10278
10380
|
* However, the LLM results are expected to be small enough to not cause issues.
|
|
10279
10381
|
*/
|
|
10280
10382
|
teeStream() {
|
|
10383
|
+
if (!this.retention.replay) {
|
|
10384
|
+
if (this.streamClaimed) throw new AISDKError$1({
|
|
10385
|
+
name: "AI_StreamAlreadyConsumedError",
|
|
10386
|
+
message: "This result supports one stream consumer. Choose one stream projection or response helper."
|
|
10387
|
+
});
|
|
10388
|
+
this.streamClaimed = true;
|
|
10389
|
+
const reader = this.baseStream.getReader();
|
|
10390
|
+
const rejectResults = (error) => this.rejectResultPromises(error);
|
|
10391
|
+
return new ReadableStream({
|
|
10392
|
+
async pull(controller) {
|
|
10393
|
+
try {
|
|
10394
|
+
const { done, value } = await reader.read();
|
|
10395
|
+
if (done) {
|
|
10396
|
+
reader.releaseLock();
|
|
10397
|
+
controller.close();
|
|
10398
|
+
} else controller.enqueue(value);
|
|
10399
|
+
} catch (error) {
|
|
10400
|
+
rejectResults(error);
|
|
10401
|
+
reader.releaseLock();
|
|
10402
|
+
controller.error(error);
|
|
10403
|
+
}
|
|
10404
|
+
},
|
|
10405
|
+
async cancel(reason) {
|
|
10406
|
+
rejectResults(reason ?? new DOMException("The stream was cancelled.", "AbortError"));
|
|
10407
|
+
try {
|
|
10408
|
+
await reader.cancel(reason);
|
|
10409
|
+
} finally {
|
|
10410
|
+
reader.releaseLock();
|
|
10411
|
+
}
|
|
10412
|
+
}
|
|
10413
|
+
}, { highWaterMark: 0 });
|
|
10414
|
+
}
|
|
10281
10415
|
const [stream1, stream2] = this.baseStream.tee();
|
|
10282
10416
|
this.baseStream = stream2;
|
|
10283
10417
|
return stream1;
|
|
10284
10418
|
}
|
|
10285
10419
|
get textStream() {
|
|
10286
|
-
return
|
|
10420
|
+
return this.asIterableStream(toTextStream({ stream: this.stream }));
|
|
10421
|
+
}
|
|
10422
|
+
asIterableStream(stream) {
|
|
10423
|
+
return this.retention.replay ? createAsyncIterableStream(stream) : asAsyncIterableStream(stream);
|
|
10287
10424
|
}
|
|
10288
10425
|
get stream() {
|
|
10289
|
-
return
|
|
10426
|
+
return this.asIterableStream(this.teeStream().pipeThrough(new TransformStream({ transform({ part }, controller) {
|
|
10290
10427
|
controller.enqueue(part);
|
|
10291
10428
|
} })));
|
|
10292
10429
|
}
|
|
@@ -10322,9 +10459,10 @@ var DefaultStreamTextResult = class {
|
|
|
10322
10459
|
}
|
|
10323
10460
|
}
|
|
10324
10461
|
async consumeStream(options) {
|
|
10462
|
+
const stream = this.stream;
|
|
10325
10463
|
try {
|
|
10326
10464
|
await consumeStream({
|
|
10327
|
-
stream
|
|
10465
|
+
stream,
|
|
10328
10466
|
onError: (error) => {
|
|
10329
10467
|
this.rejectResultPromises(error);
|
|
10330
10468
|
options?.onError?.(error);
|
|
@@ -10339,25 +10477,27 @@ var DefaultStreamTextResult = class {
|
|
|
10339
10477
|
return this.partialOutputStream;
|
|
10340
10478
|
}
|
|
10341
10479
|
get partialOutputStream() {
|
|
10342
|
-
|
|
10480
|
+
if (!this.retention.replay && this.outputSpecification == null) throw new UnsupportedFunctionalityError$1({ functionality: "partialOutputStream without an explicit output specification with experimental_streamTextLowMemory" });
|
|
10481
|
+
return this.asIterableStream(this.teeStream().pipeThrough(new TransformStream({ transform({ partialOutput }, controller) {
|
|
10343
10482
|
if (partialOutput !== void 0) controller.enqueue(partialOutput);
|
|
10344
10483
|
} })));
|
|
10345
10484
|
}
|
|
10346
10485
|
get elementStream() {
|
|
10347
10486
|
const transform = this.outputSpecification?.createElementStreamTransform();
|
|
10348
10487
|
if (transform == null) throw new UnsupportedFunctionalityError$1({ functionality: `element streams in ${this.outputSpecification?.name ?? "text"} mode` });
|
|
10349
|
-
return
|
|
10488
|
+
return this.asIterableStream(this.teeStream().pipeThrough(transform));
|
|
10350
10489
|
}
|
|
10351
10490
|
getOutputPromise() {
|
|
10352
|
-
if (this.outputPromise == null) this.outputPromise = this.finalStep.then((step) =>
|
|
10353
|
-
return (this.outputSpecification ?? text()).parseCompleteOutput({ text: step.text }, {
|
|
10354
|
-
response: step.response,
|
|
10355
|
-
usage: step.usage,
|
|
10356
|
-
finishReason: step.finishReason
|
|
10357
|
-
});
|
|
10358
|
-
});
|
|
10491
|
+
if (this.outputPromise == null) this.outputPromise = this.finalStep.then((step) => this.parseOutput(step));
|
|
10359
10492
|
return this.outputPromise;
|
|
10360
10493
|
}
|
|
10494
|
+
parseOutput(step) {
|
|
10495
|
+
return (this.outputSpecification ?? text()).parseCompleteOutput({ text: step.text }, {
|
|
10496
|
+
response: step.response,
|
|
10497
|
+
usage: step.usage,
|
|
10498
|
+
finishReason: step.finishReason
|
|
10499
|
+
});
|
|
10500
|
+
}
|
|
10361
10501
|
get output() {
|
|
10362
10502
|
return this.getOutputPromise();
|
|
10363
10503
|
}
|
|
@@ -12936,20 +13076,22 @@ function validateDecisionInput({ state, questions }) {
|
|
|
12936
13076
|
if (!isRecord$1(questions) || Object.keys(questions).length === 0) invalidInput("questions", questions, "must be a nonempty question map");
|
|
12937
13077
|
for (const [id, question] of Object.entries(questions)) {
|
|
12938
13078
|
const parameter = `questions.${id}`;
|
|
12939
|
-
if (!isRecord$1(question) || !isInput(question.instructions)) invalidInput(parameter, question, "instructions must be a JSON-compatible string, object, or array");
|
|
13079
|
+
if (!isRecord$1(question) || (question.type === "box" || question.instructions != null) && !isInput(question.instructions)) invalidInput(parameter, question, "instructions must be a JSON-compatible string, object, or array");
|
|
13080
|
+
if (question.type === "box") continue;
|
|
12940
13081
|
const criteria = question.criteria;
|
|
12941
13082
|
switch (question.type) {
|
|
12942
13083
|
case "choice":
|
|
12943
13084
|
if (!isRecord$1(criteria) || Object.keys(criteria).length === 0) invalidInput(parameter, question, "choice criteria must be a nonempty option map");
|
|
12944
13085
|
break;
|
|
12945
13086
|
case "score":
|
|
12946
|
-
if (!Array.isArray(criteria) || criteria.length
|
|
13087
|
+
if (!Array.isArray(criteria) || criteria.length === 0) invalidInput(parameter, question, "score criteria must contain at least one ordered level");
|
|
12947
13088
|
break;
|
|
12948
13089
|
case "boolean":
|
|
13090
|
+
if (question.instructions == null && (!isRecord$1(criteria) || !Object.values(criteria).some((value) => value != null))) invalidInput(parameter, question, "boolean questions require instructions or at least one non-null criterion");
|
|
12949
13091
|
if (criteria === void 0) continue;
|
|
12950
13092
|
if (!isRecord$1(criteria) || Object.keys(criteria).some((key) => key !== "true" && key !== "false")) invalidInput(parameter, question, "boolean criteria may only describe true and false");
|
|
12951
13093
|
break;
|
|
12952
|
-
default: invalidInput(parameter, question, "question type must be choice, score, or
|
|
13094
|
+
default: invalidInput(parameter, question, "question type must be choice, score, boolean, or box");
|
|
12953
13095
|
}
|
|
12954
13096
|
if (!isJSON(criteria) || Object.values(criteria).some((value) => value !== null && !isInput(value))) invalidInput(parameter, question, "criteria descriptions must be JSON-compatible strings, objects, arrays, or null");
|
|
12955
13097
|
}
|
|
@@ -13003,6 +13145,16 @@ function validateDecisionAnswers({ questions, answers, rounding }) {
|
|
|
13003
13145
|
if (Math.abs(mean - answer.score) > tolerance + meanRoundingError + scoreError) invalidAnswer(answers, `Question "${id}" score must equal the probability-weighted mean within the declared rounding precision.`);
|
|
13004
13146
|
}
|
|
13005
13147
|
break;
|
|
13148
|
+
case "box": {
|
|
13149
|
+
const box = answer.box;
|
|
13150
|
+
if (!isRecord$1(box) || !hasExactKeys(box, [
|
|
13151
|
+
"top",
|
|
13152
|
+
"bottom",
|
|
13153
|
+
"left",
|
|
13154
|
+
"right"
|
|
13155
|
+
]) || !isProbability(box.left) || !isProbability(box.right) || !isProbability(box.top) || !isProbability(box.bottom) || !(box.left < box.right) || !(box.top < box.bottom)) invalidAnswer(answers, `Question "${id}" must return box edges in [0, 1] with left < right and top < bottom.`);
|
|
13156
|
+
break;
|
|
13157
|
+
}
|
|
13006
13158
|
case "boolean": if (!isProbability(answer.probability)) invalidAnswer(answers, `Question "${id}" must return P(true) as a finite probability in [0, 1].`);
|
|
13007
13159
|
}
|
|
13008
13160
|
}
|
|
@@ -19849,7 +20001,10 @@ var DefaultChatTransport = class extends HttpChatTransport {
|
|
|
19849
20001
|
//#endregion
|
|
19850
20002
|
//#region src/ui/chat.ts
|
|
19851
20003
|
var AbstractChat = class {
|
|
19852
|
-
|
|
20004
|
+
get id() {
|
|
20005
|
+
return this._id ??= this.generateId();
|
|
20006
|
+
}
|
|
20007
|
+
constructor({ generateId = generateId$1, id, transport = new DefaultChatTransport(), messageMetadataSchema, dataPartSchemas, state, onError, onToolCall, onFinish, onData, sendAutomaticallyWhen }) {
|
|
19853
20008
|
this.pendingMessagePreparations = /* @__PURE__ */ new Set();
|
|
19854
20009
|
this.activeResponse = void 0;
|
|
19855
20010
|
this.activeResumeRequest = void 0;
|
|
@@ -20056,7 +20211,7 @@ var AbstractChat = class {
|
|
|
20056
20211
|
await this.stop();
|
|
20057
20212
|
this.transport.close?.();
|
|
20058
20213
|
};
|
|
20059
|
-
this.
|
|
20214
|
+
this._id = id;
|
|
20060
20215
|
this.transport = transport;
|
|
20061
20216
|
this.generateId = generateId;
|
|
20062
20217
|
this.messageMetadataSchema = messageMetadataSchema;
|
|
@@ -21010,6 +21165,6 @@ async function uploadSkill({ api, files, displayTitle, providerOptions }) {
|
|
|
21010
21165
|
});
|
|
21011
21166
|
}
|
|
21012
21167
|
//#endregion
|
|
21013
|
-
export { AISDKError, AI_SDK_TELEMETRY_TRACING_CHANNEL, APICallError, AbstractChat, DefaultChatTransport, DefaultGeneratedFile, DirectChatTransport, DownloadError, EmptyResponseBodyError, AbstractRealtimeSession as Experimental_AbstractRealtimeSession, ToolLoopAgent as Experimental_Agent, ToolLoopAgent, Experimental_DecisionRefusalError, Experimental_DecisionUnsupportedQuestionTypeError, Experimental_EvaluationUnsupportedQuestionTypeError, HttpChatTransport, InvalidArgumentError, InvalidDataContentError, InvalidMessageRoleError, InvalidPromptError, InvalidResponseDataError, InvalidStreamPartError, InvalidToolApprovalError, InvalidToolApprovalSignatureError, InvalidToolInputError, JSONParseError, JsonToSseTransformStream, LoadAPIKeyError, LoadSettingError, MessageConversionError, MissingToolResultsError, NoContentGeneratedError, NoImageGeneratedError, NoObjectGeneratedError, NoOutputGeneratedError, NoSpeechGeneratedError, NoSuchModelError, NoSuchProviderError, NoSuchProviderReferenceError, NoSuchToolError, NoTranscriptGeneratedError, NoTranslationGeneratedError, NoVideoGeneratedError, output_exports as Output, RetryError, SerialJobExecutor, StreamProviderError, TextStreamChatTransport, TooManyEmbeddingValuesForCallError, ToolCallNotFoundForApprovalError, ToolCallRepairError, ToolChoiceViolationError, TypeValidationError, UIMessageStreamError, UI_MESSAGE_STREAM_HEADERS, UnsupportedFunctionalityError, UnsupportedModelVersionError, WebSocketChatTransport, addToolInputExamplesMiddleware, asSchema, assistantModelMessageSchema, callCompletionApi, consumeStream, convertDataContentToBase64String, convertFileListToFileUIParts, convertToModelMessages, cosineSimilarity, createAgentUIStream, createAgentUIStreamResponse, createDownload, createGateway, createIdGenerator, createProviderRegistry, createTextStreamResponse, createUIMessageStream, createUIMessageStreamResponse, customProvider, defaultEmbeddingSettingsMiddleware, defaultInstructionsMiddleware, defaultSettingsMiddleware, detectToolDrift, dynamicTool, embed, embedMany, cancelBatch as experimental_cancelBatch, experimental_createProviderRegistry, decide as experimental_decide, decodeRealtimeAudio as experimental_decodeRealtimeAudio, encodeRealtimeAudio as experimental_encodeRealtimeAudio, experimental_evaluate, filterActiveTools as experimental_filterActiveTools, experimental_generateSpeech, experimental_generateVideo, getBatchResults as experimental_getBatchResults, getBatchStatus as experimental_getBatchStatus, getRealtimeToolDefinitions as experimental_getRealtimeToolDefinitions, experimental_getVideoStatus, listBatches as experimental_listBatches, resampleAudio as experimental_resampleAudio, startBatch as experimental_startBatch, experimental_startVideo, streamLanguageModelCall as experimental_streamLanguageModelCall, streamTranscribe as experimental_streamTranscribe, streamTranslate as experimental_streamTranslate, experimental_toolCaller, experimental_transcribe, extractJsonMiddleware, extractReasoningMiddleware, fingerprintTools, gateway, generateId, generateImage, generateObject, generateSpeech, generateText, getChunkTimeoutMs, getFirstChunkTimeoutMs, getStaticToolName, getStepTimeoutMs, getTextFromDataUrl, getToolName, getToolOrDynamicToolName, getToolTimeoutMs, getTotalTimeoutMs, hasToolCall, isCustomContentUIPart, isDataUIPart, isDeepEqualData, isDynamicToolUIPart, isFileUIPart, isLoopFinished, isReasoningFileUIPart, isReasoningUIPart, isStaticToolUIPart, isStepCount, isStepCount as stepCountIs, isTextUIPart, isToolOutputErrorUIPart, isToolUIPart, jsonSchema, lastAssistantMessageIsCompleteWithApprovalResponses, lastAssistantMessageIsCompleteWithToolCalls, modelMessageSchema, parseJsonEventStream, parsePartialJson, pipeAgentUIStreamToResponse, pipeTextStreamToResponse, pipeUIMessageStreamToResponse, pruneMessages, readUIMessageStream, registerTelemetry, rerank, safeValidateUIMessages, safeValidateWebSocketChatTransportRequest, simulateReadableStream, simulateStreamingMiddleware, smoothStream, streamObject, streamText, systemModelMessageSchema, toTextStream, toUIMessageChunk, toUIMessageStream, tool, toolModelMessageSchema, toolSearch, transcribe, uiMessageChunkSchema, uploadFile, uploadSkill, userModelMessageSchema, validateUIMessages, wrapEmbeddingModel, wrapImageModel, wrapLanguageModel, wrapProvider, zodSchema };
|
|
21168
|
+
export { AISDKError, AI_SDK_TELEMETRY_TRACING_CHANNEL, APICallError, AbstractChat, DefaultChatTransport, DefaultGeneratedFile, DirectChatTransport, DownloadError, EmptyResponseBodyError, AbstractRealtimeSession as Experimental_AbstractRealtimeSession, ToolLoopAgent as Experimental_Agent, ToolLoopAgent, Experimental_DecisionRefusalError, Experimental_DecisionUnsupportedQuestionTypeError, Experimental_EvaluationUnsupportedQuestionTypeError, HttpChatTransport, InvalidArgumentError, InvalidDataContentError, InvalidMessageRoleError, InvalidPromptError, InvalidResponseDataError, InvalidStreamPartError, InvalidToolApprovalError, InvalidToolApprovalSignatureError, InvalidToolInputError, JSONParseError, JsonToSseTransformStream, LoadAPIKeyError, LoadSettingError, MessageConversionError, MissingToolResultsError, NoContentGeneratedError, NoImageGeneratedError, NoObjectGeneratedError, NoOutputGeneratedError, NoSpeechGeneratedError, NoSuchModelError, NoSuchProviderError, NoSuchProviderReferenceError, NoSuchToolError, NoTranscriptGeneratedError, NoTranslationGeneratedError, NoVideoGeneratedError, output_exports as Output, RetryError, SerialJobExecutor, StreamProviderError, TextStreamChatTransport, TooManyEmbeddingValuesForCallError, ToolCallNotFoundForApprovalError, ToolCallRepairError, ToolChoiceViolationError, TypeValidationError, UIMessageStreamError, UI_MESSAGE_STREAM_HEADERS, UnsupportedFunctionalityError, UnsupportedModelVersionError, WebSocketChatTransport, addToolInputExamplesMiddleware, asSchema, assistantModelMessageSchema, callCompletionApi, consumeStream, convertDataContentToBase64String, convertFileListToFileUIParts, convertToModelMessages, cosineSimilarity, createAgentUIStream, createAgentUIStreamResponse, createDownload, createGateway, createIdGenerator, createProviderRegistry, createTextStreamResponse, createUIMessageStream, createUIMessageStreamResponse, customProvider, defaultEmbeddingSettingsMiddleware, defaultInstructionsMiddleware, defaultSettingsMiddleware, detectToolDrift, dynamicTool, embed, embedMany, cancelBatch as experimental_cancelBatch, experimental_createProviderRegistry, decide as experimental_decide, decodeRealtimeAudio as experimental_decodeRealtimeAudio, encodeRealtimeAudio as experimental_encodeRealtimeAudio, experimental_evaluate, filterActiveTools as experimental_filterActiveTools, experimental_generateSpeech, experimental_generateVideo, getBatchResults as experimental_getBatchResults, getBatchStatus as experimental_getBatchStatus, getRealtimeToolDefinitions as experimental_getRealtimeToolDefinitions, experimental_getVideoStatus, listBatches as experimental_listBatches, resampleAudio as experimental_resampleAudio, startBatch as experimental_startBatch, experimental_startVideo, streamLanguageModelCall as experimental_streamLanguageModelCall, streamTextLowMemory as experimental_streamTextLowMemory, streamTranscribe as experimental_streamTranscribe, streamTranslate as experimental_streamTranslate, experimental_toolCaller, experimental_transcribe, extractJsonMiddleware, extractReasoningMiddleware, fingerprintTools, gateway, generateId, generateImage, generateObject, generateSpeech, generateText, getChunkTimeoutMs, getFirstChunkTimeoutMs, getStaticToolName, getStepTimeoutMs, getTextFromDataUrl, getToolName, getToolOrDynamicToolName, getToolTimeoutMs, getTotalTimeoutMs, hasToolCall, isCustomContentUIPart, isDataUIPart, isDeepEqualData, isDynamicToolUIPart, isFileUIPart, isLoopFinished, isReasoningFileUIPart, isReasoningUIPart, isStaticToolUIPart, isStepCount, isStepCount as stepCountIs, isTextUIPart, isToolOutputErrorUIPart, isToolUIPart, jsonSchema, lastAssistantMessageIsCompleteWithApprovalResponses, lastAssistantMessageIsCompleteWithToolCalls, modelMessageSchema, parseJsonEventStream, parsePartialJson, pipeAgentUIStreamToResponse, pipeTextStreamToResponse, pipeUIMessageStreamToResponse, pruneMessages, readUIMessageStream, registerTelemetry, rerank, safeValidateUIMessages, safeValidateWebSocketChatTransportRequest, simulateReadableStream, simulateStreamingMiddleware, smoothStream, streamObject, streamText, systemModelMessageSchema, toTextStream, toUIMessageChunk, toUIMessageStream, tool, toolModelMessageSchema, toolSearch, transcribe, uiMessageChunkSchema, uploadFile, uploadSkill, userModelMessageSchema, validateUIMessages, wrapEmbeddingModel, wrapImageModel, wrapLanguageModel, wrapProvider, zodSchema };
|
|
21014
21169
|
|
|
21015
21170
|
//# sourceMappingURL=index.js.map
|