1import { ApifyClient } from 'apify-client';
2
3
4
5const client = new ApifyClient({
6 token: '<YOUR_API_TOKEN>',
7});
8
9
10const input = {
11 "sourceText": "Dr. Clara Müller signed Service Agreement SA-2026-04 on 15 March 2026 in München for EUR 48,500.",
12 "promptDescription": "Extract person names, agreement identifiers, dates, locations, and monetary amounts using exact verbatim text from the document.",
13 "exampleText": "Max Weber executed Contract C-101 on 2 January 2025 in Berlin for USD 12,000.",
14 "exampleExtractions": [
15 {
16 "key": "person",
17 "value": "Max Weber"
18 },
19 {
20 "key": "agreement_id",
21 "value": "Contract C-101"
22 },
23 {
24 "key": "date",
25 "value": "2 January 2025"
26 },
27 {
28 "key": "location",
29 "value": "Berlin"
30 },
31 {
32 "key": "amount",
33 "value": "USD 12,000"
34 }
35 ]
36};
37
38
39const run = await client.actor("solutionssmart/langextract-grounded-extractor").call(input);
40
41
42console.log('Results from dataset');
43console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
44const { items } = await client.dataset(run.defaultDatasetId).listItems();
45items.forEach((item) => {
46 console.dir(item);
47});
48
49