Skip to content

Commit

Permalink
fix(llm): remove multi-modal restriction on pre request check
Browse files Browse the repository at this point in the history
  • Loading branch information
fffonion committed Sep 24, 2024
1 parent 331194f commit 799c3d2
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 19 deletions.
4 changes: 4 additions & 0 deletions changelog/unreleased/kong/fix-ai-proxy-multi-modal-azure.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
message: |
**AI-Proxy**: Fixed issue where multi-modal requests is blocked on azure provider.
type: bugfix
scope: Plugin
19 changes: 0 additions & 19 deletions kong/llm/drivers/shared.lua
Original file line number Diff line number Diff line change
Expand Up @@ -604,20 +604,6 @@ function _M.resolve_plugin_conf(kong_request, conf)
end


local function check_multi_modal(conf, request_table)
if not request_table.messages or (conf.model.provider == "openai" or conf.model.provider == "bedrock" ) then
return true
end

for _, m in ipairs(request_table.messages) do
if type(m.content) == "table" then
return false
end
end

return true
end

function _M.pre_request(conf, request_table)
-- process form/json body auth information
local auth_param_name = conf.auth and conf.auth.param_name
Expand All @@ -636,11 +622,6 @@ function _M.pre_request(conf, request_table)
return nil, "no plugin name is being passed by the plugin"
end

local ok = check_multi_modal(conf, request_table)
if not ok then
return kong.response.exit("multi-modal input is not supported by current provider")
end

-- if enabled AND request type is compatible, capture the input for analytics
if conf.logging and conf.logging.log_payloads then
kong.log.set_serialize_value(fmt("ai.%s.%s.%s", plugin_name, log_entry_keys.PAYLOAD_CONTAINER, log_entry_keys.REQUEST_BODY), kong.request.get_raw_body())
Expand Down

0 comments on commit 799c3d2

Please sign in to comment.