The CREATE_AI_MODEL_ENDPOINT procedure creates an access endpoint for an AI model object. You must specify the endpoint address, access key, model provider, and other attributes.
Syntax
PROCEDURE create_ai_model_endpoint(
IN name VARCHAR(128),
IN params JSON);
Parameters
Parameter |
Description |
Type |
Value range |
Nullable |
|---|---|---|---|---|
| name | The name of the endpoint of the AI model object. | VARCHAR(128) | NO | |
| params | ai_model_name specifies the name of the AI model object created by the CREATE_AI_MODEL procedure. |
JSON STRING | NO | |
url specifies the complete URL of the endpoint of the AI model service, which is the specific interface address for features such as chat, embedding, or reranking, not the base URL. |
JSON STRING | NO | ||
access_key specifies the access key of the endpoint. |
JSON STRING | NO | ||
request_model_name specifies the user-defined model name, such as big-m3-custom, placed in the request body. |
JSON STRING | YES, can be empty or unspecified | ||
provider specifies the model provider. |
JSON STRING |
|
NO | |
parameters, which indicates the extension parameters of the endpoint and is used to configure the concurrent batch processing behavior of the AI_COMPLETE and AI_EMBED functions when processing multiple rows of data. The value of this field is a JSON string (not a JSON object). It is recommended to use the JSON_OBJECT() function to construct the parameters to avoid complex escape issues. For supported sub-parameters, see the parameters section below.
NoteThis parameter is available starting with V5.0.1. If not configured, the default concurrency range of 10 to 100 is used. |
JSON STRING | YES. This parameter can be empty or unspecified. |
Value range of the url parameter
Vendor |
Type |
Description/Example |
|---|---|---|
| Alibaba Cloud (OpenAI-compatible format) |
complete | https://dashscope.aliyuncs.com/compatible-mode/v1/chat/completions |
| embedding | https://dashscope.aliyuncs.com/compatible-mode/v1/embeddings | |
| Alibaba Cloud DashScope (Non-OpenAI-compatible format) |
complete | https://dashscope.aliyuncs.com/api/v1/services/aigc/text-generation/generation |
| embed | https://dashscope.aliyuncs.com/api/v1/services/embeddings/text-embedding/text-embedding | |
| rerank | https://dashscope.aliyuncs.com/api/v1/services/rerank/text-rerank/text-rerank | |
| DeepSeek (OpenAI-compatible format) |
complete | https://api.deepseek.com/chat/completions |
| SiliconFlow (OpenAI-compatible format) |
complete | https://api.siliconflow.cn/v1/chat/completions |
| embedding | https://api.siliconflow.cn/v1/embeddings | |
| rerank | https://api.siliconflow.cn/v1/rerank | |
| Tencent Hunyuan (OpenAI-compatible API) |
complete | https://api.hunyuan.cloud.tencent.com/v1/chat/completions |
| embedding | https://api.hunyuan.cloud.tencent.com/v1/embeddings |
Parameters field
The parameters field is used to configure concurrency batch processing parameters. The system employs the AIMD adaptive algorithm to dynamically adjust the concurrency based on the model service response, striking a balance between throughput and stability.
Parameter |
Description |
Type |
Default value |
Nullable |
|---|---|---|---|---|
min_concurrency |
The minimum number of concurrent tasks. The concurrency does not fall below this value during AIMD adaptive throttling. | int | 10 | YES. It can be empty, unspecified, or set to 0 (which uses the default value). |
max_concurrency |
The maximum number of concurrent tasks. The initial concurrency equals this value. | int | 100 | YES. It can be empty, unspecified, or set to 0 (which uses the default value). |
Parameter tuning guidelines:
- For public cloud APIs (such as OpenAI/DeepSeek), it is recommended that
max_concurrencydoes not exceed 50 to avoid triggering rate limiting. - For self-managed model services, you can appropriately increase it based on your computing resources.
- If 429 rate limiting logs frequently appear, it indicates that
max_concurrencyis too high. You should lower it or rely on adaptive rate limiting.
Examples
Create an AI model access endpoint of type complete that uses the deepseek-chat model. Do not configure parameters to use the default concurrency range of 10 to 100.
CALL DBMS_AI_SERVICE.CREATE_AI_MODEL_ENDPOINT (
'my_model_endpoint1', '{
"ai_model_name": "my_model1",
"url": "https://api.deepseek.com/chat/completions",
"access_key": "sk-xxxxxxxxxxxx",
"request_model_name": "deepseek-chat",
"provider": "deepseek"
}');
Create an AI model access endpoint and configure concurrency batch processing parameters using the JSON object method (recommended).
CALL DBMS_AI_SERVICE.CREATE_AI_MODEL_ENDPOINT('my_model_endpoint2',
JSON_OBJECT(
"ai_model_name", "my_model1",
"url", "https://api.deepseek.com/chat/completions",
"access_key", "sk-xxxxxxxxxxxx",
"provider", "deepseek",
"request_model_name", "deepseek-chat",
"parameters", '{"min_concurrency": 5, "max_concurrency": 50}'
)
);
Create an AI model access endpoint and configure concurrency batch processing parameters using a raw JSON string. Double escape \\\".
CALL DBMS_AI_SERVICE.CREATE_AI_MODEL_ENDPOINT('my_model_endpoint3', '{
"ai_model_name": "my_model1",
"url": "https://api.deepseek.com/chat/completions",
"access_key": "sk-xxxx",
"provider": "deepseek",
"request_model_name": "deepseek-chat",
"parameters": "{\\\"min_concurrency\\\": 5, \\\"max_concurrency\\\": 50}"
}');
