UploadFile
Upload a file to OpenAI for use with other API endpoints.
Allows uploading files that can be used with various OpenAI features, such as search, fine-tuning, or retrieval augmented responses.
type: "io.kestra.plugin.openai.UploadFile"
Examples
Upload a file to OpenAI and get its ID for later use.
id: openai_file_upload
namespace: company.team
inputs:
- id: dataFile
type: FILE
tasks:
- id: upload_file
type: io.kestra.plugin.openai.UploadFile
apiKey: "{{ secret('OPENAI_API_KEY') }}"
file: "{{ inputs.dataFile }}"
purpose: "fine-tune"
- id: use_file_id
type: io.kestra.plugin.core.log.Log
message: "Uploaded file ID: {{ outputs.upload_file.fileId }}"
Upload a user data file with description for search purposes
id: openai_search_file
namespace: company.team
inputs:
- id: documentFile
type: FILE
tasks:
- id: upload
type: io.kestra.plugin.openai.UploadFile
apiKey: "{{ secret('OPENAI_API_KEY') }}"
file: "{{ inputs.documentFile }}"
purpose: "search"
description: "Customer knowledge base articles for retrieval"
Properties
apiKey *Requiredstring
OpenAI API key
from *Requiredstring
The source file URI
URI of the file containing data to be loaded into OpenAI
Pebble expression referencing an Internal Storage URI e.g. {{ outputs.mytask.uri }}
.
purpose *Requiredstring
The intended purpose of the uploaded file
clientTimeout Non-dynamicinteger
10
The maximum number of seconds to wait for a response
user string
A unique identifier representing your end-user
Outputs
fileId string
The ID of the uploaded file