Skip to main content

LangChain integration for Aerospike Vector Store

This project has been archived.

The maintainers of this project have marked this project as archived. No new releases are expected.

Project description

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:

  1. Install Poetry if you haven't already:
curl -sSL https://install.python-poetry.org | python3 -
  1. Clone the repository and install dependencies:
git clone https://github.com/aerospike/langchain-aerospike.git
cd langchain-aerospike
poetry install
  1. 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:

  1. Install the documentation dependencies:
poetry install --with docs
  1. Activate the virtual environment:
poetry shell
  1. Build the documentation:
cd docs
make html
  1. 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:

  1. Update the version in pyproject.toml
  2. Commit the changes
  3. 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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

langchain_aerospike-0.1.0.tar.gz (10.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

langchain_aerospike-0.1.0-py3-none-any.whl (12.2 kB view details)

Uploaded Python 3

File details

Details for the file langchain_aerospike-0.1.0.tar.gz.

File metadata

  • Download URL: langchain_aerospike-0.1.0.tar.gz
  • Upload date:
  • Size: 10.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.3

File hashes

Hashes for langchain_aerospike-0.1.0.tar.gz
Algorithm Hash digest
SHA256 42095c5305b42b4cf84679cf05fcfc647ae888b56fa9101db623e32b827c0a76
MD5 dc3b94685f3094363b3f59dad6eed1e8
BLAKE2b-256 5d5ce2c14fb46494679e39de7ae810af970145175e3a2ab76c56ee881de587d6

See more details on using hashes here.

File details

Details for the file langchain_aerospike-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for langchain_aerospike-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 31bb6de265c0ee33faeb3dcafea2b5153c5334c20b70aac1e5bbf2da861cb2c8
MD5 b8d29c91de05b351f908fbe6227b28f4
BLAKE2b-256 5127efd3cb23d599afadfa2bfefb9cab6899c939e9e23c21fce2fa24df1a0314

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page