Skip to content

fix: add LLM provider detection and defaults to memory config#4400

Merged
whysosaket merged 2 commits intomainfrom
fix/openmemory-env-var-config-4194
Mar 19, 2026
Merged

fix: add LLM provider detection and defaults to memory config#4400
whysosaket merged 2 commits intomainfrom
fix/openmemory-env-var-config-4194

Conversation

@kartik-mem0
Copy link
Copy Markdown
Contributor

Description

Docker Compose environment variables for LLM and embedder configuration (LLM_PROVIDER, OLLAMA_BASE_URL, etc.) were silently ignored. The get_default_memory_config() function had extensive env var
detection for vector stores (10+ providers) but hardcoded the LLM and embedder to OpenAI with no env var override path. This meant users could not switch to Ollama or other providers via .env or
docker-compose.yml — the only way was through the database config API.

This PR adds env var detection for LLM and embedder providers following the exact same pattern already used for vector stores, and consolidates Docker URL fixing to cover both env-var and DB
config paths.

Supported env vars:

  • LLM_PROVIDER, LLM_MODEL, LLM_API_KEY, LLM_BASE_URL, OLLAMA_BASE_URL
  • EMBEDDER_PROVIDER, EMBEDDER_MODEL, EMBEDDER_API_KEY, EMBEDDER_BASE_URL

Config precedence: env vars set defaults → DB config overrides → Docker URL fixing → env:VAR resolution

Fixes #4194

Type of change

  • Bug fix (non-breaking change which fixes an issue)

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules
  • I have checked my code and corrected any misspellings

Maintainer Checklist

@kartik-mem0 kartik-mem0 requested a review from whysosaket March 18, 2026 14:29
@whysosaket whysosaket merged commit a029cc9 into main Mar 19, 2026
4 checks passed
@whysosaket whysosaket deleted the fix/openmemory-env-var-config-4194 branch March 19, 2026 09:56
jamebobob pushed a commit to jamebobob/mem0-vigil-recall that referenced this pull request Mar 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Docker Compose env vars (LLM_PROVIDER, OLLAMA_BASE_URL, etc.) are ignored

2 participants