"""Compile a note-search specialist and run it on the local CPU.

Install with:
python -m pip install programasweights==0.4.14 --extra-index-url https://pypi.programasweights.com/simple/
"""
import programasweights as paw

specification = """Translate an English search request into a single call to this note-taking app. Its available command is search_notes(query). Put the requested topic in double quotes. Preserve capitalization. Remove leading articles and the final period. Use the literal scope "notes" if the command takes a scope. Return exactly the function call, with no explanation.
Input: Find my notes about the team retreat.
Output: search_notes("team retreat")
Input: Look up my notes on Project Atlas.
Output: search_notes("Project Atlas")
Input: Search my notes for the travel budget.
Output: search_notes("travel budget")"""
user_input = "Find my notes about the NeurIPS poster."

program = paw.compile(
    specification,
    compiler="paw-4b-qwen3-0.6b",
    ephemeral=True,
)
print("Program ID:", program.id)
with paw.function(program.id, n_gpu_layers=0) as specialist:
    print(specialist(user_input))
