apify-haystack 0.1.1__tar.gz → 0.1.2__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.1 → apify_haystack-0.1.2}/PKG-INFO +1 -1
- {apify_haystack-0.1.1 → apify_haystack-0.1.2}/pyproject.toml +1 -1
- {apify_haystack-0.1.1 → apify_haystack-0.1.2}/src/apify_haystack/examples/crawl_and_process_data.py +9 -3
- {apify_haystack-0.1.1 → apify_haystack-0.1.2}/LICENSE +0 -0
- {apify_haystack-0.1.1 → apify_haystack-0.1.2}/README.md +0 -0
- {apify_haystack-0.1.1 → apify_haystack-0.1.2}/src/apify_haystack/__init__.py +0 -0
- {apify_haystack-0.1.1 → apify_haystack-0.1.2}/src/apify_haystack/apify_dataset.py +0 -0
- {apify_haystack-0.1.1 → apify_haystack-0.1.2}/src/apify_haystack/constants.py +0 -0
- {apify_haystack-0.1.1 → apify_haystack-0.1.2}/src/apify_haystack/examples/apify_actor_call.py +0 -0
- {apify_haystack-0.1.1 → apify_haystack-0.1.2}/src/apify_haystack/examples/apify_dataset_load.py +0 -0
- {apify_haystack-0.1.1 → apify_haystack-0.1.2}/src/apify_haystack/examples/rag_with_crawled_website.py +0 -0
{apify_haystack-0.1.1 → apify_haystack-0.1.2}/src/apify_haystack/examples/crawl_and_process_data.py
RENAMED
|
@@ -4,7 +4,8 @@ Crawl websites, scrape text content, and store it in the InMemoryDocumentStore.
|
|
|
4
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
|
-
After the pipeline is executed, the documents are retrieved from the document store
|
|
7
|
+
After the pipeline is executed, the documents are retrieved from the document store
|
|
8
|
+
using BM25 retrieval and vector similarity.
|
|
8
9
|
|
|
9
10
|
The script should produce the following output (an example of a single Document):
|
|
10
11
|
......
|
|
@@ -20,7 +21,7 @@ import os
|
|
|
20
21
|
|
|
21
22
|
from dotenv import load_dotenv
|
|
22
23
|
from haystack import Document, Pipeline
|
|
23
|
-
from haystack.components.embedders import OpenAIDocumentEmbedder
|
|
24
|
+
from haystack.components.embedders import OpenAIDocumentEmbedder, OpenAITextEmbedder
|
|
24
25
|
from haystack.components.preprocessors import DocumentCleaner, DocumentSplitter
|
|
25
26
|
from haystack.components.writers import DocumentWriter
|
|
26
27
|
from haystack.document_stores.in_memory import InMemoryDocumentStore
|
|
@@ -83,7 +84,12 @@ pipe.run({"document_loader": {}})
|
|
|
83
84
|
|
|
84
85
|
print(f"Added {document_store.count_documents()} to vector from Website Content Crawler")
|
|
85
86
|
|
|
86
|
-
print("Retrieving documents from the document store
|
|
87
|
+
print("Retrieving documents from the document store using BM25")
|
|
87
88
|
print("query='Haystack'")
|
|
88
89
|
for doc in document_store.bm25_retrieval("Haystack", top_k=1):
|
|
89
90
|
print(doc)
|
|
91
|
+
|
|
92
|
+
print("Retrieving documents from the document store using vector similarity")
|
|
93
|
+
print("query='What is Haystack'")
|
|
94
|
+
for doc in document_store.embedding_retrieval(OpenAITextEmbedder().run("Haystack")["embedding"], top_k=1):
|
|
95
|
+
print(doc)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{apify_haystack-0.1.1 → apify_haystack-0.1.2}/src/apify_haystack/examples/apify_actor_call.py
RENAMED
|
File without changes
|
{apify_haystack-0.1.1 → apify_haystack-0.1.2}/src/apify_haystack/examples/apify_dataset_load.py
RENAMED
|
File without changes
|
|
File without changes
|