Skip to content

Commit a5b0ee4

Browse files
committed
wip
1 parent c4be6c6 commit a5b0ee4

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

.DS_Store

6 KB
Binary file not shown.

examples/uploading-files.ts

+15
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,27 @@
22

33
// Example of uploading a file
44
import { upload } from 'together-ai/lib/upload';
5+
import fetch from 'node-fetch';
56

67
async function main() {
78
// Upload a file
89
const file = await upload('./examples/coqa.jsonl');
910
console.log('Uploaded file');
1011
console.log(file);
12+
13+
// Check if the file has any contents (https://docs.together.ai/reference/get_files-id-content)
14+
// @ts-ignore
15+
const url = `https://api.together.xyz/v1/files/${file.id}/content`;
16+
const options = {
17+
method: 'GET',
18+
headers: {
19+
accept: 'application/json',
20+
authorization: `Bearer ${process.env['TOGETHER_API_KEY']}`,
21+
},
22+
};
23+
24+
const res = await fetch(url, options);
25+
console.log(await res.text());
1126
}
1227

1328
main();

0 commit comments

Comments
 (0)