Merge pull request #339 from ggozad/fix/generated-skills-preamble
fix: apply config.prompts.domain_preamble in generated skills
This commit is contained in:
commit
f10d6b9960
2 changed files with 19 additions and 0 deletions
|
|
@ -79,6 +79,10 @@ def create_skill(
|
||||||
|
|
||||||
tools = create_skill_tools(db_path, config, SkillState, _TOOL_NAMES)
|
tools = create_skill_tools(db_path, config, SkillState, _TOOL_NAMES)
|
||||||
extras = create_skill_extras(db_path, config)
|
extras = create_skill_extras(db_path, config)
|
||||||
|
|
||||||
|
if config.prompts.domain_preamble and instructions:
|
||||||
|
instructions = f"{config.prompts.domain_preamble}\n\n{instructions}"
|
||||||
|
|
||||||
return Skill(
|
return Skill(
|
||||||
metadata=metadata,
|
metadata=metadata,
|
||||||
instructions=instructions,
|
instructions=instructions,
|
||||||
|
|
|
||||||
|
|
@ -273,6 +273,21 @@ class TestRenderTemplates:
|
||||||
assert "create_skill_extras" in content
|
assert "create_skill_extras" in content
|
||||||
assert "extras=extras" in content
|
assert "extras=extras" in content
|
||||||
|
|
||||||
|
def test_domain_preamble_applied_to_instructions(self, tmp_path):
|
||||||
|
render_templates(
|
||||||
|
output_dir=tmp_path,
|
||||||
|
name="docs",
|
||||||
|
description="A docs skill.",
|
||||||
|
tool_names=["search"],
|
||||||
|
)
|
||||||
|
init = tmp_path / "docs-skill" / "docs_skill" / "__init__.py"
|
||||||
|
content = init.read_text()
|
||||||
|
assert "config.prompts.domain_preamble" in content
|
||||||
|
assert (
|
||||||
|
'instructions = f"{config.prompts.domain_preamble}\\n\\n{instructions}"'
|
||||||
|
in content
|
||||||
|
)
|
||||||
|
|
||||||
def test_create_skill_accepts_optional_params(self, tmp_path):
|
def test_create_skill_accepts_optional_params(self, tmp_path):
|
||||||
render_templates(
|
render_templates(
|
||||||
output_dir=tmp_path,
|
output_dir=tmp_path,
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue