Official Go SDK for PowerMem.
- 🔌 Simple Integration: Lightweight SDK with automatic
.envconfiguration loading - 🧠 Intelligent Memory: Automatic fact extraction, duplicate detection, and memory merging
- 📉 Ebbinghaus Curve: Time-decay weighting based on cognitive science principles
- 🤖 Multi-Agent Support: Independent memory spaces with flexible sharing and isolation
- ⚡ Async Operations: Full async/await support for high-performance scenarios
- 🎨 Multimodal Memory: Support for text, images, and audio content
- 💾 Flexible Storage: SQLite for development, PostgreSQL/OceanBase for production
- 🔍 Hybrid Retrieval: Vector search, full-text search, and graph traversal
go get github.com/oceanbase/powermem-go- Go 1.19 or higher
- API keys for LLM and embedding providers (OpenAI, Qwen, etc.)
- Vector database (SQLite/OceanBase/PostgreSQL)
✨ Simplest Way: Create memory from .env file automatically!
- Create a
.envfile (see.env.examplefor reference):
# LLM Configuration
LLM_PROVIDER=qwen
LLM_API_KEY=your_api_key_here
LLM_MODEL=qwen-plus
# Embedding Configuration
EMBEDDER_PROVIDER=qwen
EMBEDDER_API_KEY=your_api_key_here
EMBEDDER_MODEL=text-embedding-v4
# Database Configuration (alternative to PostgreSQL/OceanBase)
DATABASE_PROVIDER=sqlite
SQLITE_COLLECTION=memories- Use the SDK:
package main
import (
"context"
"fmt"
"log"
powermem "github.com/oceanbase/powermem-go/pkg/core"
)
func main() {
// Load configuration from .env file
config, err := powermem.LoadConfigFromEnv()
if err != nil {
log.Fatal(err)
}
// Create memory client
client, err := powermem.NewClient(config)
if err != nil {
log.Fatal(err)
}
defer client.Close()
ctx := context.Background()
userID := "user123"
// Add memory
memory, err := client.Add(ctx, "User likes coffee",
powermem.WithUserID(userID),
)
if err != nil {
log.Fatal(err)
}
fmt.Printf("Added memory: %s (ID: %d)\n", memory.Content, memory.ID)
// Search memories
results, err := client.Search(ctx, "user preferences",
powermem.WithUserIDForSearch(userID),
powermem.WithLimit(10),
)
if err != nil {
log.Fatal(err)
}
fmt.Println("\nSearch results:")
for _, result := range results {
fmt.Printf("- %s (score: %.4f)\n", result.Memory, result.Score)
}
}-
API Reference - Complete API documentation
-
Examples - Working code examples for various scenarios
PowerMem supports automatic configuration loading from .env files. Copy .env.example to .env and configure.
cp .env.example .envYou can also create configuration programmatically:
config := &powermem.Config{
LLM: powermem.LLMConfig{
Provider: "qwen",
APIKey: "your_api_key",
Model: "qwen-plus",
},
Embedder: powermem.EmbedderConfig{
Provider: "qwen",
APIKey: "your_api_key",
Model: "text-embedding-v4",
},
VectorStore: powermem.VectorStoreConfig{
Provider: "sqlite",
CollectionName: "memories",
},
}LLM Providers:
- OpenAI (GPT-4, GPT-3.5)
- Qwen (Qwen-Plus, Qwen-Turbo)
- Anthropic (Claude)
- DeepSeek
- Ollama (local)
Embedding Providers:
- OpenAI
- Qwen
Vector Stores:
- SQLite (development)
- PostgreSQL (production)
- OceanBase (production, recommended)
Run tests:
# Run all tests
make test# Install dependencies
make install
# Run linter
make lint
# Build project
make build
# Build examples
make examples
Apache License 2.0. See LICENSE for details.
- Main Repository - Python SDK and documentation
- OceanBase - Recommended production database
- Documentation - Comprehensive guides and examples