@ai-sdk/anthropic 4.0.78 → 4.0.80

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.
@@ -478,6 +478,8 @@ type AnthropicTool = {
478
478
  type AnthropicToolChoice = {
479
479
  type: 'auto' | 'any';
480
480
  disable_parallel_tool_use?: boolean;
481
+ } | {
482
+ type: 'none';
481
483
  } | {
482
484
  type: 'tool';
483
485
  name: string;
@@ -827,6 +829,7 @@ type AnthropicLanguageModelConfig = {
827
829
  fetch?: FetchFunction;
828
830
  buildRequestUrl?: (baseURL: string, isStreaming: boolean) => string;
829
831
  transformRequestBody?: (args: Record<string, any>, betas: Set<string>) => Record<string, any>;
832
+ transformRequestHeaders?: (headers: Record<string, string | undefined>, providerOptions: LanguageModelV4CallOptions['providerOptions']) => Record<string, string | undefined> | PromiseLike<Record<string, string | undefined>>;
830
833
  supportedUrls?: () => LanguageModelV4['supportedUrls'];
831
834
  generateId?: () => string;
832
835
  supportsNativeStructuredOutput?: boolean;
@@ -2101,9 +2104,9 @@ export declare function prepareTools({ tools, toolChoice, disableParallelToolUse
2101
2104
  */
2102
2105
  defaultEagerInputStreaming?: boolean;
2103
2106
  /**
2104
- * Whether the model rejects forced tool use (`tool_choice` `any` or a
2105
- * named tool). When true, `required` and `tool` tool choices fall back to
2106
- * `auto` with a warning.
2107
+ * Whether the model or thinking configuration rejects forced tool use
2108
+ * (`tool_choice` `any` or a named tool). When true, `required` and `tool`
2109
+ * tool choices fall back to `auto` with a warning.
2107
2110
  */
2108
2111
  rejectsForcedToolUse?: boolean;
2109
2112
  }): Promise<{
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","names":["_$__anthropic_api0.AnthropicToolChoice","_$__anthropic_api0.AnthropicTextContent","_$__anthropic_api0.AnthropicMessage","SandboxSession","SandboxSession","_$__tool_computer_toolset_202608010.ComputerToolset_20260801Member"],"sources":["../../src/anthropic-files.ts","../../src/anthropic-api.ts","../../src/anthropic-language-model-options.ts","../../src/anthropic-language-model.ts","../../src/tool/computer-toolset_20260801.ts","../../src/tool/bash_20241022.ts","../../src/tool/bash_20250124.ts","../../src/anthropic-tools.ts","../../src/get-cache-control.ts","../../src/anthropic-prepare-tools.ts","../../src/sanitize-json-schema.ts","../../src/skills/anthropic-skills.ts"],"mappings":";;;;UA+BU;EACR;EACA;EACA,eAAe;EACf,QAAQ;;qBAGG,0BAA0B;mBAOR;WANpB;MAEL;EAIyB,YAAA,QAAQ;EAE/B,aACJ,MACA,WACA,UACA,aACA,WACC,+BAA+B,QAAQ;;;;KCxChC,mBACR,uBACA,4BACA;KAEQ;EACV;EACA;;UAGe;EACf;EACA,SAAS,MAAM,uBAAuB;EACtC;EACA;IACE;;;;;;;;;;UAWa;EACf;EACA;IAAQ;IAAwB;;EAChC;;UAGe;EACf;EACA,SAAS,MACL,uBACA,wBACA,2BACA,kCACA;;UAIW;EACf;EACA,SAAS,MACL,uBACA,2BACA,mCACA,2BACA,2BACA,gCACA,0CACA,qCACA,sCACA,uCACA,8CACA,oDACA,oCACA,6BACA,gCACA;;cAIO,gCAA8B,EAAA;;;;;;;;GAIzC,EAAA,KAAA;KAEU,2BAA2B,mBAC9B;EAEP;;UAGe;EACf;EACA;EACA;EACA,gBAAgB;;UAGD;EACf;EACA;EACA,YAAY;EACZ,eAAe;;UAGA;EACf;EACA;EACA;EAGA;;UAGe;EACf;EACA;EAGA;;KAGG;EAEC;EACA;EACA;;EAGA;EACA;;EAGA;EACA;EACA;;EAGA;EACA;;UAGW;EACf;EACA,QAAQ;EACR,eAAe;;UAGA;EACf;EACA,QAAQ;EACR;EACA;EACA;IAAc;;EACd,eAAe;;UAGA;EACf;EACA;EACA;;;;;;KAOU;EAEN;EACA;;EAGA;EACA;;EAGA;;UAGW;EACf;EACA;EACA;EACA;;;;;EAKA,SAAS;;;;;EAKT;EACA,eAAe;;UAGA;EACf;EACA;EACA;EAaA;EACA,SAAS;EACT,eAAe;;KAKZ,6BAA6B,KAChC;EAGA;;KAGG,8BAA8B,KACjC;EAGA;;KAGG,iCAAiC,KACpC;EAGA;;UAGe;EACf;EACA;;UAGe;EACf;EACA;;;;EAIA;EACA,kBAEI,MACI,6BACA,8BACA,iCACA;EAER;EACA,eAAe;;UAGA;EACf;EACA;EACA,SACI;IACE;IACA;IACA;IACA;IACA;;IAGA;IACA;;EAEN,SAAS;EACT,eAAe;;UAGA;EACf;EACA;EACA;IAEM;IACA,iBAAiB;MACf;MACA;;;IAIF;IACA;;EAEN,eAAe;;UAIA;EACf;EACA;EACA;IAEM;IACA;IACA;IACA;IACA,SAAS;MAAQ;MAA+B;;;IAGhD;IACA;IACA;IACA;IACA,SAAS;MAAQ;MAA+B;;;IAGhD;IACA;;EAEN,eAAe;;UAIA;EACf;EACA;EACA;IAEM;IACA;;IAGA;IACA;;IAGA;IACA;IACA;IACA;IACA;IACA;;IAGA;IACA;IACA;IACA;IACA;IACA;;EAEN,eAAe;;UAIA;EACf;EACA;EACA;IAEM;IACA;IACA;IACA;IACA;MACE;MACA;;;IAIF;IACA;;EAEN,eAAe;;UAGA;EACf;EACA;EACA;IAEM;IACA;IACA;;IAGA;IACA;IACA;;IAGA;;;;;;IAMA;;EAEN,eAAe;;UAGA;EACf;EACA;EACA;IAEM;IACA;IACA;IACA;MACE;MACA;MACA;QAAc;;MACd;QACM;QAAgB;QAA+B;;QAC/C;QAAc;QAA0B;;;;IAIhD;IACA;;EAEN,SAAS;EACT,eAAe;;UAEA;EACf;EACA;EACA;EACA;EACA;EACA,eAAe;;UAGA;EACf;EACA;EACA;EACA,kBAEI;IACE;IACA;IACA,YAAY;;EAElB,eAAe;;KAGL;EAEN;EACA;EACA,cAAc;EACd,eAAe;EACf;EACA;;;;;EAKA;;;;;;;;EAQA,kBAAkB;;EAKlB;EACA;EACA,eAAe;;EAGf;EACA;;EAGA;EACA;;EAGA;EACA;EACA;EACA;EACA;EACA,eAAe;;EAGf;EACA;EACA;EACA;EACA;EACA;EACA,eAAe;;;;;;EAOf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;;;;;;;;;;;;;;;;MAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;MAQP;MACF;MACJ;MAEwB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;MAJlB;MACF;MACJ;MAEwB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;MAHxB;MACA;MAEa;MACK;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cCrBR;UACH;UACA;EAER,gBACE,kBAAkB,sCAClB;IAAW;IAAc;MACxB;EA+BH,eAAe;;;;wBCpCK,eACpB,OACA,YACA,wBACA,uBACA,0BACA,qBACA,4BACA;EAEA,OAAO;EACP,YAAY;EACZ;EACA,wBAAwB;;;;EAKxB;;;;EAKA;;;;;EAMA;;;;;;EAOA;IACE;EACF,OAAO,MAAM;EACb,YAAY;EACZ,cAAc;EACd,OAAO;;;;;;;;;;;wBC3BO,mBAAmB,QAAQ,cAAc;;;UCvB/C;EACR;EACA;EACA,SAAS,WAAW;EACpB,QAAQ;;qBAcG,2BAA2B;mBAOT;WANpB;MAEL;EAIyB,YAAA,QAAQ;UAEvB;UAMA;EA4BR,YACJ,QAAQ,WAAW,8BAClB,QAAQ,QAAQ,WAAW"}
1
+ {"version":3,"file":"index.d.ts","names":["_$__anthropic_api0.AnthropicToolChoice","_$__anthropic_api0.AnthropicTextContent","_$__anthropic_api0.AnthropicMessage","SandboxSession","SandboxSession","_$__tool_computer_toolset_202608010.ComputerToolset_20260801Member"],"sources":["../../src/anthropic-files.ts","../../src/anthropic-api.ts","../../src/anthropic-language-model-options.ts","../../src/anthropic-language-model.ts","../../src/tool/computer-toolset_20260801.ts","../../src/tool/bash_20241022.ts","../../src/tool/bash_20250124.ts","../../src/anthropic-tools.ts","../../src/get-cache-control.ts","../../src/anthropic-prepare-tools.ts","../../src/sanitize-json-schema.ts","../../src/skills/anthropic-skills.ts"],"mappings":";;;;UA+BU;EACR;EACA;EACA,eAAe;EACf,QAAQ;;qBAGG,0BAA0B;mBAOR;WANpB;MAEL;EAIyB,YAAA,QAAQ;EAE/B,aACJ,MACA,WACA,UACA,aACA,WACC,+BAA+B,QAAQ;;;;KCxChC,mBACR,uBACA,4BACA;KAEQ;EACV;EACA;;UAGe;EACf;EACA,SAAS,MAAM,uBAAuB;EACtC;EACA;IACE;;;;;;;;;;UAWa;EACf;EACA;IAAQ;IAAwB;;EAChC;;UAGe;EACf;EACA,SAAS,MACL,uBACA,wBACA,2BACA,kCACA;;UAIW;EACf;EACA,SAAS,MACL,uBACA,2BACA,mCACA,2BACA,2BACA,gCACA,0CACA,qCACA,sCACA,uCACA,8CACA,oDACA,oCACA,6BACA,gCACA;;cAIO,gCAA8B,EAAA;;;;;;;;GAIzC,EAAA,KAAA;KAEU,2BAA2B,mBAC9B;EAEP;;UAGe;EACf;EACA;EACA;EACA,gBAAgB;;UAGD;EACf;EACA;EACA,YAAY;EACZ,eAAe;;UAGA;EACf;EACA;EACA;EAGA;;UAGe;EACf;EACA;EAGA;;KAGG;EAEC;EACA;EACA;;EAGA;EACA;;EAGA;EACA;EACA;;EAGA;EACA;;UAGW;EACf;EACA,QAAQ;EACR,eAAe;;UAGA;EACf;EACA,QAAQ;EACR;EACA;EACA;IAAc;;EACd,eAAe;;UAGA;EACf;EACA;EACA;;;;;;KAOU;EAEN;EACA;;EAGA;EACA;;EAGA;;UAGW;EACf;EACA;EACA;EACA;;;;;EAKA,SAAS;;;;;EAKT;EACA,eAAe;;UAGA;EACf;EACA;EACA;EAaA;EACA,SAAS;EACT,eAAe;;KAKZ,6BAA6B,KAChC;EAGA;;KAGG,8BAA8B,KACjC;EAGA;;KAGG,iCAAiC,KACpC;EAGA;;UAGe;EACf;EACA;;UAGe;EACf;EACA;;;;EAIA;EACA,kBAEI,MACI,6BACA,8BACA,iCACA;EAER;EACA,eAAe;;UAGA;EACf;EACA;EACA,SACI;IACE;IACA;IACA;IACA;IACA;;IAGA;IACA;;EAEN,SAAS;EACT,eAAe;;UAGA;EACf;EACA;EACA;IAEM;IACA,iBAAiB;MACf;MACA;;;IAIF;IACA;;EAEN,eAAe;;UAIA;EACf;EACA;EACA;IAEM;IACA;IACA;IACA;IACA,SAAS;MAAQ;MAA+B;;;IAGhD;IACA;IACA;IACA;IACA,SAAS;MAAQ;MAA+B;;;IAGhD;IACA;;EAEN,eAAe;;UAIA;EACf;EACA;EACA;IAEM;IACA;;IAGA;IACA;;IAGA;IACA;IACA;IACA;IACA;IACA;;IAGA;IACA;IACA;IACA;IACA;IACA;;EAEN,eAAe;;UAIA;EACf;EACA;EACA;IAEM;IACA;IACA;IACA;IACA;MACE;MACA;;;IAIF;IACA;;EAEN,eAAe;;UAGA;EACf;EACA;EACA;IAEM;IACA;IACA;;IAGA;IACA;IACA;;IAGA;;;;;;IAMA;;EAEN,eAAe;;UAGA;EACf;EACA;EACA;IAEM;IACA;IACA;IACA;MACE;MACA;MACA;QAAc;;MACd;QACM;QAAgB;QAA+B;;QAC/C;QAAc;QAA0B;;;;IAIhD;IACA;;EAEN,SAAS;EACT,eAAe;;UAEA;EACf;EACA;EACA;EACA;EACA;EACA,eAAe;;UAGA;EACf;EACA;EACA;EACA,kBAEI;IACE;IACA;IACA,YAAY;;EAElB,eAAe;;KAGL;EAEN;EACA;EACA,cAAc;EACd,eAAe;EACf;EACA;;;;;EAKA;;;;;;;;EAQA,kBAAkB;;EAKlB;EACA;EACA,eAAe;;EAGf;EACA;;EAGA;EACA;;EAGA;EACA;EACA;EACA;EACA;EACA,eAAe;;EAGf;EACA;EACA;EACA;EACA;EACA;EACA,eAAe;;;;;;EAOf;EACA,UAAU;IAAiB;IAAmB;;EAC9C,eAAe;;EAGf;EACA;EAIA,eAAe;;EAGf;EACA;EACA;EACA,eAAe;;EAGf;EACA;EACA,eAAe;;EAGf;EACA;;EAGA;EACA;EACA;EACA;EACA;EACA;IAAc;;EACd;EACA;EACA;EACA,eAAe;;EAGf;EAIA;EACA;EACA;EACA;EACA;IACE;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;;;;;;;;;;;;;;;;;;;;;;;MAHxB;MACA;MAEa;MACK;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cCrBR;UACH;UACA;EAER,gBACE,kBAAkB,sCAClB;IAAW;IAAc;MACxB;EA+BH,eAAe;;;;wBCpCK,eACpB,OACA,YACA,wBACA,uBACA,0BACA,qBACA,4BACA;EAEA,OAAO;EACP,YAAY;EACZ;EACA,wBAAwB;;;;EAKxB;;;;EAKA;;;;;EAMA;;;;;;EAOA;IACE;EACF,OAAO,MAAM;EACb,YAAY;EACZ,cAAc;EACd,OAAO;;;;;;;;;;;wBC3BO,mBAAmB,QAAQ,cAAc;;;UCvB/C;EACR;EACA;EACA,SAAS,WAAW;EACpB,QAAQ;;qBAcG,2BAA2B;mBAOT;WANpB;MAEL;EAIyB,YAAA,QAAQ;UAEvB;UAMA;EA4BR,YACJ,QAAQ,WAAW,8BAClB,QAAQ,QAAQ,WAAW"}
@@ -63,6 +63,37 @@ var AnthropicFiles = class {
63
63
  }
64
64
  };
65
65
  //#endregion
66
+ //#region src/map-anthropic-citation.ts
67
+ function mapAnthropicCitation(citation, documents) {
68
+ if (citation.type === "web_search_result_location" || citation.type === "search_result_location") {
69
+ const url = citation.type === "web_search_result_location" ? citation.url : citation.source;
70
+ return {
71
+ source: {
72
+ type: "source",
73
+ sourceType: "url",
74
+ id: url,
75
+ url,
76
+ title: citation.title ?? void 0,
77
+ providerMetadata: { anthropic: { ...citation } }
78
+ },
79
+ citedText: citation.cited_text
80
+ };
81
+ }
82
+ const document = documents[citation.document_index];
83
+ return {
84
+ source: {
85
+ type: "source",
86
+ sourceType: "document",
87
+ id: citation.file_id ?? String(citation.document_index),
88
+ mediaType: document?.mediaType ?? "text/plain",
89
+ title: citation.document_title ?? document?.title ?? `Document ${citation.document_index}`,
90
+ filename: document?.filename,
91
+ providerMetadata: { anthropic: { ...citation } }
92
+ },
93
+ citedText: citation.cited_text
94
+ };
95
+ }
96
+ //#endregion
66
97
  //#region src/anthropic-api.ts
67
98
  const anthropicFallbackContentSchema = z.object({
68
99
  type: z.literal("fallback"),
@@ -1811,7 +1842,7 @@ async function prepareTools({ tools, toolChoice, disableParallelToolUse, cacheCo
1811
1842
  toolWarnings.push({
1812
1843
  type: "unsupported",
1813
1844
  feature: "toolChoice",
1814
- details: "toolChoice 'required' is not supported by this model because it rejects forced tool use. Using 'auto' instead. Instruct the model to use a tool in the prompt and verify that a tool call was made."
1845
+ details: "toolChoice 'required' is not supported with this model or thinking configuration. Using 'auto' instead. Instruct the model to use a tool in the prompt and verify that a tool call was made."
1815
1846
  });
1816
1847
  return {
1817
1848
  tools: anthropicTools,
@@ -1833,8 +1864,8 @@ async function prepareTools({ tools, toolChoice, disableParallelToolUse, cacheCo
1833
1864
  betas
1834
1865
  };
1835
1866
  case "none": return {
1836
- tools: void 0,
1837
- toolChoice: void 0,
1867
+ tools: anthropicTools,
1868
+ toolChoice: { type: "none" },
1838
1869
  toolWarnings,
1839
1870
  betas
1840
1871
  };
@@ -1843,7 +1874,7 @@ async function prepareTools({ tools, toolChoice, disableParallelToolUse, cacheCo
1843
1874
  toolWarnings.push({
1844
1875
  type: "unsupported",
1845
1876
  feature: "toolChoice",
1846
- details: `toolChoice 'tool' is not supported by this model because it rejects forced tool use. Only the '${toolChoice.toolName}' tool is sent with 'auto' tool choice. Instruct the model to use the tool in the prompt and verify that a tool call was made.`
1877
+ details: `toolChoice 'tool' is not supported with this model or thinking configuration. Only the '${toolChoice.toolName}' tool is sent with 'auto' tool choice. Instruct the model to use the tool in the prompt and verify that a tool call was made.`
1847
1878
  });
1848
1879
  return {
1849
1880
  tools: anthropicTools.filter((tool) => "name" in tool && tool.name === toolChoice.toolName),
@@ -3027,6 +3058,18 @@ async function convertToAnthropicPrompt({ prompt, sendReasoning, warnings, cache
3027
3058
  }
3028
3059
  if (providerToolName === "tool_search_tool_regex" || providerToolName === "tool_search_tool_bm25") {
3029
3060
  const output = part.output;
3061
+ if (output.type === "error-json" || output.type === "json" && output.value != null && typeof output.value === "object" && !Array.isArray(output.value) && "type" in output.value && output.value.type === "tool_search_tool_result_error") {
3062
+ anthropicContent.push({
3063
+ type: "tool_search_tool_result",
3064
+ tool_use_id: part.toolCallId,
3065
+ content: {
3066
+ type: "tool_search_tool_result_error",
3067
+ error_code: extractErrorValue(output.value).errorCode ?? "unavailable"
3068
+ },
3069
+ cache_control: cacheControl
3070
+ });
3071
+ break;
3072
+ }
3030
3073
  if (output.type !== "json") {
3031
3074
  warnings.push({
3032
3075
  type: "other",
@@ -3877,7 +3920,7 @@ var AnthropicLanguageModel = class AnthropicLanguageModel {
3877
3920
  supportsStructuredOutput: false,
3878
3921
  supportsStrictTools,
3879
3922
  defaultEagerInputStreaming,
3880
- rejectsForcedToolUse
3923
+ rejectsForcedToolUse: rejectsForcedToolUse || thinkingType === "enabled"
3881
3924
  } : {
3882
3925
  tools: tools ?? [],
3883
3926
  toolChoice,
@@ -3886,7 +3929,7 @@ var AnthropicLanguageModel = class AnthropicLanguageModel {
3886
3929
  supportsStructuredOutput,
3887
3930
  supportsStrictTools,
3888
3931
  defaultEagerInputStreaming,
3889
- rejectsForcedToolUse
3932
+ rejectsForcedToolUse: rejectsForcedToolUse || thinkingType === "enabled"
3890
3933
  });
3891
3934
  const cacheWarnings = cacheControlValidator.getWarnings();
3892
3935
  return {
@@ -3920,8 +3963,9 @@ var AnthropicLanguageModel = class AnthropicLanguageModel {
3920
3963
  options
3921
3964
  });
3922
3965
  }
3923
- async getHeaders({ betas, headers }) {
3924
- return combineHeaders(this.config.headers ? await resolve(this.config.headers) : void 0, headers, betas.size > 0 ? { "anthropic-beta": Array.from(betas).join(",") } : {});
3966
+ async getHeaders({ betas, headers, providerOptions }) {
3967
+ const combinedHeaders = combineHeaders(this.config.headers ? await resolve(this.config.headers) : void 0, headers, betas.size > 0 ? { "anthropic-beta": Array.from(betas).join(",") } : {});
3968
+ return this.config.transformRequestHeaders ? this.config.transformRequestHeaders(combinedHeaders, providerOptions) : combinedHeaders;
3925
3969
  }
3926
3970
  async getBetasFromHeaders(requestHeaders) {
3927
3971
  const configBetaHeader = (this.config.headers ? await resolve(this.config.headers) : void 0)?.["anthropic-beta"] ?? "";
@@ -3961,7 +4005,8 @@ var AnthropicLanguageModel = class AnthropicLanguageModel {
3961
4005
  url: this.buildRequestUrl(false),
3962
4006
  headers: await this.getHeaders({
3963
4007
  betas,
3964
- headers: options.headers
4008
+ headers: options.headers,
4009
+ providerOptions: options.providerOptions
3965
4010
  }),
3966
4011
  body: this.transformRequestBody(args, betas),
3967
4012
  failedResponseHandler: anthropicFailedResponseHandler,
@@ -3973,16 +4018,19 @@ var AnthropicLanguageModel = class AnthropicLanguageModel {
3973
4018
  const mcpToolCalls = {};
3974
4019
  const serverToolCalls = {};
3975
4020
  let isJsonResponseFromTool = false;
4021
+ const hasWebSearchResults = response.content.some((part) => part.type === "web_search_tool_result" && Array.isArray(part.content) && part.content.length > 0);
3976
4022
  for (const part of response.content) switch (part.type) {
3977
4023
  case "text":
3978
4024
  if (!usesJsonResponseTool) {
3979
- const webSearchCitations = part.citations?.filter((citation) => citation.type === "web_search_result_location");
4025
+ const citations = part.citations ?? [];
3980
4026
  content.push({
3981
4027
  type: "text",
3982
4028
  text: part.text,
3983
- ...webSearchCitations != null && webSearchCitations.length > 0 && { providerMetadata: { anthropic: { citations: webSearchCitations } } }
4029
+ ...citations.length > 0 && { citations: citations.map((citation) => mapAnthropicCitation(citation, citationDocuments)) },
4030
+ ...citations.length > 0 && { providerMetadata: { anthropic: { citations } } }
3984
4031
  });
3985
4032
  if (part.citations) for (const citation of part.citations) {
4033
+ if (citation.type === "web_search_result_location" && hasWebSearchResults) continue;
3986
4034
  const source = createCitationSource(citation, citationDocuments, this.generateId);
3987
4035
  if (source) content.push(source);
3988
4036
  }
@@ -4378,7 +4426,8 @@ var AnthropicLanguageModel = class AnthropicLanguageModel {
4378
4426
  url,
4379
4427
  headers: await this.getHeaders({
4380
4428
  betas,
4381
- headers: options.headers
4429
+ headers: options.headers,
4430
+ providerOptions: options.providerOptions
4382
4431
  }),
4383
4432
  body: this.transformRequestBody(body, betas),
4384
4433
  failedResponseHandler: anthropicFailedResponseHandler,
@@ -4408,6 +4457,8 @@ var AnthropicLanguageModel = class AnthropicLanguageModel {
4408
4457
  let safeguardResults;
4409
4458
  let container = null;
4410
4459
  let isJsonResponseFromTool = false;
4460
+ let hasWebSearchResults = false;
4461
+ const fallbackWebCitations = [];
4411
4462
  let isMessageOpen = false;
4412
4463
  let activeMessageId;
4413
4464
  let hasInvalidMessageSequence = false;
@@ -4674,14 +4725,17 @@ var AnthropicLanguageModel = class AnthropicLanguageModel {
4674
4725
  })),
4675
4726
  ...getAnthropicCallerMetadata(part.caller)
4676
4727
  });
4677
- for (const result of part.content) controller.enqueue({
4678
- type: "source",
4679
- sourceType: "url",
4680
- id: generateId(),
4681
- url: result.url,
4682
- ...result.title != null ? { title: result.title } : {},
4683
- providerMetadata: { anthropic: { pageAge: result.page_age ?? null } }
4684
- });
4728
+ for (const result of part.content) {
4729
+ hasWebSearchResults = true;
4730
+ controller.enqueue({
4731
+ type: "source",
4732
+ sourceType: "url",
4733
+ id: generateId(),
4734
+ url: result.url,
4735
+ ...result.title != null ? { title: result.title } : {},
4736
+ providerMetadata: { anthropic: { pageAge: result.page_age ?? null } }
4737
+ });
4738
+ }
4685
4739
  } else controller.enqueue({
4686
4740
  type: "tool-result",
4687
4741
  toolCallId: part.tool_use_id,
@@ -4840,7 +4894,10 @@ var AnthropicLanguageModel = class AnthropicLanguageModel {
4840
4894
  controller.enqueue({
4841
4895
  type: "text-end",
4842
4896
  id: String(value.index),
4843
- ...contentBlock.citations.length > 0 && { providerMetadata: { anthropic: { citations: contentBlock.citations } } }
4897
+ ...contentBlock.citations.length > 0 && {
4898
+ citations: contentBlock.citations.map((citation) => mapAnthropicCitation(citation, citationDocuments)),
4899
+ providerMetadata: { anthropic: { citations: contentBlock.citations } }
4900
+ }
4844
4901
  });
4845
4902
  break;
4846
4903
  case "reasoning":
@@ -4961,9 +5018,12 @@ var AnthropicLanguageModel = class AnthropicLanguageModel {
4961
5018
  case "citations_delta": {
4962
5019
  const citation = value.delta.citation;
4963
5020
  const contentBlock = contentBlocks[value.index];
4964
- if (contentBlock?.type === "text" && citation.type === "web_search_result_location") contentBlock.citations.push(citation);
4965
- const source = createCitationSource(citation, citationDocuments, generateId);
4966
- if (source) controller.enqueue(source);
5021
+ if (contentBlock?.type === "text") contentBlock.citations.push(citation);
5022
+ if (citation.type === "web_search_result_location") fallbackWebCitations.push(citation);
5023
+ else {
5024
+ const source = createCitationSource(citation, citationDocuments, generateId);
5025
+ if (source) controller.enqueue(source);
5026
+ }
4967
5027
  return;
4968
5028
  }
4969
5029
  default: throw new Error(`Unsupported delta type: ${deltaType}`);
@@ -5099,6 +5159,11 @@ var AnthropicLanguageModel = class AnthropicLanguageModel {
5099
5159
  };
5100
5160
  const providerMetadata = { anthropic: anthropicMetadata };
5101
5161
  if (usedCustomProviderKey && providerOptionsName !== "anthropic") providerMetadata[providerOptionsName] = anthropicMetadata;
5162
+ if (!hasWebSearchResults) for (const citation of fallbackWebCitations) {
5163
+ const source = createCitationSource(citation, citationDocuments, generateId);
5164
+ if (source) controller.enqueue(source);
5165
+ }
5166
+ fallbackWebCitations.length = 0;
5102
5167
  controller.enqueue({
5103
5168
  type: "finish",
5104
5169
  finishReason,