AutoGPT icon indicating copy to clipboard operation
AutoGPT copied to clipboard

Add Qdrant as a long memory backend.

Open wangxuqi opened this issue 2 years ago β€’ 11 comments

Hi there! For this pull request, I have read your announcement carefully.

Background

As I notice there are many vector databases provided in chatgpt-retrieve-plugin. I think all the vector databases can be used by you as a long-term memory. So this is the first commit to add the most easier used one 'Qdrant'. And I am willing to implement them all!

Changes

This commit only "Add Qdrant as a long memory backend." what I do is:

  • Implement QdrantMemory based on MemoryProviderSingleton
  • add 'qdrant' option in "memory/init.py"
  • add 'qdrant-client' in requirements.txt
  • add unit test and integration test in 'qdrant_memory_test.py' and 'qdrant_memory_tests.py'

Documentation

The implement is very clear in-code comments. I just implement all your API and test all them to work.

  • def add(self, data)
  • def get(self, data)
  • def clear(self)
  • def get_relevant(self, data, num_relevant=5)
  • def get_stats(self)

Test Plan

  • Unit test in 'qdrant_memory_test.py'
  • IntegrationTest in 'qdrant_memory_tests.py'
  • Test step: Lauch a Qdrant docker instance docker run -p "6333:6333" -p "6334:6334" qdrant/qdrant:v1.0.3 and then just run all the related cases.
  • I've also tested with the following instructions:
Enter up to 5 goals for your AI:  For example: Increase net worth, Grow Twitter Account, Develop and manage multiple businesses autonomously'
Enter nothing to load defaults, enter nothing when finished.
Goal 1: Visit a website which provides today's news.
Goal 2: Summarize the articles and write the results to text files
Goal 3: Terminate
Goal 4: 
Using memory of type: QdrantMemory
SUMMARIZE TODAY'S LEADING NEWS THOUGHTS:  I need to determine which news website to visit and then summarize 
...

PR Quality Checklist

  • [x] My pull request is atomic and focuses on a single change.
  • [x] I have thoroughly tested my changes with multiple different prompts.
  • [x] I have considered potential risks and mitigations for my changes.
  • [x] I have documented my changes clearly and comprehensively.
  • [x] I have not snuck in any "extra" small tweaks changes

wangxuqi avatar Apr 15 '23 08:04 wangxuqi

@wangxuqi There are conflicts now

nponeccop avatar Apr 15 '23 13:04 nponeccop

@wangxuqi There are conflicts now

The conflict is caused by another long memory 'Milvus' merged. I have resolved the conflict.

wangxuqi avatar Apr 15 '23 15:04 wangxuqi

@nponeccop As I solve the conflict , I find the merged 'Milvus memory' code is very poor. With no tests and even not worked. Also the package import is wrong and the milvs.py is not under the correct directory. Please review the pull request again https://github.com/Significant-Gravitas/Auto-GPT/pull/801 or I will fixed it later.

wangxuqi avatar Apr 15 '23 16:04 wangxuqi

Fix conflict with another merged PR 1658. As I see you have add a potential plugin label. I think it maybe a better way to fit all chatgpt-retrieve-plugin. vector databases. Try to do this later.

wangxuqi avatar Apr 16 '23 02:04 wangxuqi

Ops! Conflict with README.md again. resolve it. Hope this time no more conflicts.

wangxuqi avatar Apr 17 '23 01:04 wangxuqi

CI broken fixed by https://github.com/Significant-Gravitas/Auto-GPT/pull/2061

wangxuqi avatar Apr 17 '23 02:04 wangxuqi

This pull request has conflicts with the base branch, please resolve those so we can evaluate the pull request.

github-actions[bot] avatar Apr 18 '23 23:04 github-actions[bot]

Conflicts have been resolved! πŸŽ‰ A maintainer will review the pull request shortly.

github-actions[bot] avatar Apr 19 '23 02:04 github-actions[bot]

This pull request has conflicts with the base branch, please resolve those so we can evaluate the pull request.

github-actions[bot] avatar Apr 22 '23 12:04 github-actions[bot]

Conflicts have been resolved! πŸŽ‰ A maintainer will review the pull request shortly.

github-actions[bot] avatar Apr 22 '23 15:04 github-actions[bot]

Codecov Report

Patch coverage: 14.06% and project coverage change: -0.46 :warning:

Comparison is base (8e8a5a1) 36.22% compared to head (0457470) 35.77%.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1515      +/-   ##
==========================================
- Coverage   36.22%   35.77%   -0.46%     
==========================================
  Files          60       61       +1     
  Lines        2849     2913      +64     
  Branches      471      477       +6     
==========================================
+ Hits         1032     1042      +10     
- Misses       1755     1808      +53     
- Partials       62       63       +1     
Impacted Files Coverage Ξ”
autogpt/memory/qdrant.py 4.00% <4.00%> (ΓΈ)
autogpt/memory/__init__.py 43.07% <41.66%> (-0.32%) :arrow_down:
autogpt/config/config.py 75.00% <100.00%> (+0.35%) :arrow_up:

... and 1 file with indirect coverage changes

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Do you have feedback about the report comment? Let us know in this issue.

codecov[bot] avatar Apr 22 '23 15:04 codecov[bot]

This pull request has conflicts with the base branch, please resolve those so we can evaluate the pull request.

github-actions[bot] avatar Apr 26 '23 18:04 github-actions[bot]

This is a mass message from the AutoGPT core team. Our apologies for the ongoing delay in processing PRs. This is because we are re-architecting the AutoGPT core!

For more details (and for infor on joining our Discord), please refer to: https://github.com/Significant-Gravitas/Auto-GPT/wiki/Architecting

p-i- avatar May 05 '23 00:05 p-i-

Hey, I've marked this as don't merge until the Memory Fixes are in. Sorry to keep it on hold longer, just no real way to test/validate functionality until the fixes are in

ntindle avatar May 25 '23 16:05 ntindle

Hey, I've marked this as don't merge until the Memory Fixes are in. Sorry to keep it on hold longer, just no real way to test/validate functionality until the fixes are in

As I see the discussion https://github.com/Significant-Gravitas/Auto-GPT/discussions/4280. So close the pr for now. Thanks for your attention and reply. Wish you all good.

wangxuqi avatar May 26 '23 03:05 wangxuqi