Skip to content

Commit

Permalink
Test request builder + streams (sashabaranov#242)
Browse files Browse the repository at this point in the history
* test request builder + streams

* provide prompt to test
  • Loading branch information
sashabaranov committed Apr 9, 2023
1 parent 9a1ecf5 commit d94c5e7
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion completion.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
var (
ErrCompletionUnsupportedModel = errors.New("this model is not supported with this method, please use CreateChatCompletion client method instead") //nolint:lll
ErrCompletionStreamNotSupported = errors.New("streaming is not supported with this method, please use CreateCompletionStream") //nolint:lll
ErrCompletionRequestPromptTypeNotSupported = errors.New("the type of CompletionRequest.Promp only supports string and []string") //nolint:lll
ErrCompletionRequestPromptTypeNotSupported = errors.New("the type of CompletionRequest.Prompt only supports string and []string") //nolint:lll
)

// GPT3 Defines the models provided by OpenAI to use when generating
Expand Down
5 changes: 5 additions & 0 deletions request_builder_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,11 @@ func TestClientReturnsRequestBuilderErrors(t *testing.T) {
if !errors.Is(err, errTestRequestBuilderFailed) {
t.Fatalf("Did not return error when request builder failed: %v", err)
}

_, err = client.CreateCompletionStream(ctx, CompletionRequest{Prompt: ""})
if !errors.Is(err, errTestRequestBuilderFailed) {
t.Fatalf("Did not return error when request builder failed: %v", err)
}
}

func TestReturnsRequestBuilderErrorsAddtion(t *testing.T) {
Expand Down

0 comments on commit d94c5e7

Please sign in to comment.