1import { ApifyClient } from 'apify-client';
2
3
4
5const client = new ApifyClient({
6 token: '<YOUR_API_TOKEN>',
7});
8
9
10const input = {
11 "documents": [
12 {
13 "id": "guide",
14 "sourceUrl": "https://example.com/guide",
15 "html": "<!doctype html><html lang=\"en\"><head><title>Knowledge guide</title></head><body><nav>Navigation</nav><main id=\"guide\"><h1>Knowledge guide</h1><h2 id=\"delivery\">Delivery</h2><p>Standard delivery takes three working days. Contact support when a delivery needs review.</p><h2 id=\"returns\">Returns</h2><p>Keep the order reference when requesting a return. Review the original source before publishing an answer.</p><pre>status = \"ready\"\n preserve_indentation()</pre></main></body></html>"
16 },
17 {
18 "id": "support",
19 "sourceUrl": "https://example.com/support",
20 "html": "<html lang=\"en\"><head><title>Support</title></head><body><main id=\"support\"><h1>Support</h1><p>Include the order reference and a description of the issue. This is supplied demonstration content, not a fetched support page.</p></main></body></html>"
21 }
22 ],
23 "chunkChars": 200
24};
25
26
27const run = await client.actor("danielmichalek/website-to-rag-dataset").call(input);
28
29
30console.log('Results from dataset');
31console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
32const { items } = await client.dataset(run.defaultDatasetId).listItems();
33items.forEach((item) => {
34 console.dir(item);
35});
36
37