Skip to main content

openhands.controller.action_parser

ActionParseError Objects

class ActionParseError(Exception)

Exception raised when the response from the LLM cannot be parsed into an action.

ResponseParser Objects

class ResponseParser(ABC)

This abstract base class is a general interface for an response parser dedicated to parsing the action from the response from the LLM.

parse

@abstractmethod
def parse(response: str) -> Action

Parses the action from the response from the LLM.

Arguments:

  • response (str): The response from the LLM.

Returns:

  • action (Action): The action parsed from the response.

parse_response

@abstractmethod
def parse_response(response) -> str

Parses the action from the response from the LLM.

Arguments:

  • response (str): The response from the LLM.

Returns:

  • action_str (str): The action str parsed from the response.

parse_action

@abstractmethod
def parse_action(action_str: str) -> Action

Parses the action from the response from the LLM.

Arguments:

  • action_str (str): The response from the LLM.

Returns:

  • action (Action): The action parsed from the response.

ActionParser Objects

class ActionParser(ABC)

This abstract base class is a general interface for an action parser dedicated to parsing the action from the action str from the LLM.

check_condition

@abstractmethod
def check_condition(action_str: str) -> bool

Check if the action string can be parsed by this parser.

parse

@abstractmethod
def parse(action_str: str) -> Action

Parses the action from the action string from the LLM response.