ai 7.0.97 → 7.0.98

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.
@@ -1,7 +1,7 @@
1
1
  import * as _ai_sdk_provider from '@ai-sdk/provider';
2
2
  import { EmbeddingModelV4Embedding, LanguageModelV4Source, SharedV4Warning, LanguageModelV4, LanguageModelV3, LanguageModelV2, SharedV4ProviderMetadata, JSONObject, LanguageModelV4Usage, LanguageModelV4CallOptions, LanguageModelV4Prompt, AISDKError, LanguageModelV4ToolCall, JSONSchema7, ProviderV4, ProviderV3, ProviderV2, LanguageModelV4ToolResultOutput, LanguageModelV4ToolChoice, LanguageModelV4FunctionTool, LanguageModelV4ProviderTool } from '@ai-sdk/provider';
3
3
  import { GatewayModelId } from '@ai-sdk/gateway';
4
- import { ModelMessage, AssistantModelMessage, ToolModelMessage, ProviderOptions, ToolSet, SystemModelMessage, Context, InferToolSetContext, Arrayable, InferToolInput, InferToolOutput, ReasoningPart, ReasoningFilePart, MaybePromiseLike, ToolExecutionOptions, InferToolContext, ToolResultOutput, Tool, Experimental_SandboxSession, ShouldRetryFunction, RetryFunction, ToolApprovalRequest, ToolApprovalResponse, ToolResultPart } from '@ai-sdk/provider-utils';
4
+ import { ModelMessage, AssistantModelMessage, ToolModelMessage, Context, ProviderOptions, ToolSet, SystemModelMessage, InferToolSetContext, Arrayable, InferToolInput, InferToolOutput, ReasoningPart, ReasoningFilePart, MaybePromiseLike, ToolExecutionOptions, InferToolContext, ToolResultOutput, Tool, Experimental_SandboxSession, ShouldRetryFunction, RetryFunction, ToolApprovalRequest, ToolApprovalResponse, ToolResultPart } from '@ai-sdk/provider-utils';
5
5
  export { convertAsyncIteratorToReadableStream } from '@ai-sdk/provider-utils';
6
6
 
7
7
  /**
@@ -252,7 +252,9 @@ type LogWarningsFunction = (options: {
252
252
  *
253
253
  * Called when the operation begins, before the embedding model is called.
254
254
  */
255
- type EmbedStartEvent = {
255
+ type EmbedStartEvent<RUNTIME_CONTEXT extends Context = Context> = {
256
+ /** User-defined runtime context. */
257
+ readonly runtimeContext: RUNTIME_CONTEXT;
256
258
  /** Unique identifier for this embed call, used to correlate events. */
257
259
  readonly callId: string;
258
260
  /** Identifies the operation type (e.g. 'ai.embed' or 'ai.embedMany'). */
@@ -275,7 +277,9 @@ type EmbedStartEvent = {
275
277
  *
276
278
  * Called when the operation completes, after the embedding model returns.
277
279
  */
278
- type EmbedEndEvent = {
280
+ type EmbedEndEvent<RUNTIME_CONTEXT extends Context = Context> = {
281
+ /** User-defined runtime context. */
282
+ readonly runtimeContext: RUNTIME_CONTEXT;
279
283
  /** Unique identifier for this embed call, used to correlate events. */
280
284
  readonly callId: string;
281
285
  /** Identifies the operation type (e.g. 'ai.embed' or 'ai.embedMany'). */
@@ -2216,7 +2220,9 @@ type GenerateTextOnAbortCallback<TOOLS extends ToolSet = ToolSet, RUNTIME_CONTEX
2216
2220
  *
2217
2221
  * Called when the operation begins, before the reranking model is called.
2218
2222
  */
2219
- type RerankStartEvent = {
2223
+ type RerankStartEvent<RUNTIME_CONTEXT extends Context = Context> = {
2224
+ /** User-defined runtime context. */
2225
+ readonly runtimeContext: RUNTIME_CONTEXT;
2220
2226
  /** Unique identifier for this rerank call, used to correlate events. */
2221
2227
  readonly callId: string;
2222
2228
  /** Identifies the operation type ('ai.rerank'). */
@@ -2242,7 +2248,9 @@ type RerankStartEvent = {
2242
2248
  *
2243
2249
  * Called when the operation completes, after the reranking model returns.
2244
2250
  */
2245
- type RerankEndEvent = {
2251
+ type RerankEndEvent<RUNTIME_CONTEXT extends Context = Context> = {
2252
+ /** User-defined runtime context. */
2253
+ readonly runtimeContext: RUNTIME_CONTEXT;
2246
2254
  /** Unique identifier for this rerank call, used to correlate events. */
2247
2255
  readonly callId: string;
2248
2256
  /** Identifies the operation type ('ai.rerank'). */
@@ -91,7 +91,7 @@ import {
91
91
  } from "@ai-sdk/provider-utils";
92
92
 
93
93
  // src/version.ts
94
- var VERSION = true ? "7.0.97" : "0.0.0-test";
94
+ var VERSION = true ? "7.0.98" : "0.0.0-test";
95
95
 
96
96
  // src/util/download/download.ts
97
97
  var download = async ({
@@ -2628,6 +2628,21 @@ function createTelemetryDispatcher({
2628
2628
  };
2629
2629
  }
2630
2630
 
2631
+ // src/telemetry/filter-included-context.ts
2632
+ function filterIncludedContext({
2633
+ context,
2634
+ includeContext
2635
+ }) {
2636
+ if (context == null) {
2637
+ return {};
2638
+ }
2639
+ return Object.fromEntries(
2640
+ Object.entries(context).filter(
2641
+ ([key]) => (includeContext == null ? void 0 : includeContext[key]) === true
2642
+ )
2643
+ );
2644
+ }
2645
+
2631
2646
  // src/generate-text/reasoning.ts
2632
2647
  function asReasoningText(reasoningParts) {
2633
2648
  const reasoningText = reasoningParts.map((part) => "text" in part ? part.text : "").join("");
@@ -2735,19 +2750,6 @@ var DefaultStepResult = class {
2735
2750
  };
2736
2751
 
2737
2752
  // src/generate-text/restricted-telemetry-dispatcher.ts
2738
- function filterIncludedContext({
2739
- context,
2740
- includeContext
2741
- }) {
2742
- if (context == null) {
2743
- return {};
2744
- }
2745
- return Object.fromEntries(
2746
- Object.entries(context).filter(
2747
- ([key]) => (includeContext == null ? void 0 : includeContext[key]) === true
2748
- )
2749
- );
2750
- }
2751
2753
  function restrictStepResult({
2752
2754
  step,
2753
2755
  includeRuntimeContext,