1import { ApifyClient } from 'apify-client';
2
3
4
5const client = new ApifyClient({
6 token: '<YOUR_API_TOKEN>',
7});
8
9
10const input = {
11 "sessionId": "my-project",
12 "memories": [
13 {
14 "text": "The customer prefers fast shipping over lower prices",
15 "metadata": {
16 "type": "preference",
17 "customer_id": "123"
18 }
19 },
20 {
21 "text": "Product X works best with Product Y for home automation",
22 "metadata": {
23 "type": "knowledge",
24 "category": "products"
25 }
26 },
27 {
28 "text": "User asked about return policy on December 10th",
29 "metadata": {
30 "type": "conversation",
31 "date": "2024-12-10"
32 }
33 }
34 ],
35 "query": "What does the customer prefer?",
36 "queries": [
37 "What does the customer prefer?",
38 "Product recommendations",
39 "Support history"
40 ],
41 "memoryIds": [
42 "mem_123",
43 "mem_456"
44 ],
45 "updates": {
46 "text": "Updated memory text",
47 "metadata": {
48 "updated": true,
49 "version": 2
50 }
51 },
52 "metadataFilter": {
53 "type": "preference"
54 },
55 "chatMessage": "What products would you recommend based on my preferences?",
56 "chatHistory": [
57 {
58 "role": "user",
59 "content": "What products do you recommend?"
60 },
61 {
62 "role": "assistant",
63 "content": "Based on your preferences, I recommend Product X."
64 }
65 ],
66 "importData": {
67 "memories": [
68 {
69 "text": "Sample memory to import",
70 "metadata": {
71 "source": "import"
72 }
73 }
74 ]
75 },
76 "actorInput": {
77 "searchStrings": [
78 "coffee shops in NYC"
79 ],
80 "maxResults": 50
81 },
82 "actorConfig": {
83 "memorizeFields": [
84 "title",
85 "description",
86 "address",
87 "rating"
88 ],
89 "limit": 100,
90 "skipDuplicates": true,
91 "enrichWithMetadata": true
92 },
93 "integrationConfig": {
94 "syntheticDataActor": "ruv/ai-synthetic-data-generator",
95 "dataType": "ecommerce",
96 "count": 100,
97 "memorizeFields": [
98 "title",
99 "description",
100 "category"
101 ]
102 },
103 "scraperConfig": {
104 "urls": [
105 "https://example.com/docs"
106 ],
107 "selector": "article",
108 "maxPages": 10
109 },
110 "tradingSymbols": [
111 "BTC",
112 "ETH",
113 "SOL"
114 ],
115 "tradingHistoryQuery": "high confidence BUY signals for BTC",
116 "tradingActorConfig": {
117 "actorId": "ruv/neural-trader-system",
118 "action": "analyze",
119 "riskProfile": "moderate",
120 "memory": 2048,
121 "timeout": 300
122 },
123 "command": "what do you know about customers"
124};
125
126
127const run = await client.actor("ruv/ai-memory-engine").call(input);
128
129
130console.log('Results from dataset');
131console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
132const { items } = await client.dataset(run.defaultDatasetId).listItems();
133items.forEach((item) => {
134 console.dir(item);
135});
136
137