feat: add prompt placeholder substitution with {filename} syntax
This commit is contained in:
parent
760eac5a7b
commit
3de3614433
6 changed files with 274 additions and 33 deletions
|
|
@ -194,3 +194,30 @@ class TestGetSubgraphForTarget:
|
|||
|
||||
assert sub.has_edge("input.txt", "summary.md")
|
||||
assert sub.has_edge("summary.md", "final.txt")
|
||||
|
||||
def test_placeholder_files_in_graph(
|
||||
self, project_dir: Path, write_config: WriteConfig
|
||||
) -> None:
|
||||
_ = (project_dir / "style.txt").write_text("impressionist")
|
||||
config = write_config(
|
||||
{
|
||||
"targets": {
|
||||
"out.txt": {"prompt": "Paint in {style.txt} style"},
|
||||
}
|
||||
}
|
||||
)
|
||||
graph = build_graph(config, project_dir)
|
||||
assert graph.has_edge("style.txt", "out.txt")
|
||||
|
||||
def test_escaped_placeholder_not_in_graph(
|
||||
self, project_dir: Path, write_config: WriteConfig
|
||||
) -> None:
|
||||
config = write_config(
|
||||
{
|
||||
"targets": {
|
||||
"out.txt": {"prompt": "Literal \\{not_a_dep.txt}"},
|
||||
}
|
||||
}
|
||||
)
|
||||
graph = build_graph(config, project_dir)
|
||||
assert "not_a_dep.txt" not in graph.nodes
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue