ai 7.0.109 → 7.0.111
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 +14 -0
- package/dist/index.d.ts +152 -41
- package/dist/index.js +232 -64
- package/dist/index.js.map +1 -1
- package/dist/internal/index.d.ts +141 -2
- package/dist/internal/index.js +13 -1
- package/dist/internal/index.js.map +1 -1
- package/docs/02-foundations/02-providers-and-models.mdx +1 -0
- package/docs/03-ai-sdk-core/32-evaluation.mdx +11 -1
- package/docs/03-ai-sdk-core/60-telemetry.mdx +56 -3
- package/docs/03-ai-sdk-core/65-lifecycle-callbacks.mdx +124 -2
- package/docs/07-reference/01-ai-sdk-core/14-evaluate.mdx +16 -9
- package/package.json +4 -4
- package/src/batch/batch.ts +18 -3
- package/src/evaluate/evaluate-events.ts +131 -0
- package/src/evaluate/evaluate.ts +145 -40
- package/src/evaluate/index.ts +6 -0
- package/src/evaluate/restricted-telemetry-dispatcher.ts +46 -0
- package/src/generate-text/convert-language-model-content.ts +15 -6
- package/src/generate-text/generate-text.ts +7 -2
- package/src/generate-text/resolve-generated-file-data.ts +41 -0
- package/src/generate-text/stream-language-model-call.ts +5 -4
- package/src/telemetry/create-telemetry-dispatcher.ts +12 -0
- package/src/telemetry/telemetry.ts +34 -0
- package/src/telemetry/tracing-channel.ts +2 -1
package/dist/index.js
CHANGED
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
} from "@ai-sdk/gateway";
|
|
12
12
|
import {
|
|
13
13
|
asSchema as asSchema8,
|
|
14
|
-
createIdGenerator as
|
|
14
|
+
createIdGenerator as createIdGenerator10,
|
|
15
15
|
dynamicTool,
|
|
16
16
|
experimental_toolCaller,
|
|
17
17
|
generateId as generateId4,
|
|
@@ -1334,7 +1334,7 @@ import {
|
|
|
1334
1334
|
} from "@ai-sdk/provider-utils";
|
|
1335
1335
|
|
|
1336
1336
|
// src/version.ts
|
|
1337
|
-
var VERSION = true ? "7.0.
|
|
1337
|
+
var VERSION = true ? "7.0.111" : "0.0.0-test";
|
|
1338
1338
|
|
|
1339
1339
|
// src/util/download/download.ts
|
|
1340
1340
|
var download = async ({
|
|
@@ -3169,14 +3169,37 @@ var DefaultGeneratedFileWithType = class extends DefaultGeneratedFile {
|
|
|
3169
3169
|
}
|
|
3170
3170
|
};
|
|
3171
3171
|
|
|
3172
|
+
// src/generate-text/resolve-generated-file-data.ts
|
|
3173
|
+
async function resolveGeneratedFileData({
|
|
3174
|
+
data,
|
|
3175
|
+
abortSignal,
|
|
3176
|
+
cache
|
|
3177
|
+
}) {
|
|
3178
|
+
if (data.type === "data") {
|
|
3179
|
+
return data.data;
|
|
3180
|
+
}
|
|
3181
|
+
const cachedData = cache == null ? void 0 : cache.get(data);
|
|
3182
|
+
if (cachedData != null) {
|
|
3183
|
+
return cachedData;
|
|
3184
|
+
}
|
|
3185
|
+
const downloadedData = (await download({
|
|
3186
|
+
url: data.url,
|
|
3187
|
+
abortSignal
|
|
3188
|
+
})).data;
|
|
3189
|
+
cache == null ? void 0 : cache.set(data, downloadedData);
|
|
3190
|
+
return downloadedData;
|
|
3191
|
+
}
|
|
3192
|
+
|
|
3172
3193
|
// src/generate-text/convert-language-model-content.ts
|
|
3173
|
-
function convertLanguageModelContent({
|
|
3194
|
+
async function convertLanguageModelContent({
|
|
3174
3195
|
content,
|
|
3175
3196
|
toolCalls,
|
|
3176
3197
|
toolOutputs,
|
|
3177
3198
|
toolApprovalRequests,
|
|
3178
3199
|
toolApprovalResponses,
|
|
3179
|
-
tools
|
|
3200
|
+
tools,
|
|
3201
|
+
abortSignal,
|
|
3202
|
+
generatedFileDataCache
|
|
3180
3203
|
}) {
|
|
3181
3204
|
const contentParts = [];
|
|
3182
3205
|
const toolOutputsWithApprovalResponses = [];
|
|
@@ -3199,7 +3222,11 @@ function convertLanguageModelContent({
|
|
|
3199
3222
|
contentParts.push({
|
|
3200
3223
|
type: part.type,
|
|
3201
3224
|
file: new DefaultGeneratedFile({
|
|
3202
|
-
data:
|
|
3225
|
+
data: await resolveGeneratedFileData({
|
|
3226
|
+
data: part.data,
|
|
3227
|
+
abortSignal,
|
|
3228
|
+
cache: generatedFileDataCache
|
|
3229
|
+
}),
|
|
3203
3230
|
mediaType: part.mediaType
|
|
3204
3231
|
}),
|
|
3205
3232
|
...part.providerMetadata != null ? { providerMetadata: part.providerMetadata } : {}
|
|
@@ -5129,6 +5156,18 @@ function createTelemetryDispatcher({
|
|
|
5129
5156
|
onEmbedEnd: mergeTelemetryCallback("onEmbedEnd"),
|
|
5130
5157
|
onRerankStart: mergeTelemetryCallback("onRerankStart"),
|
|
5131
5158
|
onRerankEnd: mergeTelemetryCallback("onRerankEnd"),
|
|
5159
|
+
experimental_onEvaluateStart: mergeTelemetryCallback(
|
|
5160
|
+
"experimental_onEvaluateStart"
|
|
5161
|
+
),
|
|
5162
|
+
experimental_onEvaluationModelCallStart: mergeTelemetryCallback(
|
|
5163
|
+
"experimental_onEvaluationModelCallStart"
|
|
5164
|
+
),
|
|
5165
|
+
experimental_onEvaluationModelCallEnd: mergeTelemetryCallback(
|
|
5166
|
+
"experimental_onEvaluationModelCallEnd"
|
|
5167
|
+
),
|
|
5168
|
+
experimental_onEvaluateEnd: mergeTelemetryCallback(
|
|
5169
|
+
"experimental_onEvaluateEnd"
|
|
5170
|
+
),
|
|
5132
5171
|
onEnd: mergeTelemetryCallback("onEnd"),
|
|
5133
5172
|
onAbort: mergeTelemetryCallback("onAbort"),
|
|
5134
5173
|
onError: mergeTelemetryCallback("onError"),
|
|
@@ -6364,13 +6403,16 @@ async function generateText({
|
|
|
6364
6403
|
const toolApprovalRequests = {};
|
|
6365
6404
|
const stepToolApprovalResponses = {};
|
|
6366
6405
|
const blockedToolCallIds = /* @__PURE__ */ new Set();
|
|
6367
|
-
const
|
|
6406
|
+
const generatedFileDataCache = /* @__PURE__ */ new WeakMap();
|
|
6407
|
+
const modelCallContent = await convertLanguageModelContent({
|
|
6368
6408
|
content: currentModelResponse.content,
|
|
6369
6409
|
toolCalls: stepToolCalls,
|
|
6370
6410
|
toolOutputs: [],
|
|
6371
6411
|
toolApprovalRequests: [],
|
|
6372
6412
|
toolApprovalResponses: [],
|
|
6373
|
-
tools
|
|
6413
|
+
tools,
|
|
6414
|
+
abortSignal: mergedAbortSignal,
|
|
6415
|
+
generatedFileDataCache
|
|
6374
6416
|
});
|
|
6375
6417
|
await notify({
|
|
6376
6418
|
event: {
|
|
@@ -6618,13 +6660,15 @@ async function generateText({
|
|
|
6618
6660
|
pendingDeferredToolCalls.delete(part.toolCallId);
|
|
6619
6661
|
}
|
|
6620
6662
|
}
|
|
6621
|
-
const stepContent = convertLanguageModelContent({
|
|
6663
|
+
const stepContent = await convertLanguageModelContent({
|
|
6622
6664
|
content: currentModelResponse.content,
|
|
6623
6665
|
toolCalls: stepToolCalls,
|
|
6624
6666
|
toolOutputs: clientToolOutputs,
|
|
6625
6667
|
toolApprovalRequests: Object.values(toolApprovalRequests),
|
|
6626
6668
|
toolApprovalResponses,
|
|
6627
|
-
tools
|
|
6669
|
+
tools,
|
|
6670
|
+
abortSignal: mergedAbortSignal,
|
|
6671
|
+
generatedFileDataCache
|
|
6628
6672
|
});
|
|
6629
6673
|
const stepResponseMessages = await toResponseMessages({
|
|
6630
6674
|
content: stepContent,
|
|
@@ -9408,7 +9452,10 @@ function createLanguageModelV4StreamPartToLanguageModelStreamPartTransform({
|
|
|
9408
9452
|
case "file":
|
|
9409
9453
|
case "reasoning-file": {
|
|
9410
9454
|
const file = new DefaultGeneratedFileWithType({
|
|
9411
|
-
data:
|
|
9455
|
+
data: await resolveGeneratedFileData({
|
|
9456
|
+
data: chunk.data,
|
|
9457
|
+
abortSignal
|
|
9458
|
+
}),
|
|
9412
9459
|
mediaType: chunk.mediaType
|
|
9413
9460
|
});
|
|
9414
9461
|
modelCallContent.push({
|
|
@@ -13702,7 +13749,13 @@ function getBatchResults({
|
|
|
13702
13749
|
});
|
|
13703
13750
|
const transformer = {
|
|
13704
13751
|
async transform(item, controller) {
|
|
13705
|
-
controller.enqueue(
|
|
13752
|
+
controller.enqueue(
|
|
13753
|
+
await convertBatchItemResult({
|
|
13754
|
+
item,
|
|
13755
|
+
tools,
|
|
13756
|
+
abortSignal: operationAbortSignal
|
|
13757
|
+
})
|
|
13758
|
+
);
|
|
13706
13759
|
},
|
|
13707
13760
|
cancel(reason) {
|
|
13708
13761
|
streamAbortController.abort(
|
|
@@ -13800,7 +13853,8 @@ function validateBatchReference({
|
|
|
13800
13853
|
}
|
|
13801
13854
|
async function convertBatchItemResult({
|
|
13802
13855
|
item,
|
|
13803
|
-
tools
|
|
13856
|
+
tools,
|
|
13857
|
+
abortSignal
|
|
13804
13858
|
}) {
|
|
13805
13859
|
switch (item.type) {
|
|
13806
13860
|
case "text":
|
|
@@ -13810,7 +13864,11 @@ async function convertBatchItemResult({
|
|
|
13810
13864
|
type: item.type,
|
|
13811
13865
|
id: item.id,
|
|
13812
13866
|
status: item.status,
|
|
13813
|
-
...await convertGenerateResult({
|
|
13867
|
+
...await convertGenerateResult({
|
|
13868
|
+
result: item.result,
|
|
13869
|
+
tools,
|
|
13870
|
+
abortSignal
|
|
13871
|
+
})
|
|
13814
13872
|
};
|
|
13815
13873
|
case "failed":
|
|
13816
13874
|
return {
|
|
@@ -13886,7 +13944,8 @@ function convertImageResult(result) {
|
|
|
13886
13944
|
}
|
|
13887
13945
|
async function convertGenerateResult({
|
|
13888
13946
|
result,
|
|
13889
|
-
tools
|
|
13947
|
+
tools,
|
|
13948
|
+
abortSignal
|
|
13890
13949
|
}) {
|
|
13891
13950
|
var _a25;
|
|
13892
13951
|
const toolCalls = await Promise.all(
|
|
@@ -13903,13 +13962,14 @@ async function convertGenerateResult({
|
|
|
13903
13962
|
})
|
|
13904
13963
|
)
|
|
13905
13964
|
);
|
|
13906
|
-
const content = convertLanguageModelContent({
|
|
13965
|
+
const content = await convertLanguageModelContent({
|
|
13907
13966
|
content: result.content,
|
|
13908
13967
|
toolCalls,
|
|
13909
13968
|
toolOutputs: [],
|
|
13910
13969
|
toolApprovalRequests: [],
|
|
13911
13970
|
toolApprovalResponses: [],
|
|
13912
|
-
tools
|
|
13971
|
+
tools,
|
|
13972
|
+
abortSignal
|
|
13913
13973
|
});
|
|
13914
13974
|
return {
|
|
13915
13975
|
content,
|
|
@@ -14478,9 +14538,40 @@ import {
|
|
|
14478
14538
|
Experimental_EvaluationUnsupportedQuestionTypeError as EvaluationUnsupportedQuestionTypeError
|
|
14479
14539
|
} from "@ai-sdk/provider";
|
|
14480
14540
|
import {
|
|
14541
|
+
createIdGenerator as createIdGenerator6,
|
|
14481
14542
|
withUserAgentSuffix as withUserAgentSuffix8
|
|
14482
14543
|
} from "@ai-sdk/provider-utils";
|
|
14483
14544
|
|
|
14545
|
+
// src/evaluate/restricted-telemetry-dispatcher.ts
|
|
14546
|
+
function createRestrictedTelemetryDispatcher3({
|
|
14547
|
+
telemetry
|
|
14548
|
+
}) {
|
|
14549
|
+
const dispatcher = createTelemetryDispatcher({ telemetry });
|
|
14550
|
+
return {
|
|
14551
|
+
...dispatcher,
|
|
14552
|
+
onStart: (event) => {
|
|
14553
|
+
var _a25;
|
|
14554
|
+
return (_a25 = dispatcher.experimental_onEvaluateStart) == null ? void 0 : _a25.call(dispatcher, {
|
|
14555
|
+
...event,
|
|
14556
|
+
runtimeContext: filterIncludedContext({
|
|
14557
|
+
context: event.runtimeContext,
|
|
14558
|
+
includeContext: telemetry == null ? void 0 : telemetry.includeRuntimeContext
|
|
14559
|
+
})
|
|
14560
|
+
});
|
|
14561
|
+
},
|
|
14562
|
+
onEnd: (event) => {
|
|
14563
|
+
var _a25;
|
|
14564
|
+
return (_a25 = dispatcher.experimental_onEvaluateEnd) == null ? void 0 : _a25.call(dispatcher, {
|
|
14565
|
+
...event,
|
|
14566
|
+
runtimeContext: filterIncludedContext({
|
|
14567
|
+
context: event.runtimeContext,
|
|
14568
|
+
includeContext: telemetry == null ? void 0 : telemetry.includeRuntimeContext
|
|
14569
|
+
})
|
|
14570
|
+
});
|
|
14571
|
+
}
|
|
14572
|
+
};
|
|
14573
|
+
}
|
|
14574
|
+
|
|
14484
14575
|
// src/evaluate/validate-evaluation.ts
|
|
14485
14576
|
import {
|
|
14486
14577
|
InvalidResponseDataError as InvalidResponseDataError3
|
|
@@ -14711,6 +14802,10 @@ function validateEvaluationAnswers({
|
|
|
14711
14802
|
}
|
|
14712
14803
|
|
|
14713
14804
|
// src/evaluate/evaluate.ts
|
|
14805
|
+
var originalGenerateCallId6 = createIdGenerator6({
|
|
14806
|
+
prefix: "call",
|
|
14807
|
+
size: 24
|
|
14808
|
+
});
|
|
14714
14809
|
async function evaluate({
|
|
14715
14810
|
model: modelArg,
|
|
14716
14811
|
state,
|
|
@@ -14718,9 +14813,14 @@ async function evaluate({
|
|
|
14718
14813
|
maxRetries,
|
|
14719
14814
|
abortSignal,
|
|
14720
14815
|
headers,
|
|
14721
|
-
providerOptions = {}
|
|
14816
|
+
providerOptions = {},
|
|
14817
|
+
telemetry,
|
|
14818
|
+
runtimeContext = {},
|
|
14819
|
+
onStart,
|
|
14820
|
+
onEnd,
|
|
14821
|
+
_internal: { generateCallId = originalGenerateCallId6 } = {}
|
|
14722
14822
|
}) {
|
|
14723
|
-
var _a25
|
|
14823
|
+
var _a25;
|
|
14724
14824
|
const model = resolveEvaluationModel(modelArg);
|
|
14725
14825
|
validateEvaluationInput({ state, questions });
|
|
14726
14826
|
for (const [questionId, question] of Object.entries(questions)) {
|
|
@@ -14733,51 +14833,119 @@ async function evaluate({
|
|
|
14733
14833
|
});
|
|
14734
14834
|
}
|
|
14735
14835
|
}
|
|
14736
|
-
const
|
|
14737
|
-
const
|
|
14738
|
-
|
|
14739
|
-
|
|
14740
|
-
state,
|
|
14741
|
-
questions,
|
|
14742
|
-
abortSignal,
|
|
14743
|
-
headers: withUserAgentSuffix8(headers != null ? headers : {}, `ai/${VERSION}`),
|
|
14744
|
-
providerOptions
|
|
14745
|
-
});
|
|
14836
|
+
const callId = generateCallId();
|
|
14837
|
+
const { maxRetries: resolvedMaxRetries, retry } = prepareRetries({
|
|
14838
|
+
maxRetries,
|
|
14839
|
+
abortSignal
|
|
14746
14840
|
});
|
|
14747
|
-
|
|
14748
|
-
|
|
14749
|
-
questions,
|
|
14750
|
-
answers: result.answers,
|
|
14751
|
-
rounding: result.rounding
|
|
14841
|
+
const telemetryDispatcher = createRestrictedTelemetryDispatcher3({
|
|
14842
|
+
telemetry
|
|
14752
14843
|
});
|
|
14753
|
-
|
|
14754
|
-
|
|
14844
|
+
const runInTracingChannelSpan = (_a25 = telemetryDispatcher.runInTracingChannelSpan) != null ? _a25 : (async ({ execute }) => await execute());
|
|
14845
|
+
const startEvent = {
|
|
14846
|
+
callId,
|
|
14847
|
+
operationId: "ai.evaluate",
|
|
14848
|
+
runtimeContext,
|
|
14755
14849
|
provider: model.provider,
|
|
14756
|
-
|
|
14757
|
-
|
|
14758
|
-
|
|
14759
|
-
|
|
14760
|
-
|
|
14761
|
-
|
|
14762
|
-
usage: {
|
|
14763
|
-
inputTokens,
|
|
14764
|
-
outputTokens,
|
|
14765
|
-
totalTokens: inputTokens != null && outputTokens != null ? inputTokens + outputTokens : void 0
|
|
14766
|
-
},
|
|
14767
|
-
warnings: result.warnings,
|
|
14768
|
-
rounding: result.rounding,
|
|
14769
|
-
providerMetadata: result.providerMetadata,
|
|
14770
|
-
response: {
|
|
14771
|
-
...result.response,
|
|
14772
|
-
timestamp: (_d = (_c = result.response) == null ? void 0 : _c.timestamp) != null ? _d : /* @__PURE__ */ new Date(),
|
|
14773
|
-
modelId: (_f = (_e = result.response) == null ? void 0 : _e.modelId) != null ? _f : model.modelId
|
|
14774
|
-
}
|
|
14850
|
+
modelId: model.modelId,
|
|
14851
|
+
state,
|
|
14852
|
+
questions,
|
|
14853
|
+
maxRetries: resolvedMaxRetries,
|
|
14854
|
+
headers,
|
|
14855
|
+
providerOptions
|
|
14775
14856
|
};
|
|
14857
|
+
const tracingStartEvent = {
|
|
14858
|
+
...startEvent,
|
|
14859
|
+
runtimeContext: filterIncludedContext({
|
|
14860
|
+
context: runtimeContext,
|
|
14861
|
+
includeContext: telemetry == null ? void 0 : telemetry.includeRuntimeContext
|
|
14862
|
+
})
|
|
14863
|
+
};
|
|
14864
|
+
return await runInTracingChannelSpan({
|
|
14865
|
+
type: "experimental_evaluate",
|
|
14866
|
+
event: tracingStartEvent,
|
|
14867
|
+
execute: async () => {
|
|
14868
|
+
var _a26, _b25, _c, _d, _e, _f, _g;
|
|
14869
|
+
await notify({
|
|
14870
|
+
event: startEvent,
|
|
14871
|
+
callbacks: [onStart, telemetryDispatcher.onStart]
|
|
14872
|
+
});
|
|
14873
|
+
try {
|
|
14874
|
+
const modelCallEvent = {
|
|
14875
|
+
callId,
|
|
14876
|
+
operationId: "ai.evaluate.doEvaluate",
|
|
14877
|
+
provider: model.provider,
|
|
14878
|
+
modelId: model.modelId,
|
|
14879
|
+
state,
|
|
14880
|
+
questions
|
|
14881
|
+
};
|
|
14882
|
+
await notify({
|
|
14883
|
+
event: modelCallEvent,
|
|
14884
|
+
callbacks: [
|
|
14885
|
+
telemetryDispatcher.experimental_onEvaluationModelCallStart
|
|
14886
|
+
]
|
|
14887
|
+
});
|
|
14888
|
+
const result = await retry(async () => {
|
|
14889
|
+
abortSignal == null ? void 0 : abortSignal.throwIfAborted();
|
|
14890
|
+
return await model.doEvaluate({
|
|
14891
|
+
state,
|
|
14892
|
+
questions,
|
|
14893
|
+
abortSignal,
|
|
14894
|
+
headers: withUserAgentSuffix8(headers != null ? headers : {}, `ai/${VERSION}`),
|
|
14895
|
+
providerOptions
|
|
14896
|
+
});
|
|
14897
|
+
});
|
|
14898
|
+
abortSignal == null ? void 0 : abortSignal.throwIfAborted();
|
|
14899
|
+
validateEvaluationAnswers({
|
|
14900
|
+
questions,
|
|
14901
|
+
answers: result.answers,
|
|
14902
|
+
rounding: result.rounding
|
|
14903
|
+
});
|
|
14904
|
+
await notify({
|
|
14905
|
+
event: { ...modelCallEvent, ...result },
|
|
14906
|
+
callbacks: [
|
|
14907
|
+
telemetryDispatcher.experimental_onEvaluationModelCallEnd
|
|
14908
|
+
]
|
|
14909
|
+
});
|
|
14910
|
+
logWarnings({
|
|
14911
|
+
warnings: result.warnings,
|
|
14912
|
+
provider: model.provider,
|
|
14913
|
+
model: model.modelId
|
|
14914
|
+
});
|
|
14915
|
+
const inputTokens = (_a26 = result.usage) == null ? void 0 : _a26.inputTokens;
|
|
14916
|
+
const outputTokens = (_b25 = result.usage) == null ? void 0 : _b25.outputTokens;
|
|
14917
|
+
const evaluationResult = {
|
|
14918
|
+
answers: result.answers,
|
|
14919
|
+
usage: {
|
|
14920
|
+
inputTokens,
|
|
14921
|
+
outputTokens,
|
|
14922
|
+
totalTokens: inputTokens != null && outputTokens != null ? inputTokens + outputTokens : void 0
|
|
14923
|
+
},
|
|
14924
|
+
warnings: result.warnings,
|
|
14925
|
+
rounding: result.rounding,
|
|
14926
|
+
providerMetadata: result.providerMetadata,
|
|
14927
|
+
response: {
|
|
14928
|
+
...result.response,
|
|
14929
|
+
timestamp: (_d = (_c = result.response) == null ? void 0 : _c.timestamp) != null ? _d : /* @__PURE__ */ new Date(),
|
|
14930
|
+
modelId: (_f = (_e = result.response) == null ? void 0 : _e.modelId) != null ? _f : model.modelId
|
|
14931
|
+
}
|
|
14932
|
+
};
|
|
14933
|
+
await notify({
|
|
14934
|
+
event: { ...startEvent, ...evaluationResult },
|
|
14935
|
+
callbacks: [onEnd, telemetryDispatcher.onEnd]
|
|
14936
|
+
});
|
|
14937
|
+
return evaluationResult;
|
|
14938
|
+
} catch (error) {
|
|
14939
|
+
await ((_g = telemetryDispatcher.onError) == null ? void 0 : _g.call(telemetryDispatcher, { callId, error }));
|
|
14940
|
+
throw error;
|
|
14941
|
+
}
|
|
14942
|
+
}
|
|
14943
|
+
});
|
|
14776
14944
|
}
|
|
14777
14945
|
|
|
14778
14946
|
// src/generate-object/generate-object.ts
|
|
14779
14947
|
import {
|
|
14780
|
-
createIdGenerator as
|
|
14948
|
+
createIdGenerator as createIdGenerator7,
|
|
14781
14949
|
withUserAgentSuffix as withUserAgentSuffix9
|
|
14782
14950
|
} from "@ai-sdk/provider-utils";
|
|
14783
14951
|
|
|
@@ -15253,7 +15421,7 @@ function validateObjectGenerationInput({
|
|
|
15253
15421
|
}
|
|
15254
15422
|
|
|
15255
15423
|
// src/generate-object/generate-object.ts
|
|
15256
|
-
var originalGenerateId4 =
|
|
15424
|
+
var originalGenerateId4 = createIdGenerator7({ prefix: "aiobj", size: 24 });
|
|
15257
15425
|
async function generateObject(options) {
|
|
15258
15426
|
var _a25, _b25, _c, _d, _e, _f, _g, _h, _i, _j;
|
|
15259
15427
|
const {
|
|
@@ -15501,7 +15669,7 @@ var DefaultGenerateObjectResult = class {
|
|
|
15501
15669
|
|
|
15502
15670
|
// src/generate-object/stream-object.ts
|
|
15503
15671
|
import {
|
|
15504
|
-
createIdGenerator as
|
|
15672
|
+
createIdGenerator as createIdGenerator8,
|
|
15505
15673
|
DelayedPromise as DelayedPromise2
|
|
15506
15674
|
} from "@ai-sdk/provider-utils";
|
|
15507
15675
|
|
|
@@ -15626,7 +15794,7 @@ function simulateReadableStream({
|
|
|
15626
15794
|
}
|
|
15627
15795
|
|
|
15628
15796
|
// src/generate-object/stream-object.ts
|
|
15629
|
-
var originalGenerateId5 =
|
|
15797
|
+
var originalGenerateId5 = createIdGenerator8({ prefix: "aiobj", size: 24 });
|
|
15630
15798
|
async function markPromiseAsHandled2(promise) {
|
|
15631
15799
|
try {
|
|
15632
15800
|
await promise;
|
|
@@ -20852,11 +21020,11 @@ import {
|
|
|
20852
21020
|
InvalidResponseDataError as InvalidResponseDataError4
|
|
20853
21021
|
} from "@ai-sdk/provider";
|
|
20854
21022
|
import {
|
|
20855
|
-
createIdGenerator as
|
|
21023
|
+
createIdGenerator as createIdGenerator9
|
|
20856
21024
|
} from "@ai-sdk/provider-utils";
|
|
20857
21025
|
|
|
20858
21026
|
// src/rerank/restricted-telemetry-dispatcher.ts
|
|
20859
|
-
function
|
|
21027
|
+
function createRestrictedTelemetryDispatcher4({
|
|
20860
21028
|
telemetry
|
|
20861
21029
|
}) {
|
|
20862
21030
|
const dispatcher = createTelemetryDispatcher({ telemetry });
|
|
@@ -20886,7 +21054,7 @@ function createRestrictedTelemetryDispatcher3({
|
|
|
20886
21054
|
}
|
|
20887
21055
|
|
|
20888
21056
|
// src/rerank/rerank.ts
|
|
20889
|
-
var
|
|
21057
|
+
var originalGenerateCallId7 = createIdGenerator9({
|
|
20890
21058
|
prefix: "call",
|
|
20891
21059
|
size: 24
|
|
20892
21060
|
});
|
|
@@ -20906,14 +21074,14 @@ async function rerank({
|
|
|
20906
21074
|
experimental_onStart,
|
|
20907
21075
|
onEnd,
|
|
20908
21076
|
experimental_onEnd,
|
|
20909
|
-
_internal: { generateCallId =
|
|
21077
|
+
_internal: { generateCallId = originalGenerateCallId7 } = {}
|
|
20910
21078
|
}) {
|
|
20911
21079
|
var _a25;
|
|
20912
21080
|
const model = resolveRerankingModel(modelArg);
|
|
20913
21081
|
const callId = generateCallId();
|
|
20914
21082
|
const resolvedOnStart = onStart != null ? onStart : experimental_onStart;
|
|
20915
21083
|
const resolvedOnEnd = onEnd != null ? onEnd : experimental_onEnd;
|
|
20916
|
-
const telemetryDispatcher =
|
|
21084
|
+
const telemetryDispatcher = createRestrictedTelemetryDispatcher4({
|
|
20917
21085
|
telemetry
|
|
20918
21086
|
});
|
|
20919
21087
|
const runInTracingChannelSpan = (_a25 = telemetryDispatcher.runInTracingChannelSpan) != null ? _a25 : (async ({ execute }) => await execute());
|
|
@@ -22755,7 +22923,7 @@ export {
|
|
|
22755
22923
|
createAgentUIStreamResponse,
|
|
22756
22924
|
createDownload,
|
|
22757
22925
|
createGateway,
|
|
22758
|
-
|
|
22926
|
+
createIdGenerator10 as createIdGenerator,
|
|
22759
22927
|
createProviderRegistry,
|
|
22760
22928
|
createTextStreamResponse,
|
|
22761
22929
|
createUIMessageStream,
|