AddFilesFromAuthorizedOss
Imports files from an authorized OSS Bucket into Alibaba Cloud Model Studio (Bailian) application data.
Operation description
-
Please ensure that the OSS Bucket and Alibaba Cloud Model Studio belong to the same Alibaba Cloud account (main account) and that authorization has been completed according to the Configuration instructions for importing data from OSS.
Supported Bucket storage types do not include Archive, Cold Archive, or Deep Cold Archive. Buckets with content encryption are supported. Public read/write, public read, and private Buckets are supported.
If you want to use a Bucket with Referer hotlink protection enabled, refer to Allow access only from trusted websites to add the domain
*.console.aliyun.comto the Referer allowlist.
-
A RAM user (sub-account) must first obtain the API permissions for Alibaba Cloud Model Studio (requires
AliyunBailianDataFullAccess, which includes the sfm:AddFilesFromAuthorizedOss permission point) and join a workspace before calling this operation. The Alibaba Cloud account (main account) can call this directly without authorization. We recommend that you call this operation through the latest version of the Alibaba Cloud Model Studio SDK. -
This operation is not idempotent.
Throttling description: Frequent calls to this operation will be throttled. The frequency should not exceed 5 calls per second. If throttled, please try again 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 will be imported into this workspace. For how to obtain it, see How to use workspaces. |
llm-3z7uw7fwz0vxxxx |
Request parameters
|
Parameter |
Type |
Required |
Description |
Example |
| CategoryId |
string |
Yes |
Specifies the target category for file import. This is the |
cate_cdd11b1b79a74e8bbd675c356a91ee35xxxxxxxx |
| CategoryType |
string |
Yes |
Category type. Optional. The default value is UNSTRUCTURED. Valid values:
Valid values:
|
UNSTRUCTURED |
| OssRegionId |
string |
Yes |
The region ID of the OSS Bucket. For how to obtain it, see OSS regions and endpoints. |
cn-beijing |
| OssBucketName |
string |
Yes |
The OSS Bucket name. For details, see Buckets. |
bucketNamexxxxx |
| FileDetails |
array<object> |
Yes |
The list of files to import. Up to 10 files can be uploaded at a time. Note
Up to 10 files can be uploaded at a time. |
|
|
array<object> |
Yes |
File object. |
||
| FileName |
string |
Yes |
The name of the file to import. Note that the suffix must include the file format type.
Important When the imported file name duplicates an existing file name in the knowledge base, the operation still returns Status as SUCCESS, but the file will not actually be imported into the knowledge base, and the existing file with the same name remains unchanged. Please ensure that each imported file name is unique.Note
To add a new data table and upload data, please use the Alibaba Cloud Model Studio console; the API does not support this. |
this_is_temp_xxxx.pdf |
| OssKey |
string |
Yes |
The key name (Key) of the imported file in the OSS Bucket. For details, see Object naming. |
root/path/this_is_temp_xxxx.pdf |
| Parser |
string |
No |
Parser type. Possible values include:
Note The currently configured parser will be used to parse your uploaded files. If AUTO_SELECT is entered, the parser configured for the corresponding category will be used. |
AUTO_SELECT |
| ParserConfig |
object |
No |
Parser configuration. Required only when the parser type is set to Qwen VL parsing. |
|
| ModelName |
string |
No |
Model name. |
qwen-vl-max |
| ModelPrompt |
string |
No |
The prompt used when invoking Qwen VL parsing. |
#角色 你是一个专业的图片内容标注人员,擅长识别并描述出图片中的内容。 # 任务目标 请结合输入图片,详细描述图片中的内容。 |
| Tags |
array |
No |
The list of tags associated with the file. The default is empty, meaning the file is not associated with any tags. Up to 10 tags can be passed in. |
|
|
string |
No |
The tag of the file. Each tag can contain up to 12 characters, supporting characters in the Unicode letter category (including English, Chinese, numbers, etc.), underscores (_), and hyphens (-). |
产品介绍 |
|
| OverWriteFileByOssKey |
boolean |
No |
Whether to overwrite the same file in the category by OssKey. The default value is false, meaning no overwrite. |
false |
Response elements
|
Element |
Type |
Description |
Example |
|
object |
Schema of Response |
||
| Code |
string |
Error status code. |
success |
| Data |
object |
Business 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. Store this ID securely. It is required for subsequent API operations on this file. |
file_809f469a59ac449586ec692576xxxxx_102248XXX |
| OssKey |
string |
The key of the imported file in the OSS bucket. |
root/path/this_is_temp_xxxx.pdf |
| Status |
string |
The import status of the file. Valid values:
Note
Only files with a status of |
SUCCESS |
| Msg |
string |
The error message returned when the file import fails. |
size too large |
| Message |
string |
Error information. |
Cant find out category for category_id param. |
| RequestId |
string |
The ID of the request. |
17204B98-xxxx-4F9A-8464-2446A84821CA |
| Status |
string |
The status code returned by the operation. |
200 |
| Success |
string |
Whether the operation call succeeded. Possible 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.