or run

npx @tessl/cli init
Log in

Version

Tile

Overview

Evals

Files

Files

docs

administration.mdassistants-threads.mdbatch-processing.mdbeta-realtime.mdchat-completions.mdconfiguration-management.mdcontainer-content.mdcore-client.mdembeddings.mdevaluation-testing.mdfeedback-collections.mdfile-management.mdfine-tuning.mdframework-integrations.mdindex.mdkey-management.mdmodels.mdmultimodal-apis.mdobservability-analytics.mdprompt-management.mdprovider-integration.mdtext-completions.mduploads.mdvector-stores.md

file-management.mddocs/

0

# File Management

1

2

File upload, management, and processing capabilities including support for assistants, fine-tuning, and batch operations.

3

4

## Capabilities

5

6

### File Operations

7

8

```python { .api }

9

class MainFiles:

10

def create(self, **kwargs): ...

11

def list(self, **kwargs): ...

12

def retrieve(self, **kwargs): ...

13

def delete(self, **kwargs): ...

14

15

class Uploads:

16

def create(self, **kwargs): ...

17

parts: Parts

18

19

class Parts:

20

def create(self, **kwargs): ...

21

```

22

23

## Usage Examples

24

25

```python

26

from portkey_ai import Portkey

27

28

portkey = Portkey(

29

api_key="PORTKEY_API_KEY",

30

virtual_key="VIRTUAL_KEY"

31

)

32

33

# Upload file

34

file_response = portkey.files.create(

35

file=open("document.pdf", "rb"),

36

purpose="assistants"

37

)

38

39

# List files

40

files = portkey.files.list()

41

42

# Delete file

43

portkey.files.delete(file_response.id)

44

```