Maintained by deepset

Integration: Weaviate
Use a Weaviate database with Haystack
Table of Contents
Overview
Installation
Use pip
to install Weaviate:
pip install weaviate-haystack
Usage
Once installed, initialize your Weaviate database to use it with Haystack.
In this example, we use the temporary embedded version for simplicity. To use a self-hosted Docker container or Weaviate Cloud Service, take a look at the docs.
from haystack_integrations.document_stores.weaviate import WeaviateDocumentStore
from weaviate.embedded import EmbeddedOptions
document_store = WeaviateDocumentStore(embedded_options=EmbeddedOptions())
Writing Documents to WeaviateDocumentStore
To write documents to WeaviateDocumentStore
, create an indexing pipeline.
from haystack.components.file_converters import TextFileToDocument
from haystack.components.writers import DocumentWriter
indexing = Pipeline()
indexing.add_component("converter", TextFileToDocument())
indexing.add_component("writer", DocumentWriter(document_store))
indexing.connect("converter", "writer")
indexing.run({"converter": {"paths": file_paths}})
License
weaviate-haystack
is distributed under the terms of the
Apache-2.0 license.