-
Notifications
You must be signed in to change notification settings - Fork 60
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
Finish action customization. #17
Comments
Thanks for pointing this out. Actually, the only constraint for Finish action is the name should be 'Finish', the output parameters can still be defined in your customized way. To achieve this, there may be two ways to solve it
class FinishAction(BaseAction):
def __init__(self) -> None:
action_name = "Finish"
action_desc = "Complete the task with a code block."
params_doc = {
'code': "this is the finish action parameter. Input a block of code to solve the task."
}
super().__init__(
action_name=action_name,
action_desc=action_desc,
params_doc=params_doc,
)
def __call__(self, code):
return code Then, you can either substitute the finish action as this new action or insert it to the
class CodeGen(BaseAction):
def __init__(self) -> None:
action_name = "code_gen"
action_desc = "generating a code block"
params_doc = {
'code': "this is the action parameter. Input a block of code to solve the task."
}
super().__init__(
action_name=action_name,
action_desc=action_desc,
params_doc=params_doc,
)
def __call__(self, code):
# save code if you want
return code I think the second way would be easier to implement. And you can still test the performance afterwards. |
I don't think you get my point. the key problem is the parse method for ALL actions are the same.
which, force the llm to put the meaningful contents INSIDE a JSON format, which is error prone, because it is easy for llm to output like the format below instead of the format defined above when content has multi-line code:
Another issue for redefine FinishAction, it has some restriction, which is caused in the forward method of BaseAgent, it hardcode FinishAct instead of custom Action in the call chain: if agent_act.name == FinishAct.action_name:
act_found_flag = True
observation = "Task Completed."
task.completion = "completed"
task.answer = FinishAct(**agent_act.params) # this line hardcode FinishAct |
I see. Yea, current action is based on the json output. If you want to define another type of actions, you may have to change the action type and define your own parser. Yea, we also find this Finish issue. We will create a new PR to fix it. |
If I want to an agent to output multiline code, it is hard to use current framework .
that is because the syntax:
the code should be included in the content, for gpt-3.5 , multiline content inside a json formatted string is error-prone.
If ,the customization code can easily :
it will be easier.
The text was updated successfully, but these errors were encountered: