Skip to main content

memhq-llamaindex

MemHQ adapter for LlamaIndex (Python). Drop-in chat memory and retriever backed by the MemHQ hosted API. Sync and async both supported.

Install

pip install memhq-llamaindex

Quickstart — Chat memory

import os
from llama_index.llms.openai import OpenAI
from llama_index.core.agent import ReActAgent

from memhq_llamaindex import MemHQMemory

memory = MemHQMemory(
    api_key=os.environ["MEMHQ_API_KEY"],
    session_id="conv_42",
    user_id="user_42",
)

agent = ReActAgent.from_tools(
    tools=[],
    llm=OpenAI(model="gpt-4o-mini"),
    memory=memory,
)

reply = agent.chat("What's my favorite coffee order?")

Quickstart — Retriever

from llama_index.core.query_engine import RetrieverQueryEngine
from memhq_llamaindex import MemHQRetriever

retriever = MemHQRetriever(
    api_key=os.environ["MEMHQ_API_KEY"],
    user_id="user_42",
    limit=8,
)

engine = RetrieverQueryEngine.from_args(retriever)
answer = engine.query("Summarize pricing discussion")

Configuration

Argument Description
api_key MemHQ project API key. Falls back to MEMHQ_API_KEY.
user_id External user id. Required.
session_id Thread anchor for the memory adapter.
recall_limit Memories surfaced per memory read. Default 10.
limit Memories returned per retriever query. Default 10.
mode "hybrid" (default), "vector", or "lexical".
base_url Override the API base.

Reference

Full reference: https://docs.memhq.ai/sdks/llamaindex-py

Metadata

Release files for memhq-llamaindex 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 memhq-llamaindex 0.1.0
File Size Uploaded
memhq_llamaindex-0.1.0.tar.gz 8.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for memhq-llamaindex 0.1.0
File Interpreter ABI Platform
memhq_llamaindex-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 18.9 kB

Release files / memhq_llamaindex-0.1.0.tar.gz

Download URL memhq_llamaindex-0.1.0.tar.gz
Size 8.8 kB
Tags Source
SHA-256 checksum
How to use checksums
8d45ea545219775ee785b7485daab38f48f24d9f31b88c18ae3b20b044768f56
BLAKE2b-256 checksum
How to use checksums
a4a1161b6253744304b9e0049da359328048b74bb1aafb9855b744746262876f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.8

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

Download URL memhq_llamaindex-0.1.0-py3-none-any.whl
Size 10.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1cbdd1a9549c77419442cde1cf9e825f80d1820e9fd393e137f14de2775d4193
BLAKE2b-256 checksum
How to use checksums
9166c33f1dac3b27bdcb8e2725a1075d53d1c46b9210a3a9a65f85e46e72168e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.8

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

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