Tools
Memory Lancedb Ollama
Ollama embedding support for OpenClaw memory-lancedb plugin
Configuration Example
{
"embedding": {
"provider": "ollama",
"model": "nomic-embed-text",
"baseUrl": "http://localhost:11434"
},
"dbPath": "~/.openclaw/memory/lancedb",
"autoCapture": true,
"autoRecall": true
}
README
# PR: Add Ollama Support to memory-lancedb Plugin
## Summary
This PR adds local Ollama embedding support to the OpenClaw memory-lancedb plugin, removing the dependency on OpenAI API for embeddings.
## Changes
### 1. config.ts
- Added `EmbeddingProvider` type: `"openai" | "ollama"`
- Added Ollama model dimensions: `nomic-embed-text` (768), `mxbai-embed-large` (1024), `bge-m3` (1024)
- Added `baseUrl` config option for Ollama server
- Updated config schema to support both providers
### 2. index.ts
- Added `OllamaEmbeddings` class that calls `http://localhost:11434/api/embeddings`
- Added `EmbeddingProvider` interface
- Modified plugin registration to choose provider based on config
## New Config Format
### For Ollama (local):
```json
{
"embedding": {
"provider": "ollama",
"model": "nomic-embed-text",
"baseUrl": "http://localhost:11434"
},
"dbPath": "~/.openclaw/memory/lancedb",
"autoCapture": true,
"autoRecall": true
}
```
### For OpenAI (cloud - original):
```json
{
"embedding": {
"provider": "openai",
"model": "text-embedding-3-small",
"apiKey": "${OPENAI_API_KEY}"
},
"dbPath": "~/.openclaw/memory/lancedb"
}
```
## Testing
1. Verify Ollama is running with nomic-embed-text:
```bash
curl http://localhost:11434/api/tags | jq '.models[].name'
```
2. Test embedding:
```bash
curl -s http://localhost:11434/api/embeddings \
-d '{"model": "nomic-embed-text", "prompt": "test"}' | jq '.embedding | length'
```
3. After applying config, test memory_recall:
- Query: "ERC-8004 registration"
- Query: "x402 payment flow"
## Safety Rules
- [ ] Garrus reviews before merge
- [ ] Do NOT restart gateway manually
- [ ] OpenClaw will hot-reload the memory plugin
- [ ] Rollback: revert PR if errors appear
## Rollback
If issues appear:
```bash
# Revert the config to OpenAI
git revert <commit>
# Or manually set provider back to "openai"
```
---
**Status:** Ready for review
tools
Comments
Sign in to leave a comment