Skip to content

Commit

Permalink
Update kong/llm/drivers/azure.lua
Browse files Browse the repository at this point in the history
Co-authored-by: Wangchong Zhou <[email protected]>
  • Loading branch information
tysoekong and fffonion committed Aug 14, 2024
1 parent d386fec commit 07001ef
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 18 deletions.
2 changes: 1 addition & 1 deletion kong/llm/drivers/azure.lua
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ function _M.post_request(conf)
end
end

function _M.subrequest(body, conf, http_opts, return_res_table, identity_interface)
function _M.subrequest(body, conf, http_opts, return_res_table)
local body_string, err

if type(body) == "table" then
Expand Down
4 changes: 2 additions & 2 deletions kong/llm/drivers/gemini.lua
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,7 @@ function _M.subrequest(body, conf, http_opts, return_res_table, identity_interfa
local identity_interface_new = identity_interface.interface:new(service_account_json)
identity_interface.interface.token = identity_interface_new.token

kong.log.notice("gcp identity token for ", kong.plugin.get_id(), " has been refreshed")
kong.log.debug("gcp identity token for ", kong.plugin.get_id(), " has been refreshed")
end

headers["Authorization"] = "Bearer " .. identity_interface.interface.token
Expand Down Expand Up @@ -430,7 +430,7 @@ function _M.configure_request(conf, identity_interface)
local identity_interface_new = identity_interface:new(service_account_json)
identity_interface.token = identity_interface_new.token

kong.log.notice("gcp identity token for ", kong.plugin.get_id(), " has been refreshed")
kong.log.debug("gcp identity token for ", kong.plugin.get_id(), " has been refreshed")
end

kong.service.request.set_header("Authorization", "Bearer " .. identity_interface.token)
Expand Down
4 changes: 2 additions & 2 deletions kong/llm/drivers/shared.lua
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ _M.cloud_identity_function = function(this_cache, plugin_config)
plugin_config.auth and
plugin_config.auth.gcp_use_service_account then

ngx.log(ngx.NOTICE, "loading gcp sdk for plugin ", kong.plugin.get_id())
ngx.log(ngx.DEBUG, "loading gcp sdk for plugin ", kong.plugin.get_id())

local service_account_json = (plugin_config.auth and plugin_config.auth.gcp_service_account_json) or GCP_SERVICE_ACCOUNT

Expand All @@ -272,7 +272,7 @@ _M.cloud_identity_function = function(this_cache, plugin_config)
return { interface = nil, error = "cloud-authentication with GCP failed" }

elseif plugin_config.model.provider == "bedrock" then
ngx.log(ngx.NOTICE, "loading aws sdk for plugin ", kong.plugin.get_id())
ngx.log(ngx.DEBUG, "loading aws sdk for plugin ", kong.plugin.get_id())
local aws

local region = plugin_config.model.options
Expand Down
13 changes: 0 additions & 13 deletions kong/llm/proxy/handler.lua
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,6 @@ local kong_utils = require("kong.tools.gzip")
local buffer = require "string.buffer"
local strip = require("kong.tools.utils").strip

-- cloud auth/sdk providers
local GCP_SERVICE_ACCOUNT do
GCP_SERVICE_ACCOUNT = os.getenv("GCP_SERVICE_ACCOUNT")
end

local GCP = require("resty.gcp.request.credentials.accesstoken")
local aws_config = require "resty.aws.config" -- reads environment variables whilst available
local AWS = require("resty.aws")
local AWS_REGION do
AWS_REGION = os.getenv("AWS_REGION") or os.getenv("AWS_DEFAULT_REGION")
end
--


local EMPTY = require("kong.tools.table").EMPTY

Expand Down

0 comments on commit 07001ef

Please sign in to comment.