Skip to main content

LlamaIndex store wrappers that auto-provision Docker containers via py-dockerdb

Project description

llama-index-pydocker

LlamaIndex store wrappers that spin up Docker containers automatically — one import swap away.

Build PyPI License

pip install llama-index-pydocker

llama-index-pydocker wraps every LlamaIndex store class that needs a running database. Pass a localhost URL and the right Docker container starts automatically via py-dockerdb. Pass a cloud URL and the wrapper is invisible — nothing Docker-related ever runs.

Switch from a local Neo4j graph store to a hosted one without touching your pipeline. Prototype a pgvector RAG index on your laptop, deploy to RDS with one URL change. Give every student an isolated vector store in seconds.

When to use this

  • Local GraphRAG prototype: one import swap gives you a Neo4j container that LlamaIndex talks to directly, with automatic teardown via context manager.
  • pgvector RAG on localhost: spin up Postgres + pgvector, run your retrieval pipeline, shut everything down — without ever opening a terminal.
  • Qdrant / OpenSearch experiments: same pattern, same API. Swap backends by changing the URL and the docker_config type.
  • Production passthrough: point any store at a cloud endpoint and llama-index-pydocker behaves exactly like the upstream LlamaIndex class.

Supported Stores

Neo4j PostgreSQL Qdrant OpenSearch

Prerequisites

  • Python 3.10+ · Docker running · py-dockerdb installed

Installation

pip install llama-index-pydocker                   # core only
pip install "llama-index-pydocker[neo4j]"          # + Neo4j graph store
pip install "llama-index-pydocker[postgres]"       # + pgvector store
pip install "llama-index-pydocker[qdrant]"         # + Qdrant vector store
pip install "llama-index-pydocker[opensearch]"     # + OpenSearch vector store
pip install "llama-index-pydocker[all]"            # everything

Usage

Change one import. Everything else stays the same.

Neo4j Graph Store

# Before
from llama_index.graph_stores.neo4j import Neo4jGraphStore

# After — Docker container starts automatically on localhost URLs
from llama_index_pydocker import Neo4jGraphStore
from llama_index_pydocker import Neo4jGraphStore

store = Neo4jGraphStore(
    url="bolt://localhost:7687",
    password="test",
)
# Container is up, store is ready
store.stop()          # remove container when done

Use a context manager for automatic teardown:

with Neo4jGraphStore(url="bolt://localhost:7687", password="test") as store:
    index = KnowledgeGraphIndex.from_documents(docs, storage_context=..., graph_store=store)
    response = query_engine.query("Who founded Neo4j?")
# Container removed here

Point at a cloud instance — Docker is never touched:

store = Neo4jGraphStore(
    url="bolt://my-aura-instance.databases.neo4j.io:7687",
    password="secret",
)

pgvector Store

from llama_index_pydocker import PGVectorStore

store = PGVectorStore(
    connection_string="postgresql://user:pass@localhost:5432/vectordb",
    embed_dim=1536,
)
store.stop()

Override Docker config (volume, retries, container name, …):

from docker_db import PostgresConfig
from llama_index_pydocker import PGVectorStore

cfg = PostgresConfig(
    user="user", password="pass", database="vectordb",
    project_name="my-rag",
    retries=30,
)

with PGVectorStore(
    connection_string="postgresql://user:pass@localhost:5432/vectordb",
    embed_dim=1536,
    docker_config=cfg,
) as store:
    index = VectorStoreIndex.from_documents(docs, vector_store=store)
    print(index.as_query_engine().query("What is pgvector?"))

Qdrant Vector Store

from llama_index_pydocker import QdrantVectorStore

with QdrantVectorStore(
    collection_name="docs",
    url="http://localhost:6333",
) as store:
    index = VectorStoreIndex.from_documents(docs, vector_store=store)
    print(index.as_query_engine().query("What is Qdrant?"))

Remote cluster — no Docker:

store = QdrantVectorStore(
    collection_name="docs",
    url="https://my-cluster.qdrant.io:6333",
    api_key="sk-...",
)

OpenSearch Vector Store

from llama_index_pydocker import OpensearchVectorStore

with OpensearchVectorStore(
    index_name="docs",
    endpoint="http://localhost:9200",
    embed_dim=1536,
) as store:
    index = VectorStoreIndex.from_documents(docs, vector_store=store)
    print(index.as_query_engine().query("What is OpenSearch?"))

Routing logic

url / connection_string / endpoint
        │
        ▼
 is_localhost(host)?
   ┌────┴────┐
  YES        NO
   │          │
   ▼          ▼
 create    passthrough
 Docker    (behaves like
container  upstream class)

Port is always inferred from the URL, even when a docker_config is supplied.

More examples

Full runnable notebooks are in usage/:

Neo4j / GraphRAG · pgvector RAG · Qdrant · OpenSearch

Development

git clone https://github.com/amadou-6e/llama-index-pydocker.git
cd llama-index-pydocker
pip install -e ".[all]"

Testing

python -m pytest tests/test_utils.py
python -m pytest tests/test_neo4j.py
python -m pytest tests/test_postgres.py
python -m pytest tests/test_qdrant.py
python -m pytest tests/test_opensearch.py

Contributing

PRs welcome. Include tests for behaviour changes.

License

MIT License. See LICENSE.

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

llama_index_pydocker-0.1.0.tar.gz (17.5 kB view details)

Uploaded Source

Built Distribution

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

llama_index_pydocker-0.1.0-py3-none-any.whl (18.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: llama_index_pydocker-0.1.0.tar.gz
  • Upload date:
  • Size: 17.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for llama_index_pydocker-0.1.0.tar.gz
Algorithm Hash digest
SHA256 07c3ca5dfcb03b4e484e5b7acbd24ec2b0d387b4b018410aba17458c8791888d
MD5 e3c2993b7d82f837033ba3467210ce73
BLAKE2b-256 b91c153d519faff6d95314d057811b97f47ee20e91ca49d3452e49a8e240c123

See more details on using hashes here.

Provenance

The following attestation bundles were made for llama_index_pydocker-0.1.0.tar.gz:

Publisher: cicd.yml on amadou-6e/llama-index-pydocker

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

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

File metadata

File hashes

Hashes for llama_index_pydocker-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 20a719bc9dedfcd02978b3174b2c948992bc89126c8cadedb2521e5d2b539151
MD5 87a774691b8ac6095f2734985d184c26
BLAKE2b-256 91ada6281603dbd7d0829084cb8a08c3a973a91c6f95ae93bd66f2cf07ce56f1

See more details on using hashes here.

Provenance

The following attestation bundles were made for llama_index_pydocker-0.1.0-py3-none-any.whl:

Publisher: cicd.yml on amadou-6e/llama-index-pydocker

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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