feat: get header from sendRequestRaw (#694)

* feat: get header from sendRequestRaw

* Fix ci lint
This commit is contained in:
Qiying Wang
2024-04-06 03:15:54 +08:00
committed by GitHub
parent 0925563e86
commit 2646bce71c
3 changed files with 16 additions and 12 deletions

View File

@@ -3,7 +3,6 @@ package openai
import (
"context"
"errors"
"io"
"net/http"
)
@@ -67,7 +66,7 @@ func isValidVoice(voice SpeechVoice) bool {
return contains([]SpeechVoice{VoiceAlloy, VoiceEcho, VoiceFable, VoiceOnyx, VoiceNova, VoiceShimmer}, voice)
}
func (c *Client) CreateSpeech(ctx context.Context, request CreateSpeechRequest) (response io.ReadCloser, err error) {
func (c *Client) CreateSpeech(ctx context.Context, request CreateSpeechRequest) (response RawResponse, err error) {
if !isValidSpeechModel(request.Model) {
err = ErrInvalidSpeechModel
return
@@ -84,7 +83,5 @@ func (c *Client) CreateSpeech(ctx context.Context, request CreateSpeechRequest)
return
}
response, err = c.sendRequestRaw(req)
return
return c.sendRequestRaw(req)
}