Skip to content
Source
Sign inSign up
TanStack/ai
Open History to see the last commit

uploadFile.md

51 lines1.1 KB

function uploadFile<TName>(options): Promise<FileHandle<TName>>;

Defined in: packages/ai/src/activities/files/index.ts:28

Upload a file to a provider's Files API and return its handle. The handle carries the provider name as a literal type, so passing it to another provider's lifecycle call is a compile error.

Type Parameters

TName

TName extends string

Parameters

options

abortSignal?

AbortSignal

Cancels the upload. The call rejects when the signal aborts.

adapter

FilesAdapter<TName> & object

input

FileUploadInput

Returns

Promise<FileHandle<TName>>

Example

const files = openaiFiles()
const handle = await uploadFile({ adapter: files, input: { data, mimeType: 'image/png' } })