mirror of
https://github.com/FoundationAgents/MetaGPT.git
synced 2026-04-29 10:56:22 +02:00
add FileManager and provide issue fixing example
This commit is contained in:
parent
5e34038831
commit
8648a7646e
4 changed files with 243 additions and 0 deletions
33
examples/di/fix_github_issue.py
Normal file
33
examples/di/fix_github_issue.py
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
# This is a real issue from MetaGPT: https://github.com/geekan/MetaGPT/issues/1067
|
||||
# with corresponding bugfix as https://github.com/geekan/MetaGPT/pull/1069
|
||||
# We demonstrate that DataInterpreter has the capability to fix such issues.
|
||||
# Prerequisite: You need to manually add back the bug in your local file metagpt/utils/repair_llm_raw_output.py
|
||||
# to test the DataInterpreter's issue solving ability.
|
||||
|
||||
import asyncio
|
||||
|
||||
from metagpt.roles.di.data_interpreter import DataInterpreter
|
||||
|
||||
REQ = """
|
||||
# Requirement
|
||||
Below is a github issue, solve it. Use FileManager to search for the function, understand it, and modify the relevant code.
|
||||
Write a new test file test.py with FileManager and use Terminal to python the test file to ensure you have fixed the issue.
|
||||
When writing test.py, you should import the function from the file you modified and test it with the given input.
|
||||
Notice: Don't write all codes in one response, each time, just write code for one step.
|
||||
|
||||
# Issue
|
||||
>> s = "-1"
|
||||
>> print(extract_state_value_from_output(s))
|
||||
>> 1
|
||||
The extract_state_value_from_output function will process -1 into 1,
|
||||
resulted in an infinite loop for the react mode.
|
||||
"""
|
||||
|
||||
|
||||
async def main():
|
||||
di = DataInterpreter(tools=["Terminal", "FileManager"], react_mode="react")
|
||||
await di.run(REQ)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
asyncio.run(main())
|
||||
Loading…
Add table
Add a link
Reference in a new issue