Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: fix long term memory class name in examples #2049

Merged
merged 4 commits into from
Feb 9, 2025

Conversation

devin-ai-integration[bot]
Copy link
Contributor

Fix documentation to match actual implementation of Long Term Memory.

The documentation was showing EnhanceLongTermMemory class which doesn't exist in the codebase. Updated to show LongTermMemory which is the correct class to use.

Fixes #2026

Link to Devin run: https://app.devin.ai/sessions/460b70be72c54909be40a086f738f333
Requested by: Joe

- Replace EnhanceLongTermMemory with LongTermMemory to match actual implementation
- Update code examples to show correct usage
- Fixes #2026

Co-Authored-By: Joe Moura <[email protected]>
Copy link
Contributor Author

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add "(aside)" to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment and CI monitoring

@joaomdmoura
Copy link
Collaborator

Disclaimer: This review was made by a crew of AI Agents.

Code Review Comment for PR #2049

Overview

The pull request proposes essential updates to the documentation for the class names in the memory examples, updating outdated references to their current implementations. This change is crucial for maintaining accurate and reliable documentation that developers rely on.

Changes Summary

  • Class Name Updates:
    • EnhanceLongTermMemory has been replaced with LongTermMemory.
    • EnhanceShortTermMemory has been replaced with ShortTermMemory.
    • EnhanceEntityMemory has been replaced with EntityMemory.

Positive Aspects

  • Accuracy: The corrections ensure that the documentation is synchronized with the latest implementations, reducing confusion among developers.
  • Consistency: The updated names align with previous naming conventions, fostering consistency across the documentation.
  • Clarity: Correct class names enhance the clarity of usage and capabilities, contributing to a better developer experience.

Recommendations for Improvement

While the changes are commendable, several enhancements could further elevate the documentation's quality and usability:

  1. Add Import Statements:
    Including import statements at the beginning of code snippets improves clarity regarding dependencies across code examples. For instance:

    from crewai import Crew
    from crewai.memory import LongTermMemory, ShortTermMemory, EntityMemory
    from crewai.storage import LTMSQLiteStorage, CustomRAGStorage
  2. Type Hints for Readability:
    Incorporating type hints can significantly enhance the readability of code:

    my_crew: Crew = Crew(
        tasks: list = [...],
        process: str = "Process.sequential",
        memory: bool = True,
        long_term_memory: LongTermMemory(
            storage=LTMSQLiteStorage(
                db_path="/my_data_dir/my_crew1/long_term_memory_storage.db"
            )
        ),
    )
  3. Documentation Comments:
    Adding meaningful comments within the code helps improve understanding of the context and purpose of different components. For example:

    # Long-term memory for persistent storage across sessions
    long_term_memory=LongTermMemory(
        storage=LTMSQLiteStorage(
            db_path="/my_data_dir/my_crew1/long_term_memory_storage.db"
        )
    ),
  4. Configuration Examples:
    Including examples that show various configurations enhances the usability of the documentation:

    # Example with SQLite storage
    sqlite_crew = Crew(memory=True, long_term_memory=LongTermMemory(storage=LTMSQLiteStorage(db_path="memory.db")))
    
    # Example with PostgreSQL storage
    postgres_crew = Crew(memory=True, long_term_memory=LongTermMemory(storage=CustomRAGStorage(connection_string="postgresql://user:pass@localhost:5432/db")))

Security Considerations

  • Sensitive Data: Ensure hardcoded connection strings are removed from the examples and mention the importance of securing database credentials.
  • Environment Variables: Suggest using environment variables for managing sensitive information.

Final Verdict

The accuracy of the changes is commendable and significantly enhances the documentation quality. The proposed improvements are aimed at further strengthening the usability, clarity, and overall quality of the documentation. I recommend merging after considering these enhancements to maximize the benefit to users.

@devin-ai-integration devin-ai-integration bot mentioned this pull request Feb 6, 2025
devin-ai-integration bot and others added 3 commits February 6, 2025 19:54
- Add proper import statements
- Add type hints for better readability
- Add descriptive comments for each memory type
- Add security considerations section
- Add configuration examples section
- Use environment variables for storage paths

Co-Authored-By: Joe Moura <[email protected]>
@joaomdmoura joaomdmoura merged commit d6d98ee into main Feb 9, 2025
4 checks passed
devin-ai-integration bot added a commit that referenced this pull request Feb 9, 2025
* docs: fix long term memory class name in examples

- Replace EnhanceLongTermMemory with LongTermMemory to match actual implementation
- Update code examples to show correct usage
- Fixes #2026

Co-Authored-By: Joe Moura <[email protected]>

* docs: improve memory examples with imports, types and security

- Add proper import statements
- Add type hints for better readability
- Add descriptive comments for each memory type
- Add security considerations section
- Add configuration examples section
- Use environment variables for storage paths

Co-Authored-By: Joe Moura <[email protected]>

* Update memory.mdx

* Update memory.mdx

---------

Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Co-authored-by: Joe Moura <[email protected]>
Co-authored-by: João Moura <[email protected]>
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] Use LTM
1 participant