Skip to main content

johpaz-langchain-hivedb

Adaptadores de LangChain y LangGraph para HiveDB, la base de memoria embebida para agentes (motor en Rust, sin servidor).

pip install johpaz-langchain-hivedb       # VectorStore + historial de chat
pip install "johpaz-langchain-hivedb[langgraph]" # + HiveDBStore (BaseStore de LangGraph)

Todo se apoya en una base de HiveDB abierta con johpaz-hive-db. Lo más cómodo es el embedder local: HiveDB genera los embeddings dentro del motor (multilingüe, sin llamar a ninguna API). El modelo (~470 MB) se descarga una vez por aplicación al activarlo y lo comparten todas las bases del proceso:

from hivedb import HiveDB

HiveDB.prepare_embedder(print)  # opcional: ver el avance de la primera descarga
db = HiveDB.open("./memoria", embedder="local")

Memoria a largo plazo en LangGraph — HiveDBStore

from langchain_hivedb import HiveDBStore

graph = builder.compile(store=HiveDBStore(db))

# dentro de un nodo:
store.put(("memorias", user_id), "gusto-1", {"texto": "le encanta el arroz con mariscos"})
store.search(("memorias", user_id), query="¿qué comida le gusta?", limit=3)  # por significado
  • search(..., query=...) es semántica + texto (BM25 y significado, fusión RRF); sin query recorre el namespace en orden de clave. filter admite igualdad y $eq/$ne/$gt/$gte/$lt/$lte.
  • put(..., index=False) excluye un elemento de la búsqueda; index=["campo.sub"] indexa solo esos campos.
  • Persistente y compartible entre procesos; list_namespaces con prefix/suffix/max_depth.
  • No admite TTL. list_namespaces y los filter recorren el namespace: para almacenes muy grandes usa un namespace por tema.

Documentos — HiveDBVectorStore

from langchain_hivedb import HiveDBVectorStore

store = HiveDBVectorStore(db)  # embeddings locales de HiveDB
store.add_texts(["La paella es un plato de arroz"], metadatas=[{"tema": "cocina"}])
store.similarity_search("cómo cocinar arroz", k=3, filter={"tema": "cocina"})
retriever = store.as_retriever(search_kwargs={"k": 4})

Con HiveDBVectorStore(db, embedding=MisEmbeddings()) los vectores los calcula LangChain (abre la base con vector={"dimension": N, "space_id": "..."}). Por defecto la búsqueda es híbrida; hybrid=False usa solo significado. Las puntuaciones son «mayor = más parecido». Supera la suite de contrato langchain-tests.

Historial de chat — HiveDBChatMessageHistory

from langchain_hivedb import HiveDBChatMessageHistory

history = HiveDBChatMessageHistory(db, session_id="ana")
history.add_user_message("hola")

Varios adaptadores en una misma base

Cada adaptador separa lo suyo con un ámbito (collection_name), así que HiveDBStore, HiveDBVectorStore y el historial pueden compartir la base sin mezclarse.

Lo que no incluye (todavía)

El checkpointer de LangGraph (BaseCheckpointSaver) no está implementado: su contrato (blobs por versión, historial de canales delta, prune, copy_thread…) pide una suite de conformidad que aún no hemos pasado. Mientras tanto usa InMemorySaver/SqliteSaver para el estado del grafo y HiveDBStore para la memoria que debe sobrevivir entre conversaciones.

Metadata

Release files for johpaz-langchain-hivedb 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for johpaz-langchain-hivedb 0.1.0
File Size Uploaded Provenance Actions
johpaz_langchain_hivedb-0.1.0.tar.gz 11.7 kB Without provenance Details for johpaz_langchain_hivedb-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for johpaz-langchain-hivedb 0.1.0
File Interpreter ABI Platform Actions
johpaz_langchain_hivedb-0.1.0-py3-none-any.whl Python 3 none any Details for johpaz_langchain_hivedb-0.1.0-py3-none-any.whl

Total release size: 22.9 kB

Release files / johpaz_langchain_hivedb-0.1.0.tar.gz

Download URL johpaz_langchain_hivedb-0.1.0.tar.gz
Size 11.7 kB
Tags Source
SHA-256 checksum
How to use checksums
3b7ee7735baef5851209a98edf41c479c16120e5c4a479fbcc215d22be21fa41
BLAKE2b-256 checksum
How to use checksums
9986a29c0650e7ab8e42516ccdfb9c9c060aa32b28139c59f0d1fe76a316005f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Release files / johpaz_langchain_hivedb-0.1.0-py3-none-any.whl

Download URL johpaz_langchain_hivedb-0.1.0-py3-none-any.whl
Size 11.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1b82c775bd82cbd657e3faf0de7f5aa4cb4b1e1b7926f14e5b4e987c36b24462
BLAKE2b-256 checksum
How to use checksums
f7e788334006410ec2ab888686ff0521035060cc09421fbbdbe765a18d8d1227
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Security for johpaz-langchain-hivedb 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page