List your organization's fine-tuning jobs
1
type Openai = {
2
api_key: string;
3
organization_id: string;
4
};
5
/**
6
* List fine tunes
7
* List your organization's fine-tuning jobs
8
9
*/
10
export async function main(auth: Openai) {
11
const url = new URL(`https://api.openai.com/v1/fine-tunes`);
12
13
const response = await fetch(url, {
14
method: "GET",
15
headers: {
16
"OpenAI-Organization": auth.organization_id,
17
Authorization: "Bearer " + auth.api_key,
18
},
19
body: undefined,
20
});
21
if (!response.ok) {
22
const text = await response.text();
23
throw new Error(`${response.status} ${text}`);
24
}
25
return await response.json();
26
27