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

Feat mock openai embed for document_store and memory UTs #939

Merged
merged 6 commits into from
Feb 28, 2024

Conversation

better629
Copy link
Collaborator

Background
img_v3_027r_42894c4f-d861-4618-9390-32a3f021b56g

To make the UT work without openai api-key, then can run the autotest

Features

  • Feat mock openai embed for document_store and memory UTs

Feature Docs

Influence

Result

(metagpt_v2) MacBook-Pro:MetaGPT xxx$ pytest -s tests/metagpt/memory/test_longterm_memory.py
2024-02-27 14:08:29.227 | INFO     | metagpt.const:get_metagpt_package_root:29 - Package root set to /Users/xxx/work/code/MetaGPT
============================================================================== test session starts ===============================================================================

tests/metagpt/memory/test_longterm_memory.py 2024-02-27 14:08:33.266 | INFO     | metagpt.memory.memory_storage:_load:44 - Missing at least one of index_file/store_file, load failed and return None
2024-02-27 14:08:33.266 | WARNING  | metagpt.memory.longterm_memory:recover_memory:35 - It may the first time to run Agent UTUserLtm(Product Manager), the long-term memory is empty
2024-02-27 14:08:33.505 | INFO     | metagpt.memory.memory_storage:add:89 - Agent UTUserLtm(Product Manager)'s memory_storage add a message
2024-02-27 14:08:33.508 | INFO     | metagpt.memory.memory_storage:add:89 - Agent UTUserLtm(Product Manager)'s memory_storage add a message
2024-02-27 14:08:33.509 | INFO     | metagpt.memory.memory_storage:add:89 - Agent UTUserLtm(Product Manager)'s memory_storage add a message
2024-02-27 14:08:33.682 | WARNING  | metagpt.memory.longterm_memory:recover_memory:37 - Agent UTUserLtm(Product Manager) has existing memory storage with 3 messages and has recovered them.
2024-02-27 14:08:33.683 | WARNING  | metagpt.memory.longterm_memory:recover_memory:37 - Agent UTUserLtm(Product Manager) has existing memory storage with 3 messages and has recovered them.

-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
========================================================================= 1 passed, 3 warnings in 1.88s ==========================================================================
(metagpt_v2) MacBook-Pro:MetaGPT xxx$ pytest -s tests/metagpt/memory/test_memory_storage.py
2024-02-27 14:09:11.922 | INFO     | metagpt.const:get_metagpt_package_root:29 - Package root set to /Users/xxx/work/code/MetaGPT
============================================================================== test session starts ===============================================================================

tests/metagpt/memory/test_memory_storage.py 2024-02-27 14:09:16.919 | INFO     | metagpt.memory.memory_storage:_load:44 - Missing at least one of index_file/store_file, load failed and return None
2024-02-27 14:09:17.392 | INFO     | metagpt.memory.memory_storage:add:89 - Agent UTUser1(Product Manager)'s memory_storage add a message
.2024-02-27 14:09:17.670 | INFO     | metagpt.memory.memory_storage:_load:44 - Missing at least one of index_file/store_file, load failed and return None
2024-02-27 14:09:17.673 | INFO     | metagpt.memory.memory_storage:add:89 - Agent UTUser2(Architect)'s memory_storage add a message

-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
========================================================================= 2 passed, 3 warnings in 2.19s ==========================================================================
(metagpt_v2) MacBook-Pro:MetaGPT xxx$ pytest -s tests/metagpt/document_store/test_faiss_store.py
2024-02-27 14:09:48.579 | INFO     | metagpt.const:get_metagpt_package_root:29 - Package root set to /Users/xxx/work/code/MetaGPT
============================================================================== test session starts ===============================================================================

tests/metagpt/document_store/test_faiss_store.py 2024-02-27 14:09:53.740 | INFO     | metagpt.roles.role:_act:399 - John Smith(Sales): to do SearchAndSummarize(SearchAndSummarize)
2024-02-27 14:09:53.764 | ERROR    | metagpt.actions.search_and_summarize:run:132 - empty rsp...
2024-02-27 14:09:53.765 | INFO     | tests.metagpt.document_store.test_faiss_store:test_search_json:35 - Sales:
.2024-02-27 14:09:54.133 | INFO     | metagpt.roles.role:_act:399 - John Smith(Sales): to do SearchAndSummarize(SearchAndSummarize)
2024-02-27 14:09:54.135 | ERROR    | metagpt.actions.search_and_summarize:run:132 - empty rsp...
2024-02-27 14:09:54.135 | INFO     | tests.metagpt.document_store.test_faiss_store:test_search_xlsx:46 - Sales:

========================================================================= 3 passed, 6 warnings in 3.17s ==========================================================================

Other

@codecov-commenter
Copy link

codecov-commenter commented Feb 27, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 83.71%. Comparing base (344bbd1) to head (9ec5626).

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@            Coverage Diff             @@
##              dev     #939      +/-   ##
==========================================
+ Coverage   82.85%   83.71%   +0.85%     
==========================================
  Files         225      225              
  Lines       12444    12444              
==========================================
+ Hits        10311    10417     +106     
+ Misses       2133     2027     -106     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@better629 better629 changed the base branch from dev to main February 27, 2024 10:05
Copy link
Owner

@geekan geekan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@geekan geekan merged commit b17cc3f into geekan:main Feb 28, 2024
1 of 3 checks passed
@better629 better629 deleted the feat_mock branch March 1, 2024 06:16
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.

4 participants