Skip to content

Files - expires_after was unexpected #212

@leoplct

Description

@leoplct

Hello,

According to the documentation, it should be possible to pass an expires_after parameter to automatically delete the file after a certain time.

However, when I include it in my request, I get the following error:

$openai = OpenAI::Client.new(
  api_key: Rails.application.credentials.openai,
  max_retries: 1
)

$openai.files.create(
  file: download,
  purpose: "user_data", 
   expires_after: {anchor: 'created_at', seconds: 3600}
 )

private 

  def download
    file = Tempfile.new([ "upload", ".pdf" ])
    file.binmode
    file.write(@file.download)
    file.rewind
    Pathname(file.path)
  end

Response

{:url=>"https://api.openai.com/v1/files", :status=>400, :body=>{:error=>{:message=>"Additional properties are not allowed ('expires_after' was unexpected)", :type=>"invalid_request_error", :param=>nil, :code=>nil}}} (OpenAI::Errors::BadRequestError)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions