Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions changelog/unreleased/kong/fix-ai-proxy-model-name-slash.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
message: "**ai-proxy**: Fixed a panic triggered by a non-JSON response."
type: "bugfix"
scope: "Plugin"
7 changes: 5 additions & 2 deletions kong/llm/plugin/shared-filters/serialize-analytics.lua
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
local cjson = require("cjson")
local cjson = require("cjson.safe")
local ai_plugin_ctx = require("kong.llm.plugin.ctx")
local ai_plugin_o11y = require("kong.llm.plugin.observability")

Expand Down Expand Up @@ -39,7 +39,10 @@ function _M:run(conf)

else
-- openai formats
local response_body_table = cjson.decode(response_body)
local response_body_table, err = cjson.decode(response_body)
if err then
kong.log.info("failed to decode response body: ", err)
Comment thread
git-hulk marked this conversation as resolved.
end
response_model = response_body_table and response_body_table.model
end
end
Expand Down
Loading