Skip to main content

Create and Upload File

Description

The file management module facilitates calls from various modules. By creating and uploading files (binary upload), file reuse is achieved.


Request URL

[POST] https://file.sensenova.cn/v1/files

Request Header

No special headers. Please refer to API Authorization.


Request Body

NameTypeRequiredDefaultOptionsDescription
descriptionstringNo--File description
No more than 256 characters
schemestringYes-Enum values, types are as follows:
Audio file format for quick voice cloning: AUDIO_TTS_1
Image file format for multimodal use: MULTIMODAL_1
Video file format for multimodal use: MULTIMODAL_2
Knowledge base JSON file: KNOWLEDGE_BASE_1
Other knowledge base formats: KNOWLEDGE_BASE_2
Assistants module file: ASSISTANT_1
File format
filefileYes--Binary data of the file

AUDIO_TTS_1 Current Version (Beta) Format Restrictions:

  • Mono channel, 16000Hz sample rate, pcm_s16le (16-bit signed integer in little-endian mode)
  • File size must not exceed 1M, audio duration must not exceed 30 seconds
  • Must contain human voice
  • Supported file formats:
    • .wav

After successfully uploading the file and passing format validation, you can use the file_id of this audio to call the voice cloning interface to achieve voice synthesis.


MULTIMODAL_1 Current Version (Beta) Format Restrictions:

  • Image resolution must not exceed 13000 px * 13000 px
  • File size must not exceed 10M
  • Supported file formats:
    • .jpg
    • .png

After successfully uploading the file and passing format validation, you can use the file_id of this image to call the multimodal dialogue generation interface to achieve image recognition, visual dialogue, and other functions.


MULTIMODAL_2 Current Version (Beta) Format Restrictions:

  • Video resolution must not exceed 720p (1280 px * 800 px), supports 720p, 480p, 360p, 240p, etc.
  • FPS must not exceed 30 frames/s
  • File size must not exceed 20MB, video duration must not exceed 30 seconds
  • Supported video encodings:
    • h264
    • h265
  • Supported file format:
    • .mp4

After successful file upload and format validation, you can use the file_id of this video to call the image-text dialogue generation interface for video understanding, target monitoring, etc.


KNOWLEDGE_BASE_1 Current Version (Beta) Format Restrictions:

  • File size must not exceed 20M
  • File format must be .json
  • Encoding format must be UTF-8
  • Content must follow the format below
{
"qa_lst": [ // Question and Answer knowledge
{
"std_q": "xxx", // Question description
"simi_qs": ["xxx", "xxx"], // Similar question descriptions
"answer": "xxx" // Answer description
},
{
"std_q": "xxx", // Question description
"simi_qs": ["xxx", "xxx"], // Similar question descriptions
"answer": "xxx" // Answer description
}
],
"text_lst": [ // Text knowledge, plain text data (In the current version (Beta), it is recommended that each piece of data is an independent semantic topic to improve retrieval efficiency and effectiveness)
"xxx",
"xxx"
]
}

KNOWLEDGE_BASE_2 Current Version (Beta) Format Restrictions:

  • Supported file formats:
    • .pdf
    • .docx
    • .xlsx
    • .csv (encoding format must be UTF-8)
  • PDF files must not exceed 50 pages and 20M in size
  • WORD files must not exceed 20M in size
  • EXCEL files must not exceed 3000 rows and 20M in size

After successfully uploading the file and passing format validation, you can use this file to create a knowledge base. When creating a knowledge base, the system will automatically recognize and convert the file content. Currently, text and table content recognition and conversion are supported.


Request Example

curl --request POST "https://file.sensenova.cn/v1/files" \
-H "Authorization: Bearer $API_TOKEN" \
-F 'description="string"' \
-F 'scheme="FINE_TUNE_1"' \
-F 'file=@"/D:/nova/dataset1.json"'

Response

NameTypeDescription
idstringFile ID
descriptionstringFile description
schemestringFile format
created_atstringFile creation time, ISO 8601 standard time format, accurate to nanoseconds
updated_atstringFile update time, ISO 8601 standard time format, accurate to nanoseconds
statusstringFile status, enum values
Not uploaded/Uploading: NOTUPLOADED
Uploaded (awaiting format validation): UPLOADED
Invalid file (format validation failed): INVALID
Valid file (format validation passed): VALID
file_namestringFile name

Response Example

{
"id": "string",
"description": "string",
"scheme": "string",
"created_at": "2023-06-28T17:23:01.243566533Z",
"updated_at": "2023-06-28T17:23:01.243566533Z",
"status": "string",
"file_name": "string"
}

Error Information

Refer to Error Codes