Create a file

Upload a file that can be used across various endpoints. Individual files can be up to 128 MB.

Request

POST

https://ai.api.cloud.yandex.net/v1/files
        

Body

multipart/form-data
{
          "file": "example",
          "purpose": "assistants",
          "expires_after": {
            "anchor": "created_at",
            "seconds": 3600
          }
        }
        

Name

Description

file

Type: string<binary>

The File object (not file name) to be uploaded.

Example: example

purpose

Type: string

The intended purpose of the uploaded file. One of:

  • assistants: Used in the Assistants API
  • batch: Used in the Batch API
  • fine-tune: Used for fine-tuning
  • vision: Images used for vision fine-tuning
  • user_data: Flexible file type for any purpose
  • evals: Used for eval data sets

Enum: assistants, batch, fine-tune, vision, user_data, evals

expires_after

Type: FileExpirationAfter

The expiration policy for a file. By default, files with purpose=batch expire after 30 days and all other files are persisted until they are manually deleted.

Example
{
          "anchor": "created_at",
          "seconds": 3600
        }
        

FileExpirationAfter

The expiration policy for a file. By default, files with purpose=batch expire after 30 days and all other files are persisted until they are manually deleted.

Name

Description

anchor

Type: string

Anchor timestamp after which the expiration policy applies. Supported anchors: created_at.

Const: created_at

Example: example

seconds

Type: integer

The number of seconds after the anchor time that the file will expire. Must be between 3600 (1 hour) and 2592000 (30 days).

Min value: 3600

Max value: 2592000

Example
{
          "anchor": "created_at",
          "seconds": 3600
        }
        

Responses

200 OK

OK

Body

application/json
{
          "id": "example",
          "bytes": 0,
          "created_at": 0,
          "expires_at": 0,
          "filename": "example",
          "object": "file",
          "purpose": "assistants",
          "status": "uploaded",
          "status_details": "example"
        }
        

Name

Description

bytes

Type: integer

The size of the file, in bytes.

created_at

Type: integer

The Unix timestamp (in seconds) for when the file was created.

filename

Type: string

The name of the file.

Example: example

id

Type: string

The file identifier, which can be referenced in the API endpoints.

Example: example

object

Type: string

The object type, which is always file.

Const: file

Example: example

purpose

Type: string

The intended purpose of the file. Supported values are assistants, assistants_output, batch, batch_output, fine-tune, fine-tune-results, vision, and user_data.

Enum: assistants, assistants_output, batch, batch_output, fine-tune, fine-tune-results, vision, user_data

status

Type: string

Deprecated. The current status of the file, which can be either uploaded, processed, or error.

Enum: uploaded, processed, error

expires_at

Type: integer

The Unix timestamp (in seconds) for when the file will expire.

status_details

Type: string

Deprecated. For details on why a fine-tuning training file failed validation, see the error field on fine_tuning.job.

Example: example

No longer supported, please use an alternative and newer version.

Предыдущая
Следующая