1from apify_client import ApifyClient
2
3
4
5client = ApifyClient("<YOUR_API_TOKEN>")
6
7
8run_input = {
9 "before": """Key / Document,Key / Section,Key / Product,Key / Version,Key / Locale,Key / Visibility,Content Hash,Evidence Hash,Source Revision,Extractor Version,Validity
10fictional-document-1,fictional-section-1,fictional-assistant,1,en,private,aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa,bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb,source-r1,fictional-extractor-1,valid
11""",
12 "after": """Key / Document,Key / Section,Key / Product,Key / Version,Key / Locale,Key / Visibility,Content Hash,Evidence Hash,Source Revision,Extractor Version,Validity
13fictional-document-1,fictional-section-1,fictional-assistant,1,en,private,aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa,cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc,source-r2,fictional-extractor-1,valid
14""",
15 "items": """Id,Kind,Product,Version,Locale,Visibility
16fictional-test-1,test,fictional-assistant,1,en,private
17fictional-test-2,test,fictional-assistant,1,en,private
18""",
19 "links": """From Source / Document,From Source / Section,From Source / Product,From Source / Version,From Source / Locale,From Source / Visibility,From Item / Id,From Item / Kind,From Item / Product,From Item / Version,From Item / Locale,From Item / Visibility,To / Id,To / Kind,To / Product,To / Version,To / Locale,To / Visibility
20fictional-document-1,fictional-section-1,fictional-assistant,1,en,private,\\N,\\N,\\N,\\N,\\N,\\N,fictional-test-1,test,fictional-assistant,1,en,private
21\\N,\\N,\\N,\\N,\\N,\\N,fictional-unknown-answer,answer,fictional-assistant,1,en,private,fictional-test-2,test,fictional-assistant,1,en,private
22""",
23 "mapping": {
24 "before_capture": {
25 "capture_id": "fictional-source-before",
26 "scope_id": "fictional-declared-source-inventory",
27 "captured_at": "2026-10-01T12:00:00Z",
28 "capture_state": "complete",
29 },
30 "after_capture": {
31 "capture_id": "fictional-source-after",
32 "scope_id": "fictional-declared-source-inventory",
33 "captured_at": "2026-10-02T12:00:00Z",
34 "capture_state": "complete",
35 },
36 "null_token": "\\N",
37 "before": [
38 {
39 "source": "Key / Document",
40 "target": "key.document",
41 },
42 {
43 "source": "Key / Section",
44 "target": "key.section",
45 },
46 {
47 "source": "Key / Product",
48 "target": "key.product",
49 },
50 {
51 "source": "Key / Version",
52 "target": "key.version",
53 },
54 {
55 "source": "Key / Locale",
56 "target": "key.locale",
57 },
58 {
59 "source": "Key / Visibility",
60 "target": "key.visibility",
61 },
62 {
63 "source": "Content Hash",
64 "target": "content_hash",
65 },
66 {
67 "source": "Evidence Hash",
68 "target": "evidence_hash",
69 },
70 {
71 "source": "Source Revision",
72 "target": "source_revision",
73 },
74 {
75 "source": "Extractor Version",
76 "target": "extractor_version",
77 },
78 {
79 "source": "Validity",
80 "target": "validity",
81 },
82 ],
83 "after": [
84 {
85 "source": "Key / Document",
86 "target": "key.document",
87 },
88 {
89 "source": "Key / Section",
90 "target": "key.section",
91 },
92 {
93 "source": "Key / Product",
94 "target": "key.product",
95 },
96 {
97 "source": "Key / Version",
98 "target": "key.version",
99 },
100 {
101 "source": "Key / Locale",
102 "target": "key.locale",
103 },
104 {
105 "source": "Key / Visibility",
106 "target": "key.visibility",
107 },
108 {
109 "source": "Content Hash",
110 "target": "content_hash",
111 },
112 {
113 "source": "Evidence Hash",
114 "target": "evidence_hash",
115 },
116 {
117 "source": "Source Revision",
118 "target": "source_revision",
119 },
120 {
121 "source": "Extractor Version",
122 "target": "extractor_version",
123 },
124 {
125 "source": "Validity",
126 "target": "validity",
127 },
128 ],
129 "items": [
130 {
131 "source": "Id",
132 "target": "id",
133 },
134 {
135 "source": "Kind",
136 "target": "kind",
137 },
138 {
139 "source": "Product",
140 "target": "product",
141 },
142 {
143 "source": "Version",
144 "target": "version",
145 },
146 {
147 "source": "Locale",
148 "target": "locale",
149 },
150 {
151 "source": "Visibility",
152 "target": "visibility",
153 },
154 ],
155 "links": [
156 {
157 "source": "From Source / Document",
158 "target": "from_source.document",
159 },
160 {
161 "source": "From Source / Section",
162 "target": "from_source.section",
163 },
164 {
165 "source": "From Source / Product",
166 "target": "from_source.product",
167 },
168 {
169 "source": "From Source / Version",
170 "target": "from_source.version",
171 },
172 {
173 "source": "From Source / Locale",
174 "target": "from_source.locale",
175 },
176 {
177 "source": "From Source / Visibility",
178 "target": "from_source.visibility",
179 },
180 {
181 "source": "From Item / Id",
182 "target": "from_item.id",
183 },
184 {
185 "source": "From Item / Kind",
186 "target": "from_item.kind",
187 },
188 {
189 "source": "From Item / Product",
190 "target": "from_item.product",
191 },
192 {
193 "source": "From Item / Version",
194 "target": "from_item.version",
195 },
196 {
197 "source": "From Item / Locale",
198 "target": "from_item.locale",
199 },
200 {
201 "source": "From Item / Visibility",
202 "target": "from_item.visibility",
203 },
204 {
205 "source": "To / Id",
206 "target": "to.id",
207 },
208 {
209 "source": "To / Kind",
210 "target": "to.kind",
211 },
212 {
213 "source": "To / Product",
214 "target": "to.product",
215 },
216 {
217 "source": "To / Version",
218 "target": "to.version",
219 },
220 {
221 "source": "To / Locale",
222 "target": "to.locale",
223 },
224 {
225 "source": "To / Visibility",
226 "target": "to.visibility",
227 },
228 ],
229 },
230}
231
232
233run = client.actor("critd/answer-drift-planner").call(run_input=run_input)
234
235
236print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
237for item in client.dataset(run.default_dataset_id).iterate_items():
238 print(item)
239
240