fix: fix finish_reason fileld not fully compatible with OpenAI (close #372, #373)

* optimize:unify finish_reason field

* refactor: use a global stop finish reason

---------

Co-authored-by: JustSong <songquanpeng@foxmail.com>
This commit is contained in:
igophper
2023-08-12 11:04:53 +08:00
committed by GitHub
parent c58f710227
commit 476a46ad7e
8 changed files with 19 additions and 7 deletions

View File

@@ -94,7 +94,7 @@ func streamResponsePaLM2OpenAI(palmResponse *PaLMChatResponse) *ChatCompletionsS
if len(palmResponse.Candidates) > 0 {
choice.Delta.Content = palmResponse.Candidates[0].Content
}
choice.FinishReason = "stop"
choice.FinishReason = &stopFinishReason
var response ChatCompletionsStreamResponse
response.Object = "chat.completion.chunk"
response.Model = "palm2"