Retrieve Data from Weaviate for LlamaIndex
Retrieve documents from Weaviate via vector lookup or a custom GraphQL query.
Why it matters
Seamlessly integrate Weaviate vector data into your LlamaIndex applications. This asset enables efficient retrieval of documents and properties for advanced AI use cases.
Outcomes
What it gets done
Connect to Weaviate instances with host and authentication.
Specify Weaviate classes and properties for targeted data retrieval.
Retrieve documents individually or as a concatenated single Document.
Utilize retrieved data within LlamaIndex or LangChain agents.
Install
Add it to your toolbox
Run in your project directory:
curl -fsSL https://spark.entire.vc/get/li-reader-readers-weaviate | bash Overview
LlamaIndex Readers Integration: Weaviate
A LlamaIndex reader that retrieves documents from Weaviate via vector lookup by class and properties, or a custom GraphQL query. Use when you already store vector data in Weaviate and want a specific class loaded into LlamaIndex.
What it does
The Weaviate Reader retrieves documents from Weaviate through vector lookup, letting you specify a class name and the properties to pull from matched documents, or supply a custom GraphQL query for more control. It also lets you choose whether each retrieved item becomes its own separate Document object, or whether retrieved documents get concatenated into a single Document.
WeaviateReader is initialized with a host and an optional auth_client_secret for authenticated instances. load_data then takes a class_name and a list of properties to retrieve from each matching object in that class.
When to use - and when NOT to
Use it when you already store data in Weaviate as vectors and want to pull specific classes and properties into a LlamaIndex pipeline, either as individual documents or concatenated into one. Use a custom GraphQL query when the simple class-name-plus-properties interface isn't expressive enough for what you need to retrieve. Do not use it to write data into Weaviate or manage its schema - it is a read-only loader for bringing existing Weaviate content into LlamaIndex.
Capabilities
load_data retrieves objects from a named Weaviate class with specified properties, or via a custom GraphQL query, returning them as one Document per object or concatenated into a single Document.
How to install
pip install llama-index-readers-weaviate
Requires a reachable Weaviate host, with an optional authentication client secret for secured instances.
Who it's for
Developers who already store vector data in Weaviate and want a specific class's content loaded into LlamaIndex for retrieval or question-answering.
Source README
LlamaIndex Readers Integration: Weaviate
Overview
The Weaviate Reader retrieves documents from Weaviate through vector lookup. It allows you to specify a class name and properties to retrieve from documents, or to provide a custom GraphQL query. You can choose to receive separate Document objects per document or concatenate retrieved documents into one Document.
Installation
You can install the Weaviate Reader via pip:
pip install llama-index-readers-weaviate
Usage
from llama_index.readers.weaviate import WeaviateReader
### Initialize WeaviateReader with host and optional authentication
reader = WeaviateReader(
host="<Weaviate Host>", auth_client_secret="<Authentication Client Secret>"
)
### Load data from Weaviate
documents = reader.load_data(
class_name="<Class Name>", properties=["property 1", "property 2"]
)
You can follow this tutorial to learn more on how to use Weaviate Reader
This loader is designed to be used as a way to load data into
LlamaIndex and/or subsequently
used as a Tool in a LangChain Agent.
FAQ
Common questions
Discussion
Questions & comments · 0
Sign In Sign in to leave a comment.