Skip to content
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
2 changes: 1 addition & 1 deletion apisix/plugins/ai-proxy/schema.lua
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ _M.ai_proxy_multi_schema = {
default = { algorithm = "roundrobin" }
},
instances = ai_instance_schema,
logging_schema = logging_schema,
logging = logging_schema,
fallback_strategy = {
anyOf = {
{
Expand Down
33 changes: 33 additions & 0 deletions t/plugin/ai-proxy-multi.t
Original file line number Diff line number Diff line change
Expand Up @@ -653,3 +653,36 @@ qr/6data: \[DONE\]\n\n/
--- error_code: 400
--- response_body eval
qr/.invalid endpoint.*/



=== TEST 16: schema accepts 'logging'
--- config
location /t {
content_by_lua_block {
local plugin = require("apisix.plugins.ai-proxy-multi")

local ok, err = plugin.check_schema({
instances = {
{
name = "openai-1",
provider = "openai",
weight = 1,
auth = { header = { apikey = "token" } },
options = { model = "gpt-4" },
},
},
logging = { summaries = true },
})

if ok then
ngx.say("ok")
else
ngx.say("bad:" .. (err or ""))
end
}
}
--- request
GET /t
--- response_body
ok
27 changes: 27 additions & 0 deletions t/plugin/ai-proxy.t
Original file line number Diff line number Diff line change
Expand Up @@ -671,3 +671,30 @@ POST /embeddings
--- error_code: 200
--- response_body_like eval
qr/.*text-embedding-ada-002*/



=== TEST 17: schema accepts 'logging'
--- config
location /t {
content_by_lua_block {
local plugin = require("apisix.plugins.ai-proxy")

local ok, err = plugin.check_schema({
provider = "openai",
auth = { header = { apikey = "token" } },
options = { model = "gpt-4" },
logging = { summaries = true, payloads = false },
})

if ok then
ngx.say("ok")
else
ngx.say("bad:" .. (err or ""))
end
}
}
--- request
GET /t
--- response_body
ok
Loading