We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent c4be6c6 commit a5b0ee4Copy full SHA for a5b0ee4
.DS_Store
6 KB
examples/uploading-files.ts
@@ -2,12 +2,27 @@
2
3
// Example of uploading a file
4
import { upload } from 'together-ai/lib/upload';
5
+import fetch from 'node-fetch';
6
7
async function main() {
8
// Upload a file
9
const file = await upload('./examples/coqa.jsonl');
10
console.log('Uploaded file');
11
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());
26
}
27
28
main();
0 commit comments