@anthropic-ai/sdk 0.20.9 → 0.21.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 (45) hide show
  1. package/CHANGELOG.md +15 -0
  2. package/_vendor/partial-json-parser/parser.d.ts +3 -0
  3. package/_vendor/partial-json-parser/parser.d.ts.map +1 -0
  4. package/_vendor/partial-json-parser/parser.js +224 -0
  5. package/_vendor/partial-json-parser/parser.js.map +1 -0
  6. package/_vendor/partial-json-parser/parser.mjs +221 -0
  7. package/_vendor/partial-json-parser/parser.mjs.map +1 -0
  8. package/lib/ToolsBetaMessageStream.d.ts +95 -0
  9. package/lib/ToolsBetaMessageStream.d.ts.map +1 -0
  10. package/lib/ToolsBetaMessageStream.js +459 -0
  11. package/lib/ToolsBetaMessageStream.js.map +1 -0
  12. package/lib/ToolsBetaMessageStream.mjs +455 -0
  13. package/lib/ToolsBetaMessageStream.mjs.map +1 -0
  14. package/package.json +1 -1
  15. package/resources/beta/tools/index.d.ts +1 -1
  16. package/resources/beta/tools/index.d.ts.map +1 -1
  17. package/resources/beta/tools/index.js.map +1 -1
  18. package/resources/beta/tools/index.mjs.map +1 -1
  19. package/resources/beta/tools/messages.d.ts +349 -18
  20. package/resources/beta/tools/messages.d.ts.map +1 -1
  21. package/resources/beta/tools/messages.js +11 -2
  22. package/resources/beta/tools/messages.js.map +1 -1
  23. package/resources/beta/tools/messages.mjs +9 -1
  24. package/resources/beta/tools/messages.mjs.map +1 -1
  25. package/resources/beta/tools/tools.d.ts +5 -0
  26. package/resources/beta/tools/tools.d.ts.map +1 -1
  27. package/resources/beta/tools/tools.js.map +1 -1
  28. package/resources/beta/tools/tools.mjs.map +1 -1
  29. package/resources/completions.d.ts +11 -19
  30. package/resources/completions.d.ts.map +1 -1
  31. package/resources/completions.js.map +1 -1
  32. package/resources/completions.mjs.map +1 -1
  33. package/resources/messages.d.ts +22 -22
  34. package/src/_vendor/partial-json-parser/README.md +3 -0
  35. package/src/_vendor/partial-json-parser/parser.ts +262 -0
  36. package/src/lib/ToolsBetaMessageStream.ts +561 -0
  37. package/src/resources/beta/tools/index.ts +5 -0
  38. package/src/resources/beta/tools/messages.ts +397 -21
  39. package/src/resources/beta/tools/tools.ts +5 -0
  40. package/src/resources/completions.ts +11 -19
  41. package/src/resources/messages.ts +22 -22
  42. package/src/version.ts +1 -1
  43. package/version.d.ts +1 -1
  44. package/version.js +1 -1
  45. package/version.mjs +1 -1
@@ -3,6 +3,8 @@
3
3
  import * as Core from "../../../core";
4
4
  import { APIPromise } from "../../../core";
5
5
  import { APIResource } from "../../../resource";
6
+ import { ToolsBetaMessageStream } from "../../../lib/ToolsBetaMessageStream";
7
+ export { ToolsBetaMessageStream } from "../../../lib/ToolsBetaMessageStream";
6
8
  import * as ToolsMessagesAPI from "./messages";
7
9
  import * as MessagesAPI from "../../messages";
8
10
  import { Stream } from "../../../streaming";
@@ -21,23 +23,36 @@ export class Messages extends APIResource {
21
23
  create(
22
24
  body: MessageCreateParamsStreaming,
23
25
  options?: Core.RequestOptions,
24
- ): APIPromise<Stream<MessagesAPI.MessageStreamEvent>>;
26
+ ): APIPromise<Stream<ToolsBetaMessageStreamEvent>>;
25
27
  create(
26
28
  body: MessageCreateParamsBase,
27
29
  options?: Core.RequestOptions,
28
- ): APIPromise<Stream<MessagesAPI.MessageStreamEvent> | ToolsBetaMessage>;
30
+ ): APIPromise<Stream<ToolsBetaMessageStreamEvent> | ToolsBetaMessage>;
29
31
  create(
30
32
  body: MessageCreateParams,
31
33
  options?: Core.RequestOptions,
32
- ): APIPromise<ToolsBetaMessage> | APIPromise<Stream<MessagesAPI.MessageStreamEvent>> {
34
+ ): APIPromise<ToolsBetaMessage> | APIPromise<Stream<ToolsBetaMessageStreamEvent>> {
33
35
  return this._client.post('/v1/messages?beta=tools', {
34
36
  body,
35
37
  timeout: 600000,
36
38
  ...options,
37
- headers: { 'anthropic-beta': 'tools-2024-04-04', ...options?.headers },
39
+ headers: { 'anthropic-beta': 'tools-2024-05-16', ...options?.headers },
38
40
  stream: body.stream ?? false,
39
- }) as APIPromise<ToolsBetaMessage> | APIPromise<Stream<MessagesAPI.MessageStreamEvent>>;
41
+ }) as APIPromise<ToolsBetaMessage> | APIPromise<Stream<ToolsBetaMessageStreamEvent>>;
40
42
  }
43
+
44
+ /**
45
+ * Create a Message stream
46
+ */
47
+ stream(body: MessageStreamParams, options?: Core.RequestOptions): ToolsBetaMessageStream {
48
+ return ToolsBetaMessageStream.createMessage(this, body, options);
49
+ }
50
+ }
51
+
52
+ export interface InputJsonDelta {
53
+ partial_json: string;
54
+
55
+ type: 'input_json_delta';
41
56
  }
42
57
 
43
58
  export interface Tool {
@@ -82,7 +97,7 @@ export interface ToolResultBlockParam {
82
97
 
83
98
  type: 'tool_result';
84
99
 
85
- content?: Array<MessagesAPI.TextBlockParam>;
100
+ content?: Array<MessagesAPI.TextBlockParam | MessagesAPI.ImageBlockParam>;
86
101
 
87
102
  is_error?: boolean;
88
103
  }
@@ -109,6 +124,22 @@ export interface ToolUseBlockParam {
109
124
 
110
125
  export type ToolsBetaContentBlock = MessagesAPI.TextBlock | ToolUseBlock;
111
126
 
127
+ export interface ToolsBetaContentBlockDeltaEvent {
128
+ delta: MessagesAPI.TextDelta | InputJsonDelta;
129
+
130
+ index: number;
131
+
132
+ type: 'content_block_delta';
133
+ }
134
+
135
+ export interface ToolsBetaContentBlockStartEvent {
136
+ content_block: MessagesAPI.TextBlock | ToolUseBlock;
137
+
138
+ index: number;
139
+
140
+ type: 'content_block_start';
141
+ }
142
+
112
143
  export interface ToolsBetaMessage {
113
144
  /**
114
145
  * Unique object identifier.
@@ -222,6 +253,14 @@ export interface ToolsBetaMessageParam {
222
253
  role: 'user' | 'assistant';
223
254
  }
224
255
 
256
+ export type ToolsBetaMessageStreamEvent =
257
+ | MessagesAPI.MessageStartEvent
258
+ | MessagesAPI.MessageDeltaEvent
259
+ | MessagesAPI.MessageStopEvent
260
+ | ToolsBetaContentBlockStartEvent
261
+ | ToolsBetaContentBlockDeltaEvent
262
+ | MessagesAPI.ContentBlockStopEvent;
263
+
225
264
  export type MessageCreateParams = MessageCreateParamsNonStreaming | MessageCreateParamsStreaming;
226
265
 
227
266
  export interface MessageCreateParamsBase {
@@ -232,7 +271,7 @@ export interface MessageCreateParamsBase {
232
271
  * only specifies the absolute maximum number of tokens to generate.
233
272
  *
234
273
  * Different models have different maximum values for this parameter. See
235
- * [models](https://docs.anthropic.com/claude/docs/models-overview) for details.
274
+ * [models](https://docs.anthropic.com/en/docs/models-overview) for details.
236
275
  */
237
276
  max_tokens: number;
238
277
 
@@ -315,12 +354,12 @@ export interface MessageCreateParamsBase {
315
354
  * We currently support the `base64` source type for images, and the `image/jpeg`,
316
355
  * `image/png`, `image/gif`, and `image/webp` media types.
317
356
  *
318
- * See [examples](https://docs.anthropic.com/claude/reference/messages-examples)
319
- * for more input examples.
357
+ * See [examples](https://docs.anthropic.com/en/api/messages-examples) for more
358
+ * input examples.
320
359
  *
321
360
  * Note that if you want to include a
322
- * [system prompt](https://docs.anthropic.com/claude/docs/system-prompts), you can
323
- * use the top-level `system` parameter — there is no `"system"` role for input
361
+ * [system prompt](https://docs.anthropic.com/en/docs/system-prompts), you can use
362
+ * the top-level `system` parameter — there is no `"system"` role for input
324
363
  * messages in the Messages API.
325
364
  */
326
365
  messages: Array<ToolsBetaMessageParam>;
@@ -328,8 +367,8 @@ export interface MessageCreateParamsBase {
328
367
  /**
329
368
  * The model that will complete your prompt.
330
369
  *
331
- * See [models](https://docs.anthropic.com/claude/docs/models-overview) for
332
- * additional details and options.
370
+ * See [models](https://docs.anthropic.com/en/docs/models-overview) for additional
371
+ * details and options.
333
372
  */
334
373
  model: string;
335
374
 
@@ -354,8 +393,8 @@ export interface MessageCreateParamsBase {
354
393
  /**
355
394
  * Whether to incrementally stream the response using server-sent events.
356
395
  *
357
- * See [streaming](https://docs.anthropic.com/claude/reference/messages-streaming)
358
- * for details.
396
+ * See [streaming](https://docs.anthropic.com/en/api/messages-streaming) for
397
+ * details.
359
398
  */
360
399
  stream?: boolean;
361
400
 
@@ -364,7 +403,7 @@ export interface MessageCreateParamsBase {
364
403
  *
365
404
  * A system prompt is a way of providing context and instructions to Claude, such
366
405
  * as specifying a particular goal or role. See our
367
- * [guide to system prompts](https://docs.anthropic.com/claude/docs/system-prompts).
406
+ * [guide to system prompts](https://docs.anthropic.com/en/docs/system-prompts).
368
407
  */
369
408
  system?: string;
370
409
 
@@ -380,6 +419,15 @@ export interface MessageCreateParamsBase {
380
419
  */
381
420
  temperature?: number;
382
421
 
422
+ /**
423
+ * How the model should use the provided tools. The model can use a specific tool,
424
+ * any available tool, or decide by itself.
425
+ */
426
+ tool_choice?:
427
+ | MessageCreateParams.ToolChoiceAuto
428
+ | MessageCreateParams.ToolChoiceAny
429
+ | MessageCreateParams.ToolChoiceTool;
430
+
383
431
  /**
384
432
  * [beta] Definitions of tools that the model may use.
385
433
  *
@@ -448,7 +496,7 @@ export interface MessageCreateParamsBase {
448
496
  * functions, or more generally whenever you want the model to produce a particular
449
497
  * JSON structure of output.
450
498
  *
451
- * See our [beta guide](https://docs.anthropic.com/claude/docs/tool-use) for more
499
+ * See our [beta guide](https://docs.anthropic.com/en/docs/tool-use) for more
452
500
  * details.
453
501
  */
454
502
  tools?: Array<Tool>;
@@ -493,6 +541,32 @@ export namespace MessageCreateParams {
493
541
  user_id?: string | null;
494
542
  }
495
543
 
544
+ /**
545
+ * The model will automatically decide whether to use tools.
546
+ */
547
+ export interface ToolChoiceAuto {
548
+ type: 'auto';
549
+ }
550
+
551
+ /**
552
+ * The model will use any available tools.
553
+ */
554
+ export interface ToolChoiceAny {
555
+ type: 'any';
556
+ }
557
+
558
+ /**
559
+ * The model will use the specified tool with `tool_choice.name`.
560
+ */
561
+ export interface ToolChoiceTool {
562
+ /**
563
+ * The name of the tool to use.
564
+ */
565
+ name: string;
566
+
567
+ type: 'tool';
568
+ }
569
+
496
570
  export type MessageCreateParamsNonStreaming = ToolsMessagesAPI.MessageCreateParamsNonStreaming;
497
571
  export type MessageCreateParamsStreaming = ToolsMessagesAPI.MessageCreateParamsStreaming;
498
572
  }
@@ -501,8 +575,8 @@ export interface MessageCreateParamsNonStreaming extends MessageCreateParamsBase
501
575
  /**
502
576
  * Whether to incrementally stream the response using server-sent events.
503
577
  *
504
- * See [streaming](https://docs.anthropic.com/claude/reference/messages-streaming)
505
- * for details.
578
+ * See [streaming](https://docs.anthropic.com/en/api/messages-streaming) for
579
+ * details.
506
580
  */
507
581
  stream?: false;
508
582
  }
@@ -511,21 +585,323 @@ export interface MessageCreateParamsStreaming extends MessageCreateParamsBase {
511
585
  /**
512
586
  * Whether to incrementally stream the response using server-sent events.
513
587
  *
514
- * See [streaming](https://docs.anthropic.com/claude/reference/messages-streaming)
515
- * for details.
588
+ * See [streaming](https://docs.anthropic.com/en/api/messages-streaming) for
589
+ * details.
516
590
  */
517
591
  stream: true;
518
592
  }
519
593
 
594
+ export interface MessageStreamParams {
595
+ /**
596
+ * The maximum number of tokens to generate before stopping.
597
+ *
598
+ * Note that our models may stop _before_ reaching this maximum. This parameter
599
+ * only specifies the absolute maximum number of tokens to generate.
600
+ *
601
+ * Different models have different maximum values for this parameter. See
602
+ * [models](https://docs.anthropic.com/en/docs/models-overview) for details.
603
+ */
604
+ max_tokens: number;
605
+
606
+ /**
607
+ * Input messages.
608
+ *
609
+ * Our models are trained to operate on alternating `user` and `assistant`
610
+ * conversational turns. When creating a new `Message`, you specify the prior
611
+ * conversational turns with the `messages` parameter, and the model then generates
612
+ * the next `Message` in the conversation.
613
+ *
614
+ * Each input message must be an object with a `role` and `content`. You can
615
+ * specify a single `user`-role message, or you can include multiple `user` and
616
+ * `assistant` messages. The first message must always use the `user` role.
617
+ *
618
+ * If the final message uses the `assistant` role, the response content will
619
+ * continue immediately from the content in that message. This can be used to
620
+ * constrain part of the model's response.
621
+ *
622
+ * Example with a single `user` message:
623
+ *
624
+ * ```json
625
+ * [{ "role": "user", "content": "Hello, Claude" }]
626
+ * ```
627
+ *
628
+ * Example with multiple conversational turns:
629
+ *
630
+ * ```json
631
+ * [
632
+ * { "role": "user", "content": "Hello there." },
633
+ * { "role": "assistant", "content": "Hi, I'm Claude. How can I help you?" },
634
+ * { "role": "user", "content": "Can you explain LLMs in plain English?" }
635
+ * ]
636
+ * ```
637
+ *
638
+ * Example with a partially-filled response from Claude:
639
+ *
640
+ * ```json
641
+ * [
642
+ * {
643
+ * "role": "user",
644
+ * "content": "What's the Greek name for Sun? (A) Sol (B) Helios (C) Sun"
645
+ * },
646
+ * { "role": "assistant", "content": "The best answer is (" }
647
+ * ]
648
+ * ```
649
+ *
650
+ * Each input message `content` may be either a single `string` or an array of
651
+ * content blocks, where each block has a specific `type`. Using a `string` for
652
+ * `content` is shorthand for an array of one content block of type `"text"`. The
653
+ * following input messages are equivalent:
654
+ *
655
+ * ```json
656
+ * { "role": "user", "content": "Hello, Claude" }
657
+ * ```
658
+ *
659
+ * ```json
660
+ * { "role": "user", "content": [{ "type": "text", "text": "Hello, Claude" }] }
661
+ * ```
662
+ *
663
+ * Starting with Claude 3 models, you can also send image content blocks:
664
+ *
665
+ * ```json
666
+ * {
667
+ * "role": "user",
668
+ * "content": [
669
+ * {
670
+ * "type": "image",
671
+ * "source": {
672
+ * "type": "base64",
673
+ * "media_type": "image/jpeg",
674
+ * "data": "/9j/4AAQSkZJRg..."
675
+ * }
676
+ * },
677
+ * { "type": "text", "text": "What is in this image?" }
678
+ * ]
679
+ * }
680
+ * ```
681
+ *
682
+ * We currently support the `base64` source type for images, and the `image/jpeg`,
683
+ * `image/png`, `image/gif`, and `image/webp` media types.
684
+ *
685
+ * See [examples](https://docs.anthropic.com/en/api/messages-examples) for more
686
+ * input examples.
687
+ *
688
+ * Note that if you want to include a
689
+ * [system prompt](https://docs.anthropic.com/en/docs/system-prompts), you can use
690
+ * the top-level `system` parameter — there is no `"system"` role for input
691
+ * messages in the Messages API.
692
+ */
693
+ messages: Array<ToolsBetaMessageParam>;
694
+
695
+ /**
696
+ * The model that will complete your prompt.
697
+ *
698
+ * See [models](https://docs.anthropic.com/en/docs/models-overview) for additional
699
+ * details and options.
700
+ */
701
+ model: string;
702
+
703
+ /**
704
+ * An object describing metadata about the request.
705
+ */
706
+ metadata?: MessageStreamParams.Metadata;
707
+
708
+ /**
709
+ * Custom text sequences that will cause the model to stop generating.
710
+ *
711
+ * Our models will normally stop when they have naturally completed their turn,
712
+ * which will result in a response `stop_reason` of `"end_turn"`.
713
+ *
714
+ * If you want the model to stop generating when it encounters custom strings of
715
+ * text, you can use the `stop_sequences` parameter. If the model encounters one of
716
+ * the custom sequences, the response `stop_reason` value will be `"stop_sequence"`
717
+ * and the response `stop_sequence` value will contain the matched stop sequence.
718
+ */
719
+ stop_sequences?: Array<string>;
720
+
721
+ /**
722
+ * System prompt.
723
+ *
724
+ * A system prompt is a way of providing context and instructions to Claude, such
725
+ * as specifying a particular goal or role. See our
726
+ * [guide to system prompts](https://docs.anthropic.com/en/docs/system-prompts).
727
+ */
728
+ system?: string;
729
+
730
+ /**
731
+ * Amount of randomness injected into the response.
732
+ *
733
+ * Defaults to `1.0`. Ranges from `0.0` to `1.0`. Use `temperature` closer to `0.0`
734
+ * for analytical / multiple choice, and closer to `1.0` for creative and
735
+ * generative tasks.
736
+ *
737
+ * Note that even with `temperature` of `0.0`, the results will not be fully
738
+ * deterministic.
739
+ */
740
+ temperature?: number;
741
+
742
+ /**
743
+ * How the model should use the provided tools. The model can use a specific tool,
744
+ * any available tool, or decide by itself.
745
+ */
746
+ tool_choice?:
747
+ | MessageStreamParams.ToolChoiceAuto
748
+ | MessageStreamParams.ToolChoiceAny
749
+ | MessageStreamParams.ToolChoiceTool;
750
+
751
+ /**
752
+ * [beta] Definitions of tools that the model may use.
753
+ *
754
+ * If you include `tools` in your API request, the model may return `tool_use`
755
+ * content blocks that represent the model's use of those tools. You can then run
756
+ * those tools using the tool input generated by the model and then optionally
757
+ * return results back to the model using `tool_result` content blocks.
758
+ *
759
+ * Each tool definition includes:
760
+ *
761
+ * - `name`: Name of the tool.
762
+ * - `description`: Optional, but strongly-recommended description of the tool.
763
+ * - `input_schema`: [JSON schema](https://json-schema.org/) for the tool `input`
764
+ * shape that the model will produce in `tool_use` output content blocks.
765
+ *
766
+ * For example, if you defined `tools` as:
767
+ *
768
+ * ```json
769
+ * [
770
+ * {
771
+ * "name": "get_stock_price",
772
+ * "description": "Get the current stock price for a given ticker symbol.",
773
+ * "input_schema": {
774
+ * "type": "object",
775
+ * "properties": {
776
+ * "ticker": {
777
+ * "type": "string",
778
+ * "description": "The stock ticker symbol, e.g. AAPL for Apple Inc."
779
+ * }
780
+ * },
781
+ * "required": ["ticker"]
782
+ * }
783
+ * }
784
+ * ]
785
+ * ```
786
+ *
787
+ * And then asked the model "What's the S&P 500 at today?", the model might produce
788
+ * `tool_use` content blocks in the response like this:
789
+ *
790
+ * ```json
791
+ * [
792
+ * {
793
+ * "type": "tool_use",
794
+ * "id": "toolu_01D7FLrfh4GYq7yT1ULFeyMV",
795
+ * "name": "get_stock_price",
796
+ * "input": { "ticker": "^GSPC" }
797
+ * }
798
+ * ]
799
+ * ```
800
+ *
801
+ * You might then run your `get_stock_price` tool with `{"ticker": "^GSPC"}` as an
802
+ * input, and return the following back to the model in a subsequent `user`
803
+ * message:
804
+ *
805
+ * ```json
806
+ * [
807
+ * {
808
+ * "type": "tool_result",
809
+ * "tool_use_id": "toolu_01D7FLrfh4GYq7yT1ULFeyMV",
810
+ * "content": "259.75 USD"
811
+ * }
812
+ * ]
813
+ * ```
814
+ *
815
+ * Tools can be used for workflows that include running client-side tools and
816
+ * functions, or more generally whenever you want the model to produce a particular
817
+ * JSON structure of output.
818
+ *
819
+ * See our [beta guide](https://docs.anthropic.com/en/docs/tool-use) for more
820
+ * details.
821
+ */
822
+ tools?: Array<Tool>;
823
+
824
+ /**
825
+ * Only sample from the top K options for each subsequent token.
826
+ *
827
+ * Used to remove "long tail" low probability responses.
828
+ * [Learn more technical details here](https://towardsdatascience.com/how-to-sample-from-language-models-682bceb97277).
829
+ *
830
+ * Recommended for advanced use cases only. You usually only need to use
831
+ * `temperature`.
832
+ */
833
+ top_k?: number;
834
+
835
+ /**
836
+ * Use nucleus sampling.
837
+ *
838
+ * In nucleus sampling, we compute the cumulative distribution over all the options
839
+ * for each subsequent token in decreasing probability order and cut it off once it
840
+ * reaches a particular probability specified by `top_p`. You should either alter
841
+ * `temperature` or `top_p`, but not both.
842
+ *
843
+ * Recommended for advanced use cases only. You usually only need to use
844
+ * `temperature`.
845
+ */
846
+ top_p?: number;
847
+ }
848
+
849
+ export namespace MessageStreamParams {
850
+ /**
851
+ * An object describing metadata about the request.
852
+ */
853
+ export interface Metadata {
854
+ /**
855
+ * An external identifier for the user who is associated with the request.
856
+ *
857
+ * This should be a uuid, hash value, or other opaque identifier. Anthropic may use
858
+ * this id to help detect abuse. Do not include any identifying information such as
859
+ * name, email address, or phone number.
860
+ */
861
+ user_id?: string | null;
862
+ }
863
+
864
+ /**
865
+ * The model will automatically decide whether to use tools.
866
+ */
867
+ export interface ToolChoiceAuto {
868
+ type: 'auto';
869
+ }
870
+
871
+ /**
872
+ * The model will use any available tools.
873
+ */
874
+ export interface ToolChoiceAny {
875
+ type: 'any';
876
+ }
877
+
878
+ /**
879
+ * The model will use the specified tool with `tool_choice.name`.
880
+ */
881
+ export interface ToolChoiceTool {
882
+ /**
883
+ * The name of the tool to use.
884
+ */
885
+ name: string;
886
+
887
+ type: 'tool';
888
+ }
889
+ }
890
+
520
891
  export namespace Messages {
892
+ export import InputJsonDelta = ToolsMessagesAPI.InputJsonDelta;
521
893
  export import Tool = ToolsMessagesAPI.Tool;
522
894
  export import ToolResultBlockParam = ToolsMessagesAPI.ToolResultBlockParam;
523
895
  export import ToolUseBlock = ToolsMessagesAPI.ToolUseBlock;
524
896
  export import ToolUseBlockParam = ToolsMessagesAPI.ToolUseBlockParam;
525
897
  export import ToolsBetaContentBlock = ToolsMessagesAPI.ToolsBetaContentBlock;
898
+ export import ToolsBetaContentBlockDeltaEvent = ToolsMessagesAPI.ToolsBetaContentBlockDeltaEvent;
899
+ export import ToolsBetaContentBlockStartEvent = ToolsMessagesAPI.ToolsBetaContentBlockStartEvent;
526
900
  export import ToolsBetaMessage = ToolsMessagesAPI.ToolsBetaMessage;
527
901
  export import ToolsBetaMessageParam = ToolsMessagesAPI.ToolsBetaMessageParam;
902
+ export import ToolsBetaMessageStreamEvent = ToolsMessagesAPI.ToolsBetaMessageStreamEvent;
528
903
  export import MessageCreateParams = ToolsMessagesAPI.MessageCreateParams;
529
904
  export import MessageCreateParamsNonStreaming = ToolsMessagesAPI.MessageCreateParamsNonStreaming;
530
905
  export import MessageCreateParamsStreaming = ToolsMessagesAPI.MessageCreateParamsStreaming;
906
+ export import MessageStreamParams = ToolsMessagesAPI.MessageStreamParams;
531
907
  }
@@ -9,14 +9,19 @@ export class Tools extends APIResource {
9
9
 
10
10
  export namespace Tools {
11
11
  export import Messages = MessagesAPI.Messages;
12
+ export import InputJsonDelta = MessagesAPI.InputJsonDelta;
12
13
  export import Tool = MessagesAPI.Tool;
13
14
  export import ToolResultBlockParam = MessagesAPI.ToolResultBlockParam;
14
15
  export import ToolUseBlock = MessagesAPI.ToolUseBlock;
15
16
  export import ToolUseBlockParam = MessagesAPI.ToolUseBlockParam;
16
17
  export import ToolsBetaContentBlock = MessagesAPI.ToolsBetaContentBlock;
18
+ export import ToolsBetaContentBlockDeltaEvent = MessagesAPI.ToolsBetaContentBlockDeltaEvent;
19
+ export import ToolsBetaContentBlockStartEvent = MessagesAPI.ToolsBetaContentBlockStartEvent;
17
20
  export import ToolsBetaMessage = MessagesAPI.ToolsBetaMessage;
18
21
  export import ToolsBetaMessageParam = MessagesAPI.ToolsBetaMessageParam;
22
+ export import ToolsBetaMessageStreamEvent = MessagesAPI.ToolsBetaMessageStreamEvent;
19
23
  export import MessageCreateParams = MessagesAPI.MessageCreateParams;
20
24
  export import MessageCreateParamsNonStreaming = MessagesAPI.MessageCreateParamsNonStreaming;
21
25
  export import MessageCreateParamsStreaming = MessagesAPI.MessageCreateParamsStreaming;
26
+ export import MessageStreamParams = MessagesAPI.MessageStreamParams;
22
27
  }
@@ -11,11 +11,10 @@ export class Completions extends APIResource {
11
11
  * [Legacy] Create a Text Completion.
12
12
  *
13
13
  * The Text Completions API is a legacy API. We recommend using the
14
- * [Messages API](https://docs.anthropic.com/claude/reference/messages_post) going
15
- * forward.
14
+ * [Messages API](https://docs.anthropic.com/en/api/messages) going forward.
16
15
  *
17
16
  * Future models and features will not be compatible with Text Completions. See our
18
- * [migration guide](https://docs.anthropic.com/claude/reference/migrating-from-text-completions-to-messages)
17
+ * [migration guide](https://docs.anthropic.com/en/api/migrating-from-text-completions-to-messages)
19
18
  * for guidance in migrating from Text Completions to Messages.
20
19
  */
21
20
  create(body: CompletionCreateParamsNonStreaming, options?: Core.RequestOptions): APIPromise<Completion>;
@@ -91,8 +90,8 @@ export interface CompletionCreateParamsBase {
91
90
  /**
92
91
  * The model that will complete your prompt.
93
92
  *
94
- * See [models](https://docs.anthropic.com/claude/docs/models-overview) for
95
- * additional details and options.
93
+ * See [models](https://docs.anthropic.com/en/docs/models-overview) for additional
94
+ * details and options.
96
95
  */
97
96
  model: (string & {}) | 'claude-2.0' | 'claude-2.1' | 'claude-instant-1.2';
98
97
 
@@ -106,11 +105,10 @@ export interface CompletionCreateParamsBase {
106
105
  * "\n\nHuman: {userQuestion}\n\nAssistant:"
107
106
  * ```
108
107
  *
109
- * See
110
- * [prompt validation](https://anthropic.readme.io/claude/reference/prompt-validation)
111
- * and our guide to
112
- * [prompt design](https://docs.anthropic.com/claude/docs/introduction-to-prompt-design)
113
- * for more details.
108
+ * See [prompt validation](https://docs.anthropic.com/en/api/prompt-validation) and
109
+ * our guide to
110
+ * [prompt design](https://docs.anthropic.com/en/docs/intro-to-prompting) for more
111
+ * details.
114
112
  */
115
113
  prompt: string;
116
114
 
@@ -131,9 +129,7 @@ export interface CompletionCreateParamsBase {
131
129
  /**
132
130
  * Whether to incrementally stream the response using server-sent events.
133
131
  *
134
- * See
135
- * [streaming](https://docs.anthropic.com/claude/reference/text-completions-streaming)
136
- * for details.
132
+ * See [streaming](https://docs.anthropic.com/en/api/streaming) for details.
137
133
  */
138
134
  stream?: boolean;
139
135
 
@@ -197,9 +193,7 @@ export interface CompletionCreateParamsNonStreaming extends CompletionCreatePara
197
193
  /**
198
194
  * Whether to incrementally stream the response using server-sent events.
199
195
  *
200
- * See
201
- * [streaming](https://docs.anthropic.com/claude/reference/text-completions-streaming)
202
- * for details.
196
+ * See [streaming](https://docs.anthropic.com/en/api/streaming) for details.
203
197
  */
204
198
  stream?: false;
205
199
  }
@@ -208,9 +202,7 @@ export interface CompletionCreateParamsStreaming extends CompletionCreateParamsB
208
202
  /**
209
203
  * Whether to incrementally stream the response using server-sent events.
210
204
  *
211
- * See
212
- * [streaming](https://docs.anthropic.com/claude/reference/text-completions-streaming)
213
- * for details.
205
+ * See [streaming](https://docs.anthropic.com/en/api/streaming) for details.
214
206
  */
215
207
  stream: true;
216
208
  }