From 365431d40617b85d0308fec8d0bd9c0cdb1ab3a4 Mon Sep 17 00:00:00 2001 From: royjhan <65097070+royjhan@users.noreply.github.com> Date: Mon, 29 Jul 2024 13:56:57 -0700 Subject: [PATCH] return tool calls finish reason for openai (#5995) * hot fix * backend stream support * clean up * finish reason * move to openai --- openai/openai.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/openai/openai.go b/openai/openai.go index de6f4bd5..5bd80660 100644 --- a/openai/openai.go +++ b/openai/openai.go @@ -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 }