@ai-sdk/anthropic 4.0.45 → 4.0.47
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 +18 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +498 -150
- package/dist/index.js.map +1 -1
- package/dist/internal/index.d.ts +32 -7
- package/dist/internal/index.js +102 -80
- package/dist/internal/index.js.map +1 -1
- package/package.json +3 -3
- package/src/anthropic-api.ts +81 -71
- package/src/anthropic-files.ts +8 -3
- package/src/anthropic-language-model-options.ts +3 -0
- package/src/anthropic-language-model.ts +29 -9
- package/src/anthropic-messages-batch.ts +456 -67
package/dist/internal/index.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ import * as _ai_sdk_provider from '@ai-sdk/provider';
|
|
|
2
2
|
import { FilesV4, FilesV4UploadFileCallOptions, FilesV4UploadFileResult, JSONSchema7, LanguageModelV4, JSONObject, LanguageModelV4CallOptions, SharedV4Warning, LanguageModelV4GenerateResult, LanguageModelV4StreamResult, SharedV4ProviderMetadata, SkillsV4 } from '@ai-sdk/provider';
|
|
3
3
|
import * as _ai_sdk_provider_utils from '@ai-sdk/provider-utils';
|
|
4
4
|
import { FetchFunction, InferSchema, Resolvable, WORKFLOW_SERIALIZE, WORKFLOW_DESERIALIZE, ToolExecuteFunction, Tool, Experimental_SandboxSession, ProviderDefinedTool } from '@ai-sdk/provider-utils';
|
|
5
|
+
import { z } from 'zod/v4';
|
|
5
6
|
|
|
6
7
|
interface AnthropicFilesConfig {
|
|
7
8
|
provider: string;
|
|
@@ -14,7 +15,7 @@ declare class AnthropicFiles implements FilesV4 {
|
|
|
14
15
|
readonly specificationVersion = "v4";
|
|
15
16
|
get provider(): string;
|
|
16
17
|
constructor(config: AnthropicFilesConfig);
|
|
17
|
-
uploadFile({ data, mediaType, filename, }: FilesV4UploadFileCallOptions): Promise<FilesV4UploadFileResult>;
|
|
18
|
+
uploadFile({ data, mediaType, filename, abortSignal, headers, }: FilesV4UploadFileCallOptions): Promise<FilesV4UploadFileResult>;
|
|
18
19
|
}
|
|
19
20
|
|
|
20
21
|
type AnthropicMessage = AnthropicUserMessage | AnthropicAssistantMessage | AnthropicSystemMessage;
|
|
@@ -328,6 +329,7 @@ interface AnthropicMcpToolResultContent {
|
|
|
328
329
|
content: string | Array<{
|
|
329
330
|
type: 'text';
|
|
330
331
|
text: string;
|
|
332
|
+
citations?: Citation[] | null;
|
|
331
333
|
}>;
|
|
332
334
|
cache_control: AnthropicCacheControl | undefined;
|
|
333
335
|
}
|
|
@@ -451,7 +453,7 @@ declare const anthropicResponseSchema: _ai_sdk_provider_utils.LazySchema<{
|
|
|
451
453
|
type: "web_search_result_location";
|
|
452
454
|
cited_text: string;
|
|
453
455
|
url: string;
|
|
454
|
-
title: string;
|
|
456
|
+
title: string | null;
|
|
455
457
|
encrypted_index: string;
|
|
456
458
|
} | {
|
|
457
459
|
type: "page_location";
|
|
@@ -460,6 +462,7 @@ declare const anthropicResponseSchema: _ai_sdk_provider_utils.LazySchema<{
|
|
|
460
462
|
document_title: string | null;
|
|
461
463
|
start_page_number: number;
|
|
462
464
|
end_page_number: number;
|
|
465
|
+
file_id?: string | null | undefined;
|
|
463
466
|
} | {
|
|
464
467
|
type: "char_location";
|
|
465
468
|
cited_text: string;
|
|
@@ -467,7 +470,24 @@ declare const anthropicResponseSchema: _ai_sdk_provider_utils.LazySchema<{
|
|
|
467
470
|
document_title: string | null;
|
|
468
471
|
start_char_index: number;
|
|
469
472
|
end_char_index: number;
|
|
470
|
-
|
|
473
|
+
file_id?: string | null | undefined;
|
|
474
|
+
} | {
|
|
475
|
+
type: "content_block_location";
|
|
476
|
+
cited_text: string;
|
|
477
|
+
document_index: number;
|
|
478
|
+
document_title: string | null;
|
|
479
|
+
start_block_index: number;
|
|
480
|
+
end_block_index: number;
|
|
481
|
+
file_id: string | null;
|
|
482
|
+
} | {
|
|
483
|
+
type: "search_result_location";
|
|
484
|
+
cited_text: string;
|
|
485
|
+
search_result_index: number;
|
|
486
|
+
source: string;
|
|
487
|
+
title: string | null;
|
|
488
|
+
start_block_index: number;
|
|
489
|
+
end_block_index: number;
|
|
490
|
+
})[] | null | undefined;
|
|
471
491
|
} | {
|
|
472
492
|
type: "thinking";
|
|
473
493
|
thinking: string;
|
|
@@ -516,9 +536,10 @@ declare const anthropicResponseSchema: _ai_sdk_provider_utils.LazySchema<{
|
|
|
516
536
|
type: "mcp_tool_result";
|
|
517
537
|
tool_use_id: string;
|
|
518
538
|
is_error: boolean;
|
|
519
|
-
content: (string | {
|
|
539
|
+
content: string | (string | {
|
|
520
540
|
type: "text";
|
|
521
541
|
text: string;
|
|
542
|
+
citations?: z.core.util.JSONType[] | null | undefined;
|
|
522
543
|
})[];
|
|
523
544
|
} | {
|
|
524
545
|
type: "web_fetch_tool_result";
|
|
@@ -526,7 +547,7 @@ declare const anthropicResponseSchema: _ai_sdk_provider_utils.LazySchema<{
|
|
|
526
547
|
content: {
|
|
527
548
|
type: "web_fetch_result";
|
|
528
549
|
url: string;
|
|
529
|
-
retrieved_at: string;
|
|
550
|
+
retrieved_at: string | null;
|
|
530
551
|
content: {
|
|
531
552
|
type: "document";
|
|
532
553
|
title: string | null;
|
|
@@ -562,7 +583,7 @@ declare const anthropicResponseSchema: _ai_sdk_provider_utils.LazySchema<{
|
|
|
562
583
|
content: {
|
|
563
584
|
type: "web_search_result";
|
|
564
585
|
url: string;
|
|
565
|
-
title: string;
|
|
586
|
+
title: string | null;
|
|
566
587
|
encrypted_content: string;
|
|
567
588
|
page_age?: string | null | undefined;
|
|
568
589
|
}[] | {
|
|
@@ -656,6 +677,9 @@ declare const anthropicResponseSchema: _ai_sdk_provider_utils.LazySchema<{
|
|
|
656
677
|
type: "tool_search_tool_result_error";
|
|
657
678
|
error_code: string;
|
|
658
679
|
};
|
|
680
|
+
} | {
|
|
681
|
+
type: "container_upload";
|
|
682
|
+
file_id: string;
|
|
659
683
|
} | {
|
|
660
684
|
type: "advisor_tool_result";
|
|
661
685
|
tool_use_id: string;
|
|
@@ -754,7 +778,7 @@ declare class AnthropicLanguageModel implements LanguageModelV4 {
|
|
|
754
778
|
readonly specificationVersion = "v4";
|
|
755
779
|
readonly modelId: AnthropicModelId;
|
|
756
780
|
protected readonly config: AnthropicLanguageModelConfig;
|
|
757
|
-
|
|
781
|
+
protected readonly generateId: () => string;
|
|
758
782
|
static [WORKFLOW_SERIALIZE](model: AnthropicLanguageModel): {
|
|
759
783
|
modelId: string;
|
|
760
784
|
config: JSONObject;
|
|
@@ -851,6 +875,7 @@ declare class AnthropicLanguageModel implements LanguageModelV4 {
|
|
|
851
875
|
speed?: "fast" | "standard" | undefined;
|
|
852
876
|
}[] | undefined;
|
|
853
877
|
inference_geo?: "us" | "global" | undefined;
|
|
878
|
+
service_tier?: "auto" | "standard_only" | undefined;
|
|
854
879
|
speed?: "fast" | "standard" | undefined;
|
|
855
880
|
output_config?: {
|
|
856
881
|
format?: {
|
package/dist/internal/index.js
CHANGED
|
@@ -57,7 +57,9 @@ var AnthropicFiles = class {
|
|
|
57
57
|
async uploadFile({
|
|
58
58
|
data,
|
|
59
59
|
mediaType,
|
|
60
|
-
filename
|
|
60
|
+
filename,
|
|
61
|
+
abortSignal,
|
|
62
|
+
headers
|
|
61
63
|
}) {
|
|
62
64
|
var _a, _b;
|
|
63
65
|
const fileBytes = convertInlineFileDataToUint8Array(data);
|
|
@@ -70,14 +72,17 @@ var AnthropicFiles = class {
|
|
|
70
72
|
}
|
|
71
73
|
const { value: response } = await postFormDataToApi({
|
|
72
74
|
url: `${this.config.baseURL}/files`,
|
|
73
|
-
headers: combineHeaders(
|
|
74
|
-
|
|
75
|
-
|
|
75
|
+
headers: combineHeaders(
|
|
76
|
+
this.config.headers(),
|
|
77
|
+
{ "anthropic-beta": "files-api-2025-04-14" },
|
|
78
|
+
headers
|
|
79
|
+
),
|
|
76
80
|
formData,
|
|
77
81
|
failedResponseHandler: anthropicFailedResponseHandler,
|
|
78
82
|
successfulResponseHandler: createJsonResponseHandler(
|
|
79
83
|
anthropicUploadFileResponseSchema
|
|
80
84
|
),
|
|
85
|
+
abortSignal,
|
|
81
86
|
fetch: this.config.fetch
|
|
82
87
|
});
|
|
83
88
|
return {
|
|
@@ -149,6 +154,66 @@ var anthropicToolCallCallerSchema = z3.union([
|
|
|
149
154
|
type: z3.literal("direct")
|
|
150
155
|
})
|
|
151
156
|
]);
|
|
157
|
+
var anthropicCitationSchema = z3.discriminatedUnion("type", [
|
|
158
|
+
z3.object({
|
|
159
|
+
type: z3.literal("web_search_result_location"),
|
|
160
|
+
cited_text: z3.string(),
|
|
161
|
+
url: z3.string(),
|
|
162
|
+
title: z3.string().nullable(),
|
|
163
|
+
encrypted_index: z3.string()
|
|
164
|
+
}),
|
|
165
|
+
z3.object({
|
|
166
|
+
type: z3.literal("page_location"),
|
|
167
|
+
cited_text: z3.string(),
|
|
168
|
+
document_index: z3.number(),
|
|
169
|
+
document_title: z3.string().nullable(),
|
|
170
|
+
start_page_number: z3.number(),
|
|
171
|
+
end_page_number: z3.number(),
|
|
172
|
+
file_id: z3.string().nullish()
|
|
173
|
+
}),
|
|
174
|
+
z3.object({
|
|
175
|
+
type: z3.literal("char_location"),
|
|
176
|
+
cited_text: z3.string(),
|
|
177
|
+
document_index: z3.number(),
|
|
178
|
+
document_title: z3.string().nullable(),
|
|
179
|
+
start_char_index: z3.number(),
|
|
180
|
+
end_char_index: z3.number(),
|
|
181
|
+
file_id: z3.string().nullish()
|
|
182
|
+
}),
|
|
183
|
+
z3.object({
|
|
184
|
+
type: z3.literal("content_block_location"),
|
|
185
|
+
cited_text: z3.string(),
|
|
186
|
+
document_index: z3.number(),
|
|
187
|
+
document_title: z3.string().nullable(),
|
|
188
|
+
start_block_index: z3.number(),
|
|
189
|
+
end_block_index: z3.number(),
|
|
190
|
+
file_id: z3.string().nullable()
|
|
191
|
+
}),
|
|
192
|
+
z3.object({
|
|
193
|
+
type: z3.literal("search_result_location"),
|
|
194
|
+
cited_text: z3.string(),
|
|
195
|
+
search_result_index: z3.number(),
|
|
196
|
+
source: z3.string(),
|
|
197
|
+
title: z3.string().nullable(),
|
|
198
|
+
start_block_index: z3.number(),
|
|
199
|
+
end_block_index: z3.number()
|
|
200
|
+
})
|
|
201
|
+
]);
|
|
202
|
+
var anthropicMcpToolResultContentSchema = z3.union([
|
|
203
|
+
z3.string(),
|
|
204
|
+
z3.array(
|
|
205
|
+
z3.union([
|
|
206
|
+
z3.string(),
|
|
207
|
+
z3.object({
|
|
208
|
+
type: z3.literal("text"),
|
|
209
|
+
text: z3.string(),
|
|
210
|
+
// MCP tool-result citations are opaque third-party pass-through data.
|
|
211
|
+
// Keep them permissive so new shapes do not reject whole responses.
|
|
212
|
+
citations: z3.array(z3.json()).nullable().optional()
|
|
213
|
+
})
|
|
214
|
+
])
|
|
215
|
+
)
|
|
216
|
+
]);
|
|
152
217
|
var anthropicResponseSchema = lazySchema3(
|
|
153
218
|
() => zodSchema3(
|
|
154
219
|
z3.object({
|
|
@@ -160,33 +225,7 @@ var anthropicResponseSchema = lazySchema3(
|
|
|
160
225
|
z3.object({
|
|
161
226
|
type: z3.literal("text"),
|
|
162
227
|
text: z3.string(),
|
|
163
|
-
citations: z3.array(
|
|
164
|
-
z3.discriminatedUnion("type", [
|
|
165
|
-
z3.object({
|
|
166
|
-
type: z3.literal("web_search_result_location"),
|
|
167
|
-
cited_text: z3.string(),
|
|
168
|
-
url: z3.string(),
|
|
169
|
-
title: z3.string(),
|
|
170
|
-
encrypted_index: z3.string()
|
|
171
|
-
}),
|
|
172
|
-
z3.object({
|
|
173
|
-
type: z3.literal("page_location"),
|
|
174
|
-
cited_text: z3.string(),
|
|
175
|
-
document_index: z3.number(),
|
|
176
|
-
document_title: z3.string().nullable(),
|
|
177
|
-
start_page_number: z3.number(),
|
|
178
|
-
end_page_number: z3.number()
|
|
179
|
-
}),
|
|
180
|
-
z3.object({
|
|
181
|
-
type: z3.literal("char_location"),
|
|
182
|
-
cited_text: z3.string(),
|
|
183
|
-
document_index: z3.number(),
|
|
184
|
-
document_title: z3.string().nullable(),
|
|
185
|
-
start_char_index: z3.number(),
|
|
186
|
-
end_char_index: z3.number()
|
|
187
|
-
})
|
|
188
|
-
])
|
|
189
|
-
).optional()
|
|
228
|
+
citations: z3.array(anthropicCitationSchema).nullable().optional()
|
|
190
229
|
}),
|
|
191
230
|
z3.object({
|
|
192
231
|
type: z3.literal("thinking"),
|
|
@@ -227,12 +266,7 @@ var anthropicResponseSchema = lazySchema3(
|
|
|
227
266
|
type: z3.literal("mcp_tool_result"),
|
|
228
267
|
tool_use_id: z3.string(),
|
|
229
268
|
is_error: z3.boolean(),
|
|
230
|
-
content:
|
|
231
|
-
z3.union([
|
|
232
|
-
z3.string(),
|
|
233
|
-
z3.object({ type: z3.literal("text"), text: z3.string() })
|
|
234
|
-
])
|
|
235
|
-
)
|
|
269
|
+
content: anthropicMcpToolResultContentSchema
|
|
236
270
|
}),
|
|
237
271
|
z3.object({
|
|
238
272
|
type: z3.literal("web_fetch_tool_result"),
|
|
@@ -242,7 +276,7 @@ var anthropicResponseSchema = lazySchema3(
|
|
|
242
276
|
z3.object({
|
|
243
277
|
type: z3.literal("web_fetch_result"),
|
|
244
278
|
url: z3.string(),
|
|
245
|
-
retrieved_at: z3.string(),
|
|
279
|
+
retrieved_at: z3.string().nullable(),
|
|
246
280
|
content: z3.object({
|
|
247
281
|
type: z3.literal("document"),
|
|
248
282
|
title: z3.string().nullable(),
|
|
@@ -276,7 +310,7 @@ var anthropicResponseSchema = lazySchema3(
|
|
|
276
310
|
z3.object({
|
|
277
311
|
type: z3.literal("web_search_result"),
|
|
278
312
|
url: z3.string(),
|
|
279
|
-
title: z3.string(),
|
|
313
|
+
title: z3.string().nullable(),
|
|
280
314
|
encrypted_content: z3.string(),
|
|
281
315
|
page_age: z3.string().nullish()
|
|
282
316
|
})
|
|
@@ -398,6 +432,10 @@ var anthropicResponseSchema = lazySchema3(
|
|
|
398
432
|
})
|
|
399
433
|
])
|
|
400
434
|
}),
|
|
435
|
+
z3.object({
|
|
436
|
+
type: z3.literal("container_upload"),
|
|
437
|
+
file_id: z3.string()
|
|
438
|
+
}),
|
|
401
439
|
// advisor results for advisor_20260301:
|
|
402
440
|
z3.object({
|
|
403
441
|
type: z3.literal("advisor_tool_result"),
|
|
@@ -567,12 +605,7 @@ var anthropicChunkSchema = lazySchema3(
|
|
|
567
605
|
type: z3.literal("mcp_tool_result"),
|
|
568
606
|
tool_use_id: z3.string(),
|
|
569
607
|
is_error: z3.boolean(),
|
|
570
|
-
content:
|
|
571
|
-
z3.union([
|
|
572
|
-
z3.string(),
|
|
573
|
-
z3.object({ type: z3.literal("text"), text: z3.string() })
|
|
574
|
-
])
|
|
575
|
-
)
|
|
608
|
+
content: anthropicMcpToolResultContentSchema
|
|
576
609
|
}),
|
|
577
610
|
z3.object({
|
|
578
611
|
type: z3.literal("web_fetch_tool_result"),
|
|
@@ -582,7 +615,7 @@ var anthropicChunkSchema = lazySchema3(
|
|
|
582
615
|
z3.object({
|
|
583
616
|
type: z3.literal("web_fetch_result"),
|
|
584
617
|
url: z3.string(),
|
|
585
|
-
retrieved_at: z3.string(),
|
|
618
|
+
retrieved_at: z3.string().nullable(),
|
|
586
619
|
content: z3.object({
|
|
587
620
|
type: z3.literal("document"),
|
|
588
621
|
title: z3.string().nullable(),
|
|
@@ -616,7 +649,7 @@ var anthropicChunkSchema = lazySchema3(
|
|
|
616
649
|
z3.object({
|
|
617
650
|
type: z3.literal("web_search_result"),
|
|
618
651
|
url: z3.string(),
|
|
619
|
-
title: z3.string(),
|
|
652
|
+
title: z3.string().nullable(),
|
|
620
653
|
encrypted_content: z3.string(),
|
|
621
654
|
page_age: z3.string().nullish()
|
|
622
655
|
})
|
|
@@ -792,31 +825,7 @@ var anthropicChunkSchema = lazySchema3(
|
|
|
792
825
|
}),
|
|
793
826
|
z3.object({
|
|
794
827
|
type: z3.literal("citations_delta"),
|
|
795
|
-
citation:
|
|
796
|
-
z3.object({
|
|
797
|
-
type: z3.literal("web_search_result_location"),
|
|
798
|
-
cited_text: z3.string(),
|
|
799
|
-
url: z3.string(),
|
|
800
|
-
title: z3.string(),
|
|
801
|
-
encrypted_index: z3.string()
|
|
802
|
-
}),
|
|
803
|
-
z3.object({
|
|
804
|
-
type: z3.literal("page_location"),
|
|
805
|
-
cited_text: z3.string(),
|
|
806
|
-
document_index: z3.number(),
|
|
807
|
-
document_title: z3.string().nullable(),
|
|
808
|
-
start_page_number: z3.number(),
|
|
809
|
-
end_page_number: z3.number()
|
|
810
|
-
}),
|
|
811
|
-
z3.object({
|
|
812
|
-
type: z3.literal("char_location"),
|
|
813
|
-
cited_text: z3.string(),
|
|
814
|
-
document_index: z3.number(),
|
|
815
|
-
document_title: z3.string().nullable(),
|
|
816
|
-
start_char_index: z3.number(),
|
|
817
|
-
end_char_index: z3.number()
|
|
818
|
-
})
|
|
819
|
-
])
|
|
828
|
+
citation: anthropicCitationSchema
|
|
820
829
|
})
|
|
821
830
|
])
|
|
822
831
|
}),
|
|
@@ -1112,6 +1121,8 @@ var anthropicLanguageModelOptions = z4.object({
|
|
|
1112
1121
|
* Only supported with claude-opus-4-6.
|
|
1113
1122
|
*/
|
|
1114
1123
|
speed: z4.enum(["fast", "standard"]).optional(),
|
|
1124
|
+
/** Selects Anthropic's service tier for the request. */
|
|
1125
|
+
serviceTier: z4.enum(["auto", "standard_only"]).optional(),
|
|
1115
1126
|
/**
|
|
1116
1127
|
* Controls where model inference runs for this request.
|
|
1117
1128
|
*
|
|
@@ -3615,14 +3626,14 @@ function getAnthropicStreamErrorMetadata(type) {
|
|
|
3615
3626
|
}
|
|
3616
3627
|
}
|
|
3617
3628
|
function createCitationSource(citation, citationDocuments, generateId2) {
|
|
3618
|
-
var _a;
|
|
3629
|
+
var _a, _b;
|
|
3619
3630
|
if (citation.type === "web_search_result_location") {
|
|
3620
3631
|
return {
|
|
3621
3632
|
type: "source",
|
|
3622
3633
|
sourceType: "url",
|
|
3623
3634
|
id: generateId2(),
|
|
3624
3635
|
url: citation.url,
|
|
3625
|
-
title: citation.title,
|
|
3636
|
+
title: (_a = citation.title) != null ? _a : void 0,
|
|
3626
3637
|
providerMetadata: {
|
|
3627
3638
|
anthropic: {
|
|
3628
3639
|
citedText: citation.cited_text,
|
|
@@ -3643,7 +3654,7 @@ function createCitationSource(citation, citationDocuments, generateId2) {
|
|
|
3643
3654
|
sourceType: "document",
|
|
3644
3655
|
id: generateId2(),
|
|
3645
3656
|
mediaType: documentInfo.mediaType,
|
|
3646
|
-
title: (
|
|
3657
|
+
title: (_b = citation.document_title) != null ? _b : documentInfo.title,
|
|
3647
3658
|
filename: documentInfo.filename,
|
|
3648
3659
|
providerMetadata: {
|
|
3649
3660
|
anthropic: citation.type === "page_location" ? {
|
|
@@ -3940,6 +3951,9 @@ var AnthropicLanguageModel = class _AnthropicLanguageModel {
|
|
|
3940
3951
|
...(anthropicOptions == null ? void 0 : anthropicOptions.speed) && {
|
|
3941
3952
|
speed: anthropicOptions.speed
|
|
3942
3953
|
},
|
|
3954
|
+
...(anthropicOptions == null ? void 0 : anthropicOptions.serviceTier) && {
|
|
3955
|
+
service_tier: anthropicOptions.serviceTier
|
|
3956
|
+
},
|
|
3943
3957
|
...(anthropicOptions == null ? void 0 : anthropicOptions.inferenceGeo) && {
|
|
3944
3958
|
inference_geo: anthropicOptions.inferenceGeo
|
|
3945
3959
|
},
|
|
@@ -4327,6 +4341,14 @@ var AnthropicLanguageModel = class _AnthropicLanguageModel {
|
|
|
4327
4341
|
});
|
|
4328
4342
|
break;
|
|
4329
4343
|
}
|
|
4344
|
+
case "container_upload": {
|
|
4345
|
+
content.push({
|
|
4346
|
+
type: "custom",
|
|
4347
|
+
kind: "anthropic.container_upload",
|
|
4348
|
+
providerMetadata: { anthropic: { fileId: part.file_id } }
|
|
4349
|
+
});
|
|
4350
|
+
break;
|
|
4351
|
+
}
|
|
4330
4352
|
case "compaction": {
|
|
4331
4353
|
content.push({
|
|
4332
4354
|
type: "text",
|
|
@@ -4493,7 +4515,7 @@ var AnthropicLanguageModel = class _AnthropicLanguageModel {
|
|
|
4493
4515
|
var _a2;
|
|
4494
4516
|
return {
|
|
4495
4517
|
url: result.url,
|
|
4496
|
-
title: result.title,
|
|
4518
|
+
...result.title != null ? { title: result.title } : {},
|
|
4497
4519
|
pageAge: (_a2 = result.page_age) != null ? _a2 : null,
|
|
4498
4520
|
encryptedContent: result.encrypted_content,
|
|
4499
4521
|
type: result.type
|
|
@@ -4507,7 +4529,7 @@ var AnthropicLanguageModel = class _AnthropicLanguageModel {
|
|
|
4507
4529
|
sourceType: "url",
|
|
4508
4530
|
id: this.generateId(),
|
|
4509
4531
|
url: result.url,
|
|
4510
|
-
title: result.title,
|
|
4532
|
+
...result.title != null ? { title: result.title } : {},
|
|
4511
4533
|
providerMetadata: {
|
|
4512
4534
|
anthropic: {
|
|
4513
4535
|
pageAge: (_c = result.page_age) != null ? _c : null
|
|
@@ -5045,7 +5067,7 @@ var AnthropicLanguageModel = class _AnthropicLanguageModel {
|
|
|
5045
5067
|
var _a3;
|
|
5046
5068
|
return {
|
|
5047
5069
|
url: result.url,
|
|
5048
|
-
title: result.title,
|
|
5070
|
+
...result.title != null ? { title: result.title } : {},
|
|
5049
5071
|
pageAge: (_a3 = result.page_age) != null ? _a3 : null,
|
|
5050
5072
|
encryptedContent: result.encrypted_content,
|
|
5051
5073
|
type: result.type
|
|
@@ -5059,7 +5081,7 @@ var AnthropicLanguageModel = class _AnthropicLanguageModel {
|
|
|
5059
5081
|
sourceType: "url",
|
|
5060
5082
|
id: generateId2(),
|
|
5061
5083
|
url: result.url,
|
|
5062
|
-
title: result.title,
|
|
5084
|
+
...result.title != null ? { title: result.title } : {},
|
|
5063
5085
|
providerMetadata: {
|
|
5064
5086
|
anthropic: {
|
|
5065
5087
|
pageAge: (_b2 = result.page_age) != null ? _b2 : null
|
|
@@ -5774,7 +5796,7 @@ function hasWebTool20260209WithoutCodeExecution(tools) {
|
|
|
5774
5796
|
hasWebTool20260209 = true;
|
|
5775
5797
|
continue;
|
|
5776
5798
|
}
|
|
5777
|
-
if (tool.
|
|
5799
|
+
if ("type" in tool && (tool.type === "code_execution_20250522" || tool.type === "code_execution_20250825" || tool.type === "code_execution_20260120")) {
|
|
5778
5800
|
hasCodeExecutionTool = true;
|
|
5779
5801
|
break;
|
|
5780
5802
|
}
|