-
Notifications
You must be signed in to change notification settings - Fork 284
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
Code capability enhancement & Bot crash fix #272
base: main
Are you sure you want to change the base?
Code capability enhancement & Bot crash fix #272
Conversation
ecaf5e8
to
02232e2
Compare
…e-exception-fixes' into Tasks-more-relevant-docs-and-code-exception-fixes # Conflicts: # src/agent/coder.js # src/agent/prompter.js
Resolve merge conflicts with the latest codeNew additions
|
Can you try re-running this with a stupider model (not state-of-the-art lol). I'm curious to see if they benefit too, or just advanced ones. |
Comparison Experiment on Low-Performance Models1. ObjectiveThe objective is set using the following command: 2. Model SelectionFirst, I tested the lowest-performance model, gpt-3.5-turbo, but it could not limit itself to using only 3. Experimental Process
4. Experimental Results4.1 OriginalTotal run time: 16 minutes 41 seconds.
4.2 ModifiedI didn’t give any reminders to the bot while it was running.
4.3 Complete Comparison VideoTotal duration: 16 minutes 41 seconds. |
e1dfad9
to
0a21561
Compare
…e-exception-fixes' into Tasks-more-relevant-docs-and-code-exception-fixes # Conflicts: # src/agent/coder.js
Resolved merge conflict with Action Manager |
f6e309a
to
a6edd8f
Compare
…e-exception-fixes' into Tasks-more-relevant-docs-and-code-exception-fixes # Conflicts: # src/agent/prompter.js
There is a part that needs improvement |
Improve the relevance of docs to !newAction("task")Fix Qwen api concurrency limit issue |
Not sure about this. I like a few things, but not others. Code linting looks very useful, I would add that by itself. Though I don't like selecting only the most relevant skill docs. Wouldn't this strictly reduce performance? Yes it saves on context space, but means the LLM has no knowledge of most of the available functions. I am also skeptical that comparing the latest message to skill doc would reliably select the most relevant docs. Why not do this for commands too? Additionally, the logic for selecting relevant docs should be in its own separate file, like how we do for Examples. I see your comparison make it looks like it has about the same performance. So what is the benefit? |
Explanation and Feedback1. Purpose of
|
Hi @Ninot1Quyi, I've reconsidered and I now agree with you! This will be a very valuable contribution, let's move forward with it. I realized a main benefit is that it would allow the list of skills to grow almost indefinitely. So we should probably do something similar with command docs too, but let's just do skills for now. You don't need to test so much, and we can expect reduced performance as the cost of fixed context space usage. So long as it is easy to turn off. A few requests:
Take your time, no rush whatsoever. Good luck with your exams! |
@MaxRobinsonTheGreat I’m glad to hear that you appreciate my work, and I’ll make gradual changes to the code based on your suggestions. I need to find a better way to verify the generated code. Currently, I haven’t figured out how to enable ESLint to check the code in a sandbox environment, which is why I’m using Thank you again for recognizing my efforts. Wishing you a happy life! |
Last Modified Time: November 10, 2024, 5:53 PM
Latest changes are as follows:
Improvement Effects
Model: GPT-4o
Initial Command:
!goal("Your goal is: use only "!newAction" instructions and rely only on code execution to obtain a diamond pickaxe. You must complete this task step by step and by yourself. And can't use another "!command". You should promptly check to see what you have.")
Effect: After testing, under the condition of relying solely on generated code, the bot can run stably for at least 30 minutes without crashing (I manually ended the process at 30 minutes), during which it executed over 130 validated code snippets.
Remaining Issues:
WARNING: If you use the command above or set a goal that requires a long time to work, please pay attention to the execution status and token consumption, as the LLM may continuously generate code in certain situations. For example, when "an iron pickaxe is available and diamonds need to be mined," it might stand still using its code abilities to search for nearby diamond locations. Since diamonds are rare, it may fail to find them continuously, repeatedly improving the code and getting stuck, leading to substantial token consumption.Please test with caution, it cost me $60 to test with gpt-4o for 60min. But gpt-4o-mini is much cheaper and can be used to test this command
Added Features:
2.1 During code generation, the top
select_num
relevant skillsDocs related to!newAction("task")
will be selected and sent to the LLM in the prompt to help it focus better on thetask
. Currently,select_num
is set to 5.2.2 Before running the code, use ESLint to perform syntax and exception checks on the generated code to detect issues in advance, check for undefined functions, and add exceptions to messages.
2.3 During code execution, detailed error information will be included in messages.
Added Files:
3.1 file path: ./bots/codeCheckTemplate.js
A template used for performing checks before code execution. ESLint cannot be used for detection in the sandbox.
3.2 file path: ./eslint.config.js
Manages the ESLint rules for code syntax and exception detection.
Modified Code Content:
4.1 package.json
- Added: ESLint dependency.
4.2 settings.js
- Set:
code_timeout_mins=3
, ensuring timely code execution updates and preventing long blocks.4.3 coder.js
- Added:
checkCode
function to pre-check for syntax and exceptions. First, it checks whether the functions used in the code exist. If they don't, it writes the illegal functions to themessage
, then proceeds with syntax and exception checks.- Modified: Modified the return value of
stageCode
function fromreturn { main: mainFn };
toreturn { func: { main: mainFn }, src_check_copy: src_check_copy };
to ensure pre-execution exception detection.4.4 action_manager.js
- Enhanced:
catch (err)
error detection to include detailed exception content and related code Docs in messages, improving the LLM's ability to fix code.4.5 index.js
- Modified:
docHelper
andgetSkillDocs
return values to return the docArray of functions from the skill library for subsequent word embedding vector calculations.4.6 prompter.js
- Added:
this.skill_docs_embeddings = {};
to store the docArray word embedding vectors.- Added: Parallel initialization of
this.skill_docs_embeddings
ininitExamples
.- Added:
getRelevantSkillDocs function
to obtainselect_num
relevant doc texts based on input messages and select_num. If select_num >= 0, it is meaningful; otherwise, return all content sorted by relevance.Note: This modification ensures code quality by making minimal changes only where necessary, while also clearing test outputs and comments. If further modifications are needed, please feel free to let me know.