feature: Allow users to define custom parse_api_key functions. (#1914)

Co-authored-by: yetone <yetoneful@gmail.com>
This commit is contained in:
Sang
2025-05-09 14:00:33 +08:00
committed by GitHub
parent daa0624e50
commit 56576c2481

View File

@@ -183,12 +183,12 @@ M = setmetatable(M, {
t[k] = Utils.deep_extend_with_metatable("keep", provider_config, module)
end
t[k].parse_api_key = function() return E.parse_envvar(t[k]) end
if t[k].parse_api_key == nil then t[k].parse_api_key = function() return E.parse_envvar(t[k]) end end
-- default to gpt-4o as tokenizer
if t[k].tokenizer_id == nil then t[k].tokenizer_id = "gpt-4o" end
if t[k].is_env_set == nil then t[k].is_env_set = function() return E.parse_envvar(t[k]) ~= nil end end
if t[k].is_env_set == nil then t[k].is_env_set = function() return t[k].parse_api_key() ~= nil end end
if t[k].setup == nil then
local provider_conf = M.parse_config(t[k])