refactor: remove the concept of 'section' from the jinja2 prompt formatter (#1726)

This commit is contained in:
Charles Packer
2024-09-06 13:18:54 -07:00
committed by GitHub
parent 2f060f3471
commit e6247692e5

View File

@@ -25,10 +25,10 @@ class Memory(BaseModel, validate_assignment=True):
# Memory.template is a Jinja2 template for compiling memory module into a prompt string.
prompt_template: str = Field(
default="{% for section, block in memory.items() %}"
'<{{ section }} characters="{{ block.value|length }}/{{ block.limit }}">\n'
default="{% for block in memory.values() %}"
'<{{ block.name }} characters="{{ block.value|length }}/{{ block.limit }}">\n'
"{{ block.value }}\n"
"</{{ section }}>"
"</{{ block.name }}>"
"{% if not loop.last %}\n{% endif %}"
"{% endfor %}",
description="Jinja2 template for compiling memory blocks into a prompt string",