Load documents and embeddings from Bagel into LlamaIndex
LlamaIndex reader that retrieves documents, embeddings, and metadata from Bagel.
Why it matters
Retrieve and load documents, embeddings, and metadata from Bagel vector database collections into LlamaIndex for RAG applications and AI agent workflows.
Outcomes
What it gets done
Connect to Bagel collections by name and initialize the reader
Query documents using text search or vector similarity with configurable limits
Filter results based on metadata conditions and document properties
Retrieve selected data fields including documents, embeddings, and metadata
Install
Add it to your toolbox
Run in your project directory:
curl -fsSL https://spark.entire.vc/get/li-reader-readers-bagel | bash Overview
LlamaIndex Readers Integration: Bagel
The Bagel Loader wires a Bagel collection into LlamaIndex, retrieving documents, embeddings, and metadata by vector or text query, filterable by condition, with a configurable result limit and include list. Use it when you have an existing Bagel collection and need to retrieve documents, embeddings, or metadata from it. It reads from an existing collection rather than creating one.
What it does
The Bagel Loader retrieves documents, embeddings, and metadata from a Bagel collection. BagelReader is initialized with a collection name, then load_data fetches results filterable by a query vector or query text, a result limit, metadata or document conditions, and a choice of what to include in the response. It is designed to load data into LlamaIndex and/or be used as a Tool in a LangChain Agent.
When to use - and when NOT to
Use it when you have an existing Bagel collection and need to retrieve documents, embeddings, or metadata from it by vector or text query, with filtering on the results. It reads from an already-populated Bagel collection rather than creating or writing to one.
Inputs and outputs
Install with:
pip install llama-index-readers-bagel
Initialize with your collection name, then load data:
from llama_index.core.schema import Document
from llama_index.readers.bagel import BagelReader
reader = BagelReader(collection_name="example_collection")
documents = reader.load_data(
query_vector=None,
query_texts=["example text"],
limit=10,
where=None,
where_document=None,
include=["documents", "embeddings"],
)
load_data accepts query_vector or query_texts to search by, a limit on results, where/where_document filter conditions, and an include list specifying what data (documents, embeddings, etc.) to return.
Who it's for
Developers building LlamaIndex or LangChain pipelines that need to retrieve documents, embeddings, or metadata from an existing Bagel collection.
Source README
LlamaIndex Readers Integration: Bagel
pip install llama-index-readers-bagel
Bagel Loader
Usage
from llama_index.core.schema import Document
from llama_index.readers.bagel import BagelReader
### Initialize BagelReader with the collection name
reader = BagelReader(collection_name="example_collection")
### Load data from Bagel
documents = reader.load_data(
query_vector=None,
query_texts=["example text"],
limit=10,
where=None,
where_document=None,
include=["documents", "embeddings"],
)
Features
- Retrieve documents, embeddings, and metadata efficiently.
- Filter results based on specified conditions.
- Specify what data to include in the retrieved results.
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.