1import { ApifyClient } from 'apify-client';
2
3
4
5const client = new ApifyClient({
6 token: '<YOUR_API_TOKEN>',
7});
8
9
10const input = {
11 "conversations": [
12 {
13 "id": "apify-qa-synthetic-001",
14 "title": "Synthetic Export Normalization Example",
15 "create_time": 1760100000,
16 "update_time": 1760100060,
17 "current_node": "apify-qa-assistant-001",
18 "mapping": {
19 "apify-qa-root-001": {
20 "id": "apify-qa-root-001",
21 "parent": null,
22 "children": [
23 "apify-qa-user-001"
24 ],
25 "message": null
26 },
27 "apify-qa-user-001": {
28 "id": "apify-qa-user-001",
29 "parent": "apify-qa-root-001",
30 "children": [
31 "apify-qa-assistant-001"
32 ],
33 "message": {
34 "id": "apify-qa-message-user-001",
35 "author": {
36 "role": "user",
37 "name": null,
38 "metadata": {}
39 },
40 "create_time": 1760100001,
41 "content": {
42 "content_type": "text",
43 "parts": [
44 "Normalize this synthetic conversation export."
45 ]
46 },
47 "metadata": {}
48 }
49 },
50 "apify-qa-assistant-001": {
51 "id": "apify-qa-assistant-001",
52 "parent": "apify-qa-user-001",
53 "children": [],
54 "message": {
55 "id": "apify-qa-message-assistant-001",
56 "author": {
57 "role": "assistant",
58 "name": null,
59 "metadata": {}
60 },
61 "create_time": 1760100002,
62 "content": {
63 "content_type": "text",
64 "parts": [
65 "Synthetic export accepted for automated quality assurance."
66 ]
67 },
68 "metadata": {
69 "model_slug": "synthetic-qa-example"
70 }
71 }
72 }
73 }
74 }
75 ]
76};
77
78
79const run = await client.actor("z3n_m4nt1s/ai-chat-export-normalizer").call(input);
80
81
82console.log('Results from dataset');
83console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
84const { items } = await client.dataset(run.defaultDatasetId).listItems();
85items.forEach((item) => {
86 console.dir(item);
87});
88
89