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

@@ -38,6 +38,21 @@ func TestChatCompletionsWrongModel(t *testing.T) {
}
}
func TestChatCompletionsWithStream(t *testing.T) {
config := DefaultConfig("whatever")
config.BaseURL = "http://localhost/v1"
client := NewClientWithConfig(config)
ctx := context.Background()
req := ChatCompletionRequest{
Stream: true,
}
_, err := client.CreateChatCompletion(ctx, req)
if !errors.Is(err, ErrChatCompletionStreamNotSupported) {
t.Fatalf("CreateChatCompletion didn't return ErrChatCompletionStreamNotSupported error")
}
}
// TestCompletions Tests the completions endpoint of the API using the mocked server.
func TestChatCompletions(t *testing.T) {
server := test.NewTestServer()