Skip to content

Commit

Permalink
🛠️ using the chunkSize value provided in the opts
Browse files Browse the repository at this point in the history
  • Loading branch information
i9si authored May 24, 2024
2 parents 331baef + b13a10b commit 6af69d1
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions embedding.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,8 @@ type ChunkTextOpts struct {

// ChunkText splits the input text into chunks of specified size.
func ChunkText(opts ChunkTextOpts) []string {
var chunkSize int
if opts.ChunkSize <= 0 {
chunkSize := opts.ChunkSize
if chunkSize <= 0 {
chunkSize = 512
}

Expand Down
6 changes: 3 additions & 3 deletions example/audio.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,21 +16,21 @@ var (
audioFilePath = fmt.Sprintf("./temp/%s", fileName)
)

func AudioGenerated(filePath string)bool{
func AudioGenerated(filePath string) bool {
return fileExists(filePath)
}

func tts() {
fileExists := AudioGenerated(audioFilePath)
if !fileExists{
if !fileExists {
audio, openaiErr := openai.TextToSpeech(client, httpClient, &openai.SpeechRequestBody{
Model: "tts-1",
Input: "Hello",
Voice: openai.SpeechVoices.Onyx,
})
if openaiErr != nil {
b, err := json.Marshal(openaiErr)
if err != nil{
if err != nil {
panic(err)
}
log.Fatal(string(b))
Expand Down

0 comments on commit 6af69d1

Please sign in to comment.