Metadata-Version: 2.4
Name: hypergraph-client
Version: 2.0.0
Summary: gRPC client for the Temporal Hypergraph Engine (shared by the LangChain and LlamaIndex integrations)
License: SSPL-1.0
Project-URL: Homepage, https://github.com/Divyansh151005/Temporal-Hypergraph-Engine
Project-URL: Repository, https://github.com/Divyansh151005/Temporal-Hypergraph-Engine
Project-URL: Documentation, https://github.com/Divyansh151005/Temporal-Hypergraph-Engine/tree/main/integrations/python-client
Requires-Python: >=3.10
Description-Content-Type: text/markdown
Requires-Dist: grpcio>=1.76
Requires-Dist: protobuf>=6.31.1
Requires-Dist: numpy>=1.24
Provides-Extra: test
Requires-Dist: pytest>=7; extra == "test"
Requires-Dist: pytest-asyncio>=0.21; extra == "test"

# hypergraph-client

gRPC client for the Temporal Hypergraph Engine. The LangChain and LlamaIndex
integrations are built on it.

```bash
pip install hypergraph-client
docker run -d -p 50051:50051 ghcr.io/divyansh151005/temporal-hypergraph-server
```

For development from a clone: `pip install -e integrations/python-client`.

```python
from hypergraph_client import TemporalHypergraph

memory = TemporalHypergraph(api_key="your_key")  # session "default"; pass session_id= to change
```

```python
from hypergraph_client import HypergraphClient, Hyperedge

with HypergraphClient("localhost:50051", api_key=None) as client:
    client.insert(Hyperedge("ACQUISITION", ["org:microsoft", "org:activision"], 1696118400,
                            summary="Microsoft completed its Activision acquisition"))
    for edge in client.traverse(["org:microsoft"], k_hops=3):
        print(edge.score, edge.summary)
```

- `endpoint` defaults to `$HYPERGRAPH_ENDPOINT`, then `localhost:50051`. It
  accepts `host:port`, `tcp://host:port` and `unix:///path`.
- `api_key` defaults to `$HYPERGRAPH_API_KEY` and is sent as `x-api-key`.
- `AsyncHypergraphClient` offers the same methods for `asyncio`.
- `HypergraphKVOffloadTierManager` stores and loads KV blocks over gRPC
  (`submit_store`, `submit_load`, `close`) with a vLLM-style interface. It is
  not yet loadable as a vLLM secondary tier; call it from your own code.
- `SessionMemory` stores chat messages around a `session:<id>` node; see the
  `hypergraph_client.session` module for the graph conventions.
- `HashingEmbedder` is a deterministic, dependency-free default embedder. Use a
  real embedding model for semantic retrieval quality.

Stubs in `src/hypergraph_client/_proto/` are generated; regenerate them with
`scripts/gen_protos.sh python` after editing `proto/hypergraph_service.proto`.

Tests (they start a local server; build it first with
`cargo build --release -p grpc-server`):

```bash
pytest integrations/python-client
```
