1import { ApifyClient } from 'apify-client';
2
3
4
5const client = new ApifyClient({
6 token: '<YOUR_API_TOKEN>',
7});
8
9
10const input = {
11 "requests_jsonl": `{"custom_id": "A", "method": "POST", "url": "/v1/responses", "body": {"model": "example-not-a-live-model", "input": "Synthetic A"}}
12{"custom_id": "B", "method": "POST", "url": "/v1/responses", "body": {"model": "example-not-a-live-model", "input": "Synthetic B"}}`,
13 "outputs_jsonl": `{"custom_id": "A", "response": {"status_code": 200, "body": {"output": []}, "request_id": "req_1"}, "error": null, "id": "batch_req_outputs_1"}`,
14 "errors_jsonl": `{"id": "batch_req_synthetic_error_B", "custom_id": "B", "response": null, "error": {"code": "batch_expired", "message": "Synthetic example only"}}`,
15 "policy_json": `{}`
16};
17
18
19const run = await client.actor("biztoolsus/openai-batch-result-reconciliation").call(input);
20
21
22console.log('Results from dataset');
23console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
24const { items } = await client.dataset(run.defaultDatasetId).listItems();
25items.forEach((item) => {
26 console.dir(item);
27});
28
29