Creating a Model
Function
The API is used to create a model. The configuration includes the model name, description, endpoint, and relevant settings.
**Note: When using a third-party LLM, it is your responsibility to ensure that the model output is secure and compliant. **
There is a strong connection between the embedding model and the cache generation model. When an embedding model is created, the system automatically generates a cache generation model. If any configuration information is deleted by mistake, the model must be rebuilt using the same configuration parameters. For example, if the name of the embedding model is pangu_embedding, the name of the matching cache generation model is pangu_embedding_faq.
When creating a knowledge base, both the embedding model (pangu_embedding) and cache generation model (pangu_embedding_faq) are required. If the cache generation model (pangu_embedding_faq) does not exist or is not accessible, an error is returned. In this case, the administrator needs to check whether the pangu_embedding_faq model exists or whether the knowledge base user has access to it. If the model is missing, create it. If the knowledge base user does not have access to it, grant them the access permission.
URI
POST /v1/{project_id}/applications/{application_id}/uni-search/models
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
project_id |
Yes |
String |
Definition: Project ID. For details about how to obtain the project ID, see Obtaining a Project ID. Constraints: N/A Value range: The value can contain 1 to 64 characters. Only digits, letters, hyphens (-), and underscores (_) are allowed. The value must start with a letter. Default value: N/A |
application_id |
Yes |
String |
Definition: Application ID. For details about how to obtain the application ID, see Obtaining an Application ID. Constraints: Character string Value range: The value can contain 1 to 64 characters. Only digits, letters, hyphens (-), and underscores (_) are allowed. The value must start with a letter. Default value: N/A |
Request Parameters
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
X-Auth-Token |
Yes |
String |
Definition: Token used for API authentication. For details about how to obtain the token, see Obtaining an IAM User Token. Constraints: N/A Value range: N/A Default value: N/A |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
name |
Yes |
String |
Definition: Model name. Constraints: The length for the embedding model is 28 characters, and 32 characters for other models. Value range: The value contains 1 to 32 characters. It can only contain letters, digits, underscores (_), and hyphens (-), and must start with a letter or digit. Default value: N/A |
alias |
No |
String |
Definition: Model name required for the Ascend model scenario. Constraints: N/A Value range: The value cannot be empty. It can contain 1 to 32 characters. It can only contain letters, digits, periods (.), hyphens (-), colons (:), and slashes (/), and must start with a letter or digit. Default value: N/A |
detail |
Yes |
String |
Definition: Model details. Constraints: N/A Value range: This parameter cannot be left blank. The value can contain 1 to 512 characters and can contain any characters. Default value: N/A |
endpoint |
Yes |
String |
Definition: Model endpoint. Constraints: N/A Value range: The value cannot be empty. It can contain 1 to 512 characters, including any characters. Default value: N/A |
type |
Yes |
String |
Definition: Model type. Constraints: N/A Value range:
Default value: N/A |
extend_config |
Yes |
ModelExtendConfig object |
Definition: User-defined model configuration, in JSON format. Constraints: N/A Value range: N/A Default value: N/A |
project_id |
No |
String |
Definition: Project ID. Constraints: N/A Value range: Optional. The value must be a string of 1 to 64 characters. It can only contain letters, digits, underscores (_), and hyphens (-). Default value: N/A |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
iam_info |
Yes |
IamInfo object |
Definition: IAM authentication agency information Constraints: N/A Value range: N/A Default value: N/A |
custom_header |
No |
map<string, object> |
Definition: Extended request header. Constraints: N/A Value range: N/A Default value: N/A |
deployment_id |
No |
String |
Definition: Model deployment ID. Constraints: N/A Value range: N/A Default value: N/A |
vector_config |
No |
VectorConfig object |
Definition: Vector model configuration. Constraints: N/A Value range: N/A Default value: N/A |
nlp_config |
No |
NlpConfig object |
Definition: Configuration of the NLP foundation model. Constraints: N/A Value range: N/A Default value: N/A |
guard_enabled |
No |
Boolean |
Definition: Whether to enable moderation. Constraints: N/A Value range: N/A Default value: N/A |
query_key |
No |
String |
Definition: Key value of the query request body. Constraints: N/A Value range: N/A Default value: N/A |
custom_param |
No |
Map<String,String> |
Definition: Request parameter. Constraints: N/A Value range: N/A Default value: N/A |
custom_enabled |
No |
Boolean |
Definition: Custom field. Constraints: N/A Value range: N/A Default value: N/A |
custom_json_parse |
No |
Map<String,String> |
Definition: Result parsing. Constraints: N/A Value range: N/A Default value: N/A |
proxy_enabled |
No |
Boolean |
Definition: Whether to enable the proxy. This parameter is enabled when the web search engine is configured. Constraints: N/A Value range: N/A Default value: N/A |
time_detect_enabled |
No |
Boolean |
Definition: Whether to enable periodic detection. This parameter is enabled when the web search engine is configured. Constraints: N/A Value range: N/A Default value: N/A |
agree_disclaimer |
No |
String |
Definition: If the disclaimer has been agreed, AGREE is sent. By default, this parameter is left empty. Constraints: N/A Value range: N/A Default value: N/A |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
iam_enabled |
No |
Boolean |
Definition: Indicates whether to enable authentication. Constraints: N/A Value range: N/A Default value: N/A |
agency_enabled |
No |
Boolean |
Definition: Indicates whether to use an agency account for authentication Constraints: N/A Value range: N/A Default value: N/A |
project_id |
No |
String |
Definition: Project ID of the IAM user. This parameter is mandatory when iam_enable is set to true. Constraints: N/A Value range: N/A Default value: N/A |
domain_name |
No |
String |
Definition: Name of the agency account. Constraints: N/A Value range: N/A Default value: N/A |
agency_name |
No |
String |
Definition: Agency name. Constraints: N/A Value range: N/A Default value: N/A |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
embedding_url |
Yes |
String |
Definition: URL for calling the embedding or query2query model. Constraints: N/A Value range: N/A Default value: N/A |
rerank_url |
No |
String |
Definition: URL for calling the reranking model. Constraints: N/A Value range: N/A Default value: N/A |
Response Parameters
Status code: 200
Added successfully.
Status code: 400
Parameter |
Type |
Description |
---|---|---|
error_code |
String |
Definition: Value range: N/A |
error_msg |
String |
Definition: Error message. Value range: N/A |
Status code: 500
Parameter |
Type |
Description |
---|---|---|
error_code |
String |
Definition: Value range: N/A |
error_msg |
String |
Definition: Error message. Value range: N/A |
Example Requests
Add a model.
/v1/b25446daeb1a41a7953c5deba2b2677a/applications/cefb2a59-2f9e-4268-b56b-eab15dc0b9d6/uni-search/models { "name" : "25-test-enbedding", "type" : "embedding", "endpoint" : "https://xxxxxx", "detail" : "test", "extend_config" : { "iam_info" : { "iam_enabled" : false, "agency_enabled" : false }, "vector_config" : { "embedding_url" : "/app/search/v1/vector" }, "time_detect_enabled" : true, "custom_enabled" : true, "custom_header" : { } } }
Example Responses
None
Status Codes
Status Code |
Description |
---|---|
200 |
Added successfully. |
400 |
Incorrect request body. |
500 |
Internal error. |
Error Codes
See Error Codes.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot