builtin_actions

Module Contents

Classes

InvalidAction

This is a invalid action class, which is used to return error message

NoAction

This is a no action class, which is used to return error message when

FinishAction

This is a finish action class, which is used to return the final

class lagent.actions.builtin_actions.InvalidAction(err_msg='The action is invalid, please check the action name.', description=None, parser=BaseParser)

Bases: lagent.actions.base_action.BaseAction

This is a invalid action class, which is used to return error message when the action is invalid.

Parameters:
  • err_msg (str) – The error message. Defaults to ‘The action is invalid, please check the action name’.

  • description (Optional[dict]) –

Returns:

The action return.

Return type:

ActionReturn

run(err_msg=None)

Return the error message.

Parameters:

err_msg (str, optional) – The error message. If err_msg is not None, it will be returned, otherwise the default error message will be returned. Defaults to None.

Return type:

lagent.schema.ActionReturn

class lagent.actions.builtin_actions.NoAction(err_msg='Please follow the format', description=None, parser=BaseParser)

Bases: lagent.actions.base_action.BaseAction

This is a no action class, which is used to return error message when the response does not follow the format.

Parameters:
  • err_msg (str) – The error message. Defaults to ‘Please follow the format’.

  • description (Optional[dict]) –

run(err_msg=None)

Return the error message.

Parameters:

err_msg (str, optional) – The error message. If err_msg is not None, it will be returned, otherwise the default error message will be returned. Defaults to None.

Returns:

The action return.

Return type:

ActionReturn

class lagent.actions.builtin_actions.FinishAction(description=None, parser=BaseParser)

Bases: lagent.actions.base_action.BaseAction

This is a finish action class, which is used to return the final result.

Parameters:

description (Optional[dict]) –

run(response)

Return the final result.

Parameters:

response (str) – The final result.

Returns:

The action return.

Return type:

ActionReturn