return tool calls finish reason for openai (#5995)

* hot fix

* backend stream support

* clean up

* finish reason

* move to openai
This commit is contained in:
royjhan 2024-07-29 13:56:57 -07:00 committed by GitHub
parent 161e12cecf
commit 365431d406
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -218,6 +218,9 @@ func toChatCompletion(id string, r api.ChatResponse) ChatCompletion {
Index: 0,
Message: Message{Role: r.Message.Role, Content: r.Message.Content, ToolCalls: toolCalls},
FinishReason: func(reason string) *string {
if len(toolCalls) > 0 {
reason = "tool_calls"
}
if len(reason) > 0 {
return &reason
}