LlamaIndex VectorStore for MySQL 9's native VECTOR type — works with ShannonBase, self-hosted MySQL, and MySQL HeatWave.
Project description
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
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file llama_index_vector_stores_shannonbase-0.1.1.tar.gz.
File metadata
- Download URL: llama_index_vector_stores_shannonbase-0.1.1.tar.gz
- Upload date:
- Size: 14.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
644b3803ce1f561a1f925bd3300c925b1f67ebc5d7841f5946c7988295b15467
|
|
| MD5 |
612b316aa534bee1ecd2bbca537cc28e
|
|
| BLAKE2b-256 |
0009e724bdd4441702158c7aef7e4f438ecf6c12a4626dc4d9e13e942aafcb21
|
Provenance
The following attestation bundles were made for llama_index_vector_stores_shannonbase-0.1.1.tar.gz:
Publisher:
publish.yml on apoorva-01/llama-index-vector-stores-shannonbase
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
llama_index_vector_stores_shannonbase-0.1.1.tar.gz -
Subject digest:
644b3803ce1f561a1f925bd3300c925b1f67ebc5d7841f5946c7988295b15467 - Sigstore transparency entry: 2193533626
- Sigstore integration time:
-
Permalink:
apoorva-01/llama-index-vector-stores-shannonbase@14254ac5e330f2bf6bd8ae5c29d5b6e1965d4145 -
Branch / Tag:
refs/tags/v0.1.1 - Owner: https://github.com/apoorva-01
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@14254ac5e330f2bf6bd8ae5c29d5b6e1965d4145 -
Trigger Event:
release
-
Statement type:
File details
Details for the file llama_index_vector_stores_shannonbase-0.1.1-py3-none-any.whl.
File metadata
- Download URL: llama_index_vector_stores_shannonbase-0.1.1-py3-none-any.whl
- Upload date:
- Size: 14.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0f7f96b3f34e10c6e4eea0458fb4c7fb90e8ca8972178f3e8c5bea8724b828dc
|
|
| MD5 |
a6e2e46df2fd925988b25f2f973cc6dc
|
|
| BLAKE2b-256 |
45e57ff2decae8f2383529d508834a849d7a51586fea32f0cc44047010609322
|
Provenance
The following attestation bundles were made for llama_index_vector_stores_shannonbase-0.1.1-py3-none-any.whl:
Publisher:
publish.yml on apoorva-01/llama-index-vector-stores-shannonbase
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
llama_index_vector_stores_shannonbase-0.1.1-py3-none-any.whl -
Subject digest:
0f7f96b3f34e10c6e4eea0458fb4c7fb90e8ca8972178f3e8c5bea8724b828dc - Sigstore transparency entry: 2193533627
- Sigstore integration time:
-
Permalink:
apoorva-01/llama-index-vector-stores-shannonbase@14254ac5e330f2bf6bd8ae5c29d5b6e1965d4145 -
Branch / Tag:
refs/tags/v0.1.1 - Owner: https://github.com/apoorva-01
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@14254ac5e330f2bf6bd8ae5c29d5b6e1965d4145 -
Trigger Event:
release
-
Statement type: