Skip to content

Commit

Permalink
unexport interface for response
Browse files Browse the repository at this point in the history
  • Loading branch information
conneroisu committed Sep 6, 2024
1 parent 4a54ec1 commit 1a26ef0
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 8 deletions.
6 changes: 3 additions & 3 deletions client.go
Original file line number Diff line number Diff line change
Expand Up @@ -155,12 +155,12 @@ func (c *Client) newRequest(
return req, nil
}

// Response is an interface for a response.
type Response interface {
// response is an interface for a response.
type response interface {
SetHeader(http.Header)
}

func (c *Client) sendRequest(req *http.Request, v Response) error {
func (c *Client) sendRequest(req *http.Request, v response) error {
req.Header.Set("Accept", "application/json")

// Check whether Content-Type is already set, Upload Files API requires
Expand Down
7 changes: 2 additions & 5 deletions stream.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,7 @@ func (c *Client) CreateCompletionStream(
ctx,
http.MethodPost,
c.fullURL(completionsSuffix, withModel(request.Model)),
withBody(request),
)
withBody(request))
if err != nil {
return nil, err
}
Expand All @@ -65,7 +64,7 @@ type streamReader[T streamer] struct {
response *http.Response
errAccumulator ErrorAccumulator

http.Header // Header is the header of the response.
Header http.Header // Header is the header of the response.
}

// Recv receives a response from the stream.
Expand Down Expand Up @@ -133,12 +132,10 @@ func (stream *streamReader[T]) unmarshalError() (errResp *ErrorResponse) {
if len(errBytes) == 0 {
return
}

err := json.Unmarshal(errBytes, &errResp)
if err != nil {
errResp = nil
}

return
}

Expand Down

0 comments on commit 1a26ef0

Please sign in to comment.