This project has been archived by its maintainers, and is no longer receiving any updates.
LangChain Aerospike Vector Store
This package contains the LangChain integration for the Aerospike Vector Database. It provides a VectorStore implementation that uses Aerospike for storing and searching vectors.
Installation
You can install the package directly from PyPI:
pip install langchain-aerospike
Documentation
For more advanced usage, including configuring distance metrics, indexes, and other options, please refer to the API documentation and the Aerospike Vector Search client documentation
https://langchain-aerospike.readthedocs.io/en/latest/
https://aerospike-vector-search-python-client.readthedocs.io/en/latest/
Development Installation
This project uses Poetry for dependency management and packaging. To set up your development environment:
- Install Poetry if you haven't already:
curl -sSL https://install.python-poetry.org | python3 -
- Clone the repository and install dependencies:
git clone https://github.com/aerospike/langchain-aerospike.git
cd langchain-aerospike
poetry install
- Activate the virtual environment:
eval $(poetry env activate)
Requirements
See the pyproject.toml file dependencies section.
Running Examples
The examples in the examples/ directory require additional dependencies. You can install them with:
poetry install --with examples
This will install dependencies like langchain-huggingface which are used in the example scripts.
Usage
from langchain_aerospike.vectorstores import Aerospike
from langchain_openai import OpenAIEmbeddings
from aerospike_vector_search import Client, HostPort
# Initialize the Aerospike client
client = Client(seeds=[HostPort(host="localhost", port=3000)])
# Initialize the embeddings model
embedding_model = OpenAIEmbeddings()
# Create an Aerospike vector store
vector_store = Aerospike(
client=client,
embedding=embedding_model,
namespace="test",
set_name="vectors",
text_key="text",
metadata_key="metadata",
vector_key="vector",
)
# Add documents to the vector store
texts = ["Hello world", "Goodbye world", "Hello and goodbye"]
metadatas = [{"source": "greeting"}, {"source": "farewell"}, {"source": "mixed"}]
vector_store.add_texts(
texts=texts,
metadatas=metadatas,
)
# Search for similar documents
query = "Hello there"
docs = vector_store.similarity_search(query)
# Print the results
for doc in docs:
print(doc.page_content, doc.metadata)
Running Tests
poetry run pytest tests/
Note: Aerospike Vector Search server version 1.1.0 or newer is required to run the integration tests.
Building Documentation
Documentation is built using Sphinx and hosted on ReadTheDocs. To build the documentation locally:
- Install the documentation dependencies:
poetry install --with docs
- Activate the virtual environment:
poetry shell
- Build the documentation:
cd docs
make html
- View the documentation in your browser by opening
docs/build/html/index.html.
Continuous Integration and Deployment
This project uses GitHub Actions for continuous integration and deployment:
- Build and Release Workflow: Automatically builds and creates a GitHub Release with the package wheels when a new tag starting with 'v' is pushed
To create a new release:
- Update the version in
pyproject.toml - Commit the changes
- Create and push a new tag:
git tag v0.1.0 # Use appropriate version
git push origin v0.1.0
See the Release Process document for more details.
Migration
This package was previously part of LangChain Community Integrations and has been migrated to a standalone package following LangChain's integration guidelines.
License
This project is licensed under the MIT License - see the LICENSE file for details.
Metadata
Release files for langchain-aerospike 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_aerospike-0.1.0.tar.gz | 10.6 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| langchain_aerospike-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 22.7 kB
Release files / langchain_aerospike-0.1.0.tar.gz
| Download URL | langchain_aerospike-0.1.0.tar.gz |
|---|---|
| Size | 10.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
42095c5305b42b4cf84679cf05fcfc647ae888b56fa9101db623e32b827c0a76
|
|
BLAKE2b-256 checksum How to use checksums |
5d5ce2c14fb46494679e39de7ae810af970145175e3a2ab76c56ee881de587d6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.3
|
Release files / langchain_aerospike-0.1.0-py3-none-any.whl
| Download URL | langchain_aerospike-0.1.0-py3-none-any.whl |
|---|---|
| Size | 12.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
31bb6de265c0ee33faeb3dcafea2b5153c5334c20b70aac1e5bbf2da861cb2c8
|
|
BLAKE2b-256 checksum How to use checksums |
5127efd3cb23d599afadfa2bfefb9cab6899c939e9e23c21fce2fa24df1a0314
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.3
|