Skip to content

Commit

Permalink
fix(clustering): add removed fileds for new ai plugins
Browse files Browse the repository at this point in the history
max_request_body_size field
  • Loading branch information
fffonion committed Jul 10, 2024
1 parent ba3fb6a commit eba070f
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 11 deletions.
18 changes: 18 additions & 0 deletions kong/clustering/compat/removed_fields.lua
Original file line number Diff line number Diff line change
Expand Up @@ -167,5 +167,23 @@ return {
"traces_endpoint",
"logs_endpoint",
},
ai_proxy = {
"max_request_body_size",
},
ai_prompt_decorator = {
"max_request_body_size",
},
ai_prompt_guard = {
"max_request_body_size",
},
ai_prompt_template = {
"max_request_body_size",
},
ai_request_transformer = {
"max_request_body_size",
},
ai_response_transformer = {
"max_request_body_size",
},
},
}
38 changes: 27 additions & 11 deletions spec/02-integration/09-hybrid_mode/09-config-compat_spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -543,16 +543,22 @@ describe("CP/DP config compat transformations #" .. strategy, function()
upstream_path = "/anywhere", -- becomes nil
},
},
max_request_body_size = 8192,
},
}
-- ]]

local expected_ai_proxy_prior_37 = cycle_aware_deep_copy(ai_proxy)
expected_ai_proxy_prior_37.config.response_streaming = nil
expected_ai_proxy_prior_37.config.model.options.upstream_path = nil
expected_ai_proxy_prior_37.config.route_type = "llm/v1/chat"
local expected = cycle_aware_deep_copy(ai_proxy)

do_assert(uuid(), "3.6.0", expected_ai_proxy_prior_37)
expected.config.max_request_body_size = nil

do_assert(uuid(), "3.7.0", expected)

expected.config.response_streaming = nil
expected.config.model.options.upstream_path = nil
expected.config.route_type = "llm/v1/chat"

do_assert(uuid(), "3.6.0", expected)

-- cleanup
admin.plugins:remove({ id = ai_proxy.id })
Expand Down Expand Up @@ -584,14 +590,19 @@ describe("CP/DP config compat transformations #" .. strategy, function()
},
},
},
max_request_body_size = 8192,
},
}
-- ]]

local expected_ai_request_transformer_prior_37 = cycle_aware_deep_copy(ai_request_transformer)
expected_ai_request_transformer_prior_37.config.llm.model.options.upstream_path = nil
local expected = cycle_aware_deep_copy(ai_request_transformer)
expected.config.max_request_body_size = nil

do_assert(uuid(), "3.7.0", expected)

do_assert(uuid(), "3.6.0", expected_ai_request_transformer_prior_37)
expected.config.llm.model.options.upstream_path = nil

do_assert(uuid(), "3.6.0", expected)

-- cleanup
admin.plugins:remove({ id = ai_request_transformer.id })
Expand Down Expand Up @@ -621,14 +632,19 @@ describe("CP/DP config compat transformations #" .. strategy, function()
},
},
},
max_request_body_size = 8192,
},
}
-- ]]

local expected_ai_response_transformer_prior_37 = cycle_aware_deep_copy(ai_response_transformer)
expected_ai_response_transformer_prior_37.config.llm.model.options.upstream_path = nil
local expected = cycle_aware_deep_copy(ai_response_transformer)
expected.config.max_request_body_size = nil

do_assert(uuid(), "3.7.0", expected)

expected.config.llm.model.options.upstream_path = nil

do_assert(uuid(), "3.6.0", expected_ai_response_transformer_prior_37)
do_assert(uuid(), "3.6.0", expected)

-- cleanup
admin.plugins:remove({ id = ai_response_transformer.id })
Expand Down

0 comments on commit eba070f

Please sign in to comment.