Add support for self-hosted OpenAI-compatible embedding servers:
- Add `embedding.baseUrl` config option for custom endpoint URL
- Add `embedding.dimensions` config option to override vector dimensions
- Remove model enum restriction to allow any model name
- Update Embeddings class to pass baseURL to OpenAI client
This enables users to run local embedding models (e.g., via llama.cpp,
text-embeddings-inference, or other OpenAI-compatible servers) instead
of requiring the OpenAI API.
Example config:
```json
{
"embedding": {
"apiKey": "not-needed",
"baseUrl": "http://localhost:8080/v1",
"model": "my-local-model",
"dimensions": 4096
}
}
```
84 lines
2.1 KiB
JSON
84 lines
2.1 KiB
JSON
{
|
|
"id": "memory-lancedb",
|
|
"kind": "memory",
|
|
"uiHints": {
|
|
"embedding.apiKey": {
|
|
"label": "OpenAI API Key",
|
|
"sensitive": true,
|
|
"placeholder": "sk-proj-...",
|
|
"help": "API key for embeddings (use 'not-needed' for local servers)"
|
|
},
|
|
"embedding.model": {
|
|
"label": "Embedding Model",
|
|
"placeholder": "text-embedding-3-small",
|
|
"help": "Embedding model name"
|
|
},
|
|
"embedding.baseUrl": {
|
|
"label": "Custom Endpoint URL",
|
|
"placeholder": "http://localhost:8080/v1",
|
|
"help": "Custom OpenAI-compatible embedding endpoint (for local/self-hosted servers)",
|
|
"advanced": true
|
|
},
|
|
"embedding.dimensions": {
|
|
"label": "Vector Dimensions",
|
|
"placeholder": "1536",
|
|
"help": "Override vector dimensions (required for custom models not in built-in list)",
|
|
"advanced": true
|
|
},
|
|
"dbPath": {
|
|
"label": "Database Path",
|
|
"placeholder": "~/.clawdbot/memory/lancedb",
|
|
"advanced": true
|
|
},
|
|
"autoCapture": {
|
|
"label": "Auto-Capture",
|
|
"help": "Automatically capture important information from conversations"
|
|
},
|
|
"autoRecall": {
|
|
"label": "Auto-Recall",
|
|
"help": "Automatically inject relevant memories into context"
|
|
}
|
|
},
|
|
"configSchema": {
|
|
"type": "object",
|
|
"additionalProperties": false,
|
|
"properties": {
|
|
"embedding": {
|
|
"type": "object",
|
|
"additionalProperties": false,
|
|
"properties": {
|
|
"apiKey": {
|
|
"type": "string"
|
|
},
|
|
"model": {
|
|
"type": "string"
|
|
},
|
|
"baseUrl": {
|
|
"type": "string",
|
|
"description": "Custom OpenAI-compatible endpoint URL"
|
|
},
|
|
"dimensions": {
|
|
"type": "number",
|
|
"description": "Override vector dimensions for custom models"
|
|
}
|
|
},
|
|
"required": [
|
|
"apiKey"
|
|
]
|
|
},
|
|
"dbPath": {
|
|
"type": "string"
|
|
},
|
|
"autoCapture": {
|
|
"type": "boolean"
|
|
},
|
|
"autoRecall": {
|
|
"type": "boolean"
|
|
}
|
|
},
|
|
"required": [
|
|
"embedding"
|
|
]
|
|
}
|
|
}
|