1import { ApifyClient } from 'apify-client';
2
3
4
5const client = new ApifyClient({
6 token: '<YOUR_API_TOKEN>',
7});
8
9
10const input = {
11 "answers": [
12 {
13 "id": "sample-a",
14 "query": "Analytics for small shops",
15 "provider": "Sample engine A",
16 "answer": "Acme Analytics is one option. See [Acme guide](https://docs.acme.example/guide?utm_source=demo). Northstar is also mentioned.",
17 "citations": [
18 {
19 "url": "https://docs.acme.example/guide?utm_source=demo#top"
20 }
21 ]
22 },
23 {
24 "id": "sample-b",
25 "query": "Analytics for small shops",
26 "provider": "Sample engine B",
27 "answer": "Northstar is an option. [Independent comparison](https://review.example/compare) mentions Acme without linking its site."
28 }
29 ],
30 "brands": [
31 {
32 "name": "Acme",
33 "aliases": [
34 "Acme Analytics"
35 ],
36 "domains": [
37 "acme.example"
38 ]
39 },
40 {
41 "name": "Northstar",
42 "domains": [
43 "northstar.example"
44 ]
45 }
46 ]
47};
48
49
50const run = await client.actor("danielmichalek/ai-answer-citation-auditor").call(input);
51
52
53console.log('Results from dataset');
54console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
55const { items } = await client.dataset(run.defaultDatasetId).listItems();
56items.forEach((item) => {
57 console.dir(item);
58});
59
60