Warn about GPT3.5-turbo models in regular completion (#127)
This commit is contained in:
@@ -4,9 +4,14 @@ import (
|
|||||||
"bytes"
|
"bytes"
|
||||||
"context"
|
"context"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
|
"errors"
|
||||||
"net/http"
|
"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
|
// GPT3 Defines the models provided by OpenAI to use when generating
|
||||||
// completions from OpenAI.
|
// completions from OpenAI.
|
||||||
// GPT3 Models are designed for text-based tasks. For code-specific
|
// GPT3 Models are designed for text-based tasks. For code-specific
|
||||||
@@ -92,6 +97,11 @@ func (c *Client) CreateCompletion(
|
|||||||
ctx context.Context,
|
ctx context.Context,
|
||||||
request CompletionRequest,
|
request CompletionRequest,
|
||||||
) (response CompletionResponse, err error) {
|
) (response CompletionResponse, err error) {
|
||||||
|
if request.Model == GPT3Dot5Turbo0301 || request.Model == GPT3Dot5Turbo {
|
||||||
|
err = ErrCompletionUnsupportedModel
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
var reqBytes []byte
|
var reqBytes []byte
|
||||||
reqBytes, err = json.Marshal(request)
|
reqBytes, err = json.Marshal(request)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
Reference in New Issue
Block a user