This is an automated email from the ASF dual-hosted git repository.
baoyuan pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/apisix.git
The following commit(s) were added to refs/heads/master by this push:
new f27139273 fix(ai-proxy): correct logging schema key in ai-proxy-multi
(#12795)
f27139273 is described below
commit f27139273144a25754106b515ee743ce8cbc3d2f
Author: Orician <[email protected]>
AuthorDate: Thu Dec 18 13:55:22 2025 +0800
fix(ai-proxy): correct logging schema key in ai-proxy-multi (#12795)
---
apisix/plugins/ai-proxy/schema.lua | 2 +-
t/plugin/ai-proxy-multi.t | 33 +++++++++++++++++++++++++++++++++
t/plugin/ai-proxy.t | 27 +++++++++++++++++++++++++++
3 files changed, 61 insertions(+), 1 deletion(-)
diff --git a/apisix/plugins/ai-proxy/schema.lua
b/apisix/plugins/ai-proxy/schema.lua
index 994cffd32..5f77f05a2 100644
--- a/apisix/plugins/ai-proxy/schema.lua
+++ b/apisix/plugins/ai-proxy/schema.lua
@@ -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 = {
{
diff --git a/t/plugin/ai-proxy-multi.t b/t/plugin/ai-proxy-multi.t
index ed833fa16..bb666d1ff 100644
--- a/t/plugin/ai-proxy-multi.t
+++ b/t/plugin/ai-proxy-multi.t
@@ -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
diff --git a/t/plugin/ai-proxy.t b/t/plugin/ai-proxy.t
index e8f4e1173..cc86332af 100644
--- a/t/plugin/ai-proxy.t
+++ b/t/plugin/ai-proxy.t
@@ -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