langchain-infinispan
An integration package connecting Infinispan and LangChain.
Installation
pip install langchain-infinispan
Usage
from langchain_infinispan import InfinispanVectorStore
from langchain_openai import OpenAIEmbeddings
vector_store = InfinispanVectorStore(
embedding=OpenAIEmbeddings(),
cache_name="my_vectors",
ispn_url="http://localhost:11222",
ispn_user="admin",
ispn_password="password",
)
# Add documents
vector_store.add_texts(
["Hello world", "Infinispan is fast"],
metadatas=[{"source": "greeting"}, {"source": "fact"}],
)
# Search
results = vector_store.similarity_search("hello", k=2)
With Bearer token authentication
vector_store = InfinispanVectorStore(
embedding=OpenAIEmbeddings(),
cache_name="my_vectors",
ispn_url="http://localhost:11222",
ispn_bearer_token="my-token",
)
With pre-built client
from langchain_infinispan import InfinispanVectorStore, InfinispanClient
client = InfinispanClient(
url="http://localhost:11222",
username="admin",
password="password",
)
vector_store = InfinispanVectorStore(
embedding=OpenAIEmbeddings(),
cache_name="my_vectors",
client=client,
)
Distance strategies
Pass similarity=DistanceStrategy.<X> to choose the vector similarity function
(default COSINE):
DistanceStrategy |
Notes |
|---|---|
COSINE |
Default. |
L2 |
Euclidean (squared L2) distance. |
INNER_PRODUCT |
Requires unit-length (normalized) vectors — the server rejects non-normalized vectors at write time. |
MAX_INNER_PRODUCT |
Allows non-normalized vectors. |
Relevance scores from similarity_search_with_relevance_scores are normalized
to [0, 1] for all strategies.
Requirements
- Infinispan 15+ with vector search support
- Python 3.10+
Development
This project uses uv for dependency management.
cd libs/infinispan
make dev_install # uv sync --all-groups
make test # unit tests
make integration_tests # requires a running Infinispan 15+ server
See CONTRIBUTING.md for full setup, prerequisites, and how to run each test suite.
Metadata
Release files for langchain-infinispan 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| langchain_infinispan-0.1.0.tar.gz | 15.0 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| langchain_infinispan-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 31.5 kB
Release files / langchain_infinispan-0.1.0.tar.gz
| Download URL | langchain_infinispan-0.1.0.tar.gz |
|---|---|
| Size | 15.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
5d9c5062c5ced7abdff47d6cb6ae75e4c4ae09b6fd11156092097c023a178200
|
|
BLAKE2b-256 checksum How to use checksums |
9cddb106c6034452fad0edd93427a621f70dbb2c389516f009d3e78021ee4fea
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.7
|
Release files / langchain_infinispan-0.1.0-py3-none-any.whl
| Download URL | langchain_infinispan-0.1.0-py3-none-any.whl |
|---|---|
| Size | 16.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
e5fe5dc1a6410d44c1d43abb87ad9a43fd60026adb7cf9bd418f716db923ab1c
|
|
BLAKE2b-256 checksum How to use checksums |
590fec7f459892c8925a83e6ebf58498b36abc6cc2153b5073904a9ceb1ab32d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.7
|