-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathchat.go
33 lines (28 loc) · 949 Bytes
/
chat.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
package openai
const (
chatCompletionUrl = "/v1/chat/completions"
)
type CompletionMessage struct {
Role string `json:"role"`
Content string `json:"content"`
}
type CompletionRequest struct {
Model string `json:"model"`
Messages []*CompletionMessage `json:"messages"`
Seed int64 `json:"seed,omitempty"`
Temperature float32 `json:"temperature,omitempty"`
}
type CompletionResponse struct {
Id string `json:"id"`
Object string `json:"object"`
CreatedAt int64 `json:"created"`
Model string `json:"model"`
Choices []*Choice `json:"choices"`
Usage *Usage `json:"usage"`
SystemFingerprint string `json:"system_fingerprint"`
}
type Choice struct {
Index int `json:"index"`
Message *CompletionMessage `json:"message"`
Finish string `json:"finish_reason"`
}