Skip to content

Conversation

@ChallapalliHemanthsaikumar
Copy link
Contributor

Add configurable LLM settings for mem0_memory tool

Description

This PR adds support for configurable LLM and embedder settings in the mem0_memory tool through environment variables, allowing users to customize the language model and embedding model used for memory processing.

Changes made:

  • Add support for MEM0_LLM_PROVIDER, MEM0_LLM_MODEL, MEM0_LLM_TEMPERATURE, MEM0_LLM_MAX_TOKENS environment variables
  • Add support for MEM0_EMBEDDER_PROVIDER, MEM0_EMBEDDER_MODEL environment variables
  • Fix DEFAULT_CONFIG to properly use os.environ.get() with appropriate defaults and type conversion
  • Add comprehensive test coverage for environment variable configuration scenarios
  • Update README.md documentation with new configuration options and usage examples
  • Add module docstring documentation for new environment variables

This allows users to easily switch between different LLM providers (OpenAI, Azure OpenAI, AWS Bedrock, etc.) and models without code changes, addressing the limitation where the LLM configuration was previously hardcoded.

Related Issues

Fixes #220

Documentation PR

Documentation updates are included in this PR (README.md and module docstrings).

Type of Change

New Tool

Testing

How have you tested the change?

  • ✅ Added comprehensive unit tests covering all environment variable scenarios
  • ✅ Tested with custom environment variables (OpenAI GPT-4o, Azure OpenAI)
  • ✅ Tested default configuration fallbacks
  • ✅ Verified type conversion for temperature (float) and max_tokens (int)
  • ✅ Tested all three backend modes (Mem0 Platform, OpenSearch, FAISS)
  • ✅ Ran full test suite to ensure no regressions

Test commands run:

hatch test tests/test_mem0.py -v  # All mem0 tests pass
hatch test                       # Full test suite passes
hatch run prepare     

- Add support for MEM0_LLM_PROVIDER, MEM0_LLM_MODEL, MEM0_LLM_TEMPERATURE, MEM0_LLM_MAX_TOKENS environment variables
- Add support for MEM0_EMBEDDER_PROVIDER, MEM0_EMBEDDER_MODEL environment variables
- Fix DEFAULT_CONFIG to properly use os.environ.get() with defaults
- Add comprehensive tests for environment variable configuration
- Update README.md documentation with new configuration options
- Add module docstring documentation for new environment variables

Fixes strands-agents#220
@mehtarac mehtarac merged commit 132ed4b into strands-agents:main Aug 20, 2025
16 checks passed
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.

[BUG] Impossible to customize the LLM used by Mem0 implementation

3 participants