diff --git a/api.md b/api.md index e26b57850..7285097f2 100644 --- a/api.md +++ b/api.md @@ -20,6 +20,7 @@ Types: - ChatCompletionChunk - ChatCompletionMessage - ChatCompletionMessageParam +- ChatCompletionRole - CreateChatCompletionRequestMessage Methods: diff --git a/src/resources/chat/chat.ts b/src/resources/chat/chat.ts index 5d10f2f4d..6ef43dd7a 100644 --- a/src/resources/chat/chat.ts +++ b/src/resources/chat/chat.ts @@ -14,6 +14,7 @@ export namespace Chat { export import ChatCompletionChunk = API.ChatCompletionChunk; export import ChatCompletionMessage = API.ChatCompletionMessage; export import ChatCompletionMessageParam = API.ChatCompletionMessageParam; + export import ChatCompletionRole = API.ChatCompletionRole; export import CreateChatCompletionRequestMessage = API.CreateChatCompletionRequestMessage; export import ChatCompletionCreateParams = API.ChatCompletionCreateParams; export import CompletionCreateParams = API.CompletionCreateParams; diff --git a/src/resources/chat/completions.ts b/src/resources/chat/completions.ts index 97ab2e9dd..dfc37a731 100644 --- a/src/resources/chat/completions.ts +++ b/src/resources/chat/completions.ts @@ -164,7 +164,7 @@ export namespace ChatCompletionChunk { /** * The role of the author of this message. */ - role?: 'system' | 'user' | 'assistant' | 'function'; + role?: ChatCompletionRole; } export namespace Delta { @@ -202,7 +202,7 @@ export interface ChatCompletionMessage { /** * The role of the author of this message. */ - role: 'system' | 'user' | 'assistant' | 'function'; + role: ChatCompletionRole; /** * The name and arguments of a function that should be called, as generated by the @@ -281,6 +281,11 @@ export namespace ChatCompletionMessageParam { } } +/** + * The role of the author of this message. + */ +export type ChatCompletionRole = 'system' | 'user' | 'assistant' | 'function'; + /** * @deprecated ChatCompletionMessageParam should be used instead */ @@ -497,6 +502,7 @@ export namespace Completions { export import ChatCompletionChunk = API.ChatCompletionChunk; export import ChatCompletionMessage = API.ChatCompletionMessage; export import ChatCompletionMessageParam = API.ChatCompletionMessageParam; + export import ChatCompletionRole = API.ChatCompletionRole; export import CreateChatCompletionRequestMessage = API.CreateChatCompletionRequestMessage; export import ChatCompletionCreateParams = API.ChatCompletionCreateParams; export import CompletionCreateParams = API.CompletionCreateParams; diff --git a/src/resources/chat/index.ts b/src/resources/chat/index.ts index ea9d1d1b9..32dea91fe 100644 --- a/src/resources/chat/index.ts +++ b/src/resources/chat/index.ts @@ -6,6 +6,7 @@ export { ChatCompletionChunk, ChatCompletionMessage, ChatCompletionMessageParam, + ChatCompletionRole, CreateChatCompletionRequestMessage, ChatCompletionCreateParams, CompletionCreateParams,