From b1b743f4e633b0974b956530ccf5244227af5178 Mon Sep 17 00:00:00 2001
From: Stainless Bot <107565488+stainless-bot@users.noreply.github.com>
Date: Thu, 4 Apr 2024 11:50:18 -0400
Subject: [PATCH] chore(types): consistent naming for text block types (#373)
---
api.md | 1 +
src/index.ts | 1 +
src/resources/index.ts | 1 +
src/resources/messages.ts | 19 +++++++++++--------
4 files changed, 14 insertions(+), 8 deletions(-)
diff --git a/api.md b/api.md
index 450ef5be..5df7c25c 100644
--- a/api.md
+++ b/api.md
@@ -17,6 +17,7 @@ Types:
- MessageStopEvent
- MessageStreamEvent
- TextBlock
+- TextBlockParam
- TextDelta
- Usage
diff --git a/src/index.ts b/src/index.ts
index c0922224..a89e0bb0 100644
--- a/src/index.ts
+++ b/src/index.ts
@@ -250,6 +250,7 @@ export namespace Anthropic {
export import MessageStopEvent = API.MessageStopEvent;
export import MessageStreamEvent = API.MessageStreamEvent;
export import TextBlock = API.TextBlock;
+ export import TextBlockParam = API.TextBlockParam;
export import TextDelta = API.TextDelta;
export import Usage = API.Usage;
export import MessageCreateParams = API.MessageCreateParams;
diff --git a/src/resources/index.ts b/src/resources/index.ts
index c8647f03..97f5682a 100644
--- a/src/resources/index.ts
+++ b/src/resources/index.ts
@@ -21,6 +21,7 @@ export {
MessageStopEvent,
MessageStreamEvent,
TextBlock,
+ TextBlockParam,
TextDelta,
Usage,
MessageCreateParams,
diff --git a/src/resources/messages.ts b/src/resources/messages.ts
index fa594a62..73d9291a 100644
--- a/src/resources/messages.ts
+++ b/src/resources/messages.ts
@@ -47,11 +47,7 @@ export class Messages extends APIResource {
}
}
-export interface ContentBlock {
- text: string;
-
- type: 'text';
-}
+export type ContentBlock = TextBlock;
export interface ContentBlockDeltaEvent {
delta: TextDelta;
@@ -62,7 +58,7 @@ export interface ContentBlockDeltaEvent {
}
export interface ContentBlockStartEvent {
- content_block: ContentBlock;
+ content_block: TextBlock;
index: number;
@@ -133,7 +129,7 @@ export interface Message {
* [{ "type": "text", "text": "B)" }]
* ```
*/
- content: Array;
+ content: Array;
/**
* The model that handled the request.
@@ -234,7 +230,7 @@ export interface MessageDeltaUsage {
}
export interface MessageParam {
- content: string | Array;
+ content: string | Array;
role: 'user' | 'assistant';
}
@@ -263,6 +259,12 @@ export interface TextBlock {
type: 'text';
}
+export interface TextBlockParam {
+ text: string;
+
+ type: 'text';
+}
+
export interface TextDelta {
text: string;
@@ -720,6 +722,7 @@ export namespace Messages {
export import MessageStopEvent = MessagesAPI.MessageStopEvent;
export import MessageStreamEvent = MessagesAPI.MessageStreamEvent;
export import TextBlock = MessagesAPI.TextBlock;
+ export import TextBlockParam = MessagesAPI.TextBlockParam;
export import TextDelta = MessagesAPI.TextDelta;
export import Usage = MessagesAPI.Usage;
export import MessageCreateParams = MessagesAPI.MessageCreateParams;