ai 7.0.179 → 7.0.181

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (45) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/dist/{default-stop-condition-wtuJTiTo.js → default-stop-condition-D8PwkeWe.js} +52 -27
  3. package/dist/default-stop-condition-D8PwkeWe.js.map +1 -0
  4. package/dist/{index-CM_8u8gB.d.ts → index-CKEJqCzY.d.ts} +69 -4
  5. package/dist/index-CKEJqCzY.d.ts.map +1 -0
  6. package/dist/index.d.ts +2 -2
  7. package/dist/index.js +192 -119
  8. package/dist/index.js.map +1 -1
  9. package/dist/internal/index.d.ts +8 -4
  10. package/dist/internal/index.d.ts.map +1 -1
  11. package/dist/internal/index.js +1 -1
  12. package/docs/03-agents/04-loop-control.mdx +35 -1
  13. package/docs/03-agents/06-policy-tool-approvals.mdx +5 -2
  14. package/docs/03-agents/08-terminal-ui.mdx +10 -0
  15. package/docs/03-ai-sdk-core/16-mcp-tools.mdx +59 -0
  16. package/docs/03-ai-sdk-core/65-lifecycle-callbacks.mdx +6 -0
  17. package/docs/04-ai-sdk-ui/21-error-handling.mdx +21 -0
  18. package/docs/07-reference/01-ai-sdk-core/01-generate-text.mdx +19 -0
  19. package/docs/07-reference/01-ai-sdk-core/02-stream-text.mdx +25 -0
  20. package/docs/07-reference/01-ai-sdk-core/16-tool-loop-agent.mdx +7 -0
  21. package/docs/07-reference/01-ai-sdk-core/25-create-mcp-tools.mdx +65 -0
  22. package/docs/07-reference/06-ai-sdk-tui/01-run-agent-tui.mdx +3 -0
  23. package/package.json +4 -4
  24. package/src/agent/default-stop-condition.ts +12 -3
  25. package/src/agent/tool-loop-agent-settings.ts +11 -0
  26. package/src/agent/tool-loop-agent.ts +3 -1
  27. package/src/extract/restricted-telemetry-dispatcher.ts +9 -5
  28. package/src/generate-text/default-generate-text-result.ts +4 -0
  29. package/src/generate-text/generate-text-events.ts +7 -0
  30. package/src/generate-text/generate-text-result.ts +9 -0
  31. package/src/generate-text/generate-text.ts +37 -5
  32. package/src/generate-text/index.ts +1 -0
  33. package/src/generate-text/steering.ts +19 -5
  34. package/src/generate-text/stopped-by.ts +43 -0
  35. package/src/generate-text/stream-language-model-call.ts +21 -2
  36. package/src/generate-text/stream-text-result.ts +18 -0
  37. package/src/generate-text/stream-text.ts +59 -6
  38. package/src/logger/create-log-warnings.ts +17 -0
  39. package/src/model/as-language-model-v3.ts +3 -0
  40. package/src/model/as-language-model-v4.ts +5 -1
  41. package/src/model/resolve-model.ts +8 -3
  42. package/src/prompt/convert-to-language-model-prompt.ts +15 -6
  43. package/src/util/log-v2-compatibility-warning.ts +5 -2
  44. package/dist/default-stop-condition-wtuJTiTo.js.map +0 -1
  45. package/dist/index-CM_8u8gB.d.ts.map +0 -1
@@ -25,7 +25,8 @@ import {
25
25
  } from '@ai-sdk/provider-utils';
26
26
  import type { ServerResponse } from 'node:http';
27
27
  import { NoOutputGeneratedError, ToolChoiceViolationError } from '../error';
28
- import { logWarnings } from '../logger/log-warnings';
28
+ import { createLogWarnings } from '../logger/create-log-warnings';
29
+ import type { LogWarningsFunction } from '../logger/log-warnings';
29
30
  import { resolveLanguageModel } from '../model/resolve-model';
30
31
  import { cloneModelMessages } from '../prompt/clone-model-message';
31
32
  import { createToolModelOutput } from '../prompt/create-tool-model-output';
@@ -144,6 +145,11 @@ import {
144
145
  type SteeringNotDeliveredReason,
145
146
  type SteeringRun,
146
147
  } from './steering';
148
+ import {
149
+ getModelStoppedBy,
150
+ getPendingToolCallStoppedBy,
151
+ type StoppedBy,
152
+ } from './stopped-by';
147
153
  import {
148
154
  isStepCount,
149
155
  isStopConditionMet,
@@ -380,6 +386,7 @@ type StreamTextOptions<
380
386
  * @param onStepEnd - Callback that is called when each step (LLM call) ends, including intermediate steps.
381
387
  * @param onStepError - Callback that is called when a step that started fails before it produces a step result, i.e. when the provider call throws or rejects, or when the model stream ends without output. A provider `error` chunk still ends the step with `onStepEnd`, and an abort or timeout ends it with `onAbort`.
382
388
  * @param onStepFinish - Deprecated alias for `onStepEnd`.
389
+ * @param onWarning - Callback that receives the warnings of the call instead of the global warning logger.
383
390
  * @param onEnd - Callback that is called when all steps are finished and the response is complete.
384
391
  * @param onFinish - Deprecated alias for `onEnd`.
385
392
  *
@@ -507,6 +514,7 @@ function streamTextInternal<
507
514
  onStepEnd,
508
515
  onStepError,
509
516
  onStepFinish,
517
+ onWarning,
510
518
  onStart,
511
519
  experimental_onStart,
512
520
  onStepStart,
@@ -788,6 +796,13 @@ function streamTextInternal<
788
796
  NoInfer<OUTPUT>
789
797
  >;
790
798
 
799
+ /**
800
+ * Callback that receives the warnings of the call, e.g. unsupported
801
+ * settings or deprecated prompt parts. When it is set, the warnings are
802
+ * not sent to the global warning logger (`AI_SDK_LOG_WARNINGS`).
803
+ */
804
+ onWarning?: LogWarningsFunction;
805
+
791
806
  /**
792
807
  * Callback that is called when each step (LLM call) ends, including intermediate steps.
793
808
  *
@@ -957,7 +972,7 @@ function streamTextInternal<
957
972
  const resolvedOnStepEnd = onStepEnd ?? onStepFinish;
958
973
  return new DefaultStreamTextResult<TOOLS, RUNTIME_CONTEXT, OUTPUT>({
959
974
  retention,
960
- model: resolveLanguageModel(model),
975
+ model: resolveLanguageModel(model, onWarning),
961
976
  telemetry,
962
977
  headers,
963
978
  settings,
@@ -1008,6 +1023,7 @@ function streamTextInternal<
1008
1023
  onAbort,
1009
1024
  onStepFinish: resolvedOnStepEnd,
1010
1025
  onStepError,
1026
+ onWarning,
1011
1027
  onStart: resolvedOnStart,
1012
1028
  onStepStart: resolvedOnStepStart,
1013
1029
  onLanguageModelCallStart: resolvedOnLanguageModelCallStart,
@@ -1355,6 +1371,7 @@ class DefaultStreamTextResult<
1355
1371
  private readonly _rawFinishReason = new DelayedPromise<
1356
1372
  Awaited<StreamTextResult<TOOLS, RUNTIME_CONTEXT, OUTPUT>['rawFinishReason']>
1357
1373
  >();
1374
+ private readonly _stoppedBy = new DelayedPromise<StoppedBy | undefined>();
1358
1375
  private readonly _steps = new DelayedPromise<
1359
1376
  Awaited<StreamTextResult<TOOLS, RUNTIME_CONTEXT, OUTPUT>['steps']>
1360
1377
  >();
@@ -1433,6 +1450,7 @@ class DefaultStreamTextResult<
1433
1450
  onAbort,
1434
1451
  onStepFinish,
1435
1452
  onStepError,
1453
+ onWarning,
1436
1454
  onStart,
1437
1455
  onStepStart,
1438
1456
  onLanguageModelCallStart,
@@ -1520,6 +1538,7 @@ class DefaultStreamTextResult<
1520
1538
  NoInfer<RUNTIME_CONTEXT>,
1521
1539
  NoInfer<OUTPUT>
1522
1540
  >;
1541
+ onWarning: undefined | LogWarningsFunction;
1523
1542
  onStart:
1524
1543
  | undefined
1525
1544
  | GenerateTextOnStartCallback<
@@ -1568,13 +1587,17 @@ class DefaultStreamTextResult<
1568
1587
  // needs the updated steps to determine if another step is needed.
1569
1588
  let stepFinish!: DelayedPromise<void>;
1570
1589
 
1590
+ const logCallWarnings = createLogWarnings(onWarning);
1591
+
1571
1592
  let recordedContent: Array<ContentPart<TOOLS>> = [];
1572
1593
  let recordedFinishReason: FinishReason | undefined = undefined;
1573
1594
  let recordedRawFinishReason: string | undefined = undefined;
1595
+ let recordedStoppedBy: StoppedBy | undefined = undefined;
1574
1596
  let recordedTotalUsage: LanguageModelUsage | undefined = undefined;
1575
1597
  let recordedRequest: Omit<LanguageModelRequestMetadata, 'messages'> = {};
1576
1598
  let recordedRequestMessages: Array<ModelMessage> = [];
1577
1599
  let recordedWarnings: Array<CallWarning> = [];
1600
+ let recordedPromptWarnings: Array<CallWarning> = [];
1578
1601
  let recordedSteps: StepResult<TOOLS, RUNTIME_CONTEXT>[] = [];
1579
1602
  const initialResponseMessages: Array<ResponseMessage> = [];
1580
1603
  let stepMessagesForNextStep: Array<ModelMessage> | undefined;
@@ -1895,8 +1918,10 @@ class DefaultStreamTextResult<
1895
1918
  callbacks: [onStepFinish, telemetryDispatcher.onStepEnd],
1896
1919
  });
1897
1920
 
1898
- logWarnings({
1899
- warnings: recordedWarnings,
1921
+ logCallWarnings({
1922
+ warnings: recordedWarnings.filter(
1923
+ warning => !recordedPromptWarnings.includes(warning),
1924
+ ),
1900
1925
  provider: currentStepModel.provider,
1901
1926
  model: currentStepModel.modelId,
1902
1927
  });
@@ -1916,6 +1941,7 @@ class DefaultStreamTextResult<
1916
1941
  recordedTotalUsage = part.totalUsage;
1917
1942
  recordedFinishReason = part.finishReason;
1918
1943
  recordedRawFinishReason = part.rawFinishReason;
1944
+ recordedStoppedBy = part.stoppedBy;
1919
1945
  }
1920
1946
  },
1921
1947
 
@@ -1964,6 +1990,7 @@ class DefaultStreamTextResult<
1964
1990
  // from finish:
1965
1991
  self._finishReason.resolve(finishReason);
1966
1992
  self._rawFinishReason.resolve(recordedRawFinishReason);
1993
+ self._stoppedBy.resolve(recordedStoppedBy);
1967
1994
  self._totalUsage.resolve(totalUsage);
1968
1995
 
1969
1996
  // aggregate results:
@@ -2020,6 +2047,7 @@ class DefaultStreamTextResult<
2020
2047
  runtimeContext: finalStep.runtimeContext,
2021
2048
  finishReason: finalStep.finishReason,
2022
2049
  rawFinishReason: finalStep.rawFinishReason,
2050
+ stoppedBy: recordedStoppedBy,
2023
2051
  usage: totalUsage,
2024
2052
  totalUsage,
2025
2053
  content,
@@ -2659,6 +2687,7 @@ class DefaultStreamTextResult<
2659
2687
 
2660
2688
  const stepModel = resolveLanguageModel(
2661
2689
  prepareStepResult?.model ?? model,
2690
+ onWarning,
2662
2691
  );
2663
2692
  currentStepModel = stepModel;
2664
2693
 
@@ -2817,7 +2846,7 @@ class DefaultStreamTextResult<
2817
2846
  runInStepTracingChannelContext(() =>
2818
2847
  retry(async () =>
2819
2848
  streamLanguageModelCall({
2820
- model: prepareStepResult?.model ?? model,
2849
+ model: stepModel,
2821
2850
  tools: stepModelTools as TOOLS,
2822
2851
  toolOrder: stepToolOrder,
2823
2852
  toolChoice: prepareStepResult?.toolChoice ?? toolChoice,
@@ -2849,7 +2878,13 @@ class DefaultStreamTextResult<
2849
2878
  | undefined
2850
2879
  | OnLanguageModelCallEndCallback<TOOLS>,
2851
2880
  ),
2852
- onStart: async ({ promptMessages }) => {
2881
+ onStart: async ({ promptMessages, promptWarnings }) => {
2882
+ recordedPromptWarnings = promptWarnings;
2883
+ // retries convert the prompt again, log its warnings once per step:
2884
+ if (!stepStart.notified && promptWarnings.length > 0) {
2885
+ logCallWarnings({ warnings: promptWarnings });
2886
+ }
2887
+
2853
2888
  if (stepStart.notified) {
2854
2889
  return;
2855
2890
  }
@@ -3610,6 +3645,7 @@ class DefaultStreamTextResult<
3610
3645
  // the stream ends:
3611
3646
  let steeringEndReason: SteeringNotDeliveredReason =
3612
3647
  'finished';
3648
+ let stoppedBy: StoppedBy = 'model';
3613
3649
 
3614
3650
  const shouldStartNextStep = async () => {
3615
3651
  if (stepFinishReason === 'interrupted') {
@@ -3623,6 +3659,9 @@ class DefaultStreamTextResult<
3623
3659
  deniedToolApprovalResponses.length
3624
3660
  ) {
3625
3661
  steeringEndReason = 'waiting-for-tool-results';
3662
+ stoppedBy = getPendingToolCallStoppedBy(
3663
+ recordedSteps[recordedSteps.length - 1],
3664
+ );
3626
3665
  return false;
3627
3666
  }
3628
3667
 
@@ -3641,6 +3680,9 @@ class DefaultStreamTextResult<
3641
3680
  !steeringRun?.hasPendingMessages() &&
3642
3681
  (isTruncated || !steeringRun?.promoteQueuedMessage())
3643
3682
  ) {
3683
+ stoppedBy = getModelStoppedBy(
3684
+ recordedSteps[recordedSteps.length - 1],
3685
+ );
3644
3686
  return false;
3645
3687
  }
3646
3688
 
@@ -3659,6 +3701,7 @@ class DefaultStreamTextResult<
3659
3701
  })
3660
3702
  ) {
3661
3703
  steeringEndReason = 'stop-condition';
3704
+ stoppedBy = 'stop-condition';
3662
3705
  return false;
3663
3706
  }
3664
3707
 
@@ -3679,6 +3722,7 @@ class DefaultStreamTextResult<
3679
3722
  type: 'finish',
3680
3723
  finishReason: stepFinishReason,
3681
3724
  rawFinishReason: stepRawFinishReason,
3725
+ stoppedBy,
3682
3726
  totalUsage: combinedUsage,
3683
3727
  });
3684
3728
 
@@ -3852,6 +3896,14 @@ class DefaultStreamTextResult<
3852
3896
  return this._rawFinishReason.promise;
3853
3897
  }
3854
3898
 
3899
+ get stoppedBy() {
3900
+ // when any of the promises are accessed, the stream is consumed
3901
+ // so it resolves without needing to consume the stream separately
3902
+ if (this.retention.replay) this.consumeStream();
3903
+
3904
+ return this._stoppedBy.promise;
3905
+ }
3906
+
3855
3907
  /**
3856
3908
  * Split out a new stream from the original stream.
3857
3909
  * The original stream is replaced to allow for further splitting,
@@ -3944,6 +3996,7 @@ class DefaultStreamTextResult<
3944
3996
  private rejectResultPromises(error: unknown) {
3945
3997
  this.rejectResultPromise({ delayedPromise: this._finishReason, error });
3946
3998
  this.rejectResultPromise({ delayedPromise: this._rawFinishReason, error });
3999
+ this.rejectResultPromise({ delayedPromise: this._stoppedBy, error });
3947
4000
  this.rejectResultPromise({ delayedPromise: this._totalUsage, error });
3948
4001
  this.rejectResultPromise({ delayedPromise: this._steps, error });
3949
4002
  this.rejectResultPromise({
@@ -0,0 +1,17 @@
1
+ import { notify } from '../util/notify';
2
+ import { logWarnings, type LogWarningsFunction } from './log-warnings';
3
+
4
+ export function createLogWarnings(
5
+ onWarning: LogWarningsFunction | undefined,
6
+ ): LogWarningsFunction {
7
+ if (onWarning == null) {
8
+ return logWarnings;
9
+ }
10
+
11
+ return options => {
12
+ if (options.warnings.length > 0) {
13
+ // like the other callbacks, errors in onWarning do not break the call:
14
+ void notify({ event: options, callbacks: onWarning });
15
+ }
16
+ };
17
+ }
@@ -8,10 +8,12 @@ import type {
8
8
  LanguageModelV3StreamPart,
9
9
  LanguageModelV3Usage,
10
10
  } from '@ai-sdk/provider';
11
+ import type { LogWarningsFunction } from '../logger/log-warnings';
11
12
  import { logV2CompatibilityWarning } from '../util/log-v2-compatibility-warning';
12
13
 
13
14
  export function asLanguageModelV3(
14
15
  model: LanguageModelV2 | LanguageModelV3,
16
+ onWarning?: LogWarningsFunction,
15
17
  ): LanguageModelV3 {
16
18
  if (model.specificationVersion === 'v3') {
17
19
  return model;
@@ -20,6 +22,7 @@ export function asLanguageModelV3(
20
22
  logV2CompatibilityWarning({
21
23
  provider: model.provider,
22
24
  modelId: model.modelId,
25
+ onWarning,
23
26
  });
24
27
 
25
28
  // TODO this could break, we need to properly map v2 to v3
@@ -15,10 +15,12 @@ import {
15
15
  type SharedV4FileData,
16
16
  } from '@ai-sdk/provider';
17
17
  import { convertUint8ArrayToBase64 } from '@ai-sdk/provider-utils';
18
+ import type { LogWarningsFunction } from '../logger/log-warnings';
18
19
  import { asLanguageModelV3 } from './as-language-model-v3';
19
20
 
20
21
  export function asLanguageModelV4(
21
22
  model: LanguageModelV2 | LanguageModelV3 | LanguageModelV4,
23
+ onWarning?: LogWarningsFunction,
22
24
  ): LanguageModelV4 {
23
25
  if (model.specificationVersion === 'v4') {
24
26
  return model;
@@ -26,7 +28,9 @@ export function asLanguageModelV4(
26
28
 
27
29
  // first convert v2 to v3, then proxy v3 as v4:
28
30
  const v3Model =
29
- model.specificationVersion === 'v2' ? asLanguageModelV3(model) : model;
31
+ model.specificationVersion === 'v2'
32
+ ? asLanguageModelV3(model, onWarning)
33
+ : model;
30
34
 
31
35
  return new Proxy(v3Model, {
32
36
  get(target, prop: keyof LanguageModelV3) {
@@ -32,12 +32,17 @@ import { asTranscriptionModelV4 } from './as-transcription-model-v4';
32
32
  import { asVideoModelV4 } from './as-video-model-v4';
33
33
  import { asProviderV4 } from './as-provider-v4';
34
34
  import type { ImageModel } from '../types/image-model';
35
+ import type { LogWarningsFunction } from '../logger/log-warnings';
35
36
  import type { RerankingModel } from '../types/reranking-model';
36
37
  import type { VideoModel } from '../types/video-model';
37
38
 
38
- export function resolveLanguageModel(model: LanguageModel): LanguageModelV4 {
39
+ export function resolveLanguageModel(
40
+ model: LanguageModel,
41
+ onWarning?: LogWarningsFunction,
42
+ ): LanguageModelV4 {
39
43
  if (typeof model === 'string') {
40
- return getGlobalProvider().languageModel(model);
44
+ const provider = globalThis.AI_SDK_DEFAULT_PROVIDER ?? gateway;
45
+ return asLanguageModelV4(provider.languageModel(model), onWarning);
41
46
  }
42
47
 
43
48
  if (!['v4', 'v3', 'v2'].includes(model.specificationVersion)) {
@@ -49,7 +54,7 @@ export function resolveLanguageModel(model: LanguageModel): LanguageModelV4 {
49
54
  });
50
55
  }
51
56
 
52
- return asLanguageModelV4(model);
57
+ return asLanguageModelV4(model, onWarning);
53
58
  }
54
59
 
55
60
  export function resolveEmbeddingModel(model: EmbeddingModel): EmbeddingModelV4 {
@@ -41,12 +41,14 @@ export async function convertToLanguageModelPrompt({
41
41
  // `provider` is only needed here to convert legacy tool output types via `mapToolResultOutput`.
42
42
  // TODO: remove in v8 when "file-id" and "image-file-id" types are removed
43
43
  provider,
44
+ warnings,
44
45
  }: {
45
46
  prompt: StandardizedPrompt;
46
47
  supportedUrls: Record<string, RegExp[]>;
47
48
  download: DownloadFunction | undefined;
48
49
  abortSignal?: AbortSignal;
49
50
  provider?: string;
51
+ warnings?: Warning[];
50
52
  }): Promise<LanguageModelV4Prompt> {
51
53
  const downloadedAssets = await downloadAssets(
52
54
  prompt.messages,
@@ -66,7 +68,12 @@ export async function convertToLanguageModelPrompt({
66
68
  }))
67
69
  : []),
68
70
  ...prompt.messages.map(message =>
69
- convertToLanguageModelMessage({ message, downloadedAssets, provider }),
71
+ convertToLanguageModelMessage({
72
+ message,
73
+ downloadedAssets,
74
+ provider,
75
+ warnings,
76
+ }),
70
77
  ),
71
78
  ];
72
79
 
@@ -161,6 +168,7 @@ export function convertToLanguageModelMessage({
161
168
  // `provider` is only needed here to convert legacy tool output types via `mapToolResultOutput`.
162
169
  // TODO: remove in v8 when "file-id" and "image-file-id" types are removed
163
170
  provider,
171
+ warnings: collectedWarnings,
164
172
  }: {
165
173
  message: ModelMessage;
166
174
  downloadedAssets: Record<
@@ -168,8 +176,9 @@ export function convertToLanguageModelMessage({
168
176
  { mediaType: string | undefined; data: Uint8Array }
169
177
  >;
170
178
  provider?: string;
179
+ warnings?: Warning[];
171
180
  }): LanguageModelV4Message {
172
- const warnings: Warning[] = [];
181
+ const warnings: Warning[] = collectedWarnings ?? [];
173
182
 
174
183
  const role = message.role;
175
184
  switch (role) {
@@ -208,7 +217,7 @@ export function convertToLanguageModelMessage({
208
217
  .filter(part => part.type !== 'text' || part.text !== ''),
209
218
  providerOptions: message.providerOptions,
210
219
  };
211
- if (warnings.length > 0) {
220
+ if (collectedWarnings == null && warnings.length > 0) {
212
221
  logWarnings({ warnings });
213
222
  }
214
223
  return converted;
@@ -326,7 +335,7 @@ export function convertToLanguageModelMessage({
326
335
  }),
327
336
  providerOptions: message.providerOptions,
328
337
  };
329
- if (warnings.length > 0) {
338
+ if (collectedWarnings == null && warnings.length > 0) {
330
339
  logWarnings({ warnings });
331
340
  }
332
341
  return converted;
@@ -369,7 +378,7 @@ export function convertToLanguageModelMessage({
369
378
  }),
370
379
  providerOptions: message.providerOptions,
371
380
  };
372
- if (warnings.length > 0) {
381
+ if (collectedWarnings == null && warnings.length > 0) {
373
382
  logWarnings({ warnings });
374
383
  }
375
384
  return converted;
@@ -707,7 +716,7 @@ export function mapToolResultOutput({
707
716
  mediaType === 'application/octet-stream'
708
717
  ? `Unable to infer media type from URL. Defaulting to 'application/octet-stream'.`
709
718
  : `Inferred media type '${mediaType}' from URL.`;
710
- message = `The "file-url" tool result content part with URL "${item.url}" is missing a "mediaType". ${inferenceSuffix} ${message}`;
719
+ message = `A "file-url" tool result content part is missing a "mediaType". ${inferenceSuffix} ${message}`;
711
720
  }
712
721
  warnings.push({
713
722
  type: 'deprecated',
@@ -1,13 +1,16 @@
1
- import { logWarnings } from '../logger/log-warnings';
1
+ import { createLogWarnings } from '../logger/create-log-warnings';
2
+ import type { LogWarningsFunction } from '../logger/log-warnings';
2
3
 
3
4
  export function logV2CompatibilityWarning({
4
5
  provider,
5
6
  modelId,
7
+ onWarning,
6
8
  }: {
7
9
  provider: string;
8
10
  modelId: string;
11
+ onWarning?: LogWarningsFunction;
9
12
  }): void {
10
- logWarnings({
13
+ createLogWarnings(onWarning)({
11
14
  warnings: [
12
15
  {
13
16
  type: 'compatibility',