-
Notifications
You must be signed in to change notification settings - Fork 6.3k
Expand file tree
/
Copy pathAnalyse papers from Hugging Face with AI and store them in Notion.json
More file actions
470 lines (470 loc) · 9.2 KB
/
Copy pathAnalyse papers from Hugging Face with AI and store them in Notion.json
File metadata and controls
470 lines (470 loc) · 9.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
{
"id": "FU3MrLkaTHmfdG4n",
"meta": {
"instanceId": "3294023dd650d95df294922b9d55d174ef26f4a2e6cce97c8a4ab5f98f5b8c7b",
"templateCredsSetupCompleted": true
},
"name": "Hugging Face to Notion",
"tags": [],
"nodes": [
{
"id": "32d5bfee-97f1-4e92-b62e-d09bdd9c3821",
"name": "Schedule Trigger",
"type": "n8n-nodes-base.scheduleTrigger",
"position": [
-2640,
-300
],
"parameters": {
"rule": {
"interval": [
{
"field": "weeks",
"triggerAtDay": [
1,
2,
3,
4,
5
],
"triggerAtHour": 8
}
]
}
},
"typeVersion": 1.2
},
{
"id": "b1f4078e-ac77-47ec-995c-f52fd98fafef",
"name": "If",
"type": "n8n-nodes-base.if",
"position": [
-1360,
-280
],
"parameters": {
"options": {},
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "7094d6db-1fa7-4b59-91cf-6bbd5b5f067e",
"operator": {
"type": "object",
"operation": "empty",
"singleValue": true
},
"leftValue": "={{ $json }}",
"rightValue": ""
}
]
}
},
"typeVersion": 2.2
},
{
"id": "afac08e1-b629-4467-86ef-907e4a5e8841",
"name": "Loop Over Items",
"type": "n8n-nodes-base.splitInBatches",
"position": [
-1760,
-300
],
"parameters": {
"options": {
"reset": false
}
},
"typeVersion": 3
},
{
"id": "807ba450-9c89-4f88-aa84-91f43e3adfc6",
"name": "Split Out",
"type": "n8n-nodes-base.splitOut",
"position": [
-1960,
-300
],
"parameters": {
"options": {},
"fieldToSplitOut": "url, url"
},
"typeVersion": 1
},
{
"id": "08dd3f15-2030-48f2-ab0f-f85f797268e1",
"name": "Request Hugging Face Paper",
"type": "n8n-nodes-base.httpRequest",
"position": [
-2440,
-300
],
"parameters": {
"url": "https://huggingface.co/papers",
"options": {},
"sendQuery": true,
"queryParameters": {
"parameters": [
{
"name": "date",
"value": "={{ $now.minus(1,'days').format('yyyy-MM-dd') }}"
}
]
}
},
"typeVersion": 4.2
},
{
"id": "f37ba769-d881-4aad-927d-ca1f4a68b9a1",
"name": "Extract Hugging Face Paper",
"type": "n8n-nodes-base.html",
"position": [
-2200,
-300
],
"parameters": {
"options": {},
"operation": "extractHtmlContent",
"extractionValues": {
"values": [
{
"key": "url",
"attribute": "href",
"cssSelector": ".line-clamp-3",
"returnArray": true,
"returnValue": "attribute"
}
]
}
},
"typeVersion": 1.2
},
{
"id": "94ba99bf-a33b-4311-a4e6-86490e1bb9ad",
"name": "Check Paper URL Existed",
"type": "n8n-nodes-base.notion",
"position": [
-1540,
-280
],
"parameters": {
"filters": {
"conditions": [
{
"key": "URL|url",
"urlValue": "={{ 'https://huggingface.co'+$json.url }}",
"condition": "equals"
}
]
},
"options": {},
"resource": "databasePage",
"operation": "getAll",
"databaseId": {
"__rl": true,
"mode": "list",
"value": "17b67aba-1fcc-80ae-baa1-d88ffda7ae83",
"cachedResultUrl": "https://www.notion.so/17b67aba1fcc80aebaa1d88ffda7ae83",
"cachedResultName": "huggingface-abstract"
},
"filterType": "manual"
},
"credentials": {
"notionApi": {
"id": "I5KdUzwhWnphQ862",
"name": "notion"
}
},
"typeVersion": 2.2,
"alwaysOutputData": true
},
{
"id": "ece8dee2-e444-4557-aad9-5bdcb5ecd756",
"name": "Request Hugging Face Paper Detail",
"type": "n8n-nodes-base.httpRequest",
"position": [
-1080,
-300
],
"parameters": {
"url": "={{ 'https://huggingface.co'+$('Split Out').item.json.url }}",
"options": {}
},
"typeVersion": 4.2
},
{
"id": "53b266fe-e7c4-4820-92eb-78a6ba7a6430",
"name": "OpenAI Analysis Abstract",
"type": "@n8n/n8n-nodes-langchain.openAi",
"position": [
-640,
-300
],
"parameters": {
"modelId": {
"__rl": true,
"mode": "list",
"value": "gpt-4o-2024-11-20",
"cachedResultName": "GPT-4O-2024-11-20"
},
"options": {},
"messages": {
"values": [
{
"role": "system",
"content": "Extract the following key details from the paper abstract:\n\nCore Introduction: Summarize the main contributions and objectives of the paper, highlighting its innovations and significance.\nKeyword Extraction: List 2-5 keywords that best represent the research direction and techniques of the paper.\nKey Data and Results: Extract important performance metrics, comparison results, and the paper's advantages over other studies.\nTechnical Details: Provide a brief overview of the methods, optimization techniques, and datasets mentioned in the paper.\nClassification: Assign an appropriate academic classification based on the content of the paper.\n\n\nOutput as json:\n{\n \"Core_Introduction\": \"PaSa is an advanced Paper Search agent powered by large language models that can autonomously perform a series of decisions (including invoking search tools, reading papers, and selecting relevant references) to provide comprehensive and accurate results for complex academic queries.\",\n \"Keywords\": [\n \"Paper Search Agent\",\n \"Large Language Models\",\n \"Reinforcement Learning\",\n \"Academic Queries\",\n \"Performance Benchmarking\"\n ],\n \"Data_and_Results\": \"PaSa outperforms existing baselines (such as Google, GPT-4, chatGPT) in tests using AutoScholarQuery (35k academic queries) and RealScholarQuery (real-world academic queries). For example, PaSa-7B exceeds Google with GPT-4o by 37.78% in recall@20 and 39.90% in recall@50.\",\n \"Technical_Details\": \"PaSa is optimized using reinforcement learning with the AutoScholarQuery synthetic dataset, demonstrating superior performance in multiple benchmarks.\",\n \"Classification\": [\n \"Artificial Intelligence (AI)\",\n \"Academic Search and Information Retrieval\",\n \"Natural Language Processing (NLP)\",\n \"Reinforcement Learning\"\n ]\n}\n```"
},
{
"content": "={{ $json.abstract }}"
}
]
},
"jsonOutput": true
},
"credentials": {
"openAiApi": {
"id": "LmLcxHwbzZNWxqY6",
"name": "Unnamed credential"
}
},
"typeVersion": 1.8
},
{
"id": "f491cd7f-598e-46fd-b80c-04cfa9766dfd",
"name": "Store Abstract Notion",
"type": "n8n-nodes-base.notion",
"position": [
-300,
-300
],
"parameters": {
"options": {},
"resource": "databasePage",
"databaseId": {
"__rl": true,
"mode": "list",
"value": "17b67aba-1fcc-80ae-baa1-d88ffda7ae83",
"cachedResultUrl": "https://www.notion.so/17b67aba1fcc80aebaa1d88ffda7ae83",
"cachedResultName": "huggingface-abstract"
},
"propertiesUi": {
"propertyValues": [
{
"key": "URL|url",
"urlValue": "={{ 'https://huggingface.co'+$('Split Out').item.json.url }}"
},
{
"key": "title|title",
"title": "={{ $('Extract Hugging Face Paper Abstract').item.json.title }}"
},
{
"key": "abstract|rich_text",
"textContent": "={{ $('Extract Hugging Face Paper Abstract').item.json.abstract.substring(0,2000) }}"
},
{
"key": "scrap-date|date",
"date": "={{ $today.format('yyyy-MM-dd') }}",
"includeTime": false
},
{
"key": "Classification|rich_text",
"textContent": "={{ $json.message.content.Classification.join(',') }}"
},
{
"key": "Technical_Details|rich_text",
"textContent": "={{ $json.message.content.Technical_Details }}"
},
{
"key": "Data_and_Results|rich_text",
"textContent": "={{ $json.message.content.Data_and_Results }}"
},
{
"key": "keywords|rich_text",
"textContent": "={{ $json.message.content.Keywords.join(',') }}"
},
{
"key": "Core Introduction|rich_text",
"textContent": "={{ $json.message.content.Core_Introduction }}"
}
]
}
},
"credentials": {
"notionApi": {
"id": "I5KdUzwhWnphQ862",
"name": "notion"
}
},
"typeVersion": 2.2
},
{
"id": "d5816a1c-d1fa-4be2-8088-57fbf68e6b43",
"name": "Extract Hugging Face Paper Abstract",
"type": "n8n-nodes-base.html",
"position": [
-840,
-300
],
"parameters": {
"options": {},
"operation": "extractHtmlContent",
"extractionValues": {
"values": [
{
"key": "abstract",
"cssSelector": ".text-gray-700"
},
{
"key": "title",
"cssSelector": ".text-2xl"
}
]
}
},
"typeVersion": 1.2
}
],
"active": true,
"pinData": {},
"settings": {
"executionOrder": "v1"
},
"versionId": "4b0ec2a3-253d-46d5-a4d4-1d9ff21ba4a3",
"connections": {
"If": {
"main": [
[
{
"node": "Request Hugging Face Paper Detail",
"type": "main",
"index": 0
}
],
[
{
"node": "Loop Over Items",
"type": "main",
"index": 0
}
]
]
},
"Split Out": {
"main": [
[
{
"node": "Loop Over Items",
"type": "main",
"index": 0
}
]
]
},
"Loop Over Items": {
"main": [
[],
[
{
"node": "Check Paper URL Existed",
"type": "main",
"index": 0
}
]
]
},
"Schedule Trigger": {
"main": [
[
{
"node": "Request Hugging Face Paper",
"type": "main",
"index": 0
}
]
]
},
"Store Abstract Notion": {
"main": [
[
{
"node": "Loop Over Items",
"type": "main",
"index": 0
}
]
]
},
"Check Paper URL Existed": {
"main": [
[
{
"node": "If",
"type": "main",
"index": 0
}
]
]
},
"OpenAI Analysis Abstract": {
"main": [
[
{
"node": "Store Abstract Notion",
"type": "main",
"index": 0
}
]
]
},
"Extract Hugging Face Paper": {
"main": [
[
{
"node": "Split Out",
"type": "main",
"index": 0
}
]
]
},
"Request Hugging Face Paper": {
"main": [
[
{
"node": "Extract Hugging Face Paper",
"type": "main",
"index": 0
}
]
]
},
"Request Hugging Face Paper Detail": {
"main": [
[
{
"node": "Extract Hugging Face Paper Abstract",
"type": "main",
"index": 0
}
]
]
},
"Extract Hugging Face Paper Abstract": {
"main": [
[
{
"node": "OpenAI Analysis Abstract",
"type": "main",
"index": 0
}
]
]
}
}
}