@anthropic-ai/sdk 0.70.0 → 0.71.0

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 (83) hide show
  1. package/CHANGELOG.md +23 -0
  2. package/README.md +1 -1
  3. package/lib/tools/BetaToolRunner.d.mts +2 -0
  4. package/lib/tools/BetaToolRunner.d.mts.map +1 -1
  5. package/lib/tools/BetaToolRunner.d.ts +2 -0
  6. package/lib/tools/BetaToolRunner.d.ts.map +1 -1
  7. package/lib/tools/BetaToolRunner.js +88 -15
  8. package/lib/tools/BetaToolRunner.js.map +1 -1
  9. package/lib/tools/BetaToolRunner.mjs +88 -15
  10. package/lib/tools/BetaToolRunner.mjs.map +1 -1
  11. package/lib/tools/CompactionControl.d.mts +25 -0
  12. package/lib/tools/CompactionControl.d.mts.map +1 -0
  13. package/lib/tools/CompactionControl.d.ts +25 -0
  14. package/lib/tools/CompactionControl.d.ts.map +1 -0
  15. package/lib/tools/CompactionControl.js +28 -0
  16. package/lib/tools/CompactionControl.js.map +1 -0
  17. package/lib/tools/CompactionControl.mjs +25 -0
  18. package/lib/tools/CompactionControl.mjs.map +1 -0
  19. package/lib/tools/ToolRunner.js +1 -1
  20. package/lib/tools/ToolRunner.js.map +1 -1
  21. package/lib/tools/ToolRunner.mjs +1 -1
  22. package/lib/tools/ToolRunner.mjs.map +1 -1
  23. package/package.json +1 -1
  24. package/resources/beta/beta.d.mts +3 -3
  25. package/resources/beta/beta.d.mts.map +1 -1
  26. package/resources/beta/beta.d.ts +3 -3
  27. package/resources/beta/beta.d.ts.map +1 -1
  28. package/resources/beta/beta.js.map +1 -1
  29. package/resources/beta/beta.mjs.map +1 -1
  30. package/resources/beta/index.d.mts +1 -1
  31. package/resources/beta/index.d.mts.map +1 -1
  32. package/resources/beta/index.d.ts +1 -1
  33. package/resources/beta/index.d.ts.map +1 -1
  34. package/resources/beta/index.js.map +1 -1
  35. package/resources/beta/index.mjs.map +1 -1
  36. package/resources/beta/messages/batches.d.mts +288 -3
  37. package/resources/beta/messages/batches.d.mts.map +1 -1
  38. package/resources/beta/messages/batches.d.ts +288 -3
  39. package/resources/beta/messages/batches.d.ts.map +1 -1
  40. package/resources/beta/messages/batches.js.map +1 -1
  41. package/resources/beta/messages/batches.mjs.map +1 -1
  42. package/resources/beta/messages/index.d.mts +1 -1
  43. package/resources/beta/messages/index.d.mts.map +1 -1
  44. package/resources/beta/messages/index.d.ts +1 -1
  45. package/resources/beta/messages/index.d.ts.map +1 -1
  46. package/resources/beta/messages/index.js.map +1 -1
  47. package/resources/beta/messages/index.mjs.map +1 -1
  48. package/resources/beta/messages/messages.d.mts +344 -11
  49. package/resources/beta/messages/messages.d.mts.map +1 -1
  50. package/resources/beta/messages/messages.d.ts +344 -11
  51. package/resources/beta/messages/messages.d.ts.map +1 -1
  52. package/resources/beta/messages/messages.js +2 -2
  53. package/resources/beta/messages/messages.js.map +1 -1
  54. package/resources/beta/messages/messages.mjs +2 -2
  55. package/resources/beta/messages/messages.mjs.map +1 -1
  56. package/resources/completions.d.mts +1 -1
  57. package/resources/completions.d.ts +1 -1
  58. package/resources/messages/batches.d.mts +2 -2
  59. package/resources/messages/batches.d.ts +2 -2
  60. package/resources/messages/messages.d.mts +2 -2
  61. package/resources/messages/messages.d.mts.map +1 -1
  62. package/resources/messages/messages.d.ts +2 -2
  63. package/resources/messages/messages.d.ts.map +1 -1
  64. package/resources/messages/messages.js +1 -1
  65. package/resources/messages/messages.js.map +1 -1
  66. package/resources/messages/messages.mjs +1 -1
  67. package/resources/messages/messages.mjs.map +1 -1
  68. package/src/lib/tools/BetaToolRunner.ts +101 -15
  69. package/src/lib/tools/CompactionControl.ts +52 -0
  70. package/src/lib/tools/ToolRunner.ts +1 -1
  71. package/src/resources/beta/beta.ts +19 -2
  72. package/src/resources/beta/index.ts +18 -1
  73. package/src/resources/beta/messages/batches.ts +307 -3
  74. package/src/resources/beta/messages/index.ts +18 -1
  75. package/src/resources/beta/messages/messages.ts +463 -7
  76. package/src/resources/completions.ts +1 -1
  77. package/src/resources/messages/batches.ts +2 -2
  78. package/src/resources/messages/messages.ts +3 -1
  79. package/src/version.ts +1 -1
  80. package/version.d.mts +1 -1
  81. package/version.d.ts +1 -1
  82. package/version.js +1 -1
  83. package/version.mjs +1 -1
@@ -5,6 +5,7 @@ import * as BetaMessagesAPI from "./messages.mjs";
5
5
  import { Page, type PageParams, PagePromise } from "../../../core/pagination.mjs";
6
6
  import { RequestOptions } from "../../../internal/request-options.mjs";
7
7
  import { JSONLDecoder } from "../../../internal/decoders/jsonl.mjs";
8
+ import * as MessagesApi from "../../messages/messages.mjs";
8
9
  export declare class Batches extends APIResource {
9
10
  /**
10
11
  * Send a batch of Message creation requests.
@@ -301,10 +302,294 @@ export declare namespace BatchCreateParams {
301
302
  /**
302
303
  * Messages API creation parameters for the individual request.
303
304
  *
304
- * See the [Messages API reference](/en/api/messages) for full documentation on
305
- * available parameters.
305
+ * See the [Messages API reference](https://docs.claude.com/en/api/messages) for
306
+ * full documentation on available parameters.
306
307
  */
307
- params: Omit<BetaMessagesAPI.MessageCreateParamsNonStreaming, 'betas'>;
308
+ params: Request.Params;
309
+ }
310
+ namespace Request {
311
+ /**
312
+ * Messages API creation parameters for the individual request.
313
+ *
314
+ * See the [Messages API reference](https://docs.claude.com/en/api/messages) for
315
+ * full documentation on available parameters.
316
+ */
317
+ interface Params {
318
+ /**
319
+ * The maximum number of tokens to generate before stopping.
320
+ *
321
+ * Note that our models may stop _before_ reaching this maximum. This parameter
322
+ * only specifies the absolute maximum number of tokens to generate.
323
+ *
324
+ * Different models have different maximum values for this parameter. See
325
+ * [models](https://docs.claude.com/en/docs/models-overview) for details.
326
+ */
327
+ max_tokens: number;
328
+ /**
329
+ * Input messages.
330
+ *
331
+ * Our models are trained to operate on alternating `user` and `assistant`
332
+ * conversational turns. When creating a new `Message`, you specify the prior
333
+ * conversational turns with the `messages` parameter, and the model then generates
334
+ * the next `Message` in the conversation. Consecutive `user` or `assistant` turns
335
+ * in your request will be combined into a single turn.
336
+ *
337
+ * Each input message must be an object with a `role` and `content`. You can
338
+ * specify a single `user`-role message, or you can include multiple `user` and
339
+ * `assistant` messages.
340
+ *
341
+ * If the final message uses the `assistant` role, the response content will
342
+ * continue immediately from the content in that message. This can be used to
343
+ * constrain part of the model's response.
344
+ *
345
+ * Example with a single `user` message:
346
+ *
347
+ * ```json
348
+ * [{ "role": "user", "content": "Hello, Claude" }]
349
+ * ```
350
+ *
351
+ * Example with multiple conversational turns:
352
+ *
353
+ * ```json
354
+ * [
355
+ * { "role": "user", "content": "Hello there." },
356
+ * { "role": "assistant", "content": "Hi, I'm Claude. How can I help you?" },
357
+ * { "role": "user", "content": "Can you explain LLMs in plain English?" }
358
+ * ]
359
+ * ```
360
+ *
361
+ * Example with a partially-filled response from Claude:
362
+ *
363
+ * ```json
364
+ * [
365
+ * {
366
+ * "role": "user",
367
+ * "content": "What's the Greek name for Sun? (A) Sol (B) Helios (C) Sun"
368
+ * },
369
+ * { "role": "assistant", "content": "The best answer is (" }
370
+ * ]
371
+ * ```
372
+ *
373
+ * Each input message `content` may be either a single `string` or an array of
374
+ * content blocks, where each block has a specific `type`. Using a `string` for
375
+ * `content` is shorthand for an array of one content block of type `"text"`. The
376
+ * following input messages are equivalent:
377
+ *
378
+ * ```json
379
+ * { "role": "user", "content": "Hello, Claude" }
380
+ * ```
381
+ *
382
+ * ```json
383
+ * { "role": "user", "content": [{ "type": "text", "text": "Hello, Claude" }] }
384
+ * ```
385
+ *
386
+ * See [input examples](https://docs.claude.com/en/api/messages-examples).
387
+ *
388
+ * Note that if you want to include a
389
+ * [system prompt](https://docs.claude.com/en/docs/system-prompts), you can use the
390
+ * top-level `system` parameter — there is no `"system"` role for input messages in
391
+ * the Messages API.
392
+ *
393
+ * There is a limit of 100,000 messages in a single request.
394
+ */
395
+ messages: Array<BetaMessagesAPI.BetaMessageParam>;
396
+ /**
397
+ * The model that will complete your prompt.\n\nSee
398
+ * [models](https://docs.anthropic.com/en/docs/models-overview) for additional
399
+ * details and options.
400
+ */
401
+ model: MessagesApi.Model;
402
+ /**
403
+ * Container identifier for reuse across requests.
404
+ */
405
+ container?: BetaMessagesAPI.BetaContainerParams | string | null;
406
+ /**
407
+ * Context management configuration.
408
+ *
409
+ * This allows you to control how Claude manages context across multiple requests,
410
+ * such as whether to clear function results or not.
411
+ */
412
+ context_management?: BetaMessagesAPI.BetaContextManagementConfig | null;
413
+ /**
414
+ * MCP servers to be utilized in this request
415
+ */
416
+ mcp_servers?: Array<BetaMessagesAPI.BetaRequestMCPServerURLDefinition>;
417
+ /**
418
+ * An object describing metadata about the request.
419
+ */
420
+ metadata?: BetaMessagesAPI.BetaMetadata;
421
+ /**
422
+ * Configuration options for the model's output. Controls aspects like how much
423
+ * effort the model puts into its response.
424
+ */
425
+ output_config?: BetaMessagesAPI.BetaOutputConfig;
426
+ /**
427
+ * A schema to specify Claude's output format in responses.
428
+ */
429
+ output_format?: BetaMessagesAPI.BetaJSONOutputFormat | null;
430
+ /**
431
+ * Determines whether to use priority capacity (if available) or standard capacity
432
+ * for this request.
433
+ *
434
+ * Anthropic offers different levels of service for your API requests. See
435
+ * [service-tiers](https://docs.claude.com/en/api/service-tiers) for details.
436
+ */
437
+ service_tier?: 'auto' | 'standard_only';
438
+ /**
439
+ * Custom text sequences that will cause the model to stop generating.
440
+ *
441
+ * Our models will normally stop when they have naturally completed their turn,
442
+ * which will result in a response `stop_reason` of `"end_turn"`.
443
+ *
444
+ * If you want the model to stop generating when it encounters custom strings of
445
+ * text, you can use the `stop_sequences` parameter. If the model encounters one of
446
+ * the custom sequences, the response `stop_reason` value will be `"stop_sequence"`
447
+ * and the response `stop_sequence` value will contain the matched stop sequence.
448
+ */
449
+ stop_sequences?: Array<string>;
450
+ /**
451
+ * Whether to incrementally stream the response using server-sent events.
452
+ *
453
+ * See [streaming](https://docs.claude.com/en/api/messages-streaming) for details.
454
+ */
455
+ stream?: boolean;
456
+ /**
457
+ * System prompt.
458
+ *
459
+ * A system prompt is a way of providing context and instructions to Claude, such
460
+ * as specifying a particular goal or role. See our
461
+ * [guide to system prompts](https://docs.claude.com/en/docs/system-prompts).
462
+ */
463
+ system?: string | Array<BetaMessagesAPI.BetaTextBlockParam>;
464
+ /**
465
+ * Amount of randomness injected into the response.
466
+ *
467
+ * Defaults to `1.0`. Ranges from `0.0` to `1.0`. Use `temperature` closer to `0.0`
468
+ * for analytical / multiple choice, and closer to `1.0` for creative and
469
+ * generative tasks.
470
+ *
471
+ * Note that even with `temperature` of `0.0`, the results will not be fully
472
+ * deterministic.
473
+ */
474
+ temperature?: number;
475
+ /**
476
+ * Configuration for enabling Claude's extended thinking.
477
+ *
478
+ * When enabled, responses include `thinking` content blocks showing Claude's
479
+ * thinking process before the final answer. Requires a minimum budget of 1,024
480
+ * tokens and counts towards your `max_tokens` limit.
481
+ *
482
+ * See
483
+ * [extended thinking](https://docs.claude.com/en/docs/build-with-claude/extended-thinking)
484
+ * for details.
485
+ */
486
+ thinking?: BetaMessagesAPI.BetaThinkingConfigParam;
487
+ /**
488
+ * How the model should use the provided tools. The model can use a specific tool,
489
+ * any available tool, decide by itself, or not use tools at all.
490
+ */
491
+ tool_choice?: BetaMessagesAPI.BetaToolChoice;
492
+ /**
493
+ * Definitions of tools that the model may use.
494
+ *
495
+ * If you include `tools` in your API request, the model may return `tool_use`
496
+ * content blocks that represent the model's use of those tools. You can then run
497
+ * those tools using the tool input generated by the model and then optionally
498
+ * return results back to the model using `tool_result` content blocks.
499
+ *
500
+ * There are two types of tools: **client tools** and **server tools**. The
501
+ * behavior described below applies to client tools. For
502
+ * [server tools](https://docs.claude.com/en/docs/agents-and-tools/tool-use/overview#server-tools),
503
+ * see their individual documentation as each has its own behavior (e.g., the
504
+ * [web search tool](https://docs.claude.com/en/docs/agents-and-tools/tool-use/web-search-tool)).
505
+ *
506
+ * Each tool definition includes:
507
+ *
508
+ * - `name`: Name of the tool.
509
+ * - `description`: Optional, but strongly-recommended description of the tool.
510
+ * - `input_schema`: [JSON schema](https://json-schema.org/draft/2020-12) for the
511
+ * tool `input` shape that the model will produce in `tool_use` output content
512
+ * blocks.
513
+ *
514
+ * For example, if you defined `tools` as:
515
+ *
516
+ * ```json
517
+ * [
518
+ * {
519
+ * "name": "get_stock_price",
520
+ * "description": "Get the current stock price for a given ticker symbol.",
521
+ * "input_schema": {
522
+ * "type": "object",
523
+ * "properties": {
524
+ * "ticker": {
525
+ * "type": "string",
526
+ * "description": "The stock ticker symbol, e.g. AAPL for Apple Inc."
527
+ * }
528
+ * },
529
+ * "required": ["ticker"]
530
+ * }
531
+ * }
532
+ * ]
533
+ * ```
534
+ *
535
+ * And then asked the model "What's the S&P 500 at today?", the model might produce
536
+ * `tool_use` content blocks in the response like this:
537
+ *
538
+ * ```json
539
+ * [
540
+ * {
541
+ * "type": "tool_use",
542
+ * "id": "toolu_01D7FLrfh4GYq7yT1ULFeyMV",
543
+ * "name": "get_stock_price",
544
+ * "input": { "ticker": "^GSPC" }
545
+ * }
546
+ * ]
547
+ * ```
548
+ *
549
+ * You might then run your `get_stock_price` tool with `{"ticker": "^GSPC"}` as an
550
+ * input, and return the following back to the model in a subsequent `user`
551
+ * message:
552
+ *
553
+ * ```json
554
+ * [
555
+ * {
556
+ * "type": "tool_result",
557
+ * "tool_use_id": "toolu_01D7FLrfh4GYq7yT1ULFeyMV",
558
+ * "content": "259.75 USD"
559
+ * }
560
+ * ]
561
+ * ```
562
+ *
563
+ * Tools can be used for workflows that include running client-side tools and
564
+ * functions, or more generally whenever you want the model to produce a particular
565
+ * JSON structure of output.
566
+ *
567
+ * See our [guide](https://docs.claude.com/en/docs/tool-use) for more details.
568
+ */
569
+ tools?: Array<BetaMessagesAPI.BetaToolUnion>;
570
+ /**
571
+ * Only sample from the top K options for each subsequent token.
572
+ *
573
+ * Used to remove "long tail" low probability responses.
574
+ * [Learn more technical details here](https://towardsdatascience.com/how-to-sample-from-language-models-682bceb97277).
575
+ *
576
+ * Recommended for advanced use cases only. You usually only need to use
577
+ * `temperature`.
578
+ */
579
+ top_k?: number;
580
+ /**
581
+ * Use nucleus sampling.
582
+ *
583
+ * In nucleus sampling, we compute the cumulative distribution over all the options
584
+ * for each subsequent token in decreasing probability order and cut it off once it
585
+ * reaches a particular probability specified by `top_p`. You should either alter
586
+ * `temperature` or `top_p`, but not both.
587
+ *
588
+ * Recommended for advanced use cases only. You usually only need to use
589
+ * `temperature`.
590
+ */
591
+ top_p?: number;
592
+ }
308
593
  }
309
594
  }
310
595
  export interface BatchRetrieveParams {
@@ -1 +1 @@
1
- {"version":3,"file":"batches.d.mts","sourceRoot":"","sources":["../../../src/resources/beta/messages/batches.ts"],"names":[],"mappings":"OAEO,EAAE,WAAW,EAAE;OACf,KAAK,OAAO;OACZ,EAAE,UAAU,EAAE;OACd,KAAK,eAAe;OACpB,EAAE,IAAI,EAAE,KAAK,UAAU,EAAE,WAAW,EAAE;OAEtC,EAAE,cAAc,EAAE;OAClB,EAAE,YAAY,EAAE;AAIvB,qBAAa,OAAQ,SAAQ,WAAW;IACtC;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA4BG;IACH,MAAM,CAAC,MAAM,EAAE,iBAAiB,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,UAAU,CAAC,gBAAgB,CAAC;IAYzF;;;;;;;;;;;;;;;OAeG;IACH,QAAQ,CACN,cAAc,EAAE,MAAM,EACtB,MAAM,GAAE,mBAAmB,GAAG,IAAI,GAAG,SAAc,EACnD,OAAO,CAAC,EAAE,cAAc,GACvB,UAAU,CAAC,gBAAgB,CAAC;IAW/B;;;;;;;;;;;;;;OAcG;IACH,IAAI,CACF,MAAM,GAAE,eAAe,GAAG,IAAI,GAAG,SAAc,EAC/C,OAAO,CAAC,EAAE,cAAc,GACvB,WAAW,CAAC,sBAAsB,EAAE,gBAAgB,CAAC;IAYxD;;;;;;;;;;;;;;;;OAgBG;IACH,MAAM,CACJ,cAAc,EAAE,MAAM,EACtB,MAAM,GAAE,iBAAiB,GA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tC;AAED,MAAM,WAAW,eAAgB,SAAQ,UAAU;IACjD;;OAEG;IACH,KAAK,CAAC,EAAE,KAAK,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC;CACtC;AAED,MAAM,WAAW,iBAAiB;IAChC;;OAEG;IACH,KAAK,CAAC,EAAE,KAAK,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC;CACtC;AAED,MAAM,WAAW,iBAAiB;IAChC;;OAEG;IACH,KAAK,CAAC,EAAE,KAAK,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC;CACtC;AAED,MAAM,WAAW,kBAAkB;IACjC;;OAEG;IACH,KAAK,CAAC,EAAE,KAAK,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC;CACtC;AAED,MAAM,CAAC,OAAO,WAAW,OAAO,CAAC;IAC/B,OAAO,EACL,KAAK,uBAAuB,IAAI,uBAAuB,EACvD,KAAK,gBAAgB,IAAI,gBAAgB,EACzC,KAAK,8BAA8B,IAAI,8BAA8B,EACrE,KAAK,6BAA6B,IAAI,6BAA6B,EACnE,KAAK,6BAA6B,IAAI,6BAA6B,EACnE,KAAK,kCAAkC,IAAI,kCAAkC,EAC7E,KAAK,6BAA6B,IAAI,6BAA6B,EACnE,KAAK,sBAAsB,IAAI,sBAAsB,EACrD,KAAK,+BAA+B,IAAI,+BAA+B,EACvE,KAAK,sBAAsB,IAAI,sBAAsB,EACrD,KAAK,iBAAiB,IAAI,iBAAiB,EAC3C,KAAK,mBAAmB,IAAI,mBAAmB,EAC/C,KAAK,eAAe,IAAI,eAAe,EACvC,KAAK,iBAAiB,IAAI,iBAAiB,EAC3C,KAAK,iBAAiB,IAAI,iBAAiB,EAC3C,KAAK,kBAAkB,IAAI,kBAAkB,GAC9C,CAAC;CACH"}
@@ -5,6 +5,7 @@ import * as BetaMessagesAPI from "./messages.js";
5
5
  import { Page, type PageParams, PagePromise } from "../../../core/pagination.js";
6
6
  import { RequestOptions } from "../../../internal/request-options.js";
7
7
  import { JSONLDecoder } from "../../../internal/decoders/jsonl.js";
8
+ import * as MessagesApi from "../../messages/messages.js";
8
9
  export declare class Batches extends APIResource {
9
10
  /**
10
11
  * Send a batch of Message creation requests.
@@ -301,10 +302,294 @@ export declare namespace BatchCreateParams {
301
302
  /**
302
303
  * Messages API creation parameters for the individual request.
303
304
  *
304
- * See the [Messages API reference](/en/api/messages) for full documentation on
305
- * available parameters.
305
+ * See the [Messages API reference](https://docs.claude.com/en/api/messages) for
306
+ * full documentation on available parameters.
306
307
  */
307
- params: Omit<BetaMessagesAPI.MessageCreateParamsNonStreaming, 'betas'>;
308
+ params: Request.Params;
309
+ }
310
+ namespace Request {
311
+ /**
312
+ * Messages API creation parameters for the individual request.
313
+ *
314
+ * See the [Messages API reference](https://docs.claude.com/en/api/messages) for
315
+ * full documentation on available parameters.
316
+ */
317
+ interface Params {
318
+ /**
319
+ * The maximum number of tokens to generate before stopping.
320
+ *
321
+ * Note that our models may stop _before_ reaching this maximum. This parameter
322
+ * only specifies the absolute maximum number of tokens to generate.
323
+ *
324
+ * Different models have different maximum values for this parameter. See
325
+ * [models](https://docs.claude.com/en/docs/models-overview) for details.
326
+ */
327
+ max_tokens: number;
328
+ /**
329
+ * Input messages.
330
+ *
331
+ * Our models are trained to operate on alternating `user` and `assistant`
332
+ * conversational turns. When creating a new `Message`, you specify the prior
333
+ * conversational turns with the `messages` parameter, and the model then generates
334
+ * the next `Message` in the conversation. Consecutive `user` or `assistant` turns
335
+ * in your request will be combined into a single turn.
336
+ *
337
+ * Each input message must be an object with a `role` and `content`. You can
338
+ * specify a single `user`-role message, or you can include multiple `user` and
339
+ * `assistant` messages.
340
+ *
341
+ * If the final message uses the `assistant` role, the response content will
342
+ * continue immediately from the content in that message. This can be used to
343
+ * constrain part of the model's response.
344
+ *
345
+ * Example with a single `user` message:
346
+ *
347
+ * ```json
348
+ * [{ "role": "user", "content": "Hello, Claude" }]
349
+ * ```
350
+ *
351
+ * Example with multiple conversational turns:
352
+ *
353
+ * ```json
354
+ * [
355
+ * { "role": "user", "content": "Hello there." },
356
+ * { "role": "assistant", "content": "Hi, I'm Claude. How can I help you?" },
357
+ * { "role": "user", "content": "Can you explain LLMs in plain English?" }
358
+ * ]
359
+ * ```
360
+ *
361
+ * Example with a partially-filled response from Claude:
362
+ *
363
+ * ```json
364
+ * [
365
+ * {
366
+ * "role": "user",
367
+ * "content": "What's the Greek name for Sun? (A) Sol (B) Helios (C) Sun"
368
+ * },
369
+ * { "role": "assistant", "content": "The best answer is (" }
370
+ * ]
371
+ * ```
372
+ *
373
+ * Each input message `content` may be either a single `string` or an array of
374
+ * content blocks, where each block has a specific `type`. Using a `string` for
375
+ * `content` is shorthand for an array of one content block of type `"text"`. The
376
+ * following input messages are equivalent:
377
+ *
378
+ * ```json
379
+ * { "role": "user", "content": "Hello, Claude" }
380
+ * ```
381
+ *
382
+ * ```json
383
+ * { "role": "user", "content": [{ "type": "text", "text": "Hello, Claude" }] }
384
+ * ```
385
+ *
386
+ * See [input examples](https://docs.claude.com/en/api/messages-examples).
387
+ *
388
+ * Note that if you want to include a
389
+ * [system prompt](https://docs.claude.com/en/docs/system-prompts), you can use the
390
+ * top-level `system` parameter — there is no `"system"` role for input messages in
391
+ * the Messages API.
392
+ *
393
+ * There is a limit of 100,000 messages in a single request.
394
+ */
395
+ messages: Array<BetaMessagesAPI.BetaMessageParam>;
396
+ /**
397
+ * The model that will complete your prompt.\n\nSee
398
+ * [models](https://docs.anthropic.com/en/docs/models-overview) for additional
399
+ * details and options.
400
+ */
401
+ model: MessagesApi.Model;
402
+ /**
403
+ * Container identifier for reuse across requests.
404
+ */
405
+ container?: BetaMessagesAPI.BetaContainerParams | string | null;
406
+ /**
407
+ * Context management configuration.
408
+ *
409
+ * This allows you to control how Claude manages context across multiple requests,
410
+ * such as whether to clear function results or not.
411
+ */
412
+ context_management?: BetaMessagesAPI.BetaContextManagementConfig | null;
413
+ /**
414
+ * MCP servers to be utilized in this request
415
+ */
416
+ mcp_servers?: Array<BetaMessagesAPI.BetaRequestMCPServerURLDefinition>;
417
+ /**
418
+ * An object describing metadata about the request.
419
+ */
420
+ metadata?: BetaMessagesAPI.BetaMetadata;
421
+ /**
422
+ * Configuration options for the model's output. Controls aspects like how much
423
+ * effort the model puts into its response.
424
+ */
425
+ output_config?: BetaMessagesAPI.BetaOutputConfig;
426
+ /**
427
+ * A schema to specify Claude's output format in responses.
428
+ */
429
+ output_format?: BetaMessagesAPI.BetaJSONOutputFormat | null;
430
+ /**
431
+ * Determines whether to use priority capacity (if available) or standard capacity
432
+ * for this request.
433
+ *
434
+ * Anthropic offers different levels of service for your API requests. See
435
+ * [service-tiers](https://docs.claude.com/en/api/service-tiers) for details.
436
+ */
437
+ service_tier?: 'auto' | 'standard_only';
438
+ /**
439
+ * Custom text sequences that will cause the model to stop generating.
440
+ *
441
+ * Our models will normally stop when they have naturally completed their turn,
442
+ * which will result in a response `stop_reason` of `"end_turn"`.
443
+ *
444
+ * If you want the model to stop generating when it encounters custom strings of
445
+ * text, you can use the `stop_sequences` parameter. If the model encounters one of
446
+ * the custom sequences, the response `stop_reason` value will be `"stop_sequence"`
447
+ * and the response `stop_sequence` value will contain the matched stop sequence.
448
+ */
449
+ stop_sequences?: Array<string>;
450
+ /**
451
+ * Whether to incrementally stream the response using server-sent events.
452
+ *
453
+ * See [streaming](https://docs.claude.com/en/api/messages-streaming) for details.
454
+ */
455
+ stream?: boolean;
456
+ /**
457
+ * System prompt.
458
+ *
459
+ * A system prompt is a way of providing context and instructions to Claude, such
460
+ * as specifying a particular goal or role. See our
461
+ * [guide to system prompts](https://docs.claude.com/en/docs/system-prompts).
462
+ */
463
+ system?: string | Array<BetaMessagesAPI.BetaTextBlockParam>;
464
+ /**
465
+ * Amount of randomness injected into the response.
466
+ *
467
+ * Defaults to `1.0`. Ranges from `0.0` to `1.0`. Use `temperature` closer to `0.0`
468
+ * for analytical / multiple choice, and closer to `1.0` for creative and
469
+ * generative tasks.
470
+ *
471
+ * Note that even with `temperature` of `0.0`, the results will not be fully
472
+ * deterministic.
473
+ */
474
+ temperature?: number;
475
+ /**
476
+ * Configuration for enabling Claude's extended thinking.
477
+ *
478
+ * When enabled, responses include `thinking` content blocks showing Claude's
479
+ * thinking process before the final answer. Requires a minimum budget of 1,024
480
+ * tokens and counts towards your `max_tokens` limit.
481
+ *
482
+ * See
483
+ * [extended thinking](https://docs.claude.com/en/docs/build-with-claude/extended-thinking)
484
+ * for details.
485
+ */
486
+ thinking?: BetaMessagesAPI.BetaThinkingConfigParam;
487
+ /**
488
+ * How the model should use the provided tools. The model can use a specific tool,
489
+ * any available tool, decide by itself, or not use tools at all.
490
+ */
491
+ tool_choice?: BetaMessagesAPI.BetaToolChoice;
492
+ /**
493
+ * Definitions of tools that the model may use.
494
+ *
495
+ * If you include `tools` in your API request, the model may return `tool_use`
496
+ * content blocks that represent the model's use of those tools. You can then run
497
+ * those tools using the tool input generated by the model and then optionally
498
+ * return results back to the model using `tool_result` content blocks.
499
+ *
500
+ * There are two types of tools: **client tools** and **server tools**. The
501
+ * behavior described below applies to client tools. For
502
+ * [server tools](https://docs.claude.com/en/docs/agents-and-tools/tool-use/overview#server-tools),
503
+ * see their individual documentation as each has its own behavior (e.g., the
504
+ * [web search tool](https://docs.claude.com/en/docs/agents-and-tools/tool-use/web-search-tool)).
505
+ *
506
+ * Each tool definition includes:
507
+ *
508
+ * - `name`: Name of the tool.
509
+ * - `description`: Optional, but strongly-recommended description of the tool.
510
+ * - `input_schema`: [JSON schema](https://json-schema.org/draft/2020-12) for the
511
+ * tool `input` shape that the model will produce in `tool_use` output content
512
+ * blocks.
513
+ *
514
+ * For example, if you defined `tools` as:
515
+ *
516
+ * ```json
517
+ * [
518
+ * {
519
+ * "name": "get_stock_price",
520
+ * "description": "Get the current stock price for a given ticker symbol.",
521
+ * "input_schema": {
522
+ * "type": "object",
523
+ * "properties": {
524
+ * "ticker": {
525
+ * "type": "string",
526
+ * "description": "The stock ticker symbol, e.g. AAPL for Apple Inc."
527
+ * }
528
+ * },
529
+ * "required": ["ticker"]
530
+ * }
531
+ * }
532
+ * ]
533
+ * ```
534
+ *
535
+ * And then asked the model "What's the S&P 500 at today?", the model might produce
536
+ * `tool_use` content blocks in the response like this:
537
+ *
538
+ * ```json
539
+ * [
540
+ * {
541
+ * "type": "tool_use",
542
+ * "id": "toolu_01D7FLrfh4GYq7yT1ULFeyMV",
543
+ * "name": "get_stock_price",
544
+ * "input": { "ticker": "^GSPC" }
545
+ * }
546
+ * ]
547
+ * ```
548
+ *
549
+ * You might then run your `get_stock_price` tool with `{"ticker": "^GSPC"}` as an
550
+ * input, and return the following back to the model in a subsequent `user`
551
+ * message:
552
+ *
553
+ * ```json
554
+ * [
555
+ * {
556
+ * "type": "tool_result",
557
+ * "tool_use_id": "toolu_01D7FLrfh4GYq7yT1ULFeyMV",
558
+ * "content": "259.75 USD"
559
+ * }
560
+ * ]
561
+ * ```
562
+ *
563
+ * Tools can be used for workflows that include running client-side tools and
564
+ * functions, or more generally whenever you want the model to produce a particular
565
+ * JSON structure of output.
566
+ *
567
+ * See our [guide](https://docs.claude.com/en/docs/tool-use) for more details.
568
+ */
569
+ tools?: Array<BetaMessagesAPI.BetaToolUnion>;
570
+ /**
571
+ * Only sample from the top K options for each subsequent token.
572
+ *
573
+ * Used to remove "long tail" low probability responses.
574
+ * [Learn more technical details here](https://towardsdatascience.com/how-to-sample-from-language-models-682bceb97277).
575
+ *
576
+ * Recommended for advanced use cases only. You usually only need to use
577
+ * `temperature`.
578
+ */
579
+ top_k?: number;
580
+ /**
581
+ * Use nucleus sampling.
582
+ *
583
+ * In nucleus sampling, we compute the cumulative distribution over all the options
584
+ * for each subsequent token in decreasing probability order and cut it off once it
585
+ * reaches a particular probability specified by `top_p`. You should either alter
586
+ * `temperature` or `top_p`, but not both.
587
+ *
588
+ * Recommended for advanced use cases only. You usually only need to use
589
+ * `temperature`.
590
+ */
591
+ top_p?: number;
592
+ }
308
593
  }
309
594
  }
310
595
  export interface BatchRetrieveParams {
@@ -1 +1 @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