1from apify_client import ApifyClient
2
3
4
5client = ApifyClient("<YOUR_API_TOKEN>")
6
7
8run_input = {
9 "promptTemplate": "Classify the sentiment of this review as positive, neutral or negative: {{review}}",
10 "outputFields": ["sentiment"],
11 "rows": [
12 {
13 "product": "Desk lamp",
14 "review": "Bright, easy to set up and it arrived a day early. Very happy with it.",
15 },
16 {
17 "product": "Phone case",
18 "review": "It fits, but the colour is duller than in the photos.",
19 },
20 {
21 "product": "Kettle",
22 "review": "Stopped working after two weeks and support never replied.",
23 },
24 ],
25}
26
27
28run = client.actor("olliolli/bulk-ai-prompt").call(run_input=run_input)
29
30
31print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
32for item in client.dataset(run.default_dataset_id).iterate_items():
33 print(item)
34
35