Skip to content

Commit 2d7cef1

Browse files
fix(client): deduplicate stop reason type (#726)
1 parent 271be7d commit 2d7cef1

File tree

10 files changed

+22
-6
lines changed

10 files changed

+22
-6
lines changed

.stats.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
configured_endpoints: 21
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/anthropic-fd7537a41646cd9253c04f350436c5471e4762750fce8ca8f1909a3052d98608.yml
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/anthropic-ea0576fceb17a0976feca9aa03aa426984d6fe1390f2bcdbf9de0212a81c8334.yml
33
openapi_spec_hash: d2d7ec2a7a35a1ed2443c3b690c802c4
4-
config_hash: 92dd03fd872d52f9707c9e7a7953c3d1
4+
config_hash: 188e45a82f6284619dd4a7bddf875907

api.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ Types:
5656
- <code><a href="./src/resources/messages/messages.ts">RedactedThinkingBlock</a></code>
5757
- <code><a href="./src/resources/messages/messages.ts">RedactedThinkingBlockParam</a></code>
5858
- <code><a href="./src/resources/messages/messages.ts">SignatureDelta</a></code>
59+
- <code><a href="./src/resources/messages/messages.ts">StopReason</a></code>
5960
- <code><a href="./src/resources/messages/messages.ts">TextBlock</a></code>
6061
- <code><a href="./src/resources/messages/messages.ts">TextBlockParam</a></code>
6162
- <code><a href="./src/resources/messages/messages.ts">TextCitation</a></code>
@@ -196,6 +197,7 @@ Types:
196197
- <code><a href="./src/resources/beta/messages/messages.ts">BetaRedactedThinkingBlock</a></code>
197198
- <code><a href="./src/resources/beta/messages/messages.ts">BetaRedactedThinkingBlockParam</a></code>
198199
- <code><a href="./src/resources/beta/messages/messages.ts">BetaSignatureDelta</a></code>
200+
- <code><a href="./src/resources/beta/messages/messages.ts">BetaStopReason</a></code>
199201
- <code><a href="./src/resources/beta/messages/messages.ts">BetaTextBlock</a></code>
200202
- <code><a href="./src/resources/beta/messages/messages.ts">BetaTextBlockParam</a></code>
201203
- <code><a href="./src/resources/beta/messages/messages.ts">BetaTextCitation</a></code>

src/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ import {
8080
RedactedThinkingBlock,
8181
RedactedThinkingBlockParam,
8282
SignatureDelta,
83+
StopReason,
8384
TextBlock,
8485
TextBlockParam,
8586
TextCitation,
@@ -386,6 +387,7 @@ export declare namespace Anthropic {
386387
type RedactedThinkingBlock as RedactedThinkingBlock,
387388
type RedactedThinkingBlockParam as RedactedThinkingBlockParam,
388389
type SignatureDelta as SignatureDelta,
390+
type StopReason as StopReason,
389391
type TextBlock as TextBlock,
390392
type TextBlockParam as TextBlockParam,
391393
type TextCitation as TextCitation,

src/resources/beta/beta.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ import {
3939
BetaRedactedThinkingBlock,
4040
BetaRedactedThinkingBlockParam,
4141
BetaSignatureDelta,
42+
BetaStopReason,
4243
BetaTextBlock,
4344
BetaTextBlockParam,
4445
BetaTextCitation,
@@ -226,6 +227,7 @@ export declare namespace Beta {
226227
type BetaRedactedThinkingBlock as BetaRedactedThinkingBlock,
227228
type BetaRedactedThinkingBlockParam as BetaRedactedThinkingBlockParam,
228229
type BetaSignatureDelta as BetaSignatureDelta,
230+
type BetaStopReason as BetaStopReason,
229231
type BetaTextBlock as BetaTextBlock,
230232
type BetaTextBlockParam as BetaTextBlockParam,
231233
type BetaTextCitation as BetaTextCitation,

src/resources/beta/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ export {
5252
type BetaRedactedThinkingBlock,
5353
type BetaRedactedThinkingBlockParam,
5454
type BetaSignatureDelta,
55+
type BetaStopReason,
5556
type BetaTextBlock,
5657
type BetaTextBlockParam,
5758
type BetaTextCitation,

src/resources/beta/messages/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ export {
5555
type BetaRedactedThinkingBlock,
5656
type BetaRedactedThinkingBlockParam,
5757
type BetaSignatureDelta,
58+
type BetaStopReason,
5859
type BetaTextBlock,
5960
type BetaTextBlockParam,
6061
type BetaTextCitation,

src/resources/beta/messages/messages.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -362,7 +362,7 @@ export interface BetaMessage {
362362
* In non-streaming mode this value is always non-null. In streaming mode, it is
363363
* null in the `message_start` event and non-null otherwise.
364364
*/
365-
stop_reason: 'end_turn' | 'max_tokens' | 'stop_sequence' | 'tool_use' | null;
365+
stop_reason: BetaStopReason | null;
366366

367367
/**
368368
* Which custom stop sequence was generated, if any.
@@ -488,7 +488,7 @@ export interface BetaRawMessageDeltaEvent {
488488

489489
export namespace BetaRawMessageDeltaEvent {
490490
export interface Delta {
491-
stop_reason: 'end_turn' | 'max_tokens' | 'stop_sequence' | 'tool_use' | null;
491+
stop_reason: MessagesMessagesAPI.BetaStopReason | null;
492492

493493
stop_sequence: string | null;
494494
}
@@ -530,6 +530,8 @@ export interface BetaSignatureDelta {
530530
type: 'signature_delta';
531531
}
532532

533+
export type BetaStopReason = 'end_turn' | 'max_tokens' | 'stop_sequence' | 'tool_use';
534+
533535
export interface BetaTextBlock {
534536
/**
535537
* Citations supporting the text block.
@@ -1481,6 +1483,7 @@ export declare namespace Messages {
14811483
type BetaRedactedThinkingBlock as BetaRedactedThinkingBlock,
14821484
type BetaRedactedThinkingBlockParam as BetaRedactedThinkingBlockParam,
14831485
type BetaSignatureDelta as BetaSignatureDelta,
1486+
type BetaStopReason as BetaStopReason,
14841487
type BetaTextBlock as BetaTextBlock,
14851488
type BetaTextBlockParam as BetaTextBlockParam,
14861489
type BetaTextCitation as BetaTextCitation,

src/resources/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ export {
6363
type RedactedThinkingBlock,
6464
type RedactedThinkingBlockParam,
6565
type SignatureDelta,
66+
type StopReason,
6667
type TextBlock,
6768
type TextBlockParam,
6869
type TextCitation,

src/resources/messages/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ export {
5353
type RedactedThinkingBlock,
5454
type RedactedThinkingBlockParam,
5555
type SignatureDelta,
56+
type StopReason,
5657
type TextBlock,
5758
type TextBlockParam,
5859
type TextCitation,

src/resources/messages/messages.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -325,7 +325,7 @@ export interface Message {
325325
* In non-streaming mode this value is always non-null. In streaming mode, it is
326326
* null in the `message_start` event and non-null otherwise.
327327
*/
328-
stop_reason: 'end_turn' | 'max_tokens' | 'stop_sequence' | 'tool_use' | null;
328+
stop_reason: StopReason | null;
329329

330330
/**
331331
* Which custom stop sequence was generated, if any.
@@ -487,7 +487,7 @@ export interface RawMessageDeltaEvent {
487487

488488
export namespace RawMessageDeltaEvent {
489489
export interface Delta {
490-
stop_reason: 'end_turn' | 'max_tokens' | 'stop_sequence' | 'tool_use' | null;
490+
stop_reason: MessagesAPI.StopReason | null;
491491

492492
stop_sequence: string | null;
493493
}
@@ -529,6 +529,8 @@ export interface SignatureDelta {
529529
type: 'signature_delta';
530530
}
531531

532+
export type StopReason = 'end_turn' | 'max_tokens' | 'stop_sequence' | 'tool_use';
533+
532534
export interface TextBlock {
533535
/**
534536
* Citations supporting the text block.
@@ -1404,6 +1406,7 @@ export declare namespace Messages {
14041406
type RedactedThinkingBlock as RedactedThinkingBlock,
14051407
type RedactedThinkingBlockParam as RedactedThinkingBlockParam,
14061408
type SignatureDelta as SignatureDelta,
1409+
type StopReason as StopReason,
14071410
type TextBlock as TextBlock,
14081411
type TextBlockParam as TextBlockParam,
14091412
type TextCitation as TextCitation,

0 commit comments

Comments
 (0)