shreemaan-abhishek commented on code in PR #11499: URL: https://github.com/apache/apisix/pull/11499#discussion_r1727201303
########## apisix/plugins/ai-proxy/schema.lua: ########## @@ -0,0 +1,167 @@ +-- +-- Licensed to the Apache Software Foundation (ASF) under one or more +-- contributor license agreements. See the NOTICE file distributed with +-- this work for additional information regarding copyright ownership. +-- The ASF licenses this file to You under the Apache License, Version 2.0 +-- (the "License"); you may not use this file except in compliance with +-- the License. You may obtain a copy of the License at +-- +-- http://www.apache.org/licenses/LICENSE-2.0 +-- +-- Unless required by applicable law or agreed to in writing, software +-- distributed under the License is distributed on an "AS IS" BASIS, +-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +-- See the License for the specific language governing permissions and +-- limitations under the License. +-- +local _M = {} + +local auth_schema = { + type = "object", + properties = { + source = { + type = "string", + enum = {"header", "param"} + }, + name = { + type = "string", + description = "Name of the param/header carrying Authorization or API key.", + minLength = 1, + }, + value = { + type = "string", + description = "Full auth-header/param value.", + minLength = 1, + -- TODO encrypted = true, + }, + }, + required = { "source", "name", "value" }, + additionalProperties = false, +} + +local model_options_schema = { Review Comment: yes, later other AI providers' options can be specified here too. ########## apisix/plugins/ai-proxy/schema.lua: ########## @@ -0,0 +1,167 @@ +-- +-- Licensed to the Apache Software Foundation (ASF) under one or more +-- contributor license agreements. See the NOTICE file distributed with +-- this work for additional information regarding copyright ownership. +-- The ASF licenses this file to You under the Apache License, Version 2.0 +-- (the "License"); you may not use this file except in compliance with +-- the License. You may obtain a copy of the License at +-- +-- http://www.apache.org/licenses/LICENSE-2.0 +-- +-- Unless required by applicable law or agreed to in writing, software +-- distributed under the License is distributed on an "AS IS" BASIS, +-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +-- See the License for the specific language governing permissions and +-- limitations under the License. +-- +local _M = {} + +local auth_schema = { + type = "object", + properties = { + source = { + type = "string", + enum = {"header", "param"} + }, + name = { + type = "string", + description = "Name of the param/header carrying Authorization or API key.", + minLength = 1, + }, + value = { + type = "string", + description = "Full auth-header/param value.", + minLength = 1, + -- TODO encrypted = true, + }, + }, + required = { "source", "name", "value" }, + additionalProperties = false, +} + +local model_options_schema = { + description = "Key/value settings for the model", + type = "object", + properties = { + max_tokens = { + type = "integer", + description = "Defines the max_tokens, if using chat or completion models.", + default = 256 + + }, + input_cost = { + type = "number", + description = "Defines the cost per 1M tokens in your prompt.", + minimum = 0 + + }, + output_cost = { + type = "number", + description = "Defines the cost per 1M tokens in the output of the AI.", + minimum = 0 + + }, + temperature = { + type = "number", + description = "Defines the matching temperature, if using chat or completion models.", + minimum = 0.0, + maximum = 5.0, + + }, + top_p = { + type = "number", + description = "Defines the top-p probability mass, if supported.", + minimum = 0, + maximum = 1, + + }, + upstream_host = { + type = "string", + description = "To be specified to override the host of the AI provider", + }, + upstream_port = { + type = "integer", + description = "To be specified to override the AI provider port", + + }, + upstream_path = { + type = "string", + description = "To be specified to override the URL to the AI provider endpoints", + }, + response_streaming = { + description = "Stream response by SSE", + type = "boolean", + default = false, + } Review Comment: ok -- 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: notifications-unsubscr...@apisix.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org