Merge pull request #290 from ggozad/fix/haiku-skill-prompt-fix

Adapt skill usage to haiku.skills prompt builder.
This commit is contained in:
Yiorgis Gozadinos 2026-02-28 13:56:21 +02:00 committed by GitHub
commit 9acb04d915
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
10 changed files with 26 additions and 12 deletions

View file

@ -1,6 +1,11 @@
# Changelog
## [Unreleased]
### Fixed
- **Compatibility with haiku.skills 0.5.1**: Replaced removed `SkillToolset.system_prompt` with `build_system_prompt(toolset.skill_catalog)` across chat TUI, backend app, and examples
- **Minimum dependency**: Bumped `haiku.skills` requirement to `>=0.5.1`
## [0.32.1] - 2026-02-26
### Added

View file

@ -18,6 +18,7 @@ from haiku.rag.config import load_yaml_config
from haiku.rag.config.models import AppConfig
from haiku.rag.skills.rag import AGENT_PREAMBLE, create_skill
from haiku.skills import SkillDeps, SkillToolset
from haiku.skills.prompts import build_system_prompt
load_dotenv(find_dotenv(usecwd=True))
@ -68,7 +69,7 @@ toolset = SkillToolset(skills=[skill])
agent = Agent(
os.getenv("HAIKU_CHAT_MODEL", "openai:gpt-4o"),
instructions=AGENT_PREAMBLE + toolset.system_prompt,
instructions=build_system_prompt(toolset.skill_catalog, preamble=AGENT_PREAMBLE),
toolsets=[toolset],
deps_type=SkillDeps,
)

View file

@ -457,13 +457,14 @@ haiku.rag provides a RAG skill built on [haiku.skills](https://github.com/ggozad
from pydantic_ai import Agent
from haiku.rag.skills.rag import create_skill
from haiku.skills.agent import SkillToolset
from haiku.skills.prompts import build_system_prompt
skill = create_skill(db_path=db_path, config=config)
toolset = SkillToolset(skills=[skill])
agent = Agent(
"openai:gpt-4o",
instructions=toolset.system_prompt,
instructions=build_system_prompt(toolset.skill_catalog),
toolsets=[toolset],
)

View file

@ -24,6 +24,7 @@ haiku-skills list --use-entrypoints
```python
from haiku.rag.skills.rag import create_skill
from haiku.skills.agent import SkillToolset
from haiku.skills.prompts import build_system_prompt
from pydantic_ai import Agent
skill = create_skill(db_path=db_path, config=config)
@ -31,7 +32,7 @@ toolset = SkillToolset(skills=[skill])
agent = Agent(
"openai:gpt-4o",
instructions=toolset.system_prompt,
instructions=build_system_prompt(toolset.skill_catalog),
toolsets=[toolset],
)

View file

@ -51,6 +51,7 @@ Combine both skills to give the agent full RAG + analysis capabilities:
from haiku.rag.skills.rag import create_skill as create_rag_skill
from haiku.rag.skills.rlm import create_skill as create_rlm_skill
from haiku.skills.agent import SkillToolset
from haiku.skills.prompts import build_system_prompt
from pydantic_ai import Agent
rag = create_rag_skill(db_path=db_path)
@ -59,7 +60,7 @@ toolset = SkillToolset(skills=[rag, rlm])
agent = Agent(
"openai:gpt-4o",
instructions=toolset.system_prompt,
instructions=build_system_prompt(toolset.skill_catalog),
toolsets=[toolset],
)
```

View file

@ -20,6 +20,7 @@ from pydantic_ai import Agent
from haiku.rag.skills.rag import create_skill
from haiku.skills.agent import SkillToolset
from haiku.skills.prompts import build_system_prompt
async def main(db_path: str) -> None:
@ -28,7 +29,7 @@ async def main(db_path: str) -> None:
agent = Agent(
"anthropic:claude-haiku-4-5-20251001",
instructions=toolset.system_prompt,
instructions=build_system_prompt(toolset.skill_catalog),
toolsets=[toolset],
)

View file

@ -25,6 +25,7 @@ from starlette.routing import Route
from haiku.rag.skills.rag import create_skill
from haiku.skills.agent import SkillToolset
from haiku.skills.prompts import build_system_prompt
db_path = os.environ.get("DB_PATH")
if not db_path:
@ -38,7 +39,7 @@ toolset = SkillToolset(skills=[skill])
agent = Agent(
"anthropic:claude-haiku-4-5-20251001",
instructions=toolset.system_prompt,
instructions=build_system_prompt(toolset.skill_catalog),
toolsets=[toolset],
)

View file

@ -12,6 +12,7 @@ from haiku.rag.config import get_config
from haiku.rag.skills.rag import AGENT_PREAMBLE, RAGState
from haiku.skills.agent import SkillToolset
from haiku.skills.models import Skill
from haiku.skills.prompts import build_system_prompt
if TYPE_CHECKING:
from textual.app import ComposeResult
@ -161,7 +162,9 @@ class ChatApp(App):
self._toolset = SkillToolset(skills=[self._skill])
self._agent = Agent(
self._model,
instructions=AGENT_PREAMBLE + self._toolset.system_prompt,
instructions=build_system_prompt(
self._toolset.skill_catalog, preamble=AGENT_PREAMBLE
),
toolsets=[self._toolset],
)
self._state = self._toolset.build_state_snapshot()

View file

@ -24,7 +24,7 @@ classifiers = [
dependencies = [
"cachetools>=5.5.0",
"docling-core==2.65.1",
"haiku.skills>=0.4.2",
"haiku.skills>=0.5.1",
"httpx>=0.28.1",
"jsonpatch>=1.33",
"lancedb==0.29.2",

View file

@ -1490,7 +1490,7 @@ requires-dist = [
{ name = "cohere", marker = "extra == 'cohere'", specifier = ">=5.20.1" },
{ name = "docling", marker = "extra == 'docling'", specifier = "==2.73.1" },
{ name = "docling-core", specifier = "==2.65.1" },
{ name = "haiku-skills", specifier = ">=0.4.2" },
{ name = "haiku-skills", specifier = ">=0.5.1" },
{ name = "httpx", specifier = ">=0.28.1" },
{ name = "jsonpatch", specifier = ">=1.33" },
{ name = "lancedb", specifier = "==0.29.2" },
@ -1522,7 +1522,7 @@ provides-extras = ["docling", "voyageai", "mxbai", "cohere", "zeroentropy", "jin
[[package]]
name = "haiku-skills"
version = "0.4.2"
version = "0.5.1"
source = { registry = "https://pypi.org/simple" }
dependencies = [
{ name = "pydantic" },
@ -1530,9 +1530,9 @@ dependencies = [
{ name = "pyyaml" },
{ name = "skills-ref" },
]
sdist = { url = "https://files.pythonhosted.org/packages/3b/13/96cb8124fd47d9f7b752f835b8c751bc67908a061a53a2ba392509d1fe68/haiku_skills-0.4.2.tar.gz", hash = "sha256:4846e7ebc1c7919faa576badd77723a0d681cf3a92d90f7b97edf3f6eca8ea8d", size = 119892, upload-time = "2026-02-20T11:18:47.434Z" }
sdist = { url = "https://files.pythonhosted.org/packages/0b/4f/82d171478efe6c008705d3c2622009e5e5e18e6f4f2e4b9ad4916920d5d8/haiku_skills-0.5.1.tar.gz", hash = "sha256:8e46e7deac377a5f8fe7e4e61f8a3eca6328e069cd8b5aa63c4929a3b4f1bb6c", size = 122423, upload-time = "2026-02-27T09:31:30.785Z" }
wheels = [
{ url = "https://files.pythonhosted.org/packages/c5/77/2f94bf41b4b0f0af62431f9c9753db9343a44d1012cadb2e277210b69dae/haiku_skills-0.4.2-py3-none-any.whl", hash = "sha256:08ec15f3a9c894ef33d989850e2b73e78a2a9364056e997bff7cd910a0c4cfe9", size = 21077, upload-time = "2026-02-20T11:18:45.593Z" },
{ url = "https://files.pythonhosted.org/packages/18/98/99b1e5b0a2513abb82e7d8cd657d9ad548031c927344ca666eb92f588738/haiku_skills-0.5.1-py3-none-any.whl", hash = "sha256:662684ef13448c7b9c3c8c8d1f46256fe0a76bd5832dfb08a8f8933fc610e4c9", size = 23134, upload-time = "2026-02-27T09:31:29.624Z" },
]
[[package]]