Load capabilities eagerly for dedicated single-agent consumers
This commit is contained in:
parent
9deb1f2bd4
commit
9e7db72997
5 changed files with 12 additions and 8 deletions
|
|
@ -76,7 +76,7 @@ class AppDeps:
|
|||
state: dict[str, Any] = field(default_factory=dict)
|
||||
|
||||
|
||||
capability = create_capability(db_path=db_path, config=Config)
|
||||
capability = create_capability(db_path=db_path, config=Config, defer_loading=False)
|
||||
|
||||
agent = Agent(
|
||||
get_model(Config.qa.model, Config),
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
"""Custom agent using the native haiku.rag RAG capability.
|
||||
|
||||
Demonstrates composing a deferred Pydantic AI capability into an agent.
|
||||
Demonstrates composing a native Pydantic AI capability into an agent.
|
||||
|
||||
Requirements:
|
||||
- An Ollama instance running locally (default embedder)
|
||||
|
|
@ -21,7 +21,7 @@ from haiku.rag.capabilities.rag import create_capability
|
|||
|
||||
|
||||
async def main(db_path: str) -> None:
|
||||
capability = create_capability(db_path=Path(db_path))
|
||||
capability = create_capability(db_path=Path(db_path), defer_loading=False)
|
||||
|
||||
agent = Agent(
|
||||
"anthropic:claude-haiku-4-5-20251001",
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ if not db_path:
|
|||
)
|
||||
sys.exit(1)
|
||||
|
||||
capability = create_capability(db_path=Path(db_path))
|
||||
capability = create_capability(db_path=Path(db_path), defer_loading=False)
|
||||
|
||||
agent = Agent(
|
||||
"anthropic:claude-haiku-4-5-20251001",
|
||||
|
|
|
|||
|
|
@ -40,12 +40,16 @@ def run_chat(
|
|||
if "rag" in enabled:
|
||||
from haiku.rag.capabilities.rag import create_capability
|
||||
|
||||
capability_list.append(create_capability(db_path=db_path, config=config))
|
||||
capability_list.append(
|
||||
create_capability(db_path=db_path, config=config, defer_loading=False)
|
||||
)
|
||||
|
||||
if "analysis" in enabled:
|
||||
from haiku.rag.capabilities.analysis import create_capability
|
||||
|
||||
capability_list.append(create_capability(db_path=db_path, config=config))
|
||||
capability_list.append(
|
||||
create_capability(db_path=db_path, config=config, defer_loading=False)
|
||||
)
|
||||
|
||||
app = ChatApp(
|
||||
db_path,
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
import asyncio
|
||||
import uuid
|
||||
from collections.abc import Iterable
|
||||
from collections.abc import Iterable, Sequence
|
||||
from dataclasses import dataclass, field
|
||||
from pathlib import Path
|
||||
from typing import TYPE_CHECKING, Any
|
||||
|
|
@ -78,7 +78,7 @@ class ChatApp(App):
|
|||
def __init__(
|
||||
self,
|
||||
db_path: Path,
|
||||
capabilities: list[RAGCapabilityBase[Any]],
|
||||
capabilities: Sequence[RAGCapabilityBase[Any]],
|
||||
read_only: bool = False,
|
||||
model: str | None = None,
|
||||
) -> None:
|
||||
|
|
|
|||
Loading…
Reference in a new issue