@mastra/claude 1.0.1-alpha.2 → 1.0.1-alpha.21

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.
@@ -0,0 +1,852 @@
1
+ /**
2
+ * An individual message request within a batch.
3
+ */
4
+ export type BatchMessageRequest = {
5
+ /**
6
+ * Developer-provided ID created for each request in a Message Batch. Useful for
7
+ * matching results to requests, as results may be given out of request order.
8
+ *
9
+ * Must be unique for each request within the Message Batch.
10
+ *
11
+ */
12
+ custom_id: string;
13
+ params: CreateMessageRequest;
14
+ };
15
+ /**
16
+ * A block of content in a message.
17
+ */
18
+ export type Block = TextBlock | ImageBlock | ToolUseBlock | ToolResultBlock;
19
+ /**
20
+ * A delta in a streaming message.
21
+ */
22
+ export type BlockDelta = TextBlockDelta | InputJsonBlockDelta;
23
+ /**
24
+ * The cache control settings.
25
+ */
26
+ export type CacheControlEphemeral = {
27
+ type?: 'ephemeral';
28
+ };
29
+ export type type = 'ephemeral';
30
+ /**
31
+ * A delta event in a streaming content block.
32
+ */
33
+ export type ContentBlockDeltaEvent = {
34
+ delta: BlockDelta;
35
+ /**
36
+ * The index of the content block.
37
+ */
38
+ index: number;
39
+ type: 'content_block_delta';
40
+ };
41
+ /**
42
+ * A start event in a streaming content block.
43
+ */
44
+ export type ContentBlockStartEvent = {
45
+ content_block: Block;
46
+ /**
47
+ * The index of the content block.
48
+ */
49
+ index: number;
50
+ type: 'content_block_start';
51
+ };
52
+ /**
53
+ * A stop event in a streaming content block.
54
+ */
55
+ export type ContentBlockStopEvent = {
56
+ /**
57
+ * The index of the content block.
58
+ */
59
+ index: number;
60
+ type: 'content_block_stop';
61
+ };
62
+ /**
63
+ * The request parameters for creating a message batch.
64
+ */
65
+ export type CreateMessageBatchRequest = {
66
+ /**
67
+ * List of requests for prompt completion. Each is an individual request to create a Message.
68
+ */
69
+ requests: Array<BatchMessageRequest>;
70
+ };
71
+ /**
72
+ * The request parameters for creating a message.
73
+ */
74
+ export type CreateMessageRequest = {
75
+ /**
76
+ * The model that will complete your prompt.
77
+ *
78
+ * See [models](https://docs.anthropic.com/en/docs/models-overview) for additional
79
+ * details and options.
80
+ *
81
+ */
82
+ model: string | 'claude-3-5-sonnet-latest' | 'claude-3-5-sonnet-20241022' | 'claude-3-5-sonnet-20240620' | 'claude-3-opus-latest' | 'claude-3-opus-20240229' | 'claude-3-sonnet-20240229' | 'claude-3-haiku-20240307' | 'claude-2.1' | 'claude-2.0' | 'claude-instant-1.2';
83
+ /**
84
+ * Input messages.
85
+ *
86
+ * Our models are trained to operate on alternating `user` and `assistant`
87
+ * conversational turns. When creating a new `Message`, you specify the prior
88
+ * conversational turns with the `messages` parameter, and the model then generates
89
+ * the next `Message` in the conversation.
90
+ *
91
+ * Each input message must be an object with a `role` and `content`. You can
92
+ * specify a single `user`-role message, or you can include multiple `user` and
93
+ * `assistant` messages. The first message must always use the `user` role.
94
+ *
95
+ * If the final message uses the `assistant` role, the response content will
96
+ * continue immediately from the content in that message. This can be used to
97
+ * constrain part of the model's response.
98
+ *
99
+ * See [message content](https://docs.anthropic.com/en/api/messages-content) for
100
+ * details on how to construct valid message objects.
101
+ *
102
+ * Example with a single `user` message:
103
+ *
104
+ * ```json
105
+ * [{ "role": "user", "content": "Hello, Claude" }]
106
+ * ```
107
+ *
108
+ * Example with multiple conversational turns:
109
+ *
110
+ * ```json
111
+ * [
112
+ * { "role": "user", "content": "Hello there." },
113
+ * { "role": "assistant", "content": "Hi, I'm Claude. How can I help you?" },
114
+ * { "role": "user", "content": "Can you explain LLMs in plain English?" }
115
+ * ]
116
+ * ```
117
+ *
118
+ * Example with a partially-filled response from Claude:
119
+ *
120
+ * ```json
121
+ * [
122
+ * {
123
+ * "role": "user",
124
+ * "content": "What's the Greek name for Sun? (A) Sol (B) Helios (C) Sun"
125
+ * },
126
+ * { "role": "assistant", "content": "The best answer is (" }
127
+ * ]
128
+ * ```
129
+ *
130
+ * Each input message `content` may be either a single `string` or an array of
131
+ * content blocks, where each block has a specific `type`. Using a `string` for
132
+ * `content` is shorthand for an array of one content block of type `"text"`. The
133
+ * following input messages are equivalent:
134
+ *
135
+ * ```json
136
+ * { "role": "user", "content": "Hello, Claude" }
137
+ * ```
138
+ *
139
+ * ```json
140
+ * { "role": "user", "content": [{ "type": "text", "text": "Hello, Claude" }] }
141
+ * ```
142
+ *
143
+ * Starting with Claude 3 models, you can also send image content blocks:
144
+ *
145
+ * ```json
146
+ * {
147
+ * "role": "user",
148
+ * "content": [
149
+ * {
150
+ * "type": "image",
151
+ * "source": {
152
+ * "type": "base64",
153
+ * "media_type": "image/jpeg",
154
+ * "data": "/9j/4AAQSkZJRg..."
155
+ * }
156
+ * },
157
+ * { "type": "text", "text": "What is in this image?" }
158
+ * ]
159
+ * }
160
+ * ```
161
+ *
162
+ * We currently support the `base64` source type for images, and the `image/jpeg`,
163
+ * `image/png`, `image/gif`, and `image/webp` media types.
164
+ *
165
+ * See [examples](https://docs.anthropic.com/en/api/messages-examples) for more
166
+ * input examples.
167
+ *
168
+ * Note that if you want to include a
169
+ * [system prompt](https://docs.anthropic.com/en/docs/system-prompts), you can use
170
+ * the top-level `system` parameter — there is no `"system"` role for input
171
+ * messages in the Messages API.
172
+ *
173
+ */
174
+ messages: Array<Message>;
175
+ /**
176
+ * The maximum number of tokens to generate before stopping.
177
+ *
178
+ * Note that our models may stop _before_ reaching this maximum. This parameter
179
+ * only specifies the absolute maximum number of tokens to generate.
180
+ *
181
+ * Different models have different maximum values for this parameter. See
182
+ * [models](https://docs.anthropic.com/en/docs/models-overview) for details.
183
+ *
184
+ */
185
+ max_tokens: number;
186
+ metadata?: CreateMessageRequestMetadata;
187
+ /**
188
+ * Custom text sequences that will cause the model to stop generating.
189
+ *
190
+ * Our models will normally stop when they have naturally completed their turn,
191
+ * which will result in a response `stop_reason` of `"end_turn"`.
192
+ *
193
+ * If you want the model to stop generating when it encounters custom strings of
194
+ * text, you can use the `stop_sequences` parameter. If the model encounters one of
195
+ * the custom sequences, the response `stop_reason` value will be `"stop_sequence"`
196
+ * and the response `stop_sequence` value will contain the matched stop sequence.
197
+ *
198
+ */
199
+ stop_sequences?: Array<string>;
200
+ /**
201
+ * System prompt.
202
+ *
203
+ * A system prompt is a way of providing context and instructions to Claude, such
204
+ * as specifying a particular goal or role. See our
205
+ * [guide to system prompts](https://docs.anthropic.com/en/docs/system-prompts).
206
+ *
207
+ */
208
+ system?: string | Array<Block>;
209
+ /**
210
+ * Amount of randomness injected into the response.
211
+ *
212
+ * Defaults to `1.0`. Ranges from `0.0` to `1.0`. Use `temperature` closer to `0.0`
213
+ * for analytical / multiple choice, and closer to `1.0` for creative and
214
+ * generative tasks.
215
+ *
216
+ * Note that even with `temperature` of `0.0`, the results will not be fully
217
+ * deterministic.
218
+ *
219
+ */
220
+ temperature?: number;
221
+ tool_choice?: ToolChoice;
222
+ /**
223
+ * Definitions of tools that the model may use.
224
+ *
225
+ * If you include `tools` in your API request, the model may return `tool_use`
226
+ * content blocks that represent the model's use of those tools. You can then run
227
+ * those tools using the tool input generated by the model and then optionally
228
+ * return results back to the model using `tool_result` content blocks.
229
+ *
230
+ * Each tool definition includes:
231
+ *
232
+ * - `name`: Name of the tool.
233
+ * - `description`: Optional, but strongly-recommended description of the tool.
234
+ * - `input_schema`: [JSON schema](https://json-schema.org/) for the tool `input`
235
+ * shape that the model will produce in `tool_use` output content blocks.
236
+ *
237
+ * For example, if you defined `tools` as:
238
+ *
239
+ * ```json
240
+ * [
241
+ * {
242
+ * "name": "get_stock_price",
243
+ * "description": "Get the current stock price for a given ticker symbol.",
244
+ * "input_schema": {
245
+ * "type": "object",
246
+ * "properties": {
247
+ * "ticker": {
248
+ * "type": "string",
249
+ * "description": "The stock ticker symbol, e.g. AAPL for Apple Inc."
250
+ * }
251
+ * },
252
+ * "required": ["ticker"]
253
+ * }
254
+ * }
255
+ * ]
256
+ * ```
257
+ *
258
+ * And then asked the model "What's the S&P 500 at today?", the model might produce
259
+ * `tool_use` content blocks in the response like this:
260
+ *
261
+ * ```json
262
+ * [
263
+ * {
264
+ * "type": "tool_use",
265
+ * "id": "toolu_01D7FLrfh4GYq7yT1ULFeyMV",
266
+ * "name": "get_stock_price",
267
+ * "input": { "ticker": "^GSPC" }
268
+ * }
269
+ * ]
270
+ * ```
271
+ *
272
+ * You might then run your `get_stock_price` tool with `{"ticker": "^GSPC"}` as an
273
+ * input, and return the following back to the model in a subsequent `user`
274
+ * message:
275
+ *
276
+ * ```json
277
+ * [
278
+ * {
279
+ * "type": "tool_result",
280
+ * "tool_use_id": "toolu_01D7FLrfh4GYq7yT1ULFeyMV",
281
+ * "content": "259.75 USD"
282
+ * }
283
+ * ]
284
+ * ```
285
+ *
286
+ * Tools can be used for workflows that include running client-side tools and
287
+ * functions, or more generally whenever you want the model to produce a particular
288
+ * JSON structure of output.
289
+ *
290
+ * See our [guide](https://docs.anthropic.com/en/docs/tool-use) for more details.
291
+ *
292
+ */
293
+ tools?: Array<Tool>;
294
+ /**
295
+ * Only sample from the top K options for each subsequent token.
296
+ *
297
+ * Used to remove "long tail" low probability responses.
298
+ * [Learn more technical details here](https://towardsdatascience.com/how-to-sample-from-language-models-682bceb97277).
299
+ *
300
+ * Recommended for advanced use cases only. You usually only need to use
301
+ * `temperature`.
302
+ *
303
+ */
304
+ top_k?: number;
305
+ /**
306
+ * Use nucleus sampling.
307
+ *
308
+ * In nucleus sampling, we compute the cumulative distribution over all the options
309
+ * for each subsequent token in decreasing probability order and cut it off once it
310
+ * reaches a particular probability specified by `top_p`. You should either alter
311
+ * `temperature` or `top_p`, but not both.
312
+ *
313
+ * Recommended for advanced use cases only. You usually only need to use
314
+ * `temperature`.
315
+ *
316
+ */
317
+ top_p?: number;
318
+ /**
319
+ * Whether to incrementally stream the response using server-sent events.
320
+ *
321
+ * See [streaming](https://docs.anthropic.com/en/api/messages-streaming) for
322
+ * details.
323
+ *
324
+ */
325
+ stream?: boolean;
326
+ };
327
+ /**
328
+ * An object describing metadata about the request.
329
+ */
330
+ export type CreateMessageRequestMetadata = {
331
+ /**
332
+ * An external identifier for the user who is associated with the request.
333
+ *
334
+ * This should be a uuid, hash value, or other opaque identifier. Anthropic may use
335
+ * this id to help detect abuse. Do not include any identifying information such as
336
+ * name, email address, or phone number.
337
+ *
338
+ */
339
+ user_id?: string;
340
+ };
341
+ /**
342
+ * An error object.
343
+ */
344
+ export type Error = {
345
+ /**
346
+ * The type of error.
347
+ */
348
+ type: string;
349
+ /**
350
+ * A human-readable error message.
351
+ */
352
+ message: string;
353
+ };
354
+ /**
355
+ * An error event in a streaming conversation.
356
+ */
357
+ export type ErrorEvent = {
358
+ type: 'error';
359
+ error: Error;
360
+ };
361
+ /**
362
+ * A block of image content.
363
+ */
364
+ export type ImageBlock = {
365
+ source: ImageBlockSource;
366
+ /**
367
+ * The type of content block.
368
+ */
369
+ type?: 'image';
370
+ cache_control?: CacheControlEphemeral;
371
+ };
372
+ /**
373
+ * The source of an image block.
374
+ */
375
+ export type ImageBlockSource = {
376
+ /**
377
+ * The base64-encoded image data.
378
+ */
379
+ data: string;
380
+ /**
381
+ * The media type of the image.
382
+ */
383
+ media_type: 'image/jpeg' | 'image/png' | 'image/gif' | 'image/webp';
384
+ /**
385
+ * The type of image source.
386
+ */
387
+ type: 'base64';
388
+ };
389
+ /**
390
+ * The media type of the image.
391
+ */
392
+ export type media_type = 'image/jpeg' | 'image/png' | 'image/gif' | 'image/webp';
393
+ /**
394
+ * The type of image source.
395
+ */
396
+ export type type2 = 'base64';
397
+ /**
398
+ * A delta in a streaming input JSON.
399
+ */
400
+ export type InputJsonBlockDelta = {
401
+ /**
402
+ * The partial JSON delta.
403
+ */
404
+ partial_json?: string;
405
+ /**
406
+ * The type of content block.
407
+ */
408
+ type: 'input_json_delta';
409
+ };
410
+ /**
411
+ * A message in a chat conversation.
412
+ */
413
+ export type Message = {
414
+ /**
415
+ * Unique object identifier.
416
+ *
417
+ * The format and length of IDs may change over time.
418
+ *
419
+ */
420
+ id?: string;
421
+ /**
422
+ * The content of the message.
423
+ */
424
+ content: string | Array<Block>;
425
+ role: MessageRole;
426
+ /**
427
+ * The model that handled the request.
428
+ */
429
+ model?: string;
430
+ stop_reason?: StopReason;
431
+ /**
432
+ * Which custom stop sequence was generated, if any.
433
+ *
434
+ * This value will be a non-null string if one of your custom stop sequences was
435
+ * generated.
436
+ *
437
+ */
438
+ stop_sequence?: string;
439
+ /**
440
+ * Object type.
441
+ *
442
+ * For Messages, this is always `"message"`.
443
+ *
444
+ */
445
+ type?: string;
446
+ usage?: Usage;
447
+ };
448
+ /**
449
+ * A batch of message requests.
450
+ */
451
+ export type MessageBatch = {
452
+ /**
453
+ * Unique object identifier for the message batch.
454
+ */
455
+ id: string;
456
+ /**
457
+ * RFC 3339 datetime string representing the time at which the Message Batch was created.
458
+ */
459
+ created_at: string;
460
+ /**
461
+ * RFC 3339 datetime string representing the time at which the Message Batch will expire and end processing, which is 24 hours after creation.
462
+ */
463
+ expires_at: string;
464
+ /**
465
+ * Processing status of the Message Batch.
466
+ */
467
+ processing_status: 'in_progress' | 'canceling' | 'ended';
468
+ request_counts: MessageBatchRequestCounts;
469
+ /**
470
+ * URL to a `.jsonl` file containing the results of the Message Batch requests. Specified only once processing ends.
471
+ */
472
+ results_url?: string | null;
473
+ /**
474
+ * Object type. For Message Batches, this is always `"message_batch"`.
475
+ */
476
+ type: 'message_batch';
477
+ };
478
+ /**
479
+ * Processing status of the Message Batch.
480
+ */
481
+ export type processing_status = 'in_progress' | 'canceling' | 'ended';
482
+ /**
483
+ * Object type. For Message Batches, this is always `"message_batch"`.
484
+ */
485
+ export type type3 = 'message_batch';
486
+ /**
487
+ * Tallies requests within the Message Batch, categorized by their status.
488
+ */
489
+ export type MessageBatchRequestCounts = {
490
+ /**
491
+ * Number of requests in the Message Batch that are processing.
492
+ */
493
+ processing: number;
494
+ /**
495
+ * Number of requests in the Message Batch that have completed successfully.
496
+ */
497
+ succeeded: number;
498
+ /**
499
+ * Number of requests in the Message Batch that encountered an error.
500
+ */
501
+ errored: number;
502
+ /**
503
+ * Number of requests in the Message Batch that have been canceled.
504
+ */
505
+ canceled: number;
506
+ /**
507
+ * Number of requests in the Message Batch that have expired.
508
+ */
509
+ expired: number;
510
+ };
511
+ /**
512
+ * A delta in a streaming message.
513
+ */
514
+ export type MessageDelta = {
515
+ stop_reason?: StopReason;
516
+ /**
517
+ * Which custom stop sequence was generated, if any.
518
+ *
519
+ * This value will be a non-null string if one of your custom stop sequences was
520
+ * generated.
521
+ *
522
+ */
523
+ stop_sequence?: string;
524
+ };
525
+ /**
526
+ * A delta event in a streaming conversation.
527
+ */
528
+ export type MessageDeltaEvent = {
529
+ delta: MessageDelta;
530
+ type: 'message_delta';
531
+ usage: MessageDeltaUsage;
532
+ };
533
+ /**
534
+ * Billing and rate-limit usage.
535
+ *
536
+ * Anthropic's API bills and rate-limits by token counts, as tokens represent the
537
+ * underlying cost to our systems.
538
+ *
539
+ * Under the hood, the API transforms requests into a format suitable for the
540
+ * model. The model's output then goes through a parsing stage before becoming an
541
+ * API response. As a result, the token counts in `usage` will not match one-to-one
542
+ * with the exact visible content of an API request or response.
543
+ *
544
+ * For example, `output_tokens` will be non-zero, even for an empty string response
545
+ * from Claude.
546
+ *
547
+ */
548
+ export type MessageDeltaUsage = {
549
+ /**
550
+ * The cumulative number of output tokens which were used.
551
+ */
552
+ output_tokens: number;
553
+ };
554
+ /**
555
+ * The role of the messages author.
556
+ */
557
+ export type MessageRole = 'user' | 'assistant';
558
+ /**
559
+ * A start event in a streaming conversation.
560
+ */
561
+ export type MessageStartEvent = {
562
+ message: Message;
563
+ type: 'message_start';
564
+ };
565
+ /**
566
+ * A stop event in a streaming conversation.
567
+ */
568
+ export type MessageStopEvent = {
569
+ type: 'message_stop';
570
+ };
571
+ /**
572
+ * A event in a streaming conversation.
573
+ */
574
+ export type MessageStreamEvent = MessageStartEvent | MessageDeltaEvent | MessageStopEvent | ContentBlockStartEvent | ContentBlockDeltaEvent | ContentBlockStopEvent | PingEvent | ErrorEvent;
575
+ /**
576
+ * The type of a streaming event.
577
+ */
578
+ export type MessageStreamEventType = 'message_start' | 'message_delta' | 'message_stop' | 'content_block_start' | 'content_block_delta' | 'content_block_stop' | 'ping' | 'error';
579
+ /**
580
+ * A ping event in a streaming conversation.
581
+ */
582
+ export type PingEvent = {
583
+ type: 'ping';
584
+ };
585
+ /**
586
+ * The reason that we stopped.
587
+ *
588
+ * This may be one the following values:
589
+ *
590
+ * - `"end_turn"`: the model reached a natural stopping point
591
+ * - `"max_tokens"`: we exceeded the requested `max_tokens` or the model's maximum
592
+ * - `"stop_sequence"`: one of your provided custom `stop_sequences` was generated
593
+ * - `"tool_use"`: the model invoked one or more tools
594
+ *
595
+ * In non-streaming mode this value is always non-null. In streaming mode, it is
596
+ * null in the `message_start` event and non-null otherwise.
597
+ *
598
+ */
599
+ export type StopReason = 'end_turn' | 'max_tokens' | 'stop_sequence' | 'tool_use';
600
+ /**
601
+ * A block of text content.
602
+ */
603
+ export type TextBlock = {
604
+ /**
605
+ * The text content.
606
+ */
607
+ text: string;
608
+ /**
609
+ * The type of content block.
610
+ */
611
+ type?: 'text';
612
+ cache_control?: CacheControlEphemeral;
613
+ };
614
+ /**
615
+ * A delta in a streaming text block.
616
+ */
617
+ export type TextBlockDelta = {
618
+ /**
619
+ * The text delta.
620
+ */
621
+ text: string;
622
+ /**
623
+ * The type of content block.
624
+ */
625
+ type: 'text_delta';
626
+ };
627
+ /**
628
+ * A tool the model may use.
629
+ */
630
+ export type Tool = ToolCustom | ToolComputerUse | ToolTextEditor | ToolBash;
631
+ /**
632
+ * A tool for running commands in a bash shell.
633
+ */
634
+ export type ToolBash = {
635
+ /**
636
+ * The type of tool.
637
+ */
638
+ type?: 'ToolBash';
639
+ /**
640
+ * The name of the tool.
641
+ */
642
+ name?: string;
643
+ cache_control?: CacheControlEphemeral;
644
+ };
645
+ /**
646
+ * How the model should use the provided tools. The model can use a specific tool,
647
+ * any available tool, or decide by itself.
648
+ *
649
+ * - `auto`: allows Claude to decide whether to call any provided tools or not. This is the default value.
650
+ * - `any`: tells Claude that it must use one of the provided tools, but doesn’t force a particular tool.
651
+ * - `tool`: allows us to force Claude to always use a particular tool specified in the `name` field.
652
+ *
653
+ */
654
+ export type ToolChoice = {
655
+ type: ToolChoiceType;
656
+ /**
657
+ * The name of the tool to use.
658
+ */
659
+ name?: string;
660
+ /**
661
+ * Whether to disable parallel tool use.
662
+ */
663
+ disable_parallel_tool_use?: boolean;
664
+ };
665
+ /**
666
+ * How the model should use the provided tools. The model can use a specific tool,
667
+ * any available tool, or decide by itself.
668
+ *
669
+ * - `auto`: allows Claude to decide whether to call any provided tools or not. This is the default value.
670
+ * - `any`: tells Claude that it must use one of the provided tools, but doesn't force a particular tool.
671
+ * - `tool`: allows us to force Claude to always use a particular tool specified in the `name` field.
672
+ *
673
+ */
674
+ export type ToolChoiceType = 'auto' | 'any' | 'tool';
675
+ /**
676
+ * A tool that uses a mouse and keyboard to interact with a computer, and take screenshots.
677
+ */
678
+ export type ToolComputerUse = {
679
+ /**
680
+ * The type of tool.
681
+ */
682
+ type?: 'ToolComputerUse';
683
+ /**
684
+ * The name of the tool.
685
+ */
686
+ name?: string;
687
+ cache_control?: CacheControlEphemeral;
688
+ /**
689
+ * The width of the display in pixels.
690
+ */
691
+ display_width_px: number;
692
+ /**
693
+ * The height of the display in pixels.
694
+ */
695
+ display_height_px: number;
696
+ /**
697
+ * The number of the display to use.
698
+ */
699
+ display_number?: number | null;
700
+ };
701
+ /**
702
+ * A custom tool the model may use.
703
+ */
704
+ export type ToolCustom = {
705
+ /**
706
+ * The type of tool.
707
+ */
708
+ type?: 'ToolCustom';
709
+ /**
710
+ * The name of the tool. Must match the regex `^[a-zA-Z0-9_-]{1,64}$`.
711
+ */
712
+ name: string;
713
+ /**
714
+ * Description of what this tool does.
715
+ *
716
+ * Tool descriptions should be as detailed as possible. The more information that
717
+ * the model has about what the tool is and how to use it, the better it will
718
+ * perform. You can use natural language descriptions to reinforce important
719
+ * aspects of the tool input JSON schema.
720
+ *
721
+ */
722
+ description?: string;
723
+ /**
724
+ * [JSON schema](https://json-schema.org/) for this tool's input.
725
+ *
726
+ * This defines the shape of the `input` that your tool accepts and that the model
727
+ * will produce.
728
+ *
729
+ */
730
+ input_schema: {
731
+ [key: string]: unknown;
732
+ };
733
+ };
734
+ /**
735
+ * The result of using a tool.
736
+ */
737
+ export type ToolResultBlock = {
738
+ /**
739
+ * The `id` of the tool use request this is a result for.
740
+ */
741
+ tool_use_id: string;
742
+ /**
743
+ * The result of the tool, as a string (e.g. `"content": "15 degrees"`)
744
+ * or list of nested content blocks (e.g. `"content": [{"type": "text", "text": "15 degrees"}]`).
745
+ * These content blocks can use the text or image types.
746
+ *
747
+ */
748
+ content: string | Array<Block>;
749
+ /**
750
+ * Set to `true` if the tool execution resulted in an error.
751
+ */
752
+ is_error?: boolean;
753
+ /**
754
+ * The type of content block.
755
+ */
756
+ type?: 'tool_result';
757
+ cache_control?: CacheControlEphemeral;
758
+ };
759
+ /**
760
+ * A tool for viewing, creating and editing files.
761
+ */
762
+ export type ToolTextEditor = {
763
+ /**
764
+ * The type of tool.
765
+ */
766
+ type?: 'ToolTextEditor';
767
+ /**
768
+ * The name of the tool.
769
+ */
770
+ name?: string;
771
+ cache_control?: CacheControlEphemeral;
772
+ };
773
+ /**
774
+ * The tool the model wants to use.
775
+ */
776
+ export type ToolUseBlock = {
777
+ /**
778
+ * A unique identifier for this particular tool use block.
779
+ * This will be used to match up the tool results later.
780
+ *
781
+ */
782
+ id: string;
783
+ /**
784
+ * The name of the tool being used.
785
+ */
786
+ name: string;
787
+ /**
788
+ * An object containing the input being passed to the tool, conforming to the tool's `input_schema`.
789
+ */
790
+ input: {
791
+ [key: string]: unknown;
792
+ };
793
+ /**
794
+ * The type of content block.
795
+ */
796
+ type?: 'tool_use';
797
+ cache_control?: CacheControlEphemeral;
798
+ };
799
+ /**
800
+ * Billing and rate-limit usage.
801
+ *
802
+ * Anthropic's API bills and rate-limits by token counts, as tokens represent the
803
+ * underlying cost to our systems.
804
+ *
805
+ * Under the hood, the API transforms requests into a format suitable for the
806
+ * model. The model's output then goes through a parsing stage before becoming an
807
+ * API response. As a result, the token counts in `usage` will not match one-to-one
808
+ * with the exact visible content of an API request or response.
809
+ *
810
+ * For example, `output_tokens` will be non-zero, even for an empty string response
811
+ * from Claude.
812
+ *
813
+ */
814
+ export type Usage = {
815
+ /**
816
+ * The number of input tokens which were used.
817
+ */
818
+ input_tokens: number;
819
+ /**
820
+ * The number of output tokens which were used.
821
+ */
822
+ output_tokens: number;
823
+ /**
824
+ * The number of input tokens read from the cache.
825
+ */
826
+ cache_creation_input_tokens?: number;
827
+ /**
828
+ * The number of input tokens used to create the cache entry.
829
+ */
830
+ cache_read_input_tokens?: number;
831
+ };
832
+ export type CreateMessageData = {
833
+ body: CreateMessageRequest;
834
+ };
835
+ export type CreateMessageResponse = Message;
836
+ export type CreateMessageError = unknown;
837
+ export type CreateMessageBatchData = {
838
+ body: CreateMessageBatchRequest;
839
+ };
840
+ export type CreateMessageBatchResponse = MessageBatch;
841
+ export type CreateMessageBatchError = unknown;
842
+ export type RetrieveMessageBatchData = {
843
+ path: {
844
+ /**
845
+ * The ID of the message batch to retrieve.
846
+ */
847
+ id: string;
848
+ };
849
+ };
850
+ export type RetrieveMessageBatchResponse = MessageBatch;
851
+ export type RetrieveMessageBatchError = unknown;
852
+ //# sourceMappingURL=types.gen.d.ts.map