Skip to content

Commit

Permalink
Merge branch 'rm_unused' into 'mgx_ops'
Browse files Browse the repository at this point in the history
update

See merge request pub/MetaGPT!409
  • Loading branch information
garylin2099 committed Oct 31, 2024
2 parents 29af174 + 01ed973 commit 8fe00a1
Show file tree
Hide file tree
Showing 21 changed files with 3 additions and 532 deletions.
58 changes: 3 additions & 55 deletions metagpt/strategy/experience_retriever.py
Original file line number Diff line number Diff line change
Expand Up @@ -668,9 +668,9 @@ def retrieve(self, context: str, exp_type: Literal["plan", "task"] = "plan") ->
if "search" in context.lower() or "click" in context.lower():
return WEB_SCRAPING_EXAMPLE
return WEB_SCRAPING_EXAMPLE_SIMPLE
elif exp_type == "task":
if "diagnose" in context.lower():
return SEARCH_SYMBOL_EXAMPLE
# elif exp_type == "task":
# if "diagnose" in context.lower():
# return SEARCH_SYMBOL_EXAMPLE
return ""


Expand Down Expand Up @@ -766,58 +766,6 @@ def retrieve(self, context: str, exp_type: Literal["plan", "task"] = "plan") ->
```
"""


SEARCH_SYMBOL_EXAMPLE = """
## Past Experience 1
Issue: _achat_completion_stream in metagpt/provider/openai_api.py produced TypeError: openai.types.completion_usage.CompletionUsage() argument after ** must be a mapping, not NoneType
Explanation: To understand the issue, we first need to know the content of the method. Since the issue provides the specific file, we should directly search the symbol `def _achat_completion_stream` in that file. Notice in previous steps, we already cd to the cloned project folder, the source code is at `metagpt` under the project folder.
```python
from metagpt.tools.libs.editor import Editor
# Initialize the Editor tool
editor = Editor()
# Search for the '_achat_completion_stream' function in the 'openai_api.py' file
symbol_to_search = "def _achat_completion_stream"
file_block = editor.search_content(symbol=symbol_to_search, root_path="metagpt/provider/openai_api.py")
# Output the file block containing the method to diagnose the problem
file_block
```
## Past Experience 2
Issue: PaiEasChatEndpoint._call_eas should return bytes type instead of str type
Explanation: To understand the issue, we first need to know the content of the method. Since no specific file is provided, we can search it in the whole codebase. Therefore, we search the symbol `def _call_eas` in the cloned repo. Notice in previous steps, we already cd to the cloned project folder, the source code is at langchain under the project folder.
```python
from metagpt.tools.libs.editor import Editor
editor = Editor()
# Search for the PaiEasChatEndpoint._call_eas method in the codebase to understand the issue
symbol_to_search = "def _call_eas"
file_block = editor.search_content(symbol=symbol_to_search, root_path="langchain")
file_block
```
## Past Experience 3
Issue: When I run main.py, a message 'Running on http://127.0.0.1:5000' will appear on the console, but when I click on this link, the front-end web page cannot be displayed correctly.
Explanation: To understand the issue, we first need to know the content of the file. Since the issue doesn't provide a specific method or class, we will not search_content, but directly open and read the file main.py to diagnose the problem. Notice in previous steps, we already cd to the cloned project folder.
```python
from metagpt.tools.libs.editor import Editor
editor = Editor()
# Open the file to understand the issue
editor.read(path="./main.py")
```
## Experience Summary
- When diagnosing an issue, search for the specific symbol in the corresponding file to understand the problem.
- If no specific file is provided, search the symbol in the whole codebase to locate the issue.
- If no specific symbol is provided, directly open and read the file to diagnose the problem.
"""

ENGINEER_EXAMPLE = """
## example 1
User Requirement: Please implement the core game logic for the 2048 game, including tile movements, merging logic, score tracking, and keyboard interaction. Refer to the project schedule located at '/tmp/project_schedule.json' and the system design document at '/tmp/system_design.json' for detailed information.
Expand Down
2 changes: 0 additions & 2 deletions tests/data/embedding/2.answer.md

This file was deleted.

25 changes: 0 additions & 25 deletions tests/data/embedding/2.knowledge.md

This file was deleted.

1 change: 0 additions & 1 deletion tests/data/embedding/2.query.md

This file was deleted.

7 changes: 0 additions & 7 deletions tests/data/embedding/3.answer.md

This file was deleted.

189 changes: 0 additions & 189 deletions tests/data/embedding/3.knowledge.md

This file was deleted.

1 change: 0 additions & 1 deletion tests/data/embedding/3.query.md

This file was deleted.

Loading

0 comments on commit 8fe00a1

Please sign in to comment.