nic-6443 commented on code in PR #13249:
URL: https://github.com/apache/apisix/pull/13249#discussion_r3114883826


##########
apisix/plugins/ai-proxy/schema.lua:
##########
@@ -234,7 +308,58 @@ _M.ai_proxy_schema = {
         override = override_schema,
     },
     required = {"provider", "auth"},
-    encrypt_fields = {"auth.header", "auth.query", 
"auth.gcp.service_account_json"},
+    allOf = {
+        {
+            ["if"] = {
+                properties = { provider = { enum = { "vertex-ai" } } },
+            },
+            ["then"] = {
+                properties = {
+                    provider_conf = provider_vertex_ai_schema,
+                },
+                anyOf = {
+                    { required = { "provider_conf" } },
+                    { required = { "override" } },
+                },
+            },
+        },
+        {
+            ["if"] = {
+                properties = { provider = { enum = { "bedrock" } } },
+            },
+            ["then"] = {
+                properties = {
+                    provider_conf = provider_bedrock_schema,
+                    auth = {
+                        required = { "aws" },
+                    },
+                },
+                required = { "provider_conf", "auth" },
+            },
+        },
+        {
+            ["if"] = {
+                properties = { provider = { enum = { "bedrock" } } },
+                required = { "provider" },
+                ["not"] = {
+                    required = { "override" },
+                    properties = {
+                        override = { required = { "endpoint" } },
+                    },
+                },
+            },
+            ["then"] = {
+                properties = {
+                    options = { required = { "model" } },
+                },
+                required = { "options" },
+            },
+        },
+    },

Review Comment:
   I think the logic of this if-else block is overly complicated. It would be 
sufficient to throw an error directly when a request is made if the necessary 
auth configuration is missing.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to