Skip to content

Conversation

@zch0214
Copy link

@zch0214 zch0214 commented Dec 15, 2025

feat(api): Change the default configuration from multiple sources of truth to a single source of truth.

Description

This PR consolidates the configuration management for the OpenMemory API and fixes several initialization and compatibility issues.

Key Changes:

  1. Single Source of Truth: Refactored app/config.py to establish config.json as the primary configuration source, while preserving the ability to override specific settings (like vector store hosts) via environment variables for Docker compatibility.
  2. Universal LLM Support for Categorization: Updated app/utils/categorization.py to remove hardcoded OpenAI dependencies. It now reuses the global memory client's LLM configuration, enabling support for all providers (Ollama, DeepSeek, etc.) for memory categorization tasks.
  3. Config Initialization Fixes: Corrected logic in app/utils/memory.py to properly merge nested mem0 configurations, ensuring Memory.from_config receives the correct structure.
  4. Circular Import Resolution: Fixed a circular dependency between app/models.py, app/utils/memory.py, and app/utils/categorization.py by deferring imports.
  5. Cleanup: Removed openmemory/api/default_config.json to eliminate redundant configuration files.

Fixes # (issue)

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Refactor (does not change functionality, e.g. code style improvements, linting)
  • Documentation update

How Has This Been Tested?

  • Test Script (please provide)
    • Import Verification: Verified that circular imports are resolved by running: python3 -c "from app.utils.categorization import get_categories_for_memory; print('Import successful')"
    • Config Loading: Validated that config.json values are correctly loaded and environment variables (like OLLAMA_HOST) take precedence where appropriate.
    • Debugging: Verified the application startup and memory initialization in a local debugging environment.

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

@CLAassistant
Copy link

CLAassistant commented Dec 15, 2025

CLA assistant check
All committers have signed the CLA.

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.

2 participants