Warn about GPT3.5-turbo models in regular completion (#127)

This commit is contained in:
sashabaranov
2023-03-06 12:55:21 +04:00
committed by GitHub
parent c5fe8742cc
commit 522ae20999

View File

@@ -4,9 +4,14 @@ import (
"bytes"
"context"
"encoding/json"
"errors"
"net/http"
)
var (
ErrCompletionUnsupportedModel = errors.New("this model is not supported with this method, please use CreateChatCompletion client method instead") //nolint:lll
)
// GPT3 Defines the models provided by OpenAI to use when generating
// completions from OpenAI.
// GPT3 Models are designed for text-based tasks. For code-specific
@@ -92,6 +97,11 @@ func (c *Client) CreateCompletion(
ctx context.Context,
request CompletionRequest,
) (response CompletionResponse, err error) {
if request.Model == GPT3Dot5Turbo0301 || request.Model == GPT3Dot5Turbo {
err = ErrCompletionUnsupportedModel
return
}
var reqBytes []byte
reqBytes, err = json.Marshal(request)
if err != nil {