Skip to content

Commit 522ae20

Browse files
authored
Warn about GPT3.5-turbo models in regular completion (#127)
1 parent c5fe874 commit 522ae20

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

completion.go

+10
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,14 @@ import (
44
"bytes"
55
"context"
66
"encoding/json"
7+
"errors"
78
"net/http"
89
)
910

11+
var (
12+
ErrCompletionUnsupportedModel = errors.New("this model is not supported with this method, please use CreateChatCompletion client method instead") //nolint:lll
13+
)
14+
1015
// GPT3 Defines the models provided by OpenAI to use when generating
1116
// completions from OpenAI.
1217
// GPT3 Models are designed for text-based tasks. For code-specific
@@ -92,6 +97,11 @@ func (c *Client) CreateCompletion(
9297
ctx context.Context,
9398
request CompletionRequest,
9499
) (response CompletionResponse, err error) {
100+
if request.Model == GPT3Dot5Turbo0301 || request.Model == GPT3Dot5Turbo {
101+
err = ErrCompletionUnsupportedModel
102+
return
103+
}
104+
95105
var reqBytes []byte
96106
reqBytes, err = json.Marshal(request)
97107
if err != nil {

0 commit comments

Comments
 (0)