Skip to content

Commit 504d32a

Browse files
authored
feat: add support for gpt4 (#6)
1 parent acfe8cf commit 504d32a

File tree

3 files changed

+7
-2
lines changed

3 files changed

+7
-2
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ Go-ChatGPT is an open-source GoLang client for ChatGPT, a large language model t
77
- [x] Easy-to-use GoLang client for ChatGPT
88
- [x] Sends text to ChatGPT and receives a response
99
- [x] Support custom model and parameters
10+
- [x] Supports GPT3.5 and GPT4 models
1011

1112

1213
## Installation

chat.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,10 @@ type ChatGPTModel string
1414
const (
1515
GPT35Turbo ChatGPTModel = "gpt-3.5-turbo"
1616
GPT35Turbo0301 ChatGPTModel = "gpt-3.5-turbo-0301"
17+
GPT4 ChatGPTModel = "gpt-4"
18+
GPT4_0314 ChatGPTModel = "gpt-4-0314"
19+
GPT4_32k ChatGPTModel = "gpt-4-32k"
20+
GPT4_32k_0314 ChatGPTModel = "gpt-4-32k-0314"
1721
)
1822

1923
type ChatGPTModelRole string
@@ -139,7 +143,7 @@ func validate(req *ChatCompletionRequest) error {
139143
return chatgpt_errors.ErrNoMessages
140144
}
141145

142-
if req.Model != GPT35Turbo && req.Model != GPT35Turbo0301 {
146+
if req.Model != GPT35Turbo && req.Model != GPT35Turbo0301 && req.Model != GPT4 && req.Model != GPT4_0314 && req.Model != GPT4_32k && req.Model != GPT4_32k_0314 {
143147
return chatgpt_errors.ErrInvalidModel
144148
}
145149

examples/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ func main() {
2626
log.Println(string(a))
2727

2828
res, err = c.Send(ctx, &chatgpt.ChatCompletionRequest{
29-
Model: chatgpt.GPT35Turbo,
29+
Model: chatgpt.GPT4,
3030
Messages: []chatgpt.ChatMessage{
3131
{
3232
Role: chatgpt.ChatGPTModelRoleSystem,

0 commit comments

Comments
 (0)