Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(llm): remove llm model schema auth required #13469

Merged
merged 2 commits into from
Aug 8, 2024
Merged
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
6 changes: 0 additions & 6 deletions kong/llm/schemas/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -237,12 +237,6 @@ return {
{ logging = logging_schema },
},
entity_checks = {
-- these three checks run in a chain, to ensure that all auth params for each respective "set" are specified
{ conditional_at_least_one_of = { if_field = "model.provider",
if_match = { one_of = { "openai", "azure", "anthropic", "cohere" } },
then_at_least_one_of = { "auth.header_name", "auth.param_name" },
then_err = "must set one of %s, and its respective options, when provider is not self-hosted" }},

{ mutually_required = { "auth.header_name", "auth.header_value" }, },
oowl marked this conversation as resolved.
Show resolved Hide resolved
{ mutually_required = { "auth.param_name", "auth.param_value", "auth.param_location" }, },

Expand Down
64 changes: 0 additions & 64 deletions spec/03-plugins/38-ai-proxy/00-config_spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,6 @@ local validate do
end
end

local WWW_MODELS = {
"openai",
"azure",
"anthropic",
"cohere",
}

local SELF_HOSTED_MODELS = {
"mistral",
Expand Down Expand Up @@ -168,64 +162,6 @@ describe(PLUGIN_NAME .. ": (schema)", function()
assert.is_falsy(ok)
end)

for i, v in ipairs(WWW_MODELS) do
it("requires API auth for www-hosted " .. v .. " model", function()
local config = {
route_type = "llm/v1/chat",
model = {
name = "command",
provider = v,
options = {
max_tokens = 256,
temperature = 1.0,
upstream_url = "http://nowhere",
},
},
}

if v == "llama2" then
config.model.options.llama2_format = "raw"
end

if v == "azure" then
config.model.options.azure_instance = "kong"
end

if v == "anthropic" then
config.model.options.anthropic_version = "2021-09-01"
end

local ok, err = validate(config)

assert.not_nil(err["config"]["@entity"])
assert.not_nil(err["config"]["@entity"][1])
assert.equal(err["config"]["@entity"][1], "must set one of 'auth.header_name', 'auth.param_name', "
.. "and its respective options, when provider is not self-hosted")
assert.is_falsy(ok)
end)
end

it("requires [config.auth] block to be set", function()
local config = {
route_type = "llm/v1/chat",
model = {
name = "openai",
provider = "openai",
options = {
max_tokens = 256,
temperature = 1.0,
upstream_url = "http://nowhere",
},
},
}

local ok, err = validate(config)

assert.equal(err["config"]["@entity"][1], "must set one of 'auth.header_name', 'auth.param_name', "
.. "and its respective options, when provider is not self-hosted")
assert.is_falsy(ok)
end)

it("requires both [config.auth.header_name] and [config.auth.header_value] to be set", function()
local config = {
route_type = "llm/v1/chat",
Expand Down
Loading