llama-index-vector-stores-shannonbase
A LlamaIndex VectorStore backed by MySQL 9's native
VECTOR type. If your data already lives in MySQL, you can do retrieval without
standing up a separate vector database.
It works against the three things that share the same VECTOR / STRING_TO_VECTOR
/ DISTANCE surface: ShannonBase
(open-source "MySQL for AI"), self-hosted MySQL 9, and MySQL HeatWave.
This is the LlamaIndex sibling of langchain-shannonbase. Same storage engine underneath, wired to LlamaIndex's node and query model so it drops into a LlamaIndex pipeline instead of a LangChain one.
Install
pip install "llama-index-vector-stores-shannonbase[mysql]"
Leave off [mysql] if you only want the offline in-memory backend for tests.
Usage
from llama_index.core import VectorStoreIndex, StorageContext
from llama_index.core.schema import TextNode
from llama_index.vector_stores.shannonbase import ShannonBaseVectorStore
store = ShannonBaseVectorStore(
table="documents",
host="127.0.0.1", port=3306, user="root", password="", database="rag",
)
# with an index and your embed model of choice
storage = StorageContext.from_defaults(vector_store=store)
index = VectorStoreIndex.from_documents(documents, storage_context=storage)
retriever = index.as_retriever(similarity_top_k=3)
retriever.retrieve("what's the return policy?")
The table is created on the first write, with an embedding VECTOR(n) column sized
to your embedding model, and a FULLTEXT index on the text column for hybrid search.
What's supported
add,delete(ref_doc_id), andquery- Query modes:
DEFAULT(vector),MMR(diverse results), andHYBRID(vector + MySQLFULLTEXTkeyword matching, fused by reciprocal rank) - Metadata filters:
EQ,NE,GT,GTE,LT,LTE,IN,NIN(combined withAND;ORand nested filters aren't supported yet) - cosine (default), dot, and euclidean metrics via
metric=...
For very large tables there's the same approximate IVF index as the LangChain
package, reachable through the underlying store (store.client).
Notes on scale
By default search is an exact DISTANCE scan (100% recall), which is fine into the
low millions of vectors. On MySQL HeatWave you get its automatic HNSW vector index
for free on these queries. On ShannonBase or self-hosted MySQL, build the app-side
IVF index for approximate search at scale.
Backend is shared with langchain-shannonbase
The _sql, _store, _filter, and _ivf modules are copied verbatim from
langchain-shannonbase so both packages behave identically at the storage layer.
scripts/check_backend_sync.py fails if they drift.
License
MIT
Metadata
Release files for llama-index-vector-stores-shannonbase 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| llama_index_vector_stores_shannonbase-0.1.1.tar.gz | 14.1 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| llama_index_vector_stores_shannonbase-0.1.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 29.0 kB
Release files / llama_index_vector_stores_shannonbase-0.1.1.tar.gz
| Download URL | llama_index_vector_stores_shannonbase-0.1.1.tar.gz |
|---|---|
| Size | 14.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
644b3803ce1f561a1f925bd3300c925b1f67ebc5d7841f5946c7988295b15467
|
|
BLAKE2b-256 checksum How to use checksums |
0009e724bdd4441702158c7aef7e4f438ecf6c12a4626dc4d9e13e942aafcb21
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jul 18, 2026.
Transparency logRelease files / llama_index_vector_stores_shannonbase-0.1.1-py3-none-any.whl
| Download URL | llama_index_vector_stores_shannonbase-0.1.1-py3-none-any.whl |
|---|---|
| Size | 14.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
0f7f96b3f34e10c6e4eea0458fb4c7fb90e8ca8972178f3e8c5bea8724b828dc
|
|
BLAKE2b-256 checksum How to use checksums |
45e57ff2decae8f2383529d508834a849d7a51586fea32f0cc44047010609322
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jul 18, 2026.
Transparency log