Support Retrieve file content API (#347) (#348)

* Support Retrieve file content API (#347)

* add timeout test for GetFileContent (#347)
This commit is contained in:
渡邉祐一 / Yuichi Watanabe
2023-06-11 17:49:57 +09:00
committed by GitHub
parent 06b16a7281
commit a243e7331f
6 changed files with 216 additions and 26 deletions

View File

@@ -4,7 +4,6 @@ import (
"bufio"
"context"
"errors"
"net/http"
utils "github.com/sashabaranov/go-openai/internal"
)
@@ -46,7 +45,7 @@ func (c *Client) CreateCompletionStream(
if err != nil {
return
}
if resp.StatusCode < http.StatusOK || resp.StatusCode >= http.StatusBadRequest {
if isFailureStatusCode(resp) {
return nil, c.handleErrorResp(resp)
}