Skip to content

Commit bef150f

Browse files
committed
fix: Added UsageInfo
1 parent a8f7269 commit bef150f

File tree

3 files changed

+10
-5
lines changed

3 files changed

+10
-5
lines changed

src/models/chat/ChatCompletionsResponse.ts

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,7 @@ export interface ChatCompletionResponseChoice {
2323
export interface ChatCompletionChunk {
2424
id: string;
2525
choices: ChoicesChunk[];
26-
usage?: {
27-
prompt_tokens: number;
28-
completion_tokens: number;
29-
total_tokens: number;
30-
};
26+
usage?: UsageInfo;
3127
}
3228

3329
export interface ChoiceDelta {
@@ -42,12 +38,19 @@ export interface ChoicesChunk {
4238
finish_reason?: string;
4339
}
4440

41+
export interface UsageInfo {
42+
prompt_tokens: number;
43+
completion_tokens: number;
44+
total_tokens: number;
45+
}
46+
4547
export declare namespace ChatCompletions {
4648
export {
4749
type ChatCompletionResponseChoice,
4850
type ChatCompletionResponse,
4951
type ChoiceDelta,
5052
type ChoicesChunk,
5153
type ChatCompletionChunk,
54+
type UsageInfo,
5255
}
5356
}

src/models/chat/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ export {
1010
type ChoiceDelta,
1111
type ChoicesChunk,
1212
type ChatCompletionChunk,
13+
type UsageInfo,
1314
} from "./ChatCompletionsResponse";
1415

1516
export {

src/models/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,5 @@ export {
2424
type ChoicesChunk,
2525
type ChatCompletionChunk,
2626
type ChatModel,
27+
type UsageInfo,
2728
} from "./chat";

0 commit comments

Comments
 (0)