Reads past llm_outputs, actions, and observations or errors from the memory into a series of messages that can be used as input to the LLM. Adds a number of keywords (such as PLAN, error, etc) to help the LLM.
(
self,
summary_mode: bool = False,
)
| 756 | self.interrupt_switch = True |
| 757 | |
| 758 | def write_memory_to_messages( |
| 759 | self, |
| 760 | summary_mode: bool = False, |
| 761 | ) -> list[ChatMessage]: |
| 762 | """ |
| 763 | Reads past llm_outputs, actions, and observations or errors from the memory into a series of messages |
| 764 | that can be used as input to the LLM. Adds a number of keywords (such as PLAN, error, etc) to help |
| 765 | the LLM. |
| 766 | """ |
| 767 | messages = self.memory.system_prompt.to_messages(summary_mode=summary_mode) |
| 768 | for memory_step in self.memory.steps: |
| 769 | messages.extend(memory_step.to_messages(summary_mode=summary_mode)) |
| 770 | return messages |
| 771 | |
| 772 | def _step_stream( |
| 773 | self, memory_step: ActionStep |