-
Notifications
You must be signed in to change notification settings - Fork 1.7k
feat: add codeact_agent #1988
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
base: master
Are you sure you want to change the base?
feat: add codeact_agent #1988
Conversation
examples/agent/code_agent_example.py
Outdated
| Returns: | ||
| float: The sum of the two numbers. | ||
| """ | ||
| raise Exception("故意设置错误,来模仿工具调用失败") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
better translate these chinese into english
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK,this is currently a draft, and I will revise it once the adjustments are complete.
camel/agents/code_agent.py
Outdated
| # Add user input to memory | ||
| self.update_memory(input_message, OpenAIBackendRole.USER) | ||
|
|
||
| while True: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do we need to set the max_round here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
currently,self.single_iteration = True,so it will call mdoel only once
|
hey @fengju0213 , is this PR ready for review? |
The basic functionality has been implemented for research purposes in the OWL project. Meng Kang has taken it for testing but hasn't provided further feedback yet. I'm unsure whether this agent should be merged into CAMEL. |
| return code | ||
|
|
||
|
|
||
| class CodeExecutionEnvironment: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not reuse https://github.com/camel-ai/camel/blob/master/camel/toolkits/code_execution.py for this directly?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
reused part of code_execution.py,while also requiring a built-in method to execute code within the current process, eliminating the need for complex import logic to run the code.
| raise e | ||
|
|
||
|
|
||
| class CodeActAgent(ChatAgent): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is the main difference between CodeActAgent and https://github.com/camel-ai/camel/blob/master/camel/agents/embodied_agent.py
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It allows using tools by writing code, which in some cases can achieve multiple tool invocations through a single code parsing operation.
| """ # noqa: E501 | ||
|
|
||
|
|
||
| def _parse_code_blobs(text: str) -> str: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A similar feature has been implemented previously:
Line 253 in c514782
| def extract_text_and_code_prompts( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the implementation here references designs from existing code libraries.
echo-yiyiyi
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Left some comments in details.
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
|
@fengju0213 can you add expected outcome in example? |
Description
add code_agent
linked:#1823
Checklist
Go over all the following points, and put an
xin all the boxes that apply.Fixes #issue-numberin the PR description (required)pyproject.tomlanduv lockIf you are unsure about any of these, don't hesitate to ask. We are here to help!