feat: move file name to property (#3091)

This commit is contained in:
Kevin Lin
2025-06-30 14:06:09 -07:00
committed by GitHub
parent 269f6b6b7b
commit d0e7ab2253
2 changed files with 4 additions and 15 deletions

View File

@@ -321,8 +321,7 @@ def get_prompt_template_for_agent_type(agent_type: Optional[AgentType] = None):
return (
f"<files>\n{{% if file_blocks %}}{FILE_MEMORY_EXISTS_MESSAGE}\n{{% else %}}{FILE_MEMORY_EMPTY_MESSAGE}{{% endif %}}"
"{% for block in file_blocks %}"
f"<file status=\"{{{{ '{FileStatus.open.value}' if block.value else '{FileStatus.closed.value}' }}}}\">\n"
"<{{ block.label }}>\n"
f"<file status=\"{{{{ '{FileStatus.open.value}' if block.value else '{FileStatus.closed.value}' }}}}\" name=\"{{{{ block.label }}}}\">\n"
"<description>\n"
"{{ block.description }}\n"
"</description>\n"
@@ -334,7 +333,6 @@ def get_prompt_template_for_agent_type(agent_type: Optional[AgentType] = None):
"<value>\n"
"{{ block.value }}\n"
"</value>\n"
"</{{ block.label }}>\n"
"</file>\n"
"{% if not loop.last %}\n{% endif %}"
"{% endfor %}"
@@ -374,8 +372,7 @@ def get_prompt_template_for_agent_type(agent_type: Optional[AgentType] = None):
"{% endif %}"
f"\n\n<files>\n{{% if file_blocks %}}{FILE_MEMORY_EXISTS_MESSAGE}\n{{% else %}}{FILE_MEMORY_EMPTY_MESSAGE}{{% endif %}}"
"{% for block in file_blocks %}"
f"<file status=\"{{{{ '{FileStatus.open.value}' if block.value else '{FileStatus.closed.value}' }}}}\">\n"
"<{{ block.label }}>\n"
f"<file status=\"{{{{ '{FileStatus.open.value}' if block.value else '{FileStatus.closed.value}' }}}}\" name=\"{{{{ block.label }}}}\">\n"
"{% if block.description %}"
"<description>\n"
"{{ block.description }}\n"
@@ -391,7 +388,6 @@ def get_prompt_template_for_agent_type(agent_type: Optional[AgentType] = None):
"{{ block.value }}\n"
"</value>\n"
"{% endif %}"
"</{{ block.label }}>\n"
"</file>\n"
"{% if not loop.last %}\n{% endif %}"
"{% endfor %}"
@@ -427,13 +423,7 @@ def get_prompt_template_for_agent_type(agent_type: Optional[AgentType] = None):
"{% endif %}"
f"\n\n<files>\n{{% if file_blocks %}}{FILE_MEMORY_EXISTS_MESSAGE}\n{{% else %}}{FILE_MEMORY_EMPTY_MESSAGE}{{% endif %}}"
"{% for block in file_blocks %}"
f"<file status=\"{{{{ '{FileStatus.open.value}' if block.value else '{FileStatus.closed.value}' }}}}\">\n"
"<{{ block.label }}>\n"
"{% if block.description %}"
"<description>\n"
"{{ block.description }}\n"
"</description>\n"
"{% endif %}"
f"<file status=\"{{{{ '{FileStatus.open.value}' if block.value else '{FileStatus.closed.value}' }}}}\" name=\"{{{{ block.label }}}}\">\n"
"<metadata>"
"{% if block.read_only %}\n- read_only=true{% endif %}\n"
"- chars_current={{ block.value|length }}\n"
@@ -444,7 +434,6 @@ def get_prompt_template_for_agent_type(agent_type: Optional[AgentType] = None):
"{{ block.value }}\n"
"</value>\n"
"{% endif %}"
"</{{ block.label }}>\n"
"</file>\n"
"{% if not loop.last %}\n{% endif %}"
"{% endfor %}"

View File

@@ -238,7 +238,7 @@ def validate_context_window_overview(
# 16. Check attached file is visible
if attached_file:
assert attached_file.visible_content in overview.core_memory
assert '<file status="open">' in overview.core_memory
assert '<file status="open"' in overview.core_memory
assert "</file>" in overview.core_memory
# Check for tools