Imports files from an authorized OSS bucket into Alibaba Cloud Model Studio application data.
Operation description
-
Make sure the OSS bucket belongs to the same Alibaba Cloud account as Model Studio and that authorization has been completed as described in Importing data from OSS configuration instructions.
Supported bucket storage types do not include Archive, Cold Archive, or Deep Cold Archive. Buckets with content encryption enabled are supported. Buckets with public read/write, public read, or private access are supported.
To use a bucket with Referer-based hotlink protection enabled, add the domain name
*.console.aliyun.comto the Referer whitelist as described in Allow access only from trusted websites.
-
Resource Access Management (RAM) users must first obtain API permissions for Model Studio (the
AliyunBailianDataFullAccesspermission is required, which includes the sfm:AddFilesFromAuthorizedOss permission) and join a workspace before invoking this operation. Alibaba Cloud accounts can invoke this operation directly without authorization. Call this operation by using the latest Model Studio SDK. -
This operation does not have idempotence.
Rate limit: This operation is throttled if called too frequently. Do not exceed 5 calls per second. If throttled, retry later.
Try it now
Test
RAM authorization
|
Action |
Access level |
Resource type |
Condition key |
Dependent action |
|
sfm:AddFilesFromAuthorizedOss |
create |
*All Resource
|
None | None |
Request syntax
POST /{WorkspaceId}/datacenter/file/fromoss HTTP/1.1
Path Parameters
|
Parameter |
Type |
Required |
Description |
Example |
| WorkspaceId |
string |
Yes |
The workspace ID. Files are imported into this workspace. For more information about how to obtain the workspace ID, see How to use a workspace. |
llm-3z7uw7fwz0vxxxx |
Request parameters
|
Parameter |
Type |
Required |
Description |
Example |
| CategoryId |
string |
Yes |
The ID of the category to which the files are imported. This is the |
cate_cdd11b1b79a74e8bbd675c356a91ee35xxxxxxxx |
| CategoryType |
string |
Yes |
The category type. Optional. Default value: UNSTRUCTURED. Valid values:
Valid values:
|
UNSTRUCTURED |
| OssRegionId |
string |
Yes |
The region ID of the OSS bucket. For more information, see OSS regions and endpoints. |
cn-beijing |
| OssBucketName |
string |
Yes |
The name of the OSS bucket. For more information, see Buckets. |
bucketNamexxxxx |
| FileDetails |
array<object> |
Yes |
The list of files to import. A maximum of 10 files can be uploaded at a time. Note
A maximum of 10 files can be uploaded at a time. |
|
|
array<object> |
Yes |
The file object. |
||
| FileName |
string |
Yes |
The name of the file to import. The file name must include the file format extension.
Important If the name of the imported file is the same as an existing file in the knowledge base, the operation still returns a Status of SUCCESS, but the file is not actually imported. The existing file with the same name remains unchanged. Make sure that each imported file name is unique.Note
To create a data table and upload data, use the Model Studio console. This is not supported through the API. |
this_is_temp_xxxx.pdf |
| OssKey |
string |
Yes |
The key of the file in the OSS bucket. For more information, see Object naming conventions. |
root/path/this_is_temp_xxxx.pdf |
| Parser |
string |
No |
The parser type. Valid values:
Note The uploaded file is parsed by using the specified parser. If you set this parameter to AUTO_SELECT, the parser configured for the category is used. |
AUTO_SELECT |
| ParserConfig |
object |
No |
The parser configuration. This parameter is required only when the parser type is set to Qwen VL parsing. |
|
| ModelName |
string |
No |
The model name. |
qwen-vl-max |
| ModelPrompt |
string |
No |
The prompt used when calling Qwen VL parsing. |
#角色 你是一个专业的图片内容标注人员,擅长识别并描述出图片中的内容。 # 任务目标 请结合输入图片,详细描述图片中的内容。 |
| Tags |
array |
No |
The list of tags associated with the file. Default value: empty, which means the file is not associated with any tags. A maximum of 10 tags can be specified. |
|
|
string |
No |
The tag of the file. Each tag can be up to 12 characters in length and supports characters in the Unicode letter category (including English letters, Chinese characters, and digits), underscores (_), and hyphens (-). |
产品介绍 |
|
| OverWriteFileByOssKey |
boolean |
No |
Specifies whether to overwrite files with the same OssKey in the category. Default value: false, which means files are not overwritten. |
false |
Response elements
|
Element |
Type |
Description |
Example |
|
object |
Schema of Response |
||
| Code |
string |
The error code. |
success |
| Data |
object |
The data field returned by the operation. |
|
| AddFileResultList |
array<object> |
The list of file import results. |
|
|
object |
The list of file import results. |
||
| FileId |
string |
The file ID. Please keep this value safe, as it will be used for all subsequent API operations related to this file. |
file_809f469a59ac449586ec692576xxxxx_102248XXX |
| OssKey |
string |
The key name (Key) of the imported file in the OSS Bucket. |
root/path/this_is_temp_xxxx.pdf |
| Status |
string |
File import status. Possible values:
Note
Only files with the SUCCESS status can be used to create or update knowledge bases. |
SUCCESS |
| Msg |
string |
Error information returned when file import fails. |
size too large |
| Message |
string |
The error message. |
Cant find out category for category_id param. |
| RequestId |
string |
The request ID. |
17204B98-xxxx-4F9A-8464-2446A84821CA |
| Status |
string |
The status code returned by the operation. |
200 |
| Success |
string |
Indicates whether the call was successful. Valid values:
|
true |
Examples
Success response
JSON format
{
"Code": "success",
"Data": {
"AddFileResultList": [
{
"FileId": "file_809f469a59ac449586ec692576xxxxx_102248XXX",
"OssKey": "root/path/this_is_temp_xxxx.pdf",
"Status": "SUCCESS",
"Msg": "size too large"
}
]
},
"Message": "Cant find out category for category_id param.",
"RequestId": "17204B98-xxxx-4F9A-8464-2446A84821CA",
"Status": "200",
"Success": "true"
}
Error codes
See Error Codes for a complete list.
Release notes
See Release Notes for a complete list.