Skip to content

Commit

Permalink
retry on empty response
Browse files Browse the repository at this point in the history
  • Loading branch information
mazzz1y committed Oct 15, 2023
1 parent 1735385 commit 733dfd9
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion internal/gpt/completions.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ func (g *Gpt) complReqWithTimeout(ctx context.Context, msg []openai.ChatCompleti
return "", ctx.Err()
} else if isTokenExceededError(err) {
msg = trimFirstMsgFromHistory(msg)
} else if !isServiceUnavailableError(err) {
} else if !isServiceUnavailableError(err) && len(res.Choices) > 0 {
break
}

Expand Down

0 comments on commit 733dfd9

Please sign in to comment.