apify-haystack 0.0.1a6__tar.gz → 0.1.0a1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {apify_haystack-0.0.1a6 → apify_haystack-0.1.0a1}/PKG-INFO +37 -2
- {apify_haystack-0.0.1a6 → apify_haystack-0.1.0a1}/README.md +36 -1
- {apify_haystack-0.0.1a6 → apify_haystack-0.1.0a1}/pyproject.toml +1 -1
- {apify_haystack-0.0.1a6 → apify_haystack-0.1.0a1}/src/apify_haystack/examples/apify_actor_call.py +3 -1
- apify_haystack-0.0.1a6/src/apify_haystack/main.py +0 -5
- {apify_haystack-0.0.1a6 → apify_haystack-0.1.0a1}/LICENSE +0 -0
- {apify_haystack-0.0.1a6 → apify_haystack-0.1.0a1}/src/apify_haystack/__init__.py +0 -0
- {apify_haystack-0.0.1a6 → apify_haystack-0.1.0a1}/src/apify_haystack/apify_dataset.py +0 -0
- {apify_haystack-0.0.1a6 → apify_haystack-0.1.0a1}/src/apify_haystack/constants.py +0 -0
- {apify_haystack-0.0.1a6 → apify_haystack-0.1.0a1}/src/apify_haystack/examples/apify_dataset_load.py +0 -0
- {apify_haystack-0.0.1a6 → apify_haystack-0.1.0a1}/src/apify_haystack/examples/crawl_and_process_data.py +0 -0
- {apify_haystack-0.0.1a6 → apify_haystack-0.1.0a1}/src/apify_haystack/examples/rag_with_crawled_website.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: apify_haystack
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.1.0a1
|
|
4
4
|
Summary: Apify-haystack integration
|
|
5
5
|
Home-page: https://apify.com
|
|
6
6
|
License: Apache-2.0
|
|
@@ -46,7 +46,42 @@ pip install apify-haystack
|
|
|
46
46
|
|
|
47
47
|
## Examples
|
|
48
48
|
|
|
49
|
-
|
|
49
|
+
Crawl website using Apify Website Content Crawler and convert it to Haystack Documents
|
|
50
|
+
|
|
51
|
+
```python
|
|
52
|
+
from dotenv import load_dotenv
|
|
53
|
+
from haystack import Document
|
|
54
|
+
|
|
55
|
+
from apify_haystack import ApifyDatasetFromActorCall
|
|
56
|
+
|
|
57
|
+
# Sey APIFY-API-TOKEN here or load it from .env file
|
|
58
|
+
apify_token = "" or load_dotenv()
|
|
59
|
+
|
|
60
|
+
actor_id = "apify/website-content-crawler"
|
|
61
|
+
run_input = {
|
|
62
|
+
"maxCrawlPages": 3, # limit the number of pages to crawl
|
|
63
|
+
"startUrls": [{"url": "https://haystack.deepset.ai/"}],
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
def dataset_mapping_function(dataset_item: dict) -> Document:
|
|
68
|
+
return Document(content=dataset_item.get("text"), meta={"url": dataset_item.get("url")})
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
actor = ApifyDatasetFromActorCall(
|
|
72
|
+
actor_id=actor_id, run_input=run_input, dataset_mapping_function=dataset_mapping_function
|
|
73
|
+
)
|
|
74
|
+
print(f"Calling the Apify actor {actor_id} ... crawling will take some time ...")
|
|
75
|
+
print("You can monitor the progress at: https://console.apify.com/actors/runs")
|
|
76
|
+
|
|
77
|
+
dataset = actor.run().get("documents")
|
|
78
|
+
|
|
79
|
+
print(f"Loaded {len(dataset)} documents from the Apify Actor {actor_id}:")
|
|
80
|
+
for d in dataset:
|
|
81
|
+
print(d)
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
See other examples in the [examples directory](https://github.com/apify/apify-haystack/blob/master/src/apify_haystack/examples) for more examples, here is a list of few of them
|
|
50
85
|
|
|
51
86
|
- Load a dataset from Apify and convert it to Haystack Documents
|
|
52
87
|
- Call Apify Actor and load a dataset to convert it to Haystack Documents
|
|
@@ -17,7 +17,42 @@ pip install apify-haystack
|
|
|
17
17
|
|
|
18
18
|
## Examples
|
|
19
19
|
|
|
20
|
-
|
|
20
|
+
Crawl website using Apify Website Content Crawler and convert it to Haystack Documents
|
|
21
|
+
|
|
22
|
+
```python
|
|
23
|
+
from dotenv import load_dotenv
|
|
24
|
+
from haystack import Document
|
|
25
|
+
|
|
26
|
+
from apify_haystack import ApifyDatasetFromActorCall
|
|
27
|
+
|
|
28
|
+
# Sey APIFY-API-TOKEN here or load it from .env file
|
|
29
|
+
apify_token = "" or load_dotenv()
|
|
30
|
+
|
|
31
|
+
actor_id = "apify/website-content-crawler"
|
|
32
|
+
run_input = {
|
|
33
|
+
"maxCrawlPages": 3, # limit the number of pages to crawl
|
|
34
|
+
"startUrls": [{"url": "https://haystack.deepset.ai/"}],
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
def dataset_mapping_function(dataset_item: dict) -> Document:
|
|
39
|
+
return Document(content=dataset_item.get("text"), meta={"url": dataset_item.get("url")})
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
actor = ApifyDatasetFromActorCall(
|
|
43
|
+
actor_id=actor_id, run_input=run_input, dataset_mapping_function=dataset_mapping_function
|
|
44
|
+
)
|
|
45
|
+
print(f"Calling the Apify actor {actor_id} ... crawling will take some time ...")
|
|
46
|
+
print("You can monitor the progress at: https://console.apify.com/actors/runs")
|
|
47
|
+
|
|
48
|
+
dataset = actor.run().get("documents")
|
|
49
|
+
|
|
50
|
+
print(f"Loaded {len(dataset)} documents from the Apify Actor {actor_id}:")
|
|
51
|
+
for d in dataset:
|
|
52
|
+
print(d)
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
See other examples in the [examples directory](https://github.com/apify/apify-haystack/blob/master/src/apify_haystack/examples) for more examples, here is a list of few of them
|
|
21
56
|
|
|
22
57
|
- Load a dataset from Apify and convert it to Haystack Documents
|
|
23
58
|
- Call Apify Actor and load a dataset to convert it to Haystack Documents
|
|
@@ -4,7 +4,7 @@ build-backend = "poetry.core.masonry.api"
|
|
|
4
4
|
|
|
5
5
|
[tool.poetry]
|
|
6
6
|
name = "apify_haystack"
|
|
7
|
-
version = "0.
|
|
7
|
+
version = "0.1.0a1"
|
|
8
8
|
description = "Apify-haystack integration"
|
|
9
9
|
authors = ["Apify Technologies s.r.o. <support@apify.com>"]
|
|
10
10
|
homepage = "https://apify.com"
|
{apify_haystack-0.0.1a6 → apify_haystack-0.1.0a1}/src/apify_haystack/examples/apify_actor_call.py
RENAMED
|
@@ -36,7 +36,9 @@ def dataset_mapping_function(dataset_item: dict) -> Document:
|
|
|
36
36
|
actor = ApifyDatasetFromActorCall(
|
|
37
37
|
actor_id=actor_id, run_input=run_input, dataset_mapping_function=dataset_mapping_function
|
|
38
38
|
)
|
|
39
|
-
print(f"Calling Apify actor {actor_id} ... crawling will take some time ...")
|
|
39
|
+
print(f"Calling the Apify actor {actor_id} ... crawling will take some time ...")
|
|
40
|
+
print("You can monitor the progress at: https://console.apify.com/actors/runs")
|
|
41
|
+
|
|
40
42
|
dataset = actor.run().get("documents")
|
|
41
43
|
|
|
42
44
|
print(f"Loaded {len(dataset)} documents from the Apify Actor {actor_id}:")
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{apify_haystack-0.0.1a6 → apify_haystack-0.1.0a1}/src/apify_haystack/examples/apify_dataset_load.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|