Check for Stream parameter usage (#174)

* check for stream:true usage

* lint
This commit is contained in:
sashabaranov
2023-03-18 19:31:54 +04:00
committed by GitHub
parent 34f3a118df
commit a6b35c3ab5
6 changed files with 45 additions and 7 deletions

View File

@@ -33,6 +33,18 @@ func TestCompletionsWrongModel(t *testing.T) {
}
}
func TestCompletionWithStream(t *testing.T) {
config := DefaultConfig("whatever")
client := NewClientWithConfig(config)
ctx := context.Background()
req := CompletionRequest{Stream: true}
_, err := client.CreateCompletion(ctx, req)
if !errors.Is(err, ErrCompletionStreamNotSupported) {
t.Fatalf("CreateCompletion didn't return ErrCompletionStreamNotSupported")
}
}
// TestCompletions Tests the completions endpoint of the API using the mocked server.
func TestCompletions(t *testing.T) {
server := test.NewTestServer()