Skip to content

Commit d94c5e7

Browse files
authored
Test request builder + streams (#242)
* test request builder + streams * provide prompt to test
1 parent 9a1ecf5 commit d94c5e7

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

completion.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import (
99
var (
1010
ErrCompletionUnsupportedModel = errors.New("this model is not supported with this method, please use CreateChatCompletion client method instead") //nolint:lll
1111
ErrCompletionStreamNotSupported = errors.New("streaming is not supported with this method, please use CreateCompletionStream") //nolint:lll
12-
ErrCompletionRequestPromptTypeNotSupported = errors.New("the type of CompletionRequest.Promp only supports string and []string") //nolint:lll
12+
ErrCompletionRequestPromptTypeNotSupported = errors.New("the type of CompletionRequest.Prompt only supports string and []string") //nolint:lll
1313
)
1414

1515
// GPT3 Defines the models provided by OpenAI to use when generating

request_builder_test.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,11 @@ func TestClientReturnsRequestBuilderErrors(t *testing.T) {
145145
if !errors.Is(err, errTestRequestBuilderFailed) {
146146
t.Fatalf("Did not return error when request builder failed: %v", err)
147147
}
148+
149+
_, err = client.CreateCompletionStream(ctx, CompletionRequest{Prompt: ""})
150+
if !errors.Is(err, errTestRequestBuilderFailed) {
151+
t.Fatalf("Did not return error when request builder failed: %v", err)
152+
}
148153
}
149154

150155
func TestReturnsRequestBuilderErrorsAddtion(t *testing.T) {

0 commit comments

Comments
 (0)