From 1814a34827a993669057a1a916ed0c4c59e8a981 Mon Sep 17 00:00:00 2001 From: Jack Tysoe Date: Tue, 18 Jun 2024 10:21:18 +0100 Subject: [PATCH] fix(ai-proxy): token streaming truncation --- kong/llm/drivers/shared.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kong/llm/drivers/shared.lua b/kong/llm/drivers/shared.lua index b41841ef0fd1..0b4606da2328 100644 --- a/kong/llm/drivers/shared.lua +++ b/kong/llm/drivers/shared.lua @@ -199,7 +199,7 @@ function _M.frame_to_events(frame) -- todo check if it's raw json and -- just return the split up data frame - if string.sub(str_ltrim(frame), 1, 1) == "{" then + if (not kong.ctx.plugin.truncated_frame) and string.sub(str_ltrim(frame), 1, 1) == "{" then for event in frame:gmatch("[^\r\n]+") do events[#events + 1] = { data = event,