apify-haystack 0.1.0a3__tar.gz → 0.1.0b2__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: apify_haystack
3
- Version: 0.1.0a3
3
+ Version: 0.1.0b2
4
4
  Summary: Apify-haystack integration
5
5
  Home-page: https://apify.com
6
6
  License: Apache-2.0
@@ -46,7 +46,7 @@ pip install apify-haystack
46
46
 
47
47
  ## Examples
48
48
 
49
- ### Crawl a website Using Apify Website Content Crawler and convert it to Haystack Documents
49
+ ### Crawl a website using Apify's Website Content Crawler and convert it to Haystack Documents
50
50
 
51
51
  You need to have an Apify account and API token to run this example.
52
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).
@@ -86,13 +86,13 @@ for d in dataset:
86
86
  print(d)
87
87
  ```
88
88
 
89
- ### More Examples
89
+ ### More examples
90
90
 
91
91
  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
92
92
 
93
- - Load a dataset from Apify and convert it to Haystack Document
94
- - Call [Website Content Crawler](https://apify.com/apify/website-content-crawler) Actor and convert the data into the Haystack Documents
95
- - Crawl website, retrieve text content, and store it in the `InMemoryDocumentStore`
93
+ - Load a dataset from Apify and convert it to a Haystack Document
94
+ - Call [Website Content Crawler](https://apify.com/apify/website-content-crawler) and convert the data into the Haystack Documents
95
+ - Crawl websites, retrieve text content, and store it in the `InMemoryDocumentStore`
96
96
  - Retrieval-Augmented Generation (RAG): Extracting text from a website & question answering
97
97
 
98
98
  ## Support
@@ -17,7 +17,7 @@ pip install apify-haystack
17
17
 
18
18
  ## Examples
19
19
 
20
- ### Crawl a website Using Apify Website Content Crawler and convert it to Haystack Documents
20
+ ### Crawl a website using Apify's Website Content Crawler and convert it to Haystack Documents
21
21
 
22
22
  You need to have an Apify account and API token to run this example.
23
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).
@@ -57,13 +57,13 @@ for d in dataset:
57
57
  print(d)
58
58
  ```
59
59
 
60
- ### More Examples
60
+ ### More examples
61
61
 
62
62
  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
63
63
 
64
- - Load a dataset from Apify and convert it to Haystack Document
65
- - Call [Website Content Crawler](https://apify.com/apify/website-content-crawler) Actor and convert the data into the Haystack Documents
66
- - Crawl website, retrieve text content, and store it in the `InMemoryDocumentStore`
64
+ - Load a dataset from Apify and convert it to a Haystack Document
65
+ - Call [Website Content Crawler](https://apify.com/apify/website-content-crawler) and convert the data into the Haystack Documents
66
+ - Crawl websites, retrieve text content, and store it in the `InMemoryDocumentStore`
67
67
  - Retrieval-Augmented Generation (RAG): Extracting text from a website & question answering
68
68
 
69
69
  ## 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.0a3"
7
+ version = "0.1.0b2"
8
8
  description = "Apify-haystack integration"
9
9
  authors = ["Apify Technologies s.r.o. <support@apify.com>"]
10
10
  homepage = "https://apify.com"
@@ -12,7 +12,7 @@ from apify_haystack.constants import HAYSTACK_ATTRIBUTE_USER_AGENT
12
12
 
13
13
  @component
14
14
  class ApifyDatasetLoader:
15
- """Load datasets produced by the `Apify Actors`.
15
+ """Load datasets produced by `Apify Actors`.
16
16
 
17
17
  Actors are serverless functions that can be used to scrape, crawl, and extract data from the web.
18
18
  For details, see https://docs.apify.com/platform/integrations/haystack
@@ -64,12 +64,12 @@ class ApifyDatasetLoader:
64
64
 
65
65
  @component
66
66
  class ApifyDatasetFromActorCall:
67
- """Get Apify dataset by calling Apify Actor.
67
+ """Get an Apify dataset by calling an Apify Actor.
68
68
 
69
- Perform call of Apify actor and load produced dataset.
69
+ Perform call of Apify Actor and load produced dataset.
70
70
  For details, see https://docs.apify.com/platform/integrations/haystack
71
71
 
72
- To use, you should have the ``apify-client`` python package installed,
72
+ To use it, you should have the ``apify-client`` python package installed,
73
73
  and the environment variable ``APIFY_API_TOKEN`` set with your API key, or pass
74
74
  `apify_api_token` as a named parameter to the constructor.
75
75
  """
@@ -147,9 +147,9 @@ class ApifyDatasetFromActorCall:
147
147
 
148
148
  @component
149
149
  class ApifyDatasetFromTaskCall:
150
- """Get Apify dataset by calling Apify Task.
150
+ """Get an Apify dataset by calling an Apify task.
151
151
 
152
- Perform call of Apify task and load produced dataset.
152
+ Perform a call of an Apify task and load the produced dataset.
153
153
  """
154
154
 
155
155
  def __init__(
@@ -171,7 +171,7 @@ class ApifyDatasetFromTaskCall:
171
171
  dataset_mapping_function (Callable): A function that takes a single
172
172
  dictionary (an Apify dataset item) and converts it to an
173
173
  instance of the Document class.
174
- build (str, optional): Optionally specifies the actor build to run.
174
+ build (str, optional): Optionally specifies the Actor build to run.
175
175
  It can be either a build tag or build number.
176
176
  memory_mbytes (int, optional): Optional memory limit for the run, in megabytes.
177
177
  timeout_secs (int, optional): Optional timeout for the run, in seconds.
@@ -1,11 +1,11 @@
1
1
  """
2
- Call Apify Actor and load a dataset to convert it to Haystack Documents.
2
+ Call an Apify Actor and load a dataset to convert it to Haystack Documents.
3
3
 
4
4
  This script demonstrates how to use Apify's Website Content Crawler to scrape text content from a specified website
5
5
  and convert the scraped data into Haystack Documents.
6
6
 
7
7
  For example, if you want to crawl and get text content from https://haystack.deepset.ai/, you can use this script
8
- to call the Apify actor and retrieve the data in a structured format.
8
+ to call the Apify Actor and retrieve the data in a structured format.
9
9
 
10
10
  The script should produce the following output (an example of a single Document):
11
11
  ......
@@ -2,7 +2,7 @@
2
2
  Load a dataset from Apify and convert it to Haystack Documents.
3
3
 
4
4
  This script demonstrates how to load a dataset from Apify and convert it into Haystack Documents.
5
- Assuming you have run an Apify actor that scraped web pages from https://docs.haystack.deepset.ai/,
5
+ Assuming you have run an Apify Actor that scraped web pages from https://docs.haystack.deepset.ai/,
6
6
  you can use the dataset ID to load the dataset and transform it into a structured format suitable for Haystack.
7
7
 
8
8
  The script should produce the following output (an example of a single Document):
@@ -1,7 +1,7 @@
1
1
  """
2
- Crawl website, scrape text content, and store it in the InMemoryDocumentStore.
2
+ Crawl websites, scrape text content, and store it in the InMemoryDocumentStore.
3
3
 
4
- This script demonstrates how to extract content from a website using the Apify actor: Website Content Crawler.
4
+ This script demonstrates how to extract content from a website using Apify's Website Content Crawler.
5
5
  The content is then cleaned, split into smaller chunks, embedded, and stored in the InMemoryDocumentStore.
6
6
 
7
7
  After the pipeline is executed, the documents are retrieved from the document store using BM25 retrieval.
@@ -64,6 +64,8 @@ retriever = InMemoryEmbeddingRetriever(document_store)
64
64
  generator = OpenAIGenerator(model="gpt-3.5-turbo")
65
65
 
66
66
  # Load documents from Apify
67
+ print("Crawling will take some time ...")
68
+ print("You can visit https://console.apify.com/actors/runs to monitor the progress")
67
69
  docs = apify_dataset_loader.run()
68
70
  embeddings = docs_embedder.run(docs.get("documents"))
69
71
  document_store.write_documents(embeddings["documents"])
@@ -97,8 +99,6 @@ pipe.connect("prompt_builder", "llm")
97
99
 
98
100
  question = "What is haystack?"
99
101
 
100
- print("Running pipeline ... crawling will take some time ...")
101
- print("You can visit https://console.apify.com/actors/runs to monitor the progress")
102
102
 
103
103
  response = pipe.run({"embedder": {"text": question}, "prompt_builder": {"question": question}})
104
104