Skip to content

Commit d56a5d2

Browse files
yanxi0830stainless-app[bot]
authored andcommitted
feat: file upload readme
1 parent 8ce69f2 commit d56a5d2

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

README.md

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,8 +182,19 @@ from llama_api_client import LlamaAPIClient
182182

183183
client = LlamaAPIClient()
184184

185+
num_bytes = Path("/path/to/file").stat().st_size
186+
187+
# 1. initiate upload session
188+
r = client.uploads.create(
189+
bytes=num_bytes,
190+
filename="simpleqa.jsonl",
191+
mime_type="application/jsonl",
192+
purpose="messages_finetune",
193+
)
194+
195+
# 2. upload part
185196
client.uploads.part(
186-
upload_id="upload_id",
197+
upload_id=r.id,
187198
data=Path("/path/to/file"),
188199
)
189200
```

0 commit comments

Comments
 (0)