@ai-sdk/anthropic 4.0.32 → 4.0.34

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/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  // src/anthropic-provider.ts
2
2
  import {
3
- InvalidArgumentError,
3
+ InvalidArgumentError as InvalidArgumentError2,
4
4
  NoSuchModelError
5
5
  } from "@ai-sdk/provider";
6
6
  import {
@@ -112,29 +112,29 @@ var AnthropicFiles = class {
112
112
  }
113
113
  };
114
114
 
115
- // src/anthropic-language-model.ts
115
+ // src/anthropic-messages-batch.ts
116
116
  import {
117
- APICallError,
118
- InvalidResponseDataError
117
+ EmptyResponseBodyError,
118
+ InvalidArgumentError,
119
+ UnsupportedFunctionalityError as UnsupportedFunctionalityError3
119
120
  } from "@ai-sdk/provider";
120
121
  import {
121
- combineHeaders as combineHeaders2,
122
- createEventSourceResponseHandler,
123
- createJsonResponseHandler as createJsonResponseHandler2,
124
- createToolNameMapping,
125
- generateId,
126
- isCustomReasoning,
127
- mapReasoningToProviderBudget,
128
- mapReasoningToProviderEffort,
129
- parseProviderOptions as parseProviderOptions2,
130
- postJsonToApi,
131
- resolve,
132
- resolveProviderReference as resolveProviderReference2,
133
- secureJsonParse as secureJsonParse2,
134
- serializeModelOptions,
135
- WORKFLOW_SERIALIZE,
136
- WORKFLOW_DESERIALIZE
122
+ combineHeaders as combineHeaders3,
123
+ convertAsyncIteratorToReadableStream,
124
+ createJsonResponseHandler as createJsonResponseHandler3,
125
+ getFromApi,
126
+ lazySchema as lazySchema14,
127
+ normalizeHeaders,
128
+ parseJSON,
129
+ parseProviderOptions as parseProviderOptions3,
130
+ postJsonToApi as postJsonToApi2,
131
+ resolve as resolve2,
132
+ safeValidateTypes,
133
+ WORKFLOW_DESERIALIZE as WORKFLOW_DESERIALIZE2,
134
+ WORKFLOW_SERIALIZE as WORKFLOW_SERIALIZE2,
135
+ zodSchema as zodSchema14
137
136
  } from "@ai-sdk/provider-utils";
137
+ import { z as z15 } from "zod/v4";
138
138
 
139
139
  // src/anthropic-api.ts
140
140
  import {
@@ -961,6 +961,30 @@ var anthropicReasoningMetadataSchema = lazySchema3(
961
961
  )
962
962
  );
963
963
 
964
+ // src/anthropic-language-model.ts
965
+ import {
966
+ APICallError,
967
+ InvalidResponseDataError
968
+ } from "@ai-sdk/provider";
969
+ import {
970
+ combineHeaders as combineHeaders2,
971
+ createEventSourceResponseHandler,
972
+ createJsonResponseHandler as createJsonResponseHandler2,
973
+ createToolNameMapping,
974
+ generateId,
975
+ isCustomReasoning,
976
+ mapReasoningToProviderBudget,
977
+ mapReasoningToProviderEffort,
978
+ parseProviderOptions as parseProviderOptions2,
979
+ postJsonToApi,
980
+ resolve,
981
+ resolveProviderReference as resolveProviderReference2,
982
+ secureJsonParse as secureJsonParse2,
983
+ serializeModelOptions,
984
+ WORKFLOW_SERIALIZE,
985
+ WORKFLOW_DESERIALIZE
986
+ } from "@ai-sdk/provider-utils";
987
+
964
988
  // src/anthropic-language-model-options.ts
965
989
  import { z as z4 } from "zod/v4";
966
990
  var anthropicFilePartProviderOptions = z4.object({
@@ -5837,18 +5861,561 @@ function mapAnthropicStopDetails(stopDetails) {
5837
5861
  };
5838
5862
  }
5839
5863
 
5864
+ // src/anthropic-messages-batch.ts
5865
+ var anthropicBatchRequestIdPattern = /^[A-Za-z0-9_-]{1,64}$/;
5866
+ var anthropicBatchProviderOptionsSchema = anthropicLanguageModelOptions.pick({
5867
+ anthropicBeta: true
5868
+ });
5869
+ var anthropicBatchResponseSchema = lazySchema14(
5870
+ () => zodSchema14(
5871
+ z15.object({
5872
+ id: z15.string(),
5873
+ type: z15.literal("message_batch"),
5874
+ processing_status: z15.string(),
5875
+ request_counts: z15.object({
5876
+ processing: z15.number(),
5877
+ succeeded: z15.number(),
5878
+ errored: z15.number(),
5879
+ canceled: z15.number(),
5880
+ expired: z15.number()
5881
+ }),
5882
+ created_at: z15.string(),
5883
+ expires_at: z15.string(),
5884
+ archived_at: z15.string().nullish(),
5885
+ results_url: z15.string().nullish()
5886
+ })
5887
+ )
5888
+ );
5889
+ var anthropicBatchResultLineSchema = lazySchema14(
5890
+ () => zodSchema14(
5891
+ z15.object({
5892
+ custom_id: z15.string(),
5893
+ result: z15.discriminatedUnion("type", [
5894
+ z15.object({
5895
+ type: z15.literal("succeeded"),
5896
+ message: z15.unknown()
5897
+ }),
5898
+ z15.object({
5899
+ type: z15.literal("errored"),
5900
+ error: z15.object({
5901
+ type: z15.literal("error"),
5902
+ error: z15.object({
5903
+ type: z15.string(),
5904
+ message: z15.string()
5905
+ }),
5906
+ request_id: z15.string().nullish()
5907
+ })
5908
+ }),
5909
+ z15.object({ type: z15.literal("canceled") }),
5910
+ z15.object({ type: z15.literal("expired") })
5911
+ ])
5912
+ })
5913
+ )
5914
+ );
5915
+ var AnthropicMessagesBatchLanguageModel = class _AnthropicMessagesBatchLanguageModel extends AnthropicLanguageModel {
5916
+ static [WORKFLOW_SERIALIZE2](model) {
5917
+ return AnthropicLanguageModel[WORKFLOW_SERIALIZE2](model);
5918
+ }
5919
+ static [WORKFLOW_DESERIALIZE2](options) {
5920
+ return new _AnthropicMessagesBatchLanguageModel(
5921
+ options.modelId,
5922
+ options.config
5923
+ );
5924
+ }
5925
+ constructor(modelId, config) {
5926
+ super(modelId, config);
5927
+ }
5928
+ async experimental_doStartBatch({
5929
+ requests,
5930
+ providerOptions,
5931
+ headers,
5932
+ abortSignal
5933
+ }) {
5934
+ validateRequestIds(requests);
5935
+ const explicitBatchBetas = new Set(
5936
+ await getAnthropicBatchProviderBetas({
5937
+ provider: this.config.provider,
5938
+ providerOptions
5939
+ })
5940
+ );
5941
+ const batchBetas = new Set(explicitBatchBetas);
5942
+ const preparedRequests = [];
5943
+ const batchWarnings = [];
5944
+ for (const request of requests) {
5945
+ const requestBetas = await getAnthropicBatchProviderBetas({
5946
+ provider: this.config.provider,
5947
+ providerOptions: request.options.providerOptions
5948
+ });
5949
+ if (requestBetas.length > 0) {
5950
+ throw new UnsupportedFunctionalityError3({
5951
+ functionality: "per-request providerOptions.anthropic.anthropicBeta",
5952
+ message: `Anthropic Message Batches do not support per-request betas (request "${request.id}"). Set providerOptions.anthropic.anthropicBeta on startTextBatch instead.`
5953
+ });
5954
+ }
5955
+ const prepared = await this.getArgs({
5956
+ ...request.options,
5957
+ stream: false,
5958
+ userSuppliedBetas: new Set(explicitBatchBetas)
5959
+ });
5960
+ const body = this.transformRequestBody(prepared.args, prepared.betas);
5961
+ validateAnthropicBatchBody({
5962
+ body,
5963
+ requestId: request.id
5964
+ });
5965
+ preparedRequests.push({ custom_id: request.id, params: body });
5966
+ for (const beta of prepared.betas) {
5967
+ batchBetas.add(beta);
5968
+ }
5969
+ for (const warning of prepared.warnings) {
5970
+ batchWarnings.push({ requestId: request.id, warning });
5971
+ }
5972
+ }
5973
+ const { value: batch } = await postJsonToApi2({
5974
+ url: this.getBatchUrl(""),
5975
+ headers: await this.getStartBatchHeaders({ betas: batchBetas, headers }),
5976
+ body: { requests: preparedRequests },
5977
+ failedResponseHandler: anthropicFailedResponseHandler,
5978
+ successfulResponseHandler: createJsonResponseHandler3(
5979
+ anthropicBatchResponseSchema
5980
+ ),
5981
+ abortSignal,
5982
+ fetch: this.config.fetch
5983
+ });
5984
+ return {
5985
+ batchId: batch.id,
5986
+ ...convertAnthropicBatchStatus(batch),
5987
+ warnings: batchWarnings
5988
+ };
5989
+ }
5990
+ async experimental_doGetBatchStatus(options) {
5991
+ return convertAnthropicBatchStatus(await this.retrieveBatch(options));
5992
+ }
5993
+ async experimental_doGetBatchResults(options) {
5994
+ const batch = await this.retrieveBatch(options);
5995
+ if (convertAnthropicBatchStatus(batch).status === "pending") {
5996
+ throw new InvalidArgumentError({
5997
+ argument: "batchId",
5998
+ message: `Anthropic batch "${options.batchId}" is not complete.`
5999
+ });
6000
+ }
6001
+ if (batch.archived_at != null) {
6002
+ throw new InvalidArgumentError({
6003
+ argument: "batchId",
6004
+ message: `Anthropic batch "${options.batchId}" results are no longer available.`
6005
+ });
6006
+ }
6007
+ if (batch.results_url == null) {
6008
+ throw new InvalidArgumentError({
6009
+ argument: "batchId",
6010
+ message: `Anthropic batch "${options.batchId}" does not have a results URL.`
6011
+ });
6012
+ }
6013
+ const { value: stream } = await getFromApi({
6014
+ url: batch.results_url,
6015
+ validateUrl: true,
6016
+ credentialedOrigin: this.config.baseURL,
6017
+ trustedOrigin: this.config.baseURL,
6018
+ headers: await this.getBatchHeaders(options.headers),
6019
+ failedResponseHandler: anthropicFailedResponseHandler,
6020
+ successfulResponseHandler: rawStreamResponseHandler,
6021
+ abortSignal: options.abortSignal,
6022
+ fetch: this.config.fetch
6023
+ });
6024
+ return convertAsyncIteratorToReadableStream(
6025
+ this.iterateBatchResults(stream)
6026
+ );
6027
+ }
6028
+ async retrieveBatch(options) {
6029
+ const { value: batch } = await getFromApi({
6030
+ url: this.getBatchUrl(`/${encodeURIComponent(options.batchId)}`),
6031
+ validateUrl: false,
6032
+ headers: await this.getBatchHeaders(options.headers),
6033
+ failedResponseHandler: anthropicFailedResponseHandler,
6034
+ successfulResponseHandler: createJsonResponseHandler3(
6035
+ anthropicBatchResponseSchema
6036
+ ),
6037
+ abortSignal: options.abortSignal,
6038
+ fetch: this.config.fetch
6039
+ });
6040
+ return batch;
6041
+ }
6042
+ async *iterateBatchResults(stream) {
6043
+ for await (const line of parseJsonLines(stream)) {
6044
+ yield await convertAnthropicBatchResult(line);
6045
+ }
6046
+ }
6047
+ getBatchUrl(path) {
6048
+ return `${this.config.baseURL}/messages/batches${path}`;
6049
+ }
6050
+ async getStartBatchHeaders({
6051
+ betas,
6052
+ headers
6053
+ }) {
6054
+ return combineHeaders3(
6055
+ normalizeHeaders(await this.getBatchHeaders(headers)),
6056
+ {
6057
+ "anthropic-beta": betas.size > 0 ? Array.from(betas).join(",") : void 0
6058
+ }
6059
+ );
6060
+ }
6061
+ async getBatchHeaders(headers) {
6062
+ return combineHeaders3(
6063
+ this.config.headers ? await resolve2(this.config.headers) : void 0,
6064
+ headers
6065
+ );
6066
+ }
6067
+ };
6068
+ async function getAnthropicBatchProviderBetas({
6069
+ provider,
6070
+ providerOptions
6071
+ }) {
6072
+ var _a;
6073
+ const providerOptionsName = provider.split(".")[0];
6074
+ const canonicalOptions = await parseProviderOptions3({
6075
+ provider: "anthropic",
6076
+ providerOptions,
6077
+ schema: anthropicBatchProviderOptionsSchema
6078
+ });
6079
+ const customOptions = providerOptionsName !== "anthropic" ? await parseProviderOptions3({
6080
+ provider: providerOptionsName,
6081
+ providerOptions,
6082
+ schema: anthropicBatchProviderOptionsSchema
6083
+ }) : void 0;
6084
+ const anthropicOptions = Object.assign(
6085
+ {},
6086
+ canonicalOptions != null ? canonicalOptions : {},
6087
+ customOptions != null ? customOptions : {}
6088
+ );
6089
+ return (_a = anthropicOptions.anthropicBeta) != null ? _a : [];
6090
+ }
6091
+ function validateRequestIds(requests) {
6092
+ const ids = /* @__PURE__ */ new Set();
6093
+ for (const request of requests) {
6094
+ if (!anthropicBatchRequestIdPattern.test(request.id)) {
6095
+ throw new InvalidArgumentError({
6096
+ argument: "requests",
6097
+ message: `Anthropic batch request ID "${request.id}" must match ^[A-Za-z0-9_-]{1,64}$.`
6098
+ });
6099
+ }
6100
+ if (ids.has(request.id)) {
6101
+ throw new InvalidArgumentError({
6102
+ argument: "requests",
6103
+ message: `Anthropic batch request IDs must be unique; duplicate ID "${request.id}".`
6104
+ });
6105
+ }
6106
+ ids.add(request.id);
6107
+ }
6108
+ }
6109
+ function validateAnthropicBatchBody({
6110
+ body,
6111
+ requestId
6112
+ }) {
6113
+ if (body.speed != null) {
6114
+ throw new UnsupportedFunctionalityError3({
6115
+ functionality: "providerOptions.anthropic.speed",
6116
+ message: `Anthropic Message Batches do not support speed (request "${requestId}").`
6117
+ });
6118
+ }
6119
+ if (Array.isArray(body.fallbacks) && body.fallbacks.some(
6120
+ (fallback) => fallback != null && typeof fallback === "object" && "speed" in fallback && fallback.speed != null
6121
+ )) {
6122
+ throw new UnsupportedFunctionalityError3({
6123
+ functionality: "providerOptions.anthropic.fallbacks[].speed",
6124
+ message: `Anthropic Message Batches do not support fallback speed (request "${requestId}").`
6125
+ });
6126
+ }
6127
+ }
6128
+ function convertAnthropicBatchStatus(batch) {
6129
+ const requestCounts = convertAnthropicRequestCounts(batch.request_counts);
6130
+ return {
6131
+ status: mapAnthropicBatchStatus(batch.processing_status),
6132
+ rawStatus: batch.processing_status,
6133
+ ...requestCounts != null ? { requestCounts } : {},
6134
+ createdAt: batch.created_at,
6135
+ expiresAt: batch.expires_at
6136
+ };
6137
+ }
6138
+ function mapAnthropicBatchStatus(rawStatus) {
6139
+ switch (rawStatus) {
6140
+ case "ended":
6141
+ return "completed";
6142
+ case "in_progress":
6143
+ case "canceling":
6144
+ default:
6145
+ return "pending";
6146
+ }
6147
+ }
6148
+ function convertAnthropicRequestCounts(counts) {
6149
+ const values = [
6150
+ counts.processing,
6151
+ counts.succeeded,
6152
+ counts.errored,
6153
+ counts.canceled,
6154
+ counts.expired
6155
+ ];
6156
+ if (values.some((value) => !Number.isFinite(value) || value < 0)) {
6157
+ return void 0;
6158
+ }
6159
+ return {
6160
+ total: values.reduce((total, value) => total + value, 0),
6161
+ pending: counts.processing,
6162
+ completed: counts.succeeded,
6163
+ failed: counts.errored + counts.canceled + counts.expired
6164
+ };
6165
+ }
6166
+ async function convertAnthropicBatchResult(line) {
6167
+ switch (line.result.type) {
6168
+ case "canceled":
6169
+ return { id: line.custom_id, status: "cancelled" };
6170
+ case "expired":
6171
+ return { id: line.custom_id, status: "expired" };
6172
+ case "errored": {
6173
+ const requestId = line.result.error.request_id;
6174
+ return {
6175
+ id: line.custom_id,
6176
+ status: "failed",
6177
+ error: {
6178
+ message: line.result.error.error.message,
6179
+ type: line.result.error.error.type
6180
+ },
6181
+ ...requestId != null ? {
6182
+ providerMetadata: {
6183
+ anthropic: { requestId }
6184
+ }
6185
+ } : {}
6186
+ };
6187
+ }
6188
+ case "succeeded": {
6189
+ const validation = await safeValidateTypes({
6190
+ value: line.result.message,
6191
+ schema: anthropicResponseSchema
6192
+ });
6193
+ if (!validation.success) {
6194
+ return {
6195
+ id: line.custom_id,
6196
+ status: "failed",
6197
+ error: {
6198
+ message: "Anthropic returned an invalid Message batch result.",
6199
+ code: "invalid_response"
6200
+ }
6201
+ };
6202
+ }
6203
+ const response = validation.value;
6204
+ const unsupportedPart = response.content.find(
6205
+ (part) => !supportedBatchContentTypes.has(part.type)
6206
+ );
6207
+ if (unsupportedPart != null) {
6208
+ return {
6209
+ id: line.custom_id,
6210
+ status: "failed",
6211
+ error: {
6212
+ message: `Anthropic returned a "${unsupportedPart.type}" content block, but tool content is not supported in AI SDK text batches.`,
6213
+ code: "unsupported_tool_content"
6214
+ }
6215
+ };
6216
+ }
6217
+ return {
6218
+ id: line.custom_id,
6219
+ status: "succeeded",
6220
+ result: convertAnthropicBatchResponse(response)
6221
+ };
6222
+ }
6223
+ }
6224
+ }
6225
+ var supportedBatchContentTypes = /* @__PURE__ */ new Set([
6226
+ "text",
6227
+ "thinking",
6228
+ "redacted_thinking",
6229
+ "compaction",
6230
+ // The normal Anthropic response conversion intentionally drops this marker;
6231
+ // the fallback hop remains available through usage.iterations metadata.
6232
+ "fallback"
6233
+ ]);
6234
+ function convertAnthropicBatchResponse(response) {
6235
+ var _a, _b, _c;
6236
+ const content = [];
6237
+ for (const part of response.content) {
6238
+ switch (part.type) {
6239
+ case "text":
6240
+ content.push({ type: "text", text: part.text });
6241
+ break;
6242
+ case "thinking":
6243
+ content.push({
6244
+ type: "reasoning",
6245
+ text: part.thinking,
6246
+ providerMetadata: {
6247
+ anthropic: {
6248
+ signature: part.signature
6249
+ }
6250
+ }
6251
+ });
6252
+ break;
6253
+ case "redacted_thinking":
6254
+ content.push({
6255
+ type: "reasoning",
6256
+ text: "",
6257
+ providerMetadata: {
6258
+ anthropic: {
6259
+ redactedData: part.data
6260
+ }
6261
+ }
6262
+ });
6263
+ break;
6264
+ case "compaction":
6265
+ content.push({
6266
+ type: "text",
6267
+ text: part.content,
6268
+ providerMetadata: { anthropic: { type: "compaction" } }
6269
+ });
6270
+ break;
6271
+ }
6272
+ }
6273
+ return {
6274
+ content,
6275
+ finishReason: {
6276
+ unified: mapAnthropicStopReason({
6277
+ finishReason: response.stop_reason
6278
+ }),
6279
+ raw: (_a = response.stop_reason) != null ? _a : void 0
6280
+ },
6281
+ usage: convertAnthropicUsage({ usage: response.usage }),
6282
+ response: {
6283
+ id: (_b = response.id) != null ? _b : void 0,
6284
+ modelId: (_c = response.model) != null ? _c : void 0
6285
+ },
6286
+ warnings: [],
6287
+ providerMetadata: {
6288
+ anthropic: convertAnthropicMessageMetadata(response)
6289
+ }
6290
+ };
6291
+ }
6292
+ function convertAnthropicMessageMetadata(response) {
6293
+ var _a, _b, _c;
6294
+ const stopDetails = mapAnthropicStopDetails2(response.stop_details);
6295
+ return {
6296
+ usage: response.usage,
6297
+ stopSequence: (_a = response.stop_sequence) != null ? _a : null,
6298
+ ...stopDetails != null ? { stopDetails } : {},
6299
+ iterations: response.usage.iterations ? response.usage.iterations.map(
6300
+ (iteration) => ({
6301
+ type: iteration.type,
6302
+ ...iteration.model != null ? { model: iteration.model } : {},
6303
+ inputTokens: iteration.input_tokens,
6304
+ outputTokens: iteration.output_tokens,
6305
+ ...iteration.cache_creation_input_tokens ? {
6306
+ cacheCreationInputTokens: iteration.cache_creation_input_tokens
6307
+ } : {},
6308
+ ...iteration.cache_read_input_tokens ? { cacheReadInputTokens: iteration.cache_read_input_tokens } : {}
6309
+ })
6310
+ ) : null,
6311
+ container: response.container ? {
6312
+ expiresAt: response.container.expires_at,
6313
+ id: response.container.id,
6314
+ skills: (_c = (_b = response.container.skills) == null ? void 0 : _b.map((skill) => ({
6315
+ type: skill.type,
6316
+ skillId: skill.skill_id,
6317
+ version: skill.version
6318
+ }))) != null ? _c : null
6319
+ } : null,
6320
+ contextManagement: mapAnthropicResponseContextManagement2(
6321
+ response.context_management
6322
+ )
6323
+ };
6324
+ }
6325
+ function mapAnthropicResponseContextManagement2(contextManagement) {
6326
+ return contextManagement ? {
6327
+ appliedEdits: contextManagement.applied_edits.map((edit) => {
6328
+ switch (edit.type) {
6329
+ case "clear_tool_uses_20250919":
6330
+ return {
6331
+ type: edit.type,
6332
+ clearedToolUses: edit.cleared_tool_uses,
6333
+ clearedInputTokens: edit.cleared_input_tokens
6334
+ };
6335
+ case "clear_thinking_20251015":
6336
+ return {
6337
+ type: edit.type,
6338
+ clearedThinkingTurns: edit.cleared_thinking_turns,
6339
+ clearedInputTokens: edit.cleared_input_tokens
6340
+ };
6341
+ case "compact_20260112":
6342
+ return { type: edit.type };
6343
+ }
6344
+ })
6345
+ } : null;
6346
+ }
6347
+ function mapAnthropicStopDetails2(stopDetails) {
6348
+ if (stopDetails == null) {
6349
+ return void 0;
6350
+ }
6351
+ return {
6352
+ type: stopDetails.type,
6353
+ ...stopDetails.category != null ? { category: stopDetails.category } : {},
6354
+ ...stopDetails.explanation != null ? { explanation: stopDetails.explanation } : {},
6355
+ ...stopDetails.recommended_model != null ? { recommendedModel: stopDetails.recommended_model } : {}
6356
+ };
6357
+ }
6358
+ var rawStreamResponseHandler = async ({ response }) => {
6359
+ if (response.body == null) {
6360
+ throw new EmptyResponseBodyError();
6361
+ }
6362
+ return { value: response.body };
6363
+ };
6364
+ async function* parseJsonLines(stream) {
6365
+ const reader = stream.getReader();
6366
+ const decoder = new TextDecoder();
6367
+ let buffer = "";
6368
+ let finished = false;
6369
+ try {
6370
+ while (true) {
6371
+ const { done, value } = await reader.read();
6372
+ if (done) {
6373
+ finished = true;
6374
+ buffer += decoder.decode();
6375
+ break;
6376
+ }
6377
+ buffer += decoder.decode(value, { stream: true });
6378
+ let lineEnd = buffer.indexOf("\n");
6379
+ while (lineEnd !== -1) {
6380
+ const line = buffer.slice(0, lineEnd).replace(/\r$/, "");
6381
+ buffer = buffer.slice(lineEnd + 1);
6382
+ if (line.trim().length > 0) {
6383
+ yield await parseJSON({
6384
+ text: line,
6385
+ schema: anthropicBatchResultLineSchema
6386
+ });
6387
+ }
6388
+ lineEnd = buffer.indexOf("\n");
6389
+ }
6390
+ }
6391
+ const finalLine = buffer.replace(/\r$/, "");
6392
+ if (finalLine.trim().length > 0) {
6393
+ yield await parseJSON({
6394
+ text: finalLine,
6395
+ schema: anthropicBatchResultLineSchema
6396
+ });
6397
+ }
6398
+ } finally {
6399
+ if (!finished) {
6400
+ await reader.cancel().catch(() => {
6401
+ });
6402
+ }
6403
+ reader.releaseLock();
6404
+ }
6405
+ }
6406
+
5840
6407
  // src/tool/bash_20241022.ts
5841
6408
  import {
5842
6409
  createProviderDefinedToolFactory as createProviderDefinedToolFactory2,
5843
- lazySchema as lazySchema14,
5844
- zodSchema as zodSchema14
6410
+ lazySchema as lazySchema15,
6411
+ zodSchema as zodSchema15
5845
6412
  } from "@ai-sdk/provider-utils";
5846
- import { z as z15 } from "zod/v4";
5847
- var bash_20241022InputSchema = lazySchema14(
5848
- () => zodSchema14(
5849
- z15.object({
5850
- command: z15.string(),
5851
- restart: z15.boolean().optional()
6413
+ import { z as z16 } from "zod/v4";
6414
+ var bash_20241022InputSchema = lazySchema15(
6415
+ () => zodSchema15(
6416
+ z16.object({
6417
+ command: z16.string(),
6418
+ restart: z16.boolean().optional()
5852
6419
  })
5853
6420
  )
5854
6421
  );
@@ -5881,15 +6448,15 @@ function bash_20241022(options = {}) {
5881
6448
  // src/tool/bash_20250124.ts
5882
6449
  import {
5883
6450
  createProviderDefinedToolFactory as createProviderDefinedToolFactory3,
5884
- lazySchema as lazySchema15,
5885
- zodSchema as zodSchema15
6451
+ lazySchema as lazySchema16,
6452
+ zodSchema as zodSchema16
5886
6453
  } from "@ai-sdk/provider-utils";
5887
- import { z as z16 } from "zod/v4";
5888
- var bash_20250124InputSchema = lazySchema15(
5889
- () => zodSchema15(
5890
- z16.object({
5891
- command: z16.string(),
5892
- restart: z16.boolean().optional()
6454
+ import { z as z17 } from "zod/v4";
6455
+ var bash_20250124InputSchema = lazySchema16(
6456
+ () => zodSchema16(
6457
+ z17.object({
6458
+ command: z17.string(),
6459
+ restart: z17.boolean().optional()
5893
6460
  })
5894
6461
  )
5895
6462
  );
@@ -5922,14 +6489,14 @@ function bash_20250124(options = {}) {
5922
6489
  // src/tool/computer_20241022.ts
5923
6490
  import {
5924
6491
  createProviderDefinedToolFactory as createProviderDefinedToolFactory4,
5925
- lazySchema as lazySchema16,
5926
- zodSchema as zodSchema16
6492
+ lazySchema as lazySchema17,
6493
+ zodSchema as zodSchema17
5927
6494
  } from "@ai-sdk/provider-utils";
5928
- import { z as z17 } from "zod/v4";
5929
- var computer_20241022InputSchema = lazySchema16(
5930
- () => zodSchema16(
5931
- z17.object({
5932
- action: z17.enum([
6495
+ import { z as z18 } from "zod/v4";
6496
+ var computer_20241022InputSchema = lazySchema17(
6497
+ () => zodSchema17(
6498
+ z18.object({
6499
+ action: z18.enum([
5933
6500
  "key",
5934
6501
  "type",
5935
6502
  "mouse_move",
@@ -5941,8 +6508,8 @@ var computer_20241022InputSchema = lazySchema16(
5941
6508
  "screenshot",
5942
6509
  "cursor_position"
5943
6510
  ]),
5944
- coordinate: z17.array(z17.number().int()).optional(),
5945
- text: z17.string().optional()
6511
+ coordinate: z18.array(z18.number().int()).optional(),
6512
+ text: z18.string().optional()
5946
6513
  })
5947
6514
  )
5948
6515
  );
@@ -5954,14 +6521,14 @@ var computer_20241022 = createProviderDefinedToolFactory4({
5954
6521
  // src/tool/computer_20250124.ts
5955
6522
  import {
5956
6523
  createProviderDefinedToolFactory as createProviderDefinedToolFactory5,
5957
- lazySchema as lazySchema17,
5958
- zodSchema as zodSchema17
6524
+ lazySchema as lazySchema18,
6525
+ zodSchema as zodSchema18
5959
6526
  } from "@ai-sdk/provider-utils";
5960
- import { z as z18 } from "zod/v4";
5961
- var computer_20250124InputSchema = lazySchema17(
5962
- () => zodSchema17(
5963
- z18.object({
5964
- action: z18.enum([
6527
+ import { z as z19 } from "zod/v4";
6528
+ var computer_20250124InputSchema = lazySchema18(
6529
+ () => zodSchema18(
6530
+ z19.object({
6531
+ action: z19.enum([
5965
6532
  "key",
5966
6533
  "hold_key",
5967
6534
  "type",
@@ -5979,12 +6546,12 @@ var computer_20250124InputSchema = lazySchema17(
5979
6546
  "wait",
5980
6547
  "screenshot"
5981
6548
  ]),
5982
- coordinate: z18.tuple([z18.number().int(), z18.number().int()]).optional(),
5983
- duration: z18.number().optional(),
5984
- scroll_amount: z18.number().optional(),
5985
- scroll_direction: z18.enum(["up", "down", "left", "right"]).optional(),
5986
- start_coordinate: z18.tuple([z18.number().int(), z18.number().int()]).optional(),
5987
- text: z18.string().optional()
6549
+ coordinate: z19.tuple([z19.number().int(), z19.number().int()]).optional(),
6550
+ duration: z19.number().optional(),
6551
+ scroll_amount: z19.number().optional(),
6552
+ scroll_direction: z19.enum(["up", "down", "left", "right"]).optional(),
6553
+ start_coordinate: z19.tuple([z19.number().int(), z19.number().int()]).optional(),
6554
+ text: z19.string().optional()
5988
6555
  })
5989
6556
  )
5990
6557
  );
@@ -5996,14 +6563,14 @@ var computer_20250124 = createProviderDefinedToolFactory5({
5996
6563
  // src/tool/computer_20251124.ts
5997
6564
  import {
5998
6565
  createProviderDefinedToolFactory as createProviderDefinedToolFactory6,
5999
- lazySchema as lazySchema18,
6000
- zodSchema as zodSchema18
6566
+ lazySchema as lazySchema19,
6567
+ zodSchema as zodSchema19
6001
6568
  } from "@ai-sdk/provider-utils";
6002
- import { z as z19 } from "zod/v4";
6003
- var computer_20251124InputSchema = lazySchema18(
6004
- () => zodSchema18(
6005
- z19.object({
6006
- action: z19.enum([
6569
+ import { z as z20 } from "zod/v4";
6570
+ var computer_20251124InputSchema = lazySchema19(
6571
+ () => zodSchema19(
6572
+ z20.object({
6573
+ action: z20.enum([
6007
6574
  "key",
6008
6575
  "hold_key",
6009
6576
  "type",
@@ -6022,18 +6589,18 @@ var computer_20251124InputSchema = lazySchema18(
6022
6589
  "screenshot",
6023
6590
  "zoom"
6024
6591
  ]),
6025
- coordinate: z19.tuple([z19.number().int(), z19.number().int()]).optional(),
6026
- duration: z19.number().optional(),
6027
- region: z19.tuple([
6028
- z19.number().int(),
6029
- z19.number().int(),
6030
- z19.number().int(),
6031
- z19.number().int()
6592
+ coordinate: z20.tuple([z20.number().int(), z20.number().int()]).optional(),
6593
+ duration: z20.number().optional(),
6594
+ region: z20.tuple([
6595
+ z20.number().int(),
6596
+ z20.number().int(),
6597
+ z20.number().int(),
6598
+ z20.number().int()
6032
6599
  ]).optional(),
6033
- scroll_amount: z19.number().optional(),
6034
- scroll_direction: z19.enum(["up", "down", "left", "right"]).optional(),
6035
- start_coordinate: z19.tuple([z19.number().int(), z19.number().int()]).optional(),
6036
- text: z19.string().optional()
6600
+ scroll_amount: z20.number().optional(),
6601
+ scroll_direction: z20.enum(["up", "down", "left", "right"]).optional(),
6602
+ start_coordinate: z20.tuple([z20.number().int(), z20.number().int()]).optional(),
6603
+ text: z20.string().optional()
6037
6604
  })
6038
6605
  )
6039
6606
  );
@@ -6045,43 +6612,43 @@ var computer_20251124 = createProviderDefinedToolFactory6({
6045
6612
  // src/tool/memory_20250818.ts
6046
6613
  import {
6047
6614
  createProviderDefinedToolFactory as createProviderDefinedToolFactory7,
6048
- lazySchema as lazySchema19,
6049
- zodSchema as zodSchema19
6615
+ lazySchema as lazySchema20,
6616
+ zodSchema as zodSchema20
6050
6617
  } from "@ai-sdk/provider-utils";
6051
- import { z as z20 } from "zod/v4";
6052
- var memory_20250818InputSchema = lazySchema19(
6053
- () => zodSchema19(
6054
- z20.discriminatedUnion("command", [
6055
- z20.object({
6056
- command: z20.literal("view"),
6057
- path: z20.string(),
6058
- view_range: z20.tuple([z20.number(), z20.number()]).optional()
6618
+ import { z as z21 } from "zod/v4";
6619
+ var memory_20250818InputSchema = lazySchema20(
6620
+ () => zodSchema20(
6621
+ z21.discriminatedUnion("command", [
6622
+ z21.object({
6623
+ command: z21.literal("view"),
6624
+ path: z21.string(),
6625
+ view_range: z21.tuple([z21.number(), z21.number()]).optional()
6059
6626
  }),
6060
- z20.object({
6061
- command: z20.literal("create"),
6062
- path: z20.string(),
6063
- file_text: z20.string()
6627
+ z21.object({
6628
+ command: z21.literal("create"),
6629
+ path: z21.string(),
6630
+ file_text: z21.string()
6064
6631
  }),
6065
- z20.object({
6066
- command: z20.literal("str_replace"),
6067
- path: z20.string(),
6068
- old_str: z20.string(),
6069
- new_str: z20.string()
6632
+ z21.object({
6633
+ command: z21.literal("str_replace"),
6634
+ path: z21.string(),
6635
+ old_str: z21.string(),
6636
+ new_str: z21.string()
6070
6637
  }),
6071
- z20.object({
6072
- command: z20.literal("insert"),
6073
- path: z20.string(),
6074
- insert_line: z20.number(),
6075
- insert_text: z20.string()
6638
+ z21.object({
6639
+ command: z21.literal("insert"),
6640
+ path: z21.string(),
6641
+ insert_line: z21.number(),
6642
+ insert_text: z21.string()
6076
6643
  }),
6077
- z20.object({
6078
- command: z20.literal("delete"),
6079
- path: z20.string()
6644
+ z21.object({
6645
+ command: z21.literal("delete"),
6646
+ path: z21.string()
6080
6647
  }),
6081
- z20.object({
6082
- command: z20.literal("rename"),
6083
- old_path: z20.string(),
6084
- new_path: z20.string()
6648
+ z21.object({
6649
+ command: z21.literal("rename"),
6650
+ old_path: z21.string(),
6651
+ new_path: z21.string()
6085
6652
  })
6086
6653
  ])
6087
6654
  )
@@ -6094,37 +6661,11 @@ var memory_20250818 = createProviderDefinedToolFactory7({
6094
6661
  // src/tool/text-editor_20241022.ts
6095
6662
  import {
6096
6663
  createProviderDefinedToolFactory as createProviderDefinedToolFactory8,
6097
- lazySchema as lazySchema20,
6098
- zodSchema as zodSchema20
6099
- } from "@ai-sdk/provider-utils";
6100
- import { z as z21 } from "zod/v4";
6101
- var textEditor_20241022InputSchema = lazySchema20(
6102
- () => zodSchema20(
6103
- z21.object({
6104
- command: z21.enum(["view", "create", "str_replace", "insert", "undo_edit"]),
6105
- path: z21.string(),
6106
- file_text: z21.string().optional(),
6107
- insert_line: z21.number().int().optional(),
6108
- new_str: z21.string().optional(),
6109
- insert_text: z21.string().optional(),
6110
- old_str: z21.string().optional(),
6111
- view_range: z21.array(z21.number().int()).optional()
6112
- })
6113
- )
6114
- );
6115
- var textEditor_20241022 = createProviderDefinedToolFactory8({
6116
- id: "anthropic.text_editor_20241022",
6117
- inputSchema: textEditor_20241022InputSchema
6118
- });
6119
-
6120
- // src/tool/text-editor_20250124.ts
6121
- import {
6122
- createProviderDefinedToolFactory as createProviderDefinedToolFactory9,
6123
6664
  lazySchema as lazySchema21,
6124
6665
  zodSchema as zodSchema21
6125
6666
  } from "@ai-sdk/provider-utils";
6126
6667
  import { z as z22 } from "zod/v4";
6127
- var textEditor_20250124InputSchema = lazySchema21(
6668
+ var textEditor_20241022InputSchema = lazySchema21(
6128
6669
  () => zodSchema21(
6129
6670
  z22.object({
6130
6671
  command: z22.enum(["view", "create", "str_replace", "insert", "undo_edit"]),
@@ -6138,22 +6679,22 @@ var textEditor_20250124InputSchema = lazySchema21(
6138
6679
  })
6139
6680
  )
6140
6681
  );
6141
- var textEditor_20250124 = createProviderDefinedToolFactory9({
6142
- id: "anthropic.text_editor_20250124",
6143
- inputSchema: textEditor_20250124InputSchema
6682
+ var textEditor_20241022 = createProviderDefinedToolFactory8({
6683
+ id: "anthropic.text_editor_20241022",
6684
+ inputSchema: textEditor_20241022InputSchema
6144
6685
  });
6145
6686
 
6146
- // src/tool/text-editor_20250429.ts
6687
+ // src/tool/text-editor_20250124.ts
6147
6688
  import {
6148
- createProviderDefinedToolFactory as createProviderDefinedToolFactory10,
6689
+ createProviderDefinedToolFactory as createProviderDefinedToolFactory9,
6149
6690
  lazySchema as lazySchema22,
6150
6691
  zodSchema as zodSchema22
6151
6692
  } from "@ai-sdk/provider-utils";
6152
6693
  import { z as z23 } from "zod/v4";
6153
- var textEditor_20250429InputSchema = lazySchema22(
6694
+ var textEditor_20250124InputSchema = lazySchema22(
6154
6695
  () => zodSchema22(
6155
6696
  z23.object({
6156
- command: z23.enum(["view", "create", "str_replace", "insert"]),
6697
+ command: z23.enum(["view", "create", "str_replace", "insert", "undo_edit"]),
6157
6698
  path: z23.string(),
6158
6699
  file_text: z23.string().optional(),
6159
6700
  insert_line: z23.number().int().optional(),
@@ -6164,6 +6705,32 @@ var textEditor_20250429InputSchema = lazySchema22(
6164
6705
  })
6165
6706
  )
6166
6707
  );
6708
+ var textEditor_20250124 = createProviderDefinedToolFactory9({
6709
+ id: "anthropic.text_editor_20250124",
6710
+ inputSchema: textEditor_20250124InputSchema
6711
+ });
6712
+
6713
+ // src/tool/text-editor_20250429.ts
6714
+ import {
6715
+ createProviderDefinedToolFactory as createProviderDefinedToolFactory10,
6716
+ lazySchema as lazySchema23,
6717
+ zodSchema as zodSchema23
6718
+ } from "@ai-sdk/provider-utils";
6719
+ import { z as z24 } from "zod/v4";
6720
+ var textEditor_20250429InputSchema = lazySchema23(
6721
+ () => zodSchema23(
6722
+ z24.object({
6723
+ command: z24.enum(["view", "create", "str_replace", "insert"]),
6724
+ path: z24.string(),
6725
+ file_text: z24.string().optional(),
6726
+ insert_line: z24.number().int().optional(),
6727
+ new_str: z24.string().optional(),
6728
+ insert_text: z24.string().optional(),
6729
+ old_str: z24.string().optional(),
6730
+ view_range: z24.array(z24.number().int()).optional()
6731
+ })
6732
+ )
6733
+ );
6167
6734
  var textEditor_20250429 = createProviderDefinedToolFactory10({
6168
6735
  id: "anthropic.text_editor_20250429",
6169
6736
  inputSchema: textEditor_20250429InputSchema
@@ -6172,32 +6739,32 @@ var textEditor_20250429 = createProviderDefinedToolFactory10({
6172
6739
  // src/tool/tool-search-bm25_20251119.ts
6173
6740
  import {
6174
6741
  createProviderExecutedToolFactory as createProviderExecutedToolFactory10,
6175
- lazySchema as lazySchema23,
6176
- zodSchema as zodSchema23
6742
+ lazySchema as lazySchema24,
6743
+ zodSchema as zodSchema24
6177
6744
  } from "@ai-sdk/provider-utils";
6178
- import { z as z24 } from "zod/v4";
6179
- var toolSearchBm25_20251119OutputSchema = lazySchema23(
6180
- () => zodSchema23(
6181
- z24.array(
6182
- z24.object({
6183
- type: z24.literal("tool_reference"),
6184
- toolName: z24.string()
6745
+ import { z as z25 } from "zod/v4";
6746
+ var toolSearchBm25_20251119OutputSchema = lazySchema24(
6747
+ () => zodSchema24(
6748
+ z25.array(
6749
+ z25.object({
6750
+ type: z25.literal("tool_reference"),
6751
+ toolName: z25.string()
6185
6752
  })
6186
6753
  )
6187
6754
  )
6188
6755
  );
6189
- var toolSearchBm25_20251119InputSchema = lazySchema23(
6190
- () => zodSchema23(
6191
- z24.object({
6756
+ var toolSearchBm25_20251119InputSchema = lazySchema24(
6757
+ () => zodSchema24(
6758
+ z25.object({
6192
6759
  /**
6193
6760
  * A natural language query to search for tools.
6194
6761
  * Claude will use BM25 text search to find relevant tools.
6195
6762
  */
6196
- query: z24.string(),
6763
+ query: z25.string(),
6197
6764
  /**
6198
6765
  * Maximum number of tools to return. Optional.
6199
6766
  */
6200
- limit: z24.number().optional()
6767
+ limit: z25.number().optional()
6201
6768
  })
6202
6769
  )
6203
6770
  );
@@ -6446,49 +7013,49 @@ var anthropicTools = {
6446
7013
 
6447
7014
  // src/skills/anthropic-skills.ts
6448
7015
  import {
6449
- combineHeaders as combineHeaders3,
7016
+ combineHeaders as combineHeaders4,
6450
7017
  convertInlineFileDataToUint8Array as convertInlineFileDataToUint8Array2,
6451
- createJsonResponseHandler as createJsonResponseHandler3,
6452
- getFromApi,
7018
+ createJsonResponseHandler as createJsonResponseHandler4,
7019
+ getFromApi as getFromApi2,
6453
7020
  postFormDataToApi as postFormDataToApi2,
6454
- resolve as resolve2
7021
+ resolve as resolve3
6455
7022
  } from "@ai-sdk/provider-utils";
6456
7023
 
6457
7024
  // src/skills/anthropic-skills-api.ts
6458
- import { lazySchema as lazySchema24, zodSchema as zodSchema24 } from "@ai-sdk/provider-utils";
6459
- import { z as z25 } from "zod/v4";
6460
- var anthropicSkillResponseSchema = lazySchema24(
6461
- () => zodSchema24(
6462
- z25.object({
6463
- id: z25.string(),
6464
- display_title: z25.string().nullish(),
6465
- name: z25.string().nullish(),
6466
- description: z25.string().nullish(),
6467
- latest_version: z25.string().nullish(),
6468
- source: z25.string(),
6469
- created_at: z25.string(),
6470
- updated_at: z25.string()
7025
+ import { lazySchema as lazySchema25, zodSchema as zodSchema25 } from "@ai-sdk/provider-utils";
7026
+ import { z as z26 } from "zod/v4";
7027
+ var anthropicSkillResponseSchema = lazySchema25(
7028
+ () => zodSchema25(
7029
+ z26.object({
7030
+ id: z26.string(),
7031
+ display_title: z26.string().nullish(),
7032
+ name: z26.string().nullish(),
7033
+ description: z26.string().nullish(),
7034
+ latest_version: z26.string().nullish(),
7035
+ source: z26.string(),
7036
+ created_at: z26.string(),
7037
+ updated_at: z26.string()
6471
7038
  })
6472
7039
  )
6473
7040
  );
6474
- var anthropicSkillVersionListResponseSchema = lazySchema24(
6475
- () => zodSchema24(
6476
- z25.object({
6477
- data: z25.array(
6478
- z25.object({
6479
- version: z25.string()
7041
+ var anthropicSkillVersionListResponseSchema = lazySchema25(
7042
+ () => zodSchema25(
7043
+ z26.object({
7044
+ data: z26.array(
7045
+ z26.object({
7046
+ version: z26.string()
6480
7047
  })
6481
7048
  )
6482
7049
  })
6483
7050
  )
6484
7051
  );
6485
- var anthropicSkillVersionResponseSchema = lazySchema24(
6486
- () => zodSchema24(
6487
- z25.object({
6488
- type: z25.string(),
6489
- skill_id: z25.string(),
6490
- name: z25.string().nullish(),
6491
- description: z25.string().nullish()
7052
+ var anthropicSkillVersionResponseSchema = lazySchema25(
7053
+ () => zodSchema25(
7054
+ z26.object({
7055
+ type: z26.string(),
7056
+ skill_id: z26.string(),
7057
+ name: z26.string().nullish(),
7058
+ description: z26.string().nullish()
6492
7059
  })
6493
7060
  )
6494
7061
  );
@@ -6503,7 +7070,7 @@ var AnthropicSkills = class {
6503
7070
  return this.config.provider;
6504
7071
  }
6505
7072
  async getHeaders() {
6506
- return combineHeaders3(await resolve2(this.config.headers), {
7073
+ return combineHeaders4(await resolve3(this.config.headers), {
6507
7074
  "anthropic-beta": "skills-2025-10-02"
6508
7075
  });
6509
7076
  }
@@ -6512,12 +7079,12 @@ var AnthropicSkills = class {
6512
7079
  version,
6513
7080
  headers
6514
7081
  }) {
6515
- const { value: versionResponse } = await getFromApi({
7082
+ const { value: versionResponse } = await getFromApi2({
6516
7083
  url: `${this.config.baseURL}/skills/${skillId}/versions/${version}`,
6517
7084
  validateUrl: false,
6518
7085
  headers,
6519
7086
  failedResponseHandler: anthropicFailedResponseHandler,
6520
- successfulResponseHandler: createJsonResponseHandler3(
7087
+ successfulResponseHandler: createJsonResponseHandler4(
6521
7088
  anthropicSkillVersionResponseSchema
6522
7089
  ),
6523
7090
  fetch: this.config.fetch
@@ -6544,7 +7111,7 @@ var AnthropicSkills = class {
6544
7111
  headers,
6545
7112
  formData,
6546
7113
  failedResponseHandler: anthropicFailedResponseHandler,
6547
- successfulResponseHandler: createJsonResponseHandler3(
7114
+ successfulResponseHandler: createJsonResponseHandler4(
6548
7115
  anthropicSkillResponseSchema
6549
7116
  ),
6550
7117
  fetch: this.config.fetch
@@ -6575,7 +7142,7 @@ var AnthropicSkills = class {
6575
7142
  };
6576
7143
 
6577
7144
  // src/version.ts
6578
- var VERSION = true ? "4.0.32" : "0.0.0-test";
7145
+ var VERSION = true ? "4.0.34" : "0.0.0-test";
6579
7146
 
6580
7147
  // src/anthropic-provider.ts
6581
7148
  var ANTHROPIC_API_URL = "https://api.anthropic.com";
@@ -6596,7 +7163,7 @@ function createAnthropic(options = {}) {
6596
7163
  )) != null ? _a : ANTHROPIC_API_VERSIONED_URL;
6597
7164
  const providerName = (_b = options.name) != null ? _b : "anthropic.messages";
6598
7165
  if (options.apiKey && options.authToken) {
6599
- throw new InvalidArgumentError({
7166
+ throw new InvalidArgumentError2({
6600
7167
  argument: "apiKey/authToken",
6601
7168
  message: "Both apiKey and authToken were provided. Please use only one authentication method."
6602
7169
  });
@@ -6620,7 +7187,7 @@ function createAnthropic(options = {}) {
6620
7187
  };
6621
7188
  const createChatModel = (modelId) => {
6622
7189
  var _a2;
6623
- return new AnthropicLanguageModel(modelId, {
7190
+ return new AnthropicMessagesBatchLanguageModel(modelId, {
6624
7191
  provider: providerName,
6625
7192
  baseURL,
6626
7193
  headers: getHeaders,