{"id":37078153,"url":"https://github.com/memfuse/memfuse-python","last_synced_at":"2026-01-14T09:03:58.552Z","repository":{"id":295446464,"uuid":"990145522","full_name":"memfuse/memfuse-python","owner":"memfuse","description":"Official Python SDK for MemFuse - the lightning-fast open-source memory layer that gives LLMs persistent, queryable memory across conversations and sessions.","archived":false,"fork":false,"pushed_at":"2025-10-10T15:08:56.000Z","size":527,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-10-19T16:52:46.383Z","etag":null,"topics":["ai","artificial-intelligence","chatbot","conversation-memory","llm","machine-learning","memory","openai","persistent-memory","python-sdk","rag","vector-database"],"latest_commit_sha":null,"homepage":"https://memfuse.vercel.app/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/memfuse.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-05-25T15:42:01.000Z","updated_at":"2025-10-10T13:11:28.000Z","dependencies_parsed_at":"2025-05-25T16:32:25.266Z","dependency_job_id":"ee509434-b9eb-498d-97b3-977218844c70","html_url":"https://github.com/memfuse/memfuse-python","commit_stats":null,"previous_names":["memfuse/memfuse-python"],"tags_count":8,"template":false,"template_full_name":null,"purl":"pkg:github/memfuse/memfuse-python","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/memfuse%2Fmemfuse-python","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/memfuse%2Fmemfuse-python/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/memfuse%2Fmemfuse-python/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/memfuse%2Fmemfuse-python/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/memfuse","download_url":"https://codeload.github.com/memfuse/memfuse-python/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/memfuse%2Fmemfuse-python/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28414737,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-14T08:38:59.149Z","status":"ssl_error","status_checked_at":"2026-01-14T08:38:43.588Z","response_time":107,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ai","artificial-intelligence","chatbot","conversation-memory","llm","machine-learning","memory","openai","persistent-memory","python-sdk","rag","vector-database"],"created_at":"2026-01-14T09:03:57.695Z","updated_at":"2026-01-14T09:03:58.545Z","avatar_url":"https://github.com/memfuse.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003ca id=\"readme-top\"\u003e\u003c/a\u003e\n\n[![GitHub license](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://github.com/Percena/MemFuse/blob/readme/LICENSE)\n\n\u003c!-- PROJECT LOGO --\u003e\n\u003cbr /\u003e\n\u003cdiv align=\"center\"\u003e\n  \u003ca href=\"https://memfuse.vercel.app/\"\u003e\n    \u003cimg src=\"https://raw.githubusercontent.com/memfuse/memfuse-python/refs/heads/main/assets/logo.png\" alt=\"MemFuse Logo\"\n         style=\"max-width: 90%; height: auto; display: block; margin: 0 auto; padding-left: 16px; padding-right: 16px;\"\u003e\n  \u003c/a\u003e\n  \u003cbr /\u003e\n\n  \u003cp align=\"center\"\u003e\n    \u003cstrong\u003eMemFuse Python SDK\u003c/strong\u003e\n    \u003cbr /\u003e\n    The official Python client for MemFuse, the open-source memory layer for LLMs.\n    \u003cbr /\u003e\n    \u003ca href=\"https://memfuse.vercel.app/\"\u003e\u003cstrong\u003eExplore the Docs »\u003c/strong\u003e\u003c/a\u003e\n    \u003cbr /\u003e\n    \u003cbr /\u003e\n    \u003ca href=\"https://memfuse.vercel.app/\"\u003eView Demo\u003c/a\u003e\n    \u0026middot;\n    \u003ca href=\"https://github.com/memfuse/memfuse-python/issues\"\u003eReport Bug\u003c/a\u003e\n    \u0026middot;\n    \u003ca href=\"https://github.com/memfuse/memfuse-python/issues\"\u003eRequest Feature\u003c/a\u003e\n  \u003c/p\u003e\n\u003c/div\u003e\n\n\u003c!-- TABLE OF CONTENTS --\u003e\n\u003cdetails\u003e\n  \u003csummary\u003eTable of Contents\u003c/summary\u003e\n  \u003col\u003e\n    \u003cli\u003e\u003ca href=\"#about-memfuse\"\u003eAbout MemFuse\u003c/a\u003e\u003c/li\u003e\n    \u003cli\u003e\u003ca href=\"#installation\"\u003eInstallation\u003c/a\u003e\u003c/li\u003e\n    \u003cli\u003e\u003ca href=\"#quick-start\"\u003eQuick Start\u003c/a\u003e\u003c/li\u003e\n    \u003cli\u003e\u003ca href=\"#examples\"\u003eExamples\u003c/a\u003e\u003c/li\u003e\n    \u003cli\u003e\u003ca href=\"#documentation\"\u003eDocumentation\u003c/a\u003e\u003c/li\u003e\n    \u003cli\u003e\u003ca href=\"#community--support\"\u003eCommunity \u0026 Support\u003c/a\u003e\u003c/li\u003e\n    \u003cli\u003e\u003ca href=\"#license\"\u003eLicense\u003c/a\u003e\u003c/li\u003e\n  \u003c/ol\u003e\n\u003c/details\u003e\n\n## About MemFuse\n\nLarge language model applications are inherently stateless by design.\nWhen the context window reaches its limit, previous conversations, user preferences, and critical information simply disappear.\n\n**MemFuse** bridges this gap by providing a persistent, queryable memory layer between your LLM and storage backend, enabling AI agents to:\n\n- **Remember** user preferences and context across sessions\n- **Recall** facts and events from thousands of interactions later\n- **Optimize** token usage by avoiding redundant chat history resending\n- **Learn** continuously and improve performance over time\n\nThis repository contains the official Python SDK for seamless integration with MemFuse servers. For comprehensive information about the MemFuse server architecture and advanced features, please visit the [MemFuse Server repository](https://github.com/memfuse/memfuse).\n\n## Recent Updates\n\n- **Enhanced Testing:** Comprehensive E2E testing with semantic memory validation\n- **Better Error Handling:** Improved error messages and logging for easier debugging  \n- **Prompt Templates:** Structured prompt management system for consistent LLM interactions\n- **Performance Benchmarks:** MSC dataset accuracy testing with 95% validation threshold\n\n## Installation\n\n\u003e **Note:** This is the standalone Client SDK repository. If you need to install and run the MemFuse server, which is essential to use the SDK, please visit the [MemFuse Server repository](https://github.com/memfuse/memfuse).\n\nYou can install the MemFuse Python SDK using one of the following methods:\n\n**Option 1: Install from PyPI (Recommended)**\n\n```bash\npip install memfuse\n```\n\n**Option 2: Install from Source**\n\n```bash\ngit clone https://github.com/memfuse/memfuse-python.git\ncd memfuse-python\npip install -e .\n```\n\n### Optional extras\n\nSome features are optional and shipped as extras:\n\n- UI (Gradio demo UIs)\n  - pip: `pip install \"memfuse[ui]\"`\n  - poetry: add the `ui` extra\n\n- Full (includes UI)\n  - pip: `pip install \"memfuse[full]\"`\n  - poetry: add the `full` extra\n\nThe Gradio-based examples in `examples/` require the `ui` extra. If you run those scripts without the extra installed, they will raise: `RuntimeError('Install memfuse[ui] to use the demo UI.')`.\n\n## Quick Start\n\nHere's a comprehensive example demonstrating how to use the MemFuse Python SDK with OpenAI:\n\n```python\nfrom memfuse.llm import OpenAI\nfrom memfuse import MemFuse\nimport os\n\n\nmemfuse_client = MemFuse(\n  # api_key=os.getenv(\"MEMFUSE_API_KEY\")\n  # base_url=os.getenv(\"MEMFUSE_BASE_URL\"),\n)\n\nmemory = memfuse_client.init(\n  user=\"alice\",\n  # agent=\"agent_default\",\n  # session=\u003crandomly-generated-uuid\u003e\n)\n\n# Initialize your LLM client with the memory scope\nllm_client = OpenAI(\n    api_key=os.getenv(\"OPENAI_API_KEY\"),  # Your OpenAI API key\n    memory=memory\n)\n\n# Make a chat completion request\nresponse = llm_client.chat.completions.create(\n    model=\"gpt-4o\", # Or any model supported by your LLM provider\n    messages=[{\"role\": \"user\", \"content\": \"I'm planning a trip to Mars. What is the gravity there?\"}]\n)\n\nprint(f\"Response: {response.choices[0].message.content}\")\n# Example Output: Response: Mars has a gravity of about 3.721 m/s², which is about 38% of Earth's gravity.\n```\n\n### Contextual Follow-up\n\nNow, ask a follow-up question. MemFuse will automatically recall relevant context from the previous conversation:\n\n```python\n# Ask a follow-up question. MemFuse automatically recalls relevant context.\nfollowup_response = llm_client.chat.completions.create(\n    model=\"gpt-4o\",\n    messages=[{\"role\": \"user\", \"content\": \"What are some challenges of living on that planet?\"}]\n)\n\nprint(f\"Follow-up: {followup_response.choices[0].message.content}\")\n# Example Output: Follow-up: Some challenges of living on Mars include its thin atmosphere, extreme temperatures, high radiation levels, and the lack of liquid water on the surface.\n```\n\nMemFuse automatically manages the retrieval of relevant information and storage of new memories from conversations within the specified `memory` scope.\n\n## Advanced Features\n\n### Memory Validation \u0026 Testing\nThe SDK includes comprehensive testing capabilities to validate memory accuracy:\n\n- **E2E Memory Tests:** Automated tests that verify conversational context retention\n- **Semantic Similarity Validation:** Uses RAGAS framework for intelligent response verification\n- **Performance Benchmarks:** MSC (Multi-Session Chat) dataset testing with accuracy metrics\n\n### Error Handling \u0026 Debugging\nEnhanced error messages provide clear guidance:\n\n- **Connection Issues:** Helpful instructions for starting the MemFuse server\n- **API Errors:** Detailed error responses with actionable information\n- **Logging:** Comprehensive logging for troubleshooting and monitoring\n\n## Examples\n\nExplore comprehensive examples in the [examples/](examples/) directory of this repository, featuring:\n\n- **Basic Operations:** Fundamental usage patterns and asynchronous operations\n- **Conversation Continuity:** Maintaining context across multiple interactions\n- **UI Integrations:** Gradio-based chatbot implementations with streaming support\n\n## Documentation\n\n- **Server Documentation:** For detailed information about the MemFuse server architecture and advanced configuration, visit the [MemFuse online documentation](https://memfuse.vercel.app/)\n- **SDK Documentation:** Comprehensive API references and guides will be available soon\n\n## Community \u0026 Support\n\nJoin our growing community:\n\n- **GitHub Discussions:** Participate in roadmap discussions, RFCs, and Q\u0026A in the [MemFuse Server repository](https://github.com/memfuse/memfuse)\n- **Issues \u0026 Features:** Report bugs or request features in this repository's [Python SDK Issues section](https://github.com/memfuse/memfuse-python/issues)\n\nIf MemFuse enhances your projects, please ⭐ star both the [server repository](https://github.com/memfuse/memfuse) and this SDK repository!\n\n## License\n\nThis MemFuse Python SDK is licensed under the Apache 2.0 License. See the [LICENSE](LICENSE) file for complete details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmemfuse%2Fmemfuse-python","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmemfuse%2Fmemfuse-python","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmemfuse%2Fmemfuse-python/lists"}