apify-haystack 0.1.0a1__tar.gz → 0.1.0a2__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.1.0a1 → apify_haystack-0.1.0a2}/PKG-INFO +12 -7
- {apify_haystack-0.1.0a1 → apify_haystack-0.1.0a2}/README.md +11 -6
- {apify_haystack-0.1.0a1 → apify_haystack-0.1.0a2}/pyproject.toml +1 -1
- {apify_haystack-0.1.0a1 → apify_haystack-0.1.0a2}/src/apify_haystack/__init__.py +2 -2
- {apify_haystack-0.1.0a1 → apify_haystack-0.1.0a2}/src/apify_haystack/examples/apify_actor_call.py +6 -3
- {apify_haystack-0.1.0a1 → apify_haystack-0.1.0a2}/src/apify_haystack/examples/crawl_and_process_data.py +5 -2
- {apify_haystack-0.1.0a1 → apify_haystack-0.1.0a2}/src/apify_haystack/examples/rag_with_crawled_website.py +5 -2
- {apify_haystack-0.1.0a1 → apify_haystack-0.1.0a2}/LICENSE +0 -0
- {apify_haystack-0.1.0a1 → apify_haystack-0.1.0a2}/src/apify_haystack/apify_dataset.py +0 -0
- {apify_haystack-0.1.0a1 → apify_haystack-0.1.0a2}/src/apify_haystack/constants.py +0 -0
- {apify_haystack-0.1.0a1 → apify_haystack-0.1.0a2}/src/apify_haystack/examples/apify_dataset_load.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: apify_haystack
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.0a2
|
|
4
4
|
Summary: Apify-haystack integration
|
|
5
5
|
Home-page: https://apify.com
|
|
6
6
|
License: Apache-2.0
|
|
@@ -38,7 +38,7 @@ Haystack offers an ecosystem of tools for building, managing, and deploying sear
|
|
|
38
38
|
|
|
39
39
|
## Installation
|
|
40
40
|
|
|
41
|
-
Apify-haystack is available
|
|
41
|
+
Apify-haystack is available at the [`apify-haystack`](https://pypi.org/project/apify-haystack/) PyPI package.
|
|
42
42
|
|
|
43
43
|
```sh
|
|
44
44
|
pip install apify-haystack
|
|
@@ -46,7 +46,12 @@ pip install apify-haystack
|
|
|
46
46
|
|
|
47
47
|
## Examples
|
|
48
48
|
|
|
49
|
-
Crawl website using Apify Website Content Crawler and convert it to Haystack Documents
|
|
49
|
+
Crawl website using Apify Website Content Crawler and convert it to Haystack Documents.
|
|
50
|
+
|
|
51
|
+
You need to have an Apify account and API token to run this example.
|
|
52
|
+
You can start with a free account at [Apify](https://apify.com/) and get your [API token](https://docs.apify.com/platform/integrations/api).
|
|
53
|
+
|
|
54
|
+
In the example below, specify `apify_api_token` and run the script:
|
|
50
55
|
|
|
51
56
|
```python
|
|
52
57
|
from dotenv import load_dotenv
|
|
@@ -55,7 +60,7 @@ from haystack import Document
|
|
|
55
60
|
from apify_haystack import ApifyDatasetFromActorCall
|
|
56
61
|
|
|
57
62
|
# Sey APIFY-API-TOKEN here or load it from .env file
|
|
58
|
-
|
|
63
|
+
apify_api_token = "" or load_dotenv()
|
|
59
64
|
|
|
60
65
|
actor_id = "apify/website-content-crawler"
|
|
61
66
|
run_input = {
|
|
@@ -83,9 +88,9 @@ for d in dataset:
|
|
|
83
88
|
|
|
84
89
|
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
|
|
85
90
|
|
|
86
|
-
- Load a dataset from Apify and convert it to Haystack
|
|
87
|
-
- Call
|
|
88
|
-
- Crawl website,
|
|
91
|
+
- Load a dataset from Apify and convert it to Haystack Document
|
|
92
|
+
- Call [Website Content Crawler](https://apify.com/apify/website-content-crawler) Actor and convert the data into the Haystack Documents
|
|
93
|
+
- Crawl website, retrieve text content, and store it in the `InMemoryDocumentStore`
|
|
89
94
|
- Retrieval-Augmented Generation (RAG): Extracting text from a website & question answering
|
|
90
95
|
|
|
91
96
|
## Support
|
|
@@ -9,7 +9,7 @@ Haystack offers an ecosystem of tools for building, managing, and deploying sear
|
|
|
9
9
|
|
|
10
10
|
## Installation
|
|
11
11
|
|
|
12
|
-
Apify-haystack is available
|
|
12
|
+
Apify-haystack is available at the [`apify-haystack`](https://pypi.org/project/apify-haystack/) PyPI package.
|
|
13
13
|
|
|
14
14
|
```sh
|
|
15
15
|
pip install apify-haystack
|
|
@@ -17,7 +17,12 @@ pip install apify-haystack
|
|
|
17
17
|
|
|
18
18
|
## Examples
|
|
19
19
|
|
|
20
|
-
Crawl website using Apify Website Content Crawler and convert it to Haystack Documents
|
|
20
|
+
Crawl website using Apify Website Content Crawler and convert it to Haystack Documents.
|
|
21
|
+
|
|
22
|
+
You need to have an Apify account and API token to run this example.
|
|
23
|
+
You can start with a free account at [Apify](https://apify.com/) and get your [API token](https://docs.apify.com/platform/integrations/api).
|
|
24
|
+
|
|
25
|
+
In the example below, specify `apify_api_token` and run the script:
|
|
21
26
|
|
|
22
27
|
```python
|
|
23
28
|
from dotenv import load_dotenv
|
|
@@ -26,7 +31,7 @@ from haystack import Document
|
|
|
26
31
|
from apify_haystack import ApifyDatasetFromActorCall
|
|
27
32
|
|
|
28
33
|
# Sey APIFY-API-TOKEN here or load it from .env file
|
|
29
|
-
|
|
34
|
+
apify_api_token = "" or load_dotenv()
|
|
30
35
|
|
|
31
36
|
actor_id = "apify/website-content-crawler"
|
|
32
37
|
run_input = {
|
|
@@ -54,9 +59,9 @@ for d in dataset:
|
|
|
54
59
|
|
|
55
60
|
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
|
|
56
61
|
|
|
57
|
-
- Load a dataset from Apify and convert it to Haystack
|
|
58
|
-
- Call
|
|
59
|
-
- Crawl website,
|
|
62
|
+
- Load a dataset from Apify and convert it to Haystack Document
|
|
63
|
+
- Call [Website Content Crawler](https://apify.com/apify/website-content-crawler) Actor and convert the data into the Haystack Documents
|
|
64
|
+
- Crawl website, retrieve text content, and store it in the `InMemoryDocumentStore`
|
|
60
65
|
- Retrieval-Augmented Generation (RAG): Extracting text from a website & question answering
|
|
61
66
|
|
|
62
67
|
## Support
|
|
@@ -4,7 +4,7 @@ build-backend = "poetry.core.masonry.api"
|
|
|
4
4
|
|
|
5
5
|
[tool.poetry]
|
|
6
6
|
name = "apify_haystack"
|
|
7
|
-
version = "0.1.
|
|
7
|
+
version = "0.1.0a2"
|
|
8
8
|
description = "Apify-haystack integration"
|
|
9
9
|
authors = ["Apify Technologies s.r.o. <support@apify.com>"]
|
|
10
10
|
homepage = "https://apify.com"
|
|
@@ -2,6 +2,6 @@ from importlib import metadata
|
|
|
2
2
|
|
|
3
3
|
__version__ = metadata.version("apify-haystack")
|
|
4
4
|
|
|
5
|
-
from apify_haystack.apify_dataset import ApifyDatasetFromActorCall, ApifyDatasetLoader
|
|
5
|
+
from apify_haystack.apify_dataset import ApifyDatasetFromActorCall, ApifyDatasetFromTaskCall, ApifyDatasetLoader
|
|
6
6
|
|
|
7
|
-
__all__ = ["ApifyDatasetLoader", "ApifyDatasetFromActorCall", "
|
|
7
|
+
__all__ = ["ApifyDatasetLoader", "ApifyDatasetFromActorCall", "ApifyDatasetFromTaskCall"]
|
{apify_haystack-0.1.0a1 → apify_haystack-0.1.0a2}/src/apify_haystack/examples/apify_actor_call.py
RENAMED
|
@@ -19,8 +19,8 @@ from haystack import Document
|
|
|
19
19
|
|
|
20
20
|
from apify_haystack import ApifyDatasetFromActorCall
|
|
21
21
|
|
|
22
|
-
#
|
|
23
|
-
|
|
22
|
+
# Set APIFY-API-TOKEN here or load it from .env file
|
|
23
|
+
apify_api_token = "" or load_dotenv()
|
|
24
24
|
|
|
25
25
|
actor_id = "apify/website-content-crawler"
|
|
26
26
|
run_input = {
|
|
@@ -34,7 +34,10 @@ def dataset_mapping_function(dataset_item: dict) -> Document:
|
|
|
34
34
|
|
|
35
35
|
|
|
36
36
|
actor = ApifyDatasetFromActorCall(
|
|
37
|
-
actor_id=actor_id,
|
|
37
|
+
actor_id=actor_id,
|
|
38
|
+
run_input=run_input,
|
|
39
|
+
dataset_mapping_function=dataset_mapping_function,
|
|
40
|
+
apify_api_token=str(apify_api_token),
|
|
38
41
|
)
|
|
39
42
|
print(f"Calling the Apify actor {actor_id} ... crawling will take some time ...")
|
|
40
43
|
print("You can monitor the progress at: https://console.apify.com/actors/runs")
|
|
@@ -31,7 +31,7 @@ from apify_haystack import ApifyDatasetFromActorCall
|
|
|
31
31
|
load_dotenv()
|
|
32
32
|
|
|
33
33
|
# Set APIFY-API-TOKEN here or use it from .env file
|
|
34
|
-
|
|
34
|
+
apify_api_token = "" or os.getenv("APIFY_API_TOKEN")
|
|
35
35
|
openai_api_key = "" or os.getenv("OPENAI_API_KEY")
|
|
36
36
|
|
|
37
37
|
actor_id = "apify/website-content-crawler"
|
|
@@ -46,7 +46,10 @@ def dataset_mapping_function(dataset_item: dict) -> Document:
|
|
|
46
46
|
|
|
47
47
|
|
|
48
48
|
document_loader = ApifyDatasetFromActorCall(
|
|
49
|
-
actor_id=actor_id,
|
|
49
|
+
actor_id=actor_id,
|
|
50
|
+
run_input=run_input,
|
|
51
|
+
dataset_mapping_function=dataset_mapping_function,
|
|
52
|
+
apify_api_token=apify_api_token,
|
|
50
53
|
)
|
|
51
54
|
|
|
52
55
|
document_store = InMemoryDocumentStore()
|
|
@@ -33,7 +33,7 @@ from apify_haystack import ApifyDatasetFromActorCall
|
|
|
33
33
|
|
|
34
34
|
# Set APIFY-API-TOKEN here or use it from .env file
|
|
35
35
|
load_dotenv()
|
|
36
|
-
|
|
36
|
+
apify_api_token = "" or os.getenv("APIFY_API_TOKEN")
|
|
37
37
|
openai_api_key = "" or os.getenv("OPENAI_API_KEY")
|
|
38
38
|
|
|
39
39
|
actor_id = "apify/website-content-crawler"
|
|
@@ -48,7 +48,10 @@ def dataset_mapping_function(dataset_item: dict) -> Document:
|
|
|
48
48
|
|
|
49
49
|
|
|
50
50
|
apify_dataset_loader = ApifyDatasetFromActorCall(
|
|
51
|
-
actor_id=actor_id,
|
|
51
|
+
actor_id=actor_id,
|
|
52
|
+
run_input=run_input,
|
|
53
|
+
dataset_mapping_function=dataset_mapping_function,
|
|
54
|
+
apify_api_token=apify_api_token,
|
|
52
55
|
)
|
|
53
56
|
|
|
54
57
|
# Components
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{apify_haystack-0.1.0a1 → apify_haystack-0.1.0a2}/src/apify_haystack/examples/apify_dataset_load.py
RENAMED
|
File without changes
|