1import { ApifyClient } from 'apify-client';
2
3
4
5const client = new ApifyClient({
6 token: '<YOUR_API_TOKEN>',
7});
8
9
10const input = {
11 "texts": [
12 "```json\n{\n name: 'Alice',\n \"role\": 'Engineer',\n \"skills\": ['Python', 'AI',],\n \"active\": True,\n}\n```\nHope this helps!",
13 "Here is the product info: {\"id\": 101, \"title\": \"Smart Lamp\", \"price\": 29.99, \"inStock\": true}"
14 ],
15 "schema": {
16 "type": "object",
17 "properties": {
18 "name": {
19 "type": "string"
20 },
21 "role": {
22 "type": "string"
23 },
24 "skills": {
25 "type": "array",
26 "items": {
27 "type": "string"
28 }
29 },
30 "active": {
31 "type": "boolean"
32 }
33 },
34 "required": [
35 "name",
36 "role"
37 ]
38 }
39};
40
41
42const run = await client.actor("kadev-code/llm-json-repair").call(input);
43
44
45console.log('Results from dataset');
46console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
47const { items } = await client.dataset(run.defaultDatasetId).listItems();
48items.forEach((item) => {
49 console.dir(item);
50});
51
52