createFile

fun createFile(filePath: String, rewriteExists: Boolean = false, purpose: OpenAIFilePurpose = defaultPurpose, block: (KoryFile) -> Unit)

Creates a new file and adds it to the upload list.

Parameters

filePath

The path to create the file at.

rewriteExists

If true, overwrites an existing file. Defaults to false.

purpose

The file's purpose. Defaults to defaultPurpose.

block

Callback invoked with the created KoryFile.

Throws

FileAlreadyExistsException

if the file exists and rewriteExists is false.