INNER CODE UNIT · Python

__print_instruction_and_action

handrew/browserpilot · browserpilot/agents/gpt_selenium_agent.py:259

    def __print_instruction_and_action(self, instruction, action):
        """Logging the instruction and action."""
        info_str = f"\nInstruction: {instruction}\n"
        info_str = info_str + f"\nAction: {action}\n"
        logger.info(info_str)

    def __get_relevant_part_of_stack_trace(self):
        """Get the relevant part of the stack trace."""
        original_stack_trace = traceback.format_exc()
        stack_trace = original_stack_trace.split("\n")[3:5]
        stack_trace = "\n".join(stack_trace)
        # Get the name of this class (GPTSeleniumAgent) and
        # replace it with "env".
        class_name = self.__class__.__name__
        stack_trace = stack_trace.replace(class_name, "env")
        # Get the number after the word "line " in the stack trace.
        everything_after_line = stack_trace.split("line ")[1]
        everything_before_rest = everything_after_line.split(",")[0]

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…