Skip to content

Commit

Permalink
chore(llm): remove llm model schema auth required (#13469)
Browse files Browse the repository at this point in the history
  • Loading branch information
oowl authored Aug 8, 2024
1 parent 0f73339 commit 9bf3d1f
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 70 deletions.
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" }, },
{ 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

1 comment on commit 9bf3d1f

@github-actions
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bazel Build

Docker image available kong/kong:9bf3d1f547b5891c0c43e510daf9caf7003d9996
Artifacts available https://github.com/Kong/kong/actions/runs/10300634275

Please sign in to comment.