Skip to content

Commit e50725d

Browse files
committed
fix: Corrected type definitions for ChatCompletion responses
1 parent a80cea2 commit e50725d

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

src/services/copilot/create-chat-completions.ts

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ export interface ChatCompletionChunk {
4141
object: "chat.completion.chunk"
4242
created: number
4343
model: string
44-
choices: [Choice]
44+
choices: Array<Choice>
4545
system_fingerprint?: string
4646
}
4747

@@ -73,7 +73,7 @@ export interface ChatCompletionResponse {
7373
object: "chat.completion"
7474
created: number
7575
model: string
76-
choices: [ChoiceNonStreaming]
76+
choices: Array<ChoiceNonStreaming>
7777
system_fingerprint?: string
7878
usage?: {
7979
prompt_tokens: number
@@ -82,9 +82,15 @@ export interface ChatCompletionResponse {
8282
}
8383
}
8484

85+
interface ResponseMessage {
86+
role: "assistant"
87+
content: string | null
88+
tool_calls?: Array<ToolCall>
89+
}
90+
8591
interface ChoiceNonStreaming {
8692
index: number
87-
message: Message
93+
message: ResponseMessage
8894
logprobs: object | null
8995
finish_reason: "stop" | "length" | "tool_calls" | "content_filter"
9096
}
@@ -127,7 +133,7 @@ export interface Tool {
127133
}
128134

129135
export interface Message {
130-
role: "user" | "assistant" | "system" | "tool"
136+
role: "user" | "assistant" | "system" | "tool" | "developer"
131137
content: string | Array<ContentPart> | null
132138

133139
name?: string

0 commit comments

Comments
 (0)