Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
694119b
fix: update execute() to execute_prompt() across codebase
SalemBajjali Jun 4, 2026
158684e
feat: add skill engineering support
SalemBajjali Jun 4, 2026
f0331d2
test: add unit tests for skills
SalemBajjali Jun 4, 2026
42501e1
chore: update notes and comments for maintainer review
SalemBajjali Jun 4, 2026
076b70e
fix: update skill_path in test_skill_registry.py to correct path
SalemBajjali Jun 4, 2026
6dc4393
fix: clean up build_user_prompt docstring in BaseSkillTemplate
SalemBajjali Jun 4, 2026
584e18c
refactor: add _check_cache helper and CacheCheckResult to StructuredT…
SalemBajjali Jun 10, 2026
72380af
chore: rename entity_detection.md to test_skill_v1.md and update format
SalemBajjali Jun 10, 2026
22d1f9a
chore: clean up comments in SkillRegistry
SalemBajjali Jun 10, 2026
300d0d5
feat: derive name/version from filename via regex and add build_syste…
SalemBajjali Jun 10, 2026
6f73db7
test: update skill tests based on PR feedback
SalemBajjali Jun 10, 2026
2152e05
refactor: update CacheLookupResult based on PR feedback
SalemBajjali Jun 11, 2026
47771d0
fix: handle UnicodeDecodeError in load_skill and rename _get_skill_na…
SalemBajjali Jun 11, 2026
ddd220e
feat: add unified registry replacing PromptRegistry and SkillRegistry
SalemBajjali Jun 15, 2026
124eea4
feat: add unified templates directory replacing prompts and skills di…
SalemBajjali Jun 15, 2026
9bd8891
refactor: remove prompts and skills directories in favor of unified t…
SalemBajjali Jun 15, 2026
18b7aff
refactor: update StructuredTaskRunner to use unified registry
SalemBajjali Jun 15, 2026
28aac05
test: update tests to reflect new templates and registry structure
SalemBajjali Jun 15, 2026
6446ada
chore: update example notebook to reflect new structure
SalemBajjali Jun 15, 2026
3d742f3
refactor: update _get_skill_name_and_version to return tuple[str, str]
SalemBajjali Jun 15, 2026
c8cff35
Use full skill path in filename error message
SalemBajjali Jun 17, 2026
d79b88e
Merge branch 'main' into feat/skills
korikuzma Jun 18, 2026
913aa5f
Merge remote-tracking branch 'origin/feat/skills' into issue-17
SalemBajjali Jun 18, 2026
ab91299
refactor: simplify StructuredTaskRunner with unified _execute() method
SalemBajjali Jun 18, 2026
75b5204
chore: add test skill fixture using semantic versioning
SalemBajjali Jun 18, 2026
30f4c8e
test: update skill tests to use semantic versioning format
SalemBajjali Jun 18, 2026
fdcef2a
chore: update integration tests and notebook to reflect new structure
SalemBajjali Jun 18, 2026
1b92e09
Merge remote-tracking branch 'origin/main' into issue-17
SalemBajjali Jun 23, 2026
f73d43e
chore: update module docstrings for clarity
SalemBajjali Jun 24, 2026
59f728e
feat: implement TaskKind enum for structured task execution
SalemBajjali Jun 24, 2026
c8cf01e
Merge remote-tracking branch 'origin/main' into issue-17
SalemBajjali Jun 25, 2026
be6eef2
fix: update notebook examples to match refactored code structure
SalemBajjali Jun 25, 2026
8966f74
Add task type to registry keys
SalemBajjali Jun 25, 2026
26fec9a
Update tests for task-type registry lookup
SalemBajjali Jun 25, 2026
a384589
test: move shared example file to tests/examples
SalemBajjali Jun 30, 2026
6c64064
test: combine prompt and skill registry tests
SalemBajjali Jun 30, 2026
a52d93c
refactor: split prompt template into base template and updated paths
SalemBajjali Jun 30, 2026
f109c0b
feat: add template type to registry for duplicate skill and prompt en…
SalemBajjali Jun 30, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions notebooks/example.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
},
{
"cell_type": "code",
"execution_count": 1,
"execution_count": null,
"id": "b5fe35fe",
"metadata": {},
"outputs": [],
Expand All @@ -24,9 +24,9 @@
"\n",
"from wags_llm.cache import InMemoryCache\n",
"from wags_llm.client.bedrock import BedrockClaudeJsonClient\n",
"from wags_llm.prompts.base import BasePromptTemplate\n",
"from wags_llm.prompts.registry import PromptRegistry\n",
"from wags_llm.registry.base import Registry\n",
"from wags_llm.services.structured_task import StructuredTaskRunner\n",
"from wags_llm.templates.base import PromptTemplate\n",
"\n",
"logging.basicConfig(\n",
" stream=sys.stdout,\n",
Expand All @@ -46,12 +46,12 @@
},
{
"cell_type": "code",
"execution_count": 2,
"execution_count": null,
"id": "ba6504ff",
"metadata": {},
"outputs": [],
"source": [
"class MyPrompt(BasePromptTemplate):\n",
"class MyPrompt(PromptTemplate):\n",
" name = \"mondo_id_classification\"\n",
" version = \"v1\"\n",
"\n",
Expand Down Expand Up @@ -112,7 +112,7 @@
},
{
"cell_type": "code",
"execution_count": 4,
"execution_count": null,
"id": "5b14b5ce",
"metadata": {},
"outputs": [
Expand All @@ -133,12 +133,12 @@
" profile_name=\"dev-account\",\n",
")\n",
"\n",
"registry = PromptRegistry()\n",
"registry = Registry()\n",
"registry.register(MyPrompt())\n",
"\n",
"service = StructuredTaskRunner(\n",
" client=client,\n",
" prompt_registry=registry,\n",
" registry=registry,\n",
" cache=InMemoryCache(),\n",
")"
]
Expand Down Expand Up @@ -227,7 +227,7 @@
],
"metadata": {
"kernelspec": {
"display_name": "wags-llm",
"display_name": "wags-llm (3.11.14)",
"language": "python",
"name": "python3"
},
Expand Down
20 changes: 10 additions & 10 deletions notebooks/skills.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
},
{
"cell_type": "code",
"execution_count": 1,
"execution_count": null,
"id": "e9161ef9",
"metadata": {},
"outputs": [],
Expand All @@ -26,9 +26,9 @@
"from pydantic import BaseModel, ConfigDict\n",
"\n",
"from wags_llm.client.bedrock import BedrockClaudeJsonClient\n",
"from wags_llm.registry.base import Registry\n",
"from wags_llm.services.structured_task import StructuredTaskRunner\n",
"from wags_llm.skills.base import BaseSkillTemplate\n",
"from wags_llm.skills.registry import SkillRegistry\n",
"from wags_llm.templates.skill_template import SkillTemplate\n",
"\n",
"logging.basicConfig(\n",
" stream=sys.stdout,\n",
Expand All @@ -45,7 +45,7 @@
"metadata": {},
"outputs": [],
"source": [
"class VariantCurationSkill(BaseSkillTemplate):\n",
"class VariantCurationSkill(SkillTemplate):\n",
" skill_path = Path(\"skills/variant_curation_0.1.0.md\")\n",
"\n",
" def build_user_prompt(self, payload: Mapping[str, Any]) -> str:\n",
Expand Down Expand Up @@ -96,7 +96,7 @@
},
{
"cell_type": "code",
"execution_count": 4,
"execution_count": null,
"id": "c44eeb11",
"metadata": {},
"outputs": [
Expand All @@ -111,7 +111,7 @@
}
],
"source": [
"registry = SkillRegistry()\n",
"registry = Registry()\n",
"registry.register(skill)\n",
"\n",
"MODEL_ID = \"us.anthropic.claude-sonnet-4-6\"\n",
Expand All @@ -129,13 +129,13 @@
"\n",
"task_runner = StructuredTaskRunner(\n",
" client=llm_client,\n",
" skill_registry=registry,\n",
" registry=registry,\n",
")"
]
},
{
"cell_type": "code",
"execution_count": 5,
"execution_count": null,
"id": "d045cf30",
"metadata": {},
"outputs": [
Expand Down Expand Up @@ -201,7 +201,7 @@
],
"metadata": {
"kernelspec": {
"display_name": "wags-llm (3.13.5)",
"display_name": "wags-llm (3.11.14)",
"language": "python",
"name": "python3"
},
Expand All @@ -215,7 +215,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.13.5"
"version": "3.11.14"
}
},
"nbformat": 4,
Expand Down
13 changes: 0 additions & 13 deletions src/wags_llm/prompts/__init__.py

This file was deleted.

55 changes: 0 additions & 55 deletions src/wags_llm/prompts/registry.py

This file was deleted.

11 changes: 11 additions & 0 deletions src/wags_llm/registry/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
"""Registry module.

Store and retrieve versioned prompt and skill templates.
"""

from wags_llm.registry.base import Registry, build_empty_registry

__all__ = [
"Registry",
"build_empty_registry",
]
97 changes: 97 additions & 0 deletions src/wags_llm/registry/base.py
Comment thread
SalemBajjali marked this conversation as resolved.
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
"""Registry.

Maps (name, version, TemplateType) -> template instance.
Template instances can be either prompts or skills.

Users typically:
* create prompts or skills in their project
* register them here or pass a custom registry
"""

import logging
from types import MappingProxyType

from wags_llm.templates.base import TemplateType
from wags_llm.templates.prompt_template import PromptTemplate
from wags_llm.templates.skill_template import SkillTemplate

_logger = logging.getLogger(__name__)

_TEMPLATE_CLASS_TO_TYPE = MappingProxyType(
{
SkillTemplate: TemplateType.SKILL,
PromptTemplate: TemplateType.PROMPT,
}
)


class Registry:
"""Store and retrieve prompt and skill templates."""

def __init__(self) -> None:
"""Initialize an empty template registry."""
self._templates: dict[
tuple[str, str, TemplateType], PromptTemplate | SkillTemplate
] = {}

def register(self, template: PromptTemplate | SkillTemplate) -> None:
"""Register a template.

:param template: Template instance to register.
:raise TypeError: If the template type is unsupported.
:raise ValueError: If a template with the same name, version, and template type is already registered.
"""
for cls, mapped_type in _TEMPLATE_CLASS_TO_TYPE.items():
if isinstance(template, cls):
template_type = mapped_type
break
else:
msg = f"Unsupported template type: {type(template)}"
raise TypeError(msg)

key = (template.name, template.version, template_type)

_logger.debug(
"Registering template: name='%s', version='%s', template_type='%s'",
template.name,
template.version,
template_type.value,
)

if key in self._templates:
Comment thread
SalemBajjali marked this conversation as resolved.
msg = f"Template already registered:({template.name}, {template.version}, {template_type.value})"
_logger.error(msg)
raise ValueError(msg)

self._templates[key] = template

def get(
self,
name: str,
version: str,
template_type: TemplateType,
) -> PromptTemplate | SkillTemplate:
"""Retrieve a template by name and version.

:param name: Template name.
:param version: Template version.
:param template_type: Template type.
:return: Registered template.
:raise KeyError: If template not found.
"""
key = (name, version, template_type)

try:
return self._templates[key]
except KeyError as exc:
msg = f"Template not found: ({name}, {version}, {template_type.value})"
_logger.exception(msg)
raise KeyError(msg) from exc


def build_empty_registry() -> Registry:
"""Create an empty registry.

:return: New Registry instance.
"""
return Registry()
Loading