//native
type Cohere = {
apiKey: string;
};
/**
* Cancel an Embed Job
* This API allows users to cancel an active embed job. Once invoked, the embedding process will be terminated, and users will be charged for the embeddings processed up to the cancellation point. It's important to note that partial results will not be available to users after cancellation.
*/
export async function main(auth: Cohere, id: string) {
const url = new URL(`https://api.cohere.com/v1/embed-jobs/${id}/cancel`);
const response = await fetch(url, {
method: "POST",
headers: {
Authorization: "Bearer " + auth.apiKey,
},
body: undefined,
});
if (!response.ok) {
const text = await response.text();
throw new Error(`${response.status} ${text}`);
}
return await response.text();
}
Submitted by hugo697 428 days ago