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 "{\"name\": \"Alice\", \"age\": 30, \"email\": \"alice@example.com\"}"
13 ],
14 "schema": {
15 "type": "object",
16 "properties": {
17 "name": {
18 "type": "string"
19 },
20 "age": {
21 "type": "integer",
22 "minimum": 0
23 },
24 "email": {
25 "type": "string",
26 "format": "email"
27 }
28 },
29 "required": [
30 "name",
31 "age",
32 "email"
33 ],
34 "additionalProperties": false
35 }
36};
37
38
39const run = await client.actor("codeclouds/llm-output-validator").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