@@ -93,37 +93,17 @@ import Together, { toFile } from 'together-ai';
9393const client = new Together ();
9494
9595// If you have access to Node `fs` we recommend using `fs.createReadStream()`:
96- await client .files .upload ({
97- file: fs .createReadStream (' /path/to/file' ),
98- file_name: ' dataset.csv' ,
99- purpose: ' fine-tune' ,
100- });
96+ await client .audio .transcriptions .create ({ file: fs .createReadStream (' /path/to/file' ) });
10197
10298// Or if you have the web `File` API you can pass a `File` instance:
103- await client .files .upload ({
104- file: new File ([' my bytes' ], ' file' ),
105- file_name: ' dataset.csv' ,
106- purpose: ' fine-tune' ,
107- });
99+ await client .audio .transcriptions .create ({ file: new File ([' my bytes' ], ' file' ) });
108100
109101// You can also pass a `fetch` `Response`:
110- await client .files .upload ({
111- file: await fetch (' https://somesite/file' ),
112- file_name: ' dataset.csv' ,
113- purpose: ' fine-tune' ,
114- });
102+ await client .audio .transcriptions .create ({ file: await fetch (' https://somesite/file' ) });
115103
116104// Finally, if none of the above are convenient, you can use our `toFile` helper:
117- await client .files .upload ({
118- file: await toFile (Buffer .from (' my bytes' ), ' file' ),
119- file_name: ' dataset.csv' ,
120- purpose: ' fine-tune' ,
121- });
122- await client .files .upload ({
123- file: await toFile (new Uint8Array ([0 , 1 , 2 ]), ' file' ),
124- file_name: ' dataset.csv' ,
125- purpose: ' fine-tune' ,
126- });
105+ await client .audio .transcriptions .create ({ file: await toFile (Buffer .from (' my bytes' ), ' file' ) });
106+ await client .audio .transcriptions .create ({ file: await toFile (new Uint8Array ([0 , 1 , 2 ]), ' file' ) });
127107```
128108
129109## Handling errors
0 commit comments