ErikBjare / gptme

Your agent in your terminal, equipped with local tools: writes code, uses the terminal, browses the web, vision.
https://gptme.org/docs/
MIT License
2.64k stars 180 forks source link

refactor(rag): improve RAG manager implementation #268

Closed ErikBjare closed 3 days ago

ErikBjare commented 3 days ago

[!IMPORTANT] Refactor RAG manager to use a shared singleton, add a default collection constant, remove an unused function, and update the gptme-rag dependency.

  • RAG Manager:
    • Introduce shared singleton RAGManager via get_rag_manager() in _rag_context.py.
    • Replace rag_manager initialization in rag.py with get_rag_manager() calls.
  • Constants:
    • Add DEFAULT_COLLECTION in _rag_context.py for consistent collection naming.
  • Functions:
    • Remove unused _clear_cache() function in _rag_context.py.
  • Dependencies:
    • Update gptme-rag dependency to version 0.3.1 in pyproject.toml.

This description was created by Ellipsis for edbf5201cb1c5880e2a16b54339df65151454d6a. It will automatically update as commits are pushed.

codecov-commenter commented 3 days ago

Codecov Report

Attention: Patch coverage is 86.66667% with 2 lines in your changes missing coverage. Please review.

Project coverage is 72.52%. Comparing base (3f00be1) to head (edbf520).

:white_check_mark: All tests successful. No failed tests found.

Files with missing lines Patch % Lines
gptme/tools/rag.py 75.00% 2 Missing :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #268 +/- ## ========================================== + Coverage 72.36% 72.52% +0.15% ========================================== Files 64 64 Lines 4313 4316 +3 ========================================== + Hits 3121 3130 +9 + Misses 1192 1186 -6 ``` | [Flag](https://app.codecov.io/gh/ErikBjare/gptme/pull/268/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Erik+Bj%C3%A4reholt) | Coverage Δ | | |---|---|---| | [anthropic/claude-3-haiku-20240307](https://app.codecov.io/gh/ErikBjare/gptme/pull/268/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Erik+Bj%C3%A4reholt) | `71.24% <86.66%> (+0.15%)` | :arrow_up: | | [openai/gpt-4o-mini](https://app.codecov.io/gh/ErikBjare/gptme/pull/268/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Erik+Bj%C3%A4reholt) | `71.15% <86.66%> (+0.15%)` | :arrow_up: | Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Erik+Bj%C3%A4reholt#carryforward-flags-in-the-pull-request-comment) to find out more.

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.


🚨 Try these New Features: