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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: apify_haystack
3
- Version: 0.1.1
3
+ Version: 0.1.2
4
4
  Summary: Apify-haystack integration
5
5
  Home-page: https://apify.com
6
6
  License: Apache-2.0
@@ -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.1"
7
+ version = "0.1.2"
8
8
  description = "Apify-haystack integration"
9
9
  authors = ["Apify Technologies s.r.o. <support@apify.com>"]
10
10
  homepage = "https://apify.com"
@@ -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 using BM25 retrieval.
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: query='Haystack'")
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