This directory contains example scripts demonstrating how to use the MemFuse Python client library.
A comprehensive example showing how to use the synchronous MemFuse APIs, including:
- Synchronous OpenAI integration
- Basic memory operations (add, query, list messages)
- Error handling
A comprehensive example showing how to use the asynchronous MemFuse APIs, including:
- Async OpenAI integration
- Async memory operations with proper
awaitsyntax - Async context managers for automatic resource cleanup
- Concurrent operations and better performance for I/O-bound tasks
A focused example demonstrating conversation context persistence, including:
- Multi-turn conversations with automatic context retention
- How MemFuse maintains conversation history without manual tracking
- Seamless follow-up questions without repeating context
- Testing context switching between different topics
A web-based chatbot interface using Gradio with traditional responses, including:
- Interactive web UI for chatting with MemFuse-powered LLMs
- Synchronous OpenAI integration with MemFuse memory
- Non-streaming responses (complete responses appear at once)
- Gradio ChatInterface with custom examples and styling
- Proper error handling and resource cleanup
A web-based chatbot interface with real-time streaming responses, including:
- Interactive web UI with live streaming text generation
- Synchronous OpenAI integration with streaming enabled
- Real-time token-by-token response display
- Enhanced user experience with immediate feedback
- Gradio ChatInterface optimized for streaming
Note: The Gradio-based examples require the optional UI dependencies. Install with:
pip install "memfuse[ui]". If not installed, the scripts raise a clear error:Install memfuse[ui] to use the demo UI.
An example demonstrating synchronous Anthropic integration, including:
- How to use MemFuse with Anthropic's Claude models
- Synchronous API calls to Anthropic
- Basic memory operations tailored for Anthropic usage
- Asynchronous Anthropic integration with
async/await
An example demonstrating synchronous Gemini integration, including:
- How to use MemFuse with Google's Gemini models
- Synchronous API calls to Gemini
- Basic memory operations tailored for Gemini usage
- Asynchronous Gemini integration with
async/await