programasweights 0.2.4__tar.gz → 0.2.7__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (505) hide show
  1. programasweights-0.2.7/.gitignore +14 -0
  2. {programasweights-0.2.4 → programasweights-0.2.7}/AGENTS.md +69 -36
  3. {programasweights-0.2.4 → programasweights-0.2.7}/CHANGELOG.md +11 -0
  4. {programasweights-0.2.4 → programasweights-0.2.7}/PKG-INFO +3 -3
  5. {programasweights-0.2.4 → programasweights-0.2.7}/PYPI_README.md +1 -1
  6. programasweights-0.2.7/README.md +113 -0
  7. {programasweights-0.2.4 → programasweights-0.2.7}/docs/api-reference/python-sdk.md +4 -2
  8. programasweights-0.2.7/docs/case-studies/semantic-search.md +146 -0
  9. programasweights-0.2.7/docs/case-studies/site-navigation.md +127 -0
  10. {programasweights-0.2.4 → programasweights-0.2.7}/docs/index.md +1 -1
  11. programasweights-0.2.7/examples/paw_monitor.py +180 -0
  12. {programasweights-0.2.4 → programasweights-0.2.7}/mkdocs.yml +3 -0
  13. {programasweights-0.2.4 → programasweights-0.2.7}/programasweights/__init__.py +15 -17
  14. {programasweights-0.2.4 → programasweights-0.2.7}/programasweights/cache.py +21 -15
  15. {programasweights-0.2.4 → programasweights-0.2.7}/programasweights/client.py +18 -16
  16. {programasweights-0.2.4 → programasweights-0.2.7}/programasweights/config.py +4 -0
  17. {programasweights-0.2.4 → programasweights-0.2.7}/programasweights/runtime_llamacpp.py +34 -20
  18. {programasweights-0.2.4 → programasweights-0.2.7}/pyproject.toml +2 -2
  19. programasweights-0.2.4/.cursor/rules/sdk-publishing.mdc +0 -53
  20. programasweights-0.2.4/.cursor/rules/vllm-deployment.mdc +0 -118
  21. programasweights-0.2.4/.git +0 -1
  22. programasweights-0.2.4/.github/workflows/web-sdk.yml +0 -51
  23. programasweights-0.2.4/.gitignore +0 -76
  24. programasweights-0.2.4/.gitmodules +0 -3
  25. programasweights-0.2.4/.hatch_build.toml +0 -28
  26. programasweights-0.2.4/1apple.jpg +0 -0
  27. programasweights-0.2.4/1apple2.jpg +0 -0
  28. programasweights-0.2.4/2apples.jpg +0 -0
  29. programasweights-0.2.4/2apples2.jpg +0 -0
  30. programasweights-0.2.4/3apples.jpg +0 -0
  31. programasweights-0.2.4/3apples2.jpg +0 -0
  32. programasweights-0.2.4/479400.png +0 -0
  33. programasweights-0.2.4/4apples.jpg +0 -0
  34. programasweights-0.2.4/4apples2.jpg +0 -0
  35. programasweights-0.2.4/4apples3.jpg +0 -0
  36. programasweights-0.2.4/4apples4.jpg +0 -0
  37. programasweights-0.2.4/5apples.jpg +0 -0
  38. programasweights-0.2.4/6apples.jpg +0 -0
  39. programasweights-0.2.4/8apples.jpg +0 -0
  40. programasweights-0.2.4/9apples.jpg +0 -0
  41. programasweights-0.2.4/FLOW_SUMMARY.md +0 -202
  42. programasweights-0.2.4/MANIFEST.in +0 -25
  43. programasweights-0.2.4/ONNX_MIGRATION_PLAN.md +0 -84
  44. programasweights-0.2.4/PREFIX_TOKENS_DESIGN.md +0 -176
  45. programasweights-0.2.4/README.md +0 -186
  46. programasweights-0.2.4/TRUNCATION_CHANGES.md +0 -185
  47. programasweights-0.2.4/USE_CASES_AND_IDEAS.md +0 -748
  48. programasweights-0.2.4/VERIFICATION_USAGE.md +0 -282
  49. programasweights-0.2.4/analyze_dataset.py +0 -372
  50. programasweights-0.2.4/analyze_lengths.py +0 -246
  51. programasweights-0.2.4/baselines/code_prompt.md +0 -21
  52. programasweights-0.2.4/baselines/evaluate_openai_python_code_baseline.py +0 -296
  53. programasweights-0.2.4/baselines/openai_batch_request.py +0 -218
  54. programasweights-0.2.4/baselines/prepare_alchemist_data.py +0 -194
  55. programasweights-0.2.4/baselines/prepare_var_bench_data.py +0 -53
  56. programasweights-0.2.4/baselines/python_code_sandbox.py +0 -302
  57. programasweights-0.2.4/baselines/script_evaluation_var_bench.sh +0 -3
  58. programasweights-0.2.4/baselines/script_evalution_evaluation.sh +0 -8
  59. programasweights-0.2.4/baselines/script_evalution_request.sh +0 -8
  60. programasweights-0.2.4/baselines/script_evalution_statistics.sh +0 -8
  61. programasweights-0.2.4/benchmark_pytorch_vs_onnx.py +0 -315
  62. programasweights-0.2.4/benchmark_user_experience.py +0 -375
  63. programasweights-0.2.4/check_dataset.py +0 -31
  64. programasweights-0.2.4/combine_datasets.py +0 -157
  65. programasweights-0.2.4/compare_datasets.py +0 -268
  66. programasweights-0.2.4/compare_old_vs_regen.py +0 -227
  67. programasweights-0.2.4/convert_paw_to_svg.py +0 -119
  68. programasweights-0.2.4/create_favicon_sizes.py +0 -86
  69. programasweights-0.2.4/create_visualization_from_log.py +0 -269
  70. programasweights-0.2.4/create_vqa_dataset.py +0 -217
  71. programasweights-0.2.4/debug_cache.py +0 -80
  72. programasweights-0.2.4/debug_eos_example.sh +0 -22
  73. programasweights-0.2.4/estimate_data_gen_cost.py +0 -273
  74. programasweights-0.2.4/eval.py +0 -739
  75. programasweights-0.2.4/export_to_onnx.py +0 -485
  76. programasweights-0.2.4/extract_models.py +0 -193
  77. programasweights-0.2.4/inspect_data_dirs.py +0 -384
  78. programasweights-0.2.4/latest_export.csv +0 -230
  79. programasweights-0.2.4/log.train.81920.morecategories.extraprefix +0 -14928
  80. programasweights-0.2.4/main_no_spec_direct_ans_mix_continuous_sampleref_shorterprompt_vllm.py +0 -1546
  81. programasweights-0.2.4/merge_datasets.py +0 -303
  82. programasweights-0.2.4/paw.png +0 -0
  83. programasweights-0.2.4/paw.svg +0 -34
  84. programasweights-0.2.4/process_im2latex_dataset.py +0 -207
  85. programasweights-0.2.4/programasweights_lora/__init__.py +0 -28
  86. programasweights-0.2.4/programasweights_lora/compiler/__init__.py +0 -112
  87. programasweights-0.2.4/programasweights_lora/lora_format.py +0 -193
  88. programasweights-0.2.4/programasweights_lora/runtime/__init__.py +0 -6
  89. programasweights-0.2.4/programasweights_lora/runtime/interpreter_lora.py +0 -267
  90. programasweights-0.2.4/programasweights_lora/tests/test_compile_and_run.py +0 -67
  91. programasweights-0.2.4/programasweights_lora/tests/test_lora_format.py +0 -91
  92. programasweights-0.2.4/programasweights_lora/tests/test_training.py +0 -153
  93. programasweights-0.2.4/programasweights_lora/train_lora.py +0 -101
  94. programasweights-0.2.4/programasweights_lora/training/__init__.py +0 -6
  95. programasweights-0.2.4/programasweights_lora/training/loops/lora_tuning_sft.py +0 -655
  96. programasweights-0.2.4/run_eval.sh +0 -95
  97. programasweights-0.2.4/run_training.sh +0 -70
  98. programasweights-0.2.4/scripts/filter_table_by_length.py +0 -150
  99. programasweights-0.2.4/server/.env.example +0 -46
  100. programasweights-0.2.4/server/alembic/env.py +0 -48
  101. programasweights-0.2.4/server/alembic/script.py.mako +0 -24
  102. programasweights-0.2.4/server/alembic/versions/001_initial_schema.py +0 -127
  103. programasweights-0.2.4/server/alembic/versions/002_namespaced_aliases_hf_url.py +0 -37
  104. programasweights-0.2.4/server/alembic/versions/003_fulltext_search_ranking.py +0 -41
  105. programasweights-0.2.4/server/alembic/versions/004_fix_alias_slug_constraint.py +0 -49
  106. programasweights-0.2.4/server/alembic.ini +0 -36
  107. programasweights-0.2.4/server/api/__init__.py +0 -1
  108. programasweights-0.2.4/server/api/config.py +0 -75
  109. programasweights-0.2.4/server/api/dependencies.py +0 -63
  110. programasweights-0.2.4/server/api/logging_config.py +0 -74
  111. programasweights-0.2.4/server/api/main.py +0 -279
  112. programasweights-0.2.4/server/api/middleware/__init__.py +0 -0
  113. programasweights-0.2.4/server/api/middleware/rate_limit.py +0 -172
  114. programasweights-0.2.4/server/api/models/__init__.py +0 -1
  115. programasweights-0.2.4/server/api/models/database.py +0 -41
  116. programasweights-0.2.4/server/api/models/orm.py +0 -205
  117. programasweights-0.2.4/server/api/models/schemas.py +0 -225
  118. programasweights-0.2.4/server/api/routes/__init__.py +0 -1
  119. programasweights-0.2.4/server/api/routes/auth.py +0 -274
  120. programasweights-0.2.4/server/api/routes/compile.py +0 -276
  121. programasweights-0.2.4/server/api/routes/feedback.py +0 -45
  122. programasweights-0.2.4/server/api/routes/health.py +0 -29
  123. programasweights-0.2.4/server/api/routes/infer.py +0 -115
  124. programasweights-0.2.4/server/api/routes/models_info.py +0 -17
  125. programasweights-0.2.4/server/api/routes/programs.py +0 -753
  126. programasweights-0.2.4/server/api/services/__init__.py +0 -1
  127. programasweights-0.2.4/server/api/services/auto_tag_service.py +0 -103
  128. programasweights-0.2.4/server/api/services/auto_title_service.py +0 -100
  129. programasweights-0.2.4/server/api/services/compile_provider.py +0 -745
  130. programasweights-0.2.4/server/api/services/compile_service.py +0 -546
  131. programasweights-0.2.4/server/api/services/infer_service.py +0 -263
  132. programasweights-0.2.4/server/api/services/search_service.py +0 -152
  133. programasweights-0.2.4/server/api/services/storage_service.py +0 -239
  134. programasweights-0.2.4/server/benchmarks/benchmark_api.py +0 -301
  135. programasweights-0.2.4/server/benchmarks/handcrafted_specs.json +0 -130
  136. programasweights-0.2.4/server/benchmarks/last_benchmark_results.json +0 -266
  137. programasweights-0.2.4/server/benchmarks/last_stress_results.json +0 -250
  138. programasweights-0.2.4/server/benchmarks/stress_test.py +0 -695
  139. programasweights-0.2.4/server/compiler_registry.json +0 -26
  140. programasweights-0.2.4/server/provider_configs/gpt2.json +0 -17
  141. programasweights-0.2.4/server/provider_configs/qwen3-0.6b.json +0 -16
  142. programasweights-0.2.4/server/requirements.txt +0 -25
  143. programasweights-0.2.4/server/scripts/ab_test_hf_vs_vllm.py +0 -180
  144. programasweights-0.2.4/server/scripts/ablation_search.py +0 -221
  145. programasweights-0.2.4/server/scripts/backfill_hf_browser_assets.py +0 -226
  146. programasweights-0.2.4/server/scripts/backfill_hf_safetensors.py +0 -95
  147. programasweights-0.2.4/server/scripts/backfill_interestingness.py +0 -111
  148. programasweights-0.2.4/server/scripts/backfill_tags.py +0 -76
  149. programasweights-0.2.4/server/scripts/backfill_titles.py +0 -76
  150. programasweights-0.2.4/server/scripts/benchmark_gpt2.py +0 -89
  151. programasweights-0.2.4/server/scripts/cleanup_storage.py +0 -66
  152. programasweights-0.2.4/server/scripts/eval_search.py +0 -211
  153. programasweights-0.2.4/server/scripts/evict_cold_programs.py +0 -40
  154. programasweights-0.2.4/server/scripts/generate_prefix_cache.py +0 -117
  155. programasweights-0.2.4/server/scripts/launch_gpt2_compiler.py +0 -32
  156. programasweights-0.2.4/server/scripts/launch_qwen3_compiler.py +0 -32
  157. programasweights-0.2.4/server/scripts/patch_vllm.sh +0 -65
  158. programasweights-0.2.4/server/scripts/restart.sh +0 -23
  159. programasweights-0.2.4/server/scripts/start_all.sh +0 -193
  160. programasweights-0.2.4/server/scripts/start_gpt2_services.sh +0 -67
  161. programasweights-0.2.4/server/scripts/start_provider.sh +0 -27
  162. programasweights-0.2.4/server/scripts/start_services.sh +0 -86
  163. programasweights-0.2.4/server/tests/__init__.py +0 -1
  164. programasweights-0.2.4/server/tests/conftest.py +0 -86
  165. programasweights-0.2.4/server/tests/test_auth.py +0 -52
  166. programasweights-0.2.4/server/tests/test_compile.py +0 -97
  167. programasweights-0.2.4/server/tests/test_errors.py +0 -60
  168. programasweights-0.2.4/server/tests/test_infer.py +0 -72
  169. programasweights-0.2.4/server/tests/test_integration_gpu.py +0 -183
  170. programasweights-0.2.4/server/tests/test_rate_limit.py +0 -213
  171. programasweights-0.2.4/server/tests/test_storage.py +0 -134
  172. programasweights-0.2.4/server/vllm_models/__init__.py +0 -1
  173. programasweights-0.2.4/server/vllm_models/gpt2_lora_patch.py +0 -34
  174. programasweights-0.2.4/server/vllm_models/paw_compiler.py +0 -414
  175. programasweights-0.2.4/server/vllm_models/prepare_checkpoint.py +0 -143
  176. programasweights-0.2.4/server/vllm_models/register.py +0 -17
  177. programasweights-0.2.4/stage2_firstpromptqwen_512_e1_generate_lora_e2grpo_overfit_one_debug.reward_plot.rollout_ppl.png +0 -0
  178. programasweights-0.2.4/stage2_firstpromptqwen_512_e1_generate_lora_e2grpo_overfit_one_debug.reward_plot.train_gt_logprob.em_es.png +0 -0
  179. programasweights-0.2.4/stage2_firstpromptqwen_512_e1_generate_lora_e2grpo_overfit_one_debug.reward_plot.train_gt_logprob.ppl.png +0 -0
  180. programasweights-0.2.4/stage2_firstpromptqwen_512_e1_generate_lora_e2grpo_overfit_one_debug.reward_plot.train_gt_logprob.reward.png +0 -0
  181. programasweights-0.2.4/test_1spec.py +0 -18
  182. programasweights-0.2.4/test_all_caching.py +0 -167
  183. programasweights-0.2.4/test_apple_count.py +0 -84
  184. programasweights-0.2.4/test_batch_pilot.py +0 -593
  185. programasweights-0.2.4/test_compile.py +0 -10
  186. programasweights-0.2.4/test_e2e.py +0 -363
  187. programasweights-0.2.4/test_execute.py +0 -6
  188. programasweights-0.2.4/test_nspecs.py +0 -18
  189. programasweights-0.2.4/test_one_vs_two_step.py +0 -149
  190. programasweights-0.2.4/test_onnx_correctness.py +0 -430
  191. programasweights-0.2.4/test_onnx_hf_model.py +0 -39
  192. programasweights-0.2.4/test_onnx_hf_with_images.py +0 -158
  193. programasweights-0.2.4/test_paw_format.py +0 -144
  194. programasweights-0.2.4/test_thinking_comparison.py +0 -542
  195. programasweights-0.2.4/train.py +0 -153
  196. programasweights-0.2.4/train_no_spec_direct_ans_mix_continuous_sampleref_trainonly_shorterprompt_withregularizer_generate_lora.py +0 -3581
  197. programasweights-0.2.4/training/README.md +0 -45
  198. programasweights-0.2.4/training/__init__.py +0 -42
  199. programasweights-0.2.4/training/data_generation/DATASET_CHANGELOG.md +0 -1791
  200. programasweights-0.2.4/training/data_generation/README.md +0 -74
  201. programasweights-0.2.4/training/data_generation/VERIFICATION_PIPELINE.md +0 -259
  202. programasweights-0.2.4/training/data_generation/build_user_bench.py +0 -487
  203. programasweights-0.2.4/training/data_generation/dry_run_batch.py +0 -248
  204. programasweights-0.2.4/training/data_generation/filter_test_data.py +0 -397
  205. programasweights-0.2.4/training/data_generation/generate_specs.py +0 -716
  206. programasweights-0.2.4/training/data_generation/generate_specs_batch.py +0 -368
  207. programasweights-0.2.4/training/data_generation/incremental_merge.py +0 -397
  208. programasweights-0.2.4/training/data_generation/merge_and_upload.py +0 -383
  209. programasweights-0.2.4/training/data_generation/regenerate_outputs_batch.py +0 -522
  210. programasweights-0.2.4/training/data_generation/synthesize_data.py +0 -536
  211. programasweights-0.2.4/training/data_generation/synthesize_data_batch.py +0 -389
  212. programasweights-0.2.4/training/data_generation/templates/filter_system.txt +0 -10
  213. programasweights-0.2.4/training/data_generation/templates/filter_user.txt +0 -9
  214. programasweights-0.2.4/training/data_generation/templates/pairs_system.txt +0 -3
  215. programasweights-0.2.4/training/data_generation/templates/pairs_user.txt +0 -14
  216. programasweights-0.2.4/training/data_generation/templates/specs_system.txt +0 -1
  217. programasweights-0.2.4/training/data_generation/templates/specs_user.txt +0 -11
  218. programasweights-0.2.4/training/data_generation/templates/specs_user_freeform.txt +0 -8
  219. programasweights-0.2.4/training/data_generation/templates/specs_user_freeform_with_examples.txt +0 -8
  220. programasweights-0.2.4/training/data_generation/templates/specs_user_with_examples.txt +0 -11
  221. programasweights-0.2.4/training/data_generation/templates/verify_system.txt +0 -10
  222. programasweights-0.2.4/training/data_generation/templates/verify_user.txt +0 -3
  223. programasweights-0.2.4/training/data_generation/templates_old/filter_system.txt +0 -10
  224. programasweights-0.2.4/training/data_generation/templates_old/filter_user.txt +0 -9
  225. programasweights-0.2.4/training/data_generation/templates_old/pairs_system.txt +0 -3
  226. programasweights-0.2.4/training/data_generation/templates_old/pairs_user.txt +0 -10
  227. programasweights-0.2.4/training/data_generation/templates_old/specs_system.txt +0 -1
  228. programasweights-0.2.4/training/data_generation/templates_old/specs_user.txt +0 -9
  229. programasweights-0.2.4/training/data_generation/templates_old/specs_user_freeform.txt +0 -8
  230. programasweights-0.2.4/training/data_generation/templates_old/specs_user_freeform_with_examples.txt +0 -8
  231. programasweights-0.2.4/training/data_generation/templates_old/specs_user_with_examples.txt +0 -10
  232. programasweights-0.2.4/training/data_generation/templates_old/verify_system.txt +0 -10
  233. programasweights-0.2.4/training/data_generation/templates_old/verify_user.txt +0 -3
  234. programasweights-0.2.4/training/data_generation/verify_test_data.py +0 -377
  235. programasweights-0.2.4/training/datasets/__init__.py +0 -1
  236. programasweights-0.2.4/training/datasets/jsonl_text_pairs.py +0 -186
  237. programasweights-0.2.4/training/loops/__init__.py +0 -1
  238. programasweights-0.2.4/training/loops/prefix_tuning_sft.py +0 -1297
  239. programasweights-0.2.4/ttt.py +0 -11
  240. programasweights-0.2.4/upload_model.py +0 -95
  241. programasweights-0.2.4/upload_onnx_to_huggingface.py +0 -242
  242. programasweights-0.2.4/upload_onnx_to_huggingface_with_token.py +0 -264
  243. programasweights-0.2.4/utils.py +0 -100
  244. programasweights-0.2.4/web-app/HANDOFF.md +0 -237
  245. programasweights-0.2.4/web-app/README.md +0 -187
  246. programasweights-0.2.4/web-app/backend/app/__init__.py +0 -1
  247. programasweights-0.2.4/web-app/backend/app/config.py +0 -71
  248. programasweights-0.2.4/web-app/backend/app/main.py +0 -1463
  249. programasweights-0.2.4/web-app/backend/app/middleware/__init__.py +0 -1
  250. programasweights-0.2.4/web-app/backend/app/middleware/rate_limit.py +0 -58
  251. programasweights-0.2.4/web-app/backend/app/models.py +0 -123
  252. programasweights-0.2.4/web-app/backend/app/services/__init__.py +0 -13
  253. programasweights-0.2.4/web-app/backend/app/services/auth_service.py +0 -172
  254. programasweights-0.2.4/web-app/backend/app/services/case_service.py +0 -201
  255. programasweights-0.2.4/web-app/backend/app/services/compiler_service.py +0 -202
  256. programasweights-0.2.4/web-app/backend/app/services/gpt_service.py +0 -166
  257. programasweights-0.2.4/web-app/backend/app/services/hub_service.py +0 -291
  258. programasweights-0.2.4/web-app/backend/app/services/image_service.py +0 -127
  259. programasweights-0.2.4/web-app/backend/app/services/interpreter_service.py +0 -179
  260. programasweights-0.2.4/web-app/backend/app/services/sql_manager.py +0 -1324
  261. programasweights-0.2.4/web-app/backend/app/templates/gpt_test_generation.txt +0 -42
  262. programasweights-0.2.4/web-app/backend/app/utils/__init__.py +0 -1
  263. programasweights-0.2.4/web-app/backend/app/utils/image_placeholders.py +0 -147
  264. programasweights-0.2.4/web-app/backend/app/utils/program_hash.py +0 -211
  265. programasweights-0.2.4/web-app/backend/clear_db.sh +0 -62
  266. programasweights-0.2.4/web-app/backend/clear_tables.sql +0 -29
  267. programasweights-0.2.4/web-app/backend/data/programs.db +0 -0
  268. programasweights-0.2.4/web-app/backend/env_example.txt +0 -24
  269. programasweights-0.2.4/web-app/backend/example_images/README.md +0 -140
  270. programasweights-0.2.4/web-app/backend/get_data_examples.py +0 -55
  271. programasweights-0.2.4/web-app/backend/requirements.txt +0 -10
  272. programasweights-0.2.4/web-app/backend/run_server.py +0 -27
  273. programasweights-0.2.4/web-app/backend/setup_analytics_tables.sql +0 -16
  274. programasweights-0.2.4/web-app/backend/setup_auth_tables.sql +0 -30
  275. programasweights-0.2.4/web-app/backend/setup_cache_tables.sql +0 -73
  276. programasweights-0.2.4/web-app/backend/setup_cases_tables.sql +0 -36
  277. programasweights-0.2.4/web-app/backend/setup_database.sql +0 -248
  278. programasweights-0.2.4/web-app/backend/setup_database_simple.sql +0 -113
  279. programasweights-0.2.4/web-app/backend/setup_db.sh +0 -52
  280. programasweights-0.2.4/web-app/backend/setup_example_images.py +0 -166
  281. programasweights-0.2.4/web-app/backend/setup_hub_tables.sql +0 -74
  282. programasweights-0.2.4/web-app/backend/test_compilation_cache.py +0 -85
  283. programasweights-0.2.4/web-app/frontend/README.md +0 -73
  284. programasweights-0.2.4/web-app/frontend/e2e/full.spec.ts +0 -861
  285. programasweights-0.2.4/web-app/frontend/e2e/helpers.ts +0 -14
  286. programasweights-0.2.4/web-app/frontend/e2e/smoke.spec.ts +0 -117
  287. programasweights-0.2.4/web-app/frontend/eslint.config.js +0 -23
  288. programasweights-0.2.4/web-app/frontend/index.html +0 -39
  289. programasweights-0.2.4/web-app/frontend/package-lock.json +0 -5245
  290. programasweights-0.2.4/web-app/frontend/package.json +0 -43
  291. programasweights-0.2.4/web-app/frontend/playwright.config.ts +0 -17
  292. programasweights-0.2.4/web-app/frontend/postcss.config.js +0 -6
  293. programasweights-0.2.4/web-app/frontend/public/apple-touch-icon.png +0 -0
  294. programasweights-0.2.4/web-app/frontend/public/browser-worker.html +0 -142
  295. programasweights-0.2.4/web-app/frontend/public/favicon-16x16.png +0 -0
  296. programasweights-0.2.4/web-app/frontend/public/favicon-32x32.png +0 -0
  297. programasweights-0.2.4/web-app/frontend/public/paw-192.png +0 -0
  298. programasweights-0.2.4/web-app/frontend/public/paw-512.png +0 -0
  299. programasweights-0.2.4/web-app/frontend/public/paw.svg +0 -34
  300. programasweights-0.2.4/web-app/frontend/public/react-test.html +0 -112
  301. programasweights-0.2.4/web-app/frontend/public/test.html +0 -40
  302. programasweights-0.2.4/web-app/frontend/public/vite.svg +0 -1
  303. programasweights-0.2.4/web-app/frontend/scripts/deploy.sh +0 -43
  304. programasweights-0.2.4/web-app/frontend/src/App.css +0 -42
  305. programasweights-0.2.4/web-app/frontend/src/App.tsx +0 -110
  306. programasweights-0.2.4/web-app/frontend/src/assets/react.svg +0 -1
  307. programasweights-0.2.4/web-app/frontend/src/components/AboutPage.tsx +0 -210
  308. programasweights-0.2.4/web-app/frontend/src/components/AgentsPage.tsx +0 -268
  309. programasweights-0.2.4/web-app/frontend/src/components/AuthorPage.tsx +0 -135
  310. programasweights-0.2.4/web-app/frontend/src/components/BrowserPage.tsx +0 -600
  311. programasweights-0.2.4/web-app/frontend/src/components/CasesSection.tsx +0 -195
  312. programasweights-0.2.4/web-app/frontend/src/components/CompileButtonWithConfig.tsx +0 -115
  313. programasweights-0.2.4/web-app/frontend/src/components/CompileSection.tsx +0 -74
  314. programasweights-0.2.4/web-app/frontend/src/components/DocsPage.tsx +0 -496
  315. programasweights-0.2.4/web-app/frontend/src/components/ExamplesInput.tsx +0 -74
  316. programasweights-0.2.4/web-app/frontend/src/components/Footer.tsx +0 -86
  317. programasweights-0.2.4/web-app/frontend/src/components/Header.tsx +0 -176
  318. programasweights-0.2.4/web-app/frontend/src/components/HubPage.tsx +0 -351
  319. programasweights-0.2.4/web-app/frontend/src/components/HubProgramPage.tsx +0 -428
  320. programasweights-0.2.4/web-app/frontend/src/components/HubUploadPage.tsx +0 -21
  321. programasweights-0.2.4/web-app/frontend/src/components/LandingPage.tsx +0 -546
  322. programasweights-0.2.4/web-app/frontend/src/components/MainInterface.tsx +0 -664
  323. programasweights-0.2.4/web-app/frontend/src/components/ModelSelector.tsx +0 -55
  324. programasweights-0.2.4/web-app/frontend/src/components/NavigationHelper.tsx +0 -339
  325. programasweights-0.2.4/web-app/frontend/src/components/PrivacyPage.tsx +0 -101
  326. programasweights-0.2.4/web-app/frontend/src/components/ProfilePage.tsx +0 -283
  327. programasweights-0.2.4/web-app/frontend/src/components/SettingsPage.tsx +0 -215
  328. programasweights-0.2.4/web-app/frontend/src/components/SpecSuggestions.tsx +0 -49
  329. programasweights-0.2.4/web-app/frontend/src/components/TermsPage.tsx +0 -101
  330. programasweights-0.2.4/web-app/frontend/src/components/TestSection.tsx +0 -122
  331. programasweights-0.2.4/web-app/frontend/src/contexts/AuthContext.tsx +0 -45
  332. programasweights-0.2.4/web-app/frontend/src/index.css +0 -48
  333. programasweights-0.2.4/web-app/frontend/src/main.tsx +0 -13
  334. programasweights-0.2.4/web-app/frontend/src/types/index.ts +0 -206
  335. programasweights-0.2.4/web-app/frontend/src/utils/api.ts +0 -217
  336. programasweights-0.2.4/web-app/frontend/tailwind.config.js +0 -67
  337. programasweights-0.2.4/web-app/frontend/test-results/.last-run.json +0 -4
  338. programasweights-0.2.4/web-app/frontend/tsconfig.app.json +0 -28
  339. programasweights-0.2.4/web-app/frontend/tsconfig.json +0 -7
  340. programasweights-0.2.4/web-app/frontend/tsconfig.node.json +0 -26
  341. programasweights-0.2.4/web-app/frontend/vite.config.ts +0 -17
  342. programasweights-0.2.4/web-app/nginx-paw.conf +0 -56
  343. programasweights-0.2.4/web-app/nginx.conf +0 -111
  344. programasweights-0.2.4/web-app/setup_mysql.sh +0 -145
  345. programasweights-0.2.4/web-app/start.sh +0 -102
  346. programasweights-0.2.4/web-app/test_setup.py +0 -160
  347. programasweights-0.2.4/web-app/ttt.py +0 -26
  348. programasweights-0.2.4/web-sdk/.gitignore +0 -3
  349. programasweights-0.2.4/web-sdk/LICENSE +0 -21
  350. programasweights-0.2.4/web-sdk/README.md +0 -117
  351. programasweights-0.2.4/web-sdk/__tests__/e2e/browser.spec.ts +0 -223
  352. programasweights-0.2.4/web-sdk/__tests__/e2e/server.ts +0 -69
  353. programasweights-0.2.4/web-sdk/__tests__/e2e/start-server.ts +0 -2
  354. programasweights-0.2.4/web-sdk/__tests__/e2e/test-page.html +0 -122
  355. programasweights-0.2.4/web-sdk/__tests__/loader.test.ts +0 -244
  356. programasweights-0.2.4/web-sdk/__tests__/prompt.test.ts +0 -45
  357. programasweights-0.2.4/web-sdk/examples/basic.html +0 -121
  358. programasweights-0.2.4/web-sdk/package-lock.json +0 -3093
  359. programasweights-0.2.4/web-sdk/package.json +0 -58
  360. programasweights-0.2.4/web-sdk/playwright.config.ts +0 -19
  361. programasweights-0.2.4/web-sdk/serve.py +0 -12
  362. programasweights-0.2.4/web-sdk/src/index.ts +0 -55
  363. programasweights-0.2.4/web-sdk/src/loader.ts +0 -96
  364. programasweights-0.2.4/web-sdk/src/runtime.ts +0 -146
  365. programasweights-0.2.4/web-sdk/src/types.ts +0 -35
  366. programasweights-0.2.4/web-sdk/test-standalone.html +0 -188
  367. programasweights-0.2.4/web-sdk/tsconfig.json +0 -22
  368. programasweights-0.2.4/web-sdk/vitest.config.ts +0 -12
  369. programasweights-0.2.4/web-sdk/wllama/.git +0 -1
  370. programasweights-0.2.4/web-sdk/wllama/.github/workflows/build-hf-space.yml +0 -41
  371. programasweights-0.2.4/web-sdk/wllama/.github/workflows/ci.yml +0 -80
  372. programasweights-0.2.4/web-sdk/wllama/.github/workflows/generate-docs.yml +0 -63
  373. programasweights-0.2.4/web-sdk/wllama/.github/workflows/verify-generated-code.yml +0 -37
  374. programasweights-0.2.4/web-sdk/wllama/.gitignore +0 -16
  375. programasweights-0.2.4/web-sdk/wllama/.gitmodules +0 -3
  376. programasweights-0.2.4/web-sdk/wllama/.npmignore +0 -9
  377. programasweights-0.2.4/web-sdk/wllama/.prettierignore +0 -35
  378. programasweights-0.2.4/web-sdk/wllama/CMakeLists.txt +0 -23
  379. programasweights-0.2.4/web-sdk/wllama/LICENCE +0 -21
  380. programasweights-0.2.4/web-sdk/wllama/README.md +0 -210
  381. programasweights-0.2.4/web-sdk/wllama/README_banner.png +0 -0
  382. programasweights-0.2.4/web-sdk/wllama/assets/screenshot_0.png +0 -0
  383. programasweights-0.2.4/web-sdk/wllama/cpp/actions.hpp +0 -949
  384. programasweights-0.2.4/web-sdk/wllama/cpp/generate_glue_prototype.js +0 -115
  385. programasweights-0.2.4/web-sdk/wllama/cpp/glue.hpp +0 -874
  386. programasweights-0.2.4/web-sdk/wllama/cpp/helpers/wcommon.cpp +0 -580
  387. programasweights-0.2.4/web-sdk/wllama/cpp/helpers/wcommon.h +0 -561
  388. programasweights-0.2.4/web-sdk/wllama/cpp/helpers/wlog.cpp +0 -392
  389. programasweights-0.2.4/web-sdk/wllama/cpp/helpers/wlog.h +0 -102
  390. programasweights-0.2.4/web-sdk/wllama/cpp/helpers/wsampling.cpp +0 -526
  391. programasweights-0.2.4/web-sdk/wllama/cpp/helpers/wsampling.h +0 -107
  392. programasweights-0.2.4/web-sdk/wllama/cpp/test_glue.cpp +0 -80
  393. programasweights-0.2.4/web-sdk/wllama/cpp/wllama.cpp +0 -194
  394. programasweights-0.2.4/web-sdk/wllama/examples/basic/index.html +0 -176
  395. programasweights-0.2.4/web-sdk/wllama/examples/embeddings/index.html +0 -107
  396. programasweights-0.2.4/web-sdk/wllama/examples/main/.eslintrc.cjs +0 -18
  397. programasweights-0.2.4/web-sdk/wllama/examples/main/.gitignore +0 -24
  398. programasweights-0.2.4/web-sdk/wllama/examples/main/README.md +0 -6
  399. programasweights-0.2.4/web-sdk/wllama/examples/main/index.html +0 -13
  400. programasweights-0.2.4/web-sdk/wllama/examples/main/package-lock.json +0 -5800
  401. programasweights-0.2.4/web-sdk/wllama/examples/main/package.json +0 -40
  402. programasweights-0.2.4/web-sdk/wllama/examples/main/postcss.config.js +0 -6
  403. programasweights-0.2.4/web-sdk/wllama/examples/main/public/favicon.ico +0 -0
  404. programasweights-0.2.4/web-sdk/wllama/examples/main/public/wllama.png +0 -0
  405. programasweights-0.2.4/web-sdk/wllama/examples/main/src/App.tsx +0 -40
  406. programasweights-0.2.4/web-sdk/wllama/examples/main/src/components/ChatScreen.tsx +0 -196
  407. programasweights-0.2.4/web-sdk/wllama/examples/main/src/components/GuideScreen.tsx +0 -91
  408. programasweights-0.2.4/web-sdk/wllama/examples/main/src/components/LogScreen.tsx +0 -26
  409. programasweights-0.2.4/web-sdk/wllama/examples/main/src/components/MarkdownMessage.tsx +0 -58
  410. programasweights-0.2.4/web-sdk/wllama/examples/main/src/components/ModelScreen.tsx +0 -444
  411. programasweights-0.2.4/web-sdk/wllama/examples/main/src/components/Navbar.tsx +0 -27
  412. programasweights-0.2.4/web-sdk/wllama/examples/main/src/components/ScreenWrapper.tsx +0 -17
  413. programasweights-0.2.4/web-sdk/wllama/examples/main/src/components/Sidebar.tsx +0 -119
  414. programasweights-0.2.4/web-sdk/wllama/examples/main/src/config.ts +0 -96
  415. programasweights-0.2.4/web-sdk/wllama/examples/main/src/index.css +0 -56
  416. programasweights-0.2.4/web-sdk/wllama/examples/main/src/main.tsx +0 -11
  417. programasweights-0.2.4/web-sdk/wllama/examples/main/src/utils/benchmark.ts +0 -116
  418. programasweights-0.2.4/web-sdk/wllama/examples/main/src/utils/custom-models.tsx +0 -97
  419. programasweights-0.2.4/web-sdk/wllama/examples/main/src/utils/displayed-model.tsx +0 -90
  420. programasweights-0.2.4/web-sdk/wllama/examples/main/src/utils/messages.context.tsx +0 -120
  421. programasweights-0.2.4/web-sdk/wllama/examples/main/src/utils/nl2br.tsx +0 -10
  422. programasweights-0.2.4/web-sdk/wllama/examples/main/src/utils/types.ts +0 -38
  423. programasweights-0.2.4/web-sdk/wllama/examples/main/src/utils/use-interval-when.ts +0 -48
  424. programasweights-0.2.4/web-sdk/wllama/examples/main/src/utils/utils.ts +0 -133
  425. programasweights-0.2.4/web-sdk/wllama/examples/main/src/utils/wllama.context.tsx +0 -293
  426. programasweights-0.2.4/web-sdk/wllama/examples/main/src/vite-env.d.ts +0 -1
  427. programasweights-0.2.4/web-sdk/wllama/examples/main/tailwind.config.cjs +0 -8
  428. programasweights-0.2.4/web-sdk/wllama/examples/main/tsconfig.app.json +0 -27
  429. programasweights-0.2.4/web-sdk/wllama/examples/main/tsconfig.json +0 -11
  430. programasweights-0.2.4/web-sdk/wllama/examples/main/tsconfig.node.json +0 -13
  431. programasweights-0.2.4/web-sdk/wllama/examples/main/vite.config.ts +0 -20
  432. programasweights-0.2.4/web-sdk/wllama/guides/intro-v2.md +0 -132
  433. programasweights-0.2.4/web-sdk/wllama/index.ts +0 -1
  434. programasweights-0.2.4/web-sdk/wllama/package-lock.json +0 -7396
  435. programasweights-0.2.4/web-sdk/wllama/package.json +0 -68
  436. programasweights-0.2.4/web-sdk/wllama/scripts/build_hf_space.sh +0 -26
  437. programasweights-0.2.4/web-sdk/wllama/scripts/build_wasm.sh +0 -19
  438. programasweights-0.2.4/web-sdk/wllama/scripts/build_worker.sh +0 -39
  439. programasweights-0.2.4/web-sdk/wllama/scripts/docker-compose.yml +0 -53
  440. programasweights-0.2.4/web-sdk/wllama/scripts/generate_wasm_from_cdn.js +0 -20
  441. programasweights-0.2.4/web-sdk/wllama/scripts/http_server.js +0 -33
  442. programasweights-0.2.4/web-sdk/wllama/scripts/post_build.sh +0 -26
  443. programasweights-0.2.4/web-sdk/wllama/src/cache-manager.ts +0 -392
  444. programasweights-0.2.4/web-sdk/wllama/src/glue/glue.ts +0 -291
  445. programasweights-0.2.4/web-sdk/wllama/src/glue/messages.ts +0 -1346
  446. programasweights-0.2.4/web-sdk/wllama/src/index.ts +0 -4
  447. programasweights-0.2.4/web-sdk/wllama/src/mjs.test.ts +0 -48
  448. programasweights-0.2.4/web-sdk/wllama/src/model-manager.test.ts +0 -200
  449. programasweights-0.2.4/web-sdk/wllama/src/model-manager.ts +0 -324
  450. programasweights-0.2.4/web-sdk/wllama/src/multi-thread/wllama.js +0 -1
  451. programasweights-0.2.4/web-sdk/wllama/src/multi-thread/wllama.wasm +0 -0
  452. programasweights-0.2.4/web-sdk/wllama/src/single-thread/wllama.js +0 -1
  453. programasweights-0.2.4/web-sdk/wllama/src/single-thread/wllama.wasm +0 -0
  454. programasweights-0.2.4/web-sdk/wllama/src/utils.test.ts +0 -231
  455. programasweights-0.2.4/web-sdk/wllama/src/utils.ts +0 -271
  456. programasweights-0.2.4/web-sdk/wllama/src/wasm-from-cdn.ts +0 -9
  457. programasweights-0.2.4/web-sdk/wllama/src/wllama.test.ts +0 -402
  458. programasweights-0.2.4/web-sdk/wllama/src/wllama.ts +0 -1396
  459. programasweights-0.2.4/web-sdk/wllama/src/worker.ts +0 -298
  460. programasweights-0.2.4/web-sdk/wllama/src/workers-code/generated.ts +0 -13
  461. programasweights-0.2.4/web-sdk/wllama/src/workers-code/llama-cpp.js +0 -383
  462. programasweights-0.2.4/web-sdk/wllama/src/workers-code/opfs-utils.js +0 -141
  463. programasweights-0.2.4/web-sdk/wllama/tsconfig.build.json +0 -34
  464. programasweights-0.2.4/web-sdk/wllama/tsup.config.ts +0 -23
  465. programasweights-0.2.4/web-sdk/wllama/vitest.config.ts +0 -44
  466. {programasweights-0.2.4 → programasweights-0.2.7}/.readthedocs.yaml +0 -0
  467. {programasweights-0.2.4 → programasweights-0.2.7}/LICENSE +0 -0
  468. {programasweights-0.2.4 → programasweights-0.2.7}/docs/adr/001-llama-cpp-over-pytorch.md +0 -0
  469. {programasweights-0.2.4 → programasweights-0.2.7}/docs/adr/002-q4_0-adapter-format.md +0 -0
  470. {programasweights-0.2.4 → programasweights-0.2.7}/docs/adr/003-single-spec-field.md +0 -0
  471. {programasweights-0.2.4 → programasweights-0.2.7}/docs/adr/004-compiler-naming.md +0 -0
  472. {programasweights-0.2.4 → programasweights-0.2.7}/docs/adr/005-vllm-hidden-states.md +0 -0
  473. {programasweights-0.2.4 → programasweights-0.2.7}/docs/adr/006-email-api-key-auth.md +0 -0
  474. {programasweights-0.2.4 → programasweights-0.2.7}/docs/advanced/adrs.md +0 -0
  475. {programasweights-0.2.4 → programasweights-0.2.7}/docs/advanced/architecture.md +0 -0
  476. {programasweights-0.2.4 → programasweights-0.2.7}/docs/api-reference/cli.md +0 -0
  477. {programasweights-0.2.4 → programasweights-0.2.7}/docs/api-reference/rest-api.md +0 -0
  478. {programasweights-0.2.4 → programasweights-0.2.7}/docs/architecture.md +0 -0
  479. {programasweights-0.2.4 → programasweights-0.2.7}/docs/getting-started/first-program.md +0 -0
  480. {programasweights-0.2.4 → programasweights-0.2.7}/docs/getting-started/installation.md +0 -0
  481. {programasweights-0.2.4 → programasweights-0.2.7}/docs/getting-started/naming-programs.md +0 -0
  482. {programasweights-0.2.4 → programasweights-0.2.7}/docs/guide/browser-inference.md +0 -0
  483. {programasweights-0.2.4 → programasweights-0.2.7}/docs/guide/how-it-works.md +0 -0
  484. {programasweights-0.2.4 → programasweights-0.2.7}/docs/guide/local-inference.md +0 -0
  485. {programasweights-0.2.4 → programasweights-0.2.7}/docs/guide/writing-good-specs.md +0 -0
  486. {programasweights-0.2.4 → programasweights-0.2.7}/docs/hub/browsing-programs.md +0 -0
  487. {programasweights-0.2.4 → programasweights-0.2.7}/docs/hub/feedback-cases.md +0 -0
  488. {programasweights-0.2.4 → programasweights-0.2.7}/docs/hub/publishing-programs.md +0 -0
  489. {programasweights-0.2.4 → programasweights-0.2.7}/docs/requirements.txt +0 -0
  490. {programasweights-0.2.4 → programasweights-0.2.7}/examples/flask_app.py +0 -0
  491. {programasweights-0.2.4 → programasweights-0.2.7}/examples/jupyter_notebook.py +0 -0
  492. {programasweights-0.2.4 → programasweights-0.2.7}/examples/langchain_integration.py +0 -0
  493. {programasweights-0.2.4 → programasweights-0.2.7}/examples/replace_openai.py +0 -0
  494. {programasweights-0.2.4 → programasweights-0.2.7}/programasweights/artifacts.py +0 -0
  495. {programasweights-0.2.4 → programasweights-0.2.7}/programasweights/cli.py +0 -0
  496. {programasweights-0.2.4 → programasweights-0.2.7}/programasweights/compiler/__init__.py +0 -0
  497. {programasweights-0.2.4 → programasweights-0.2.7}/programasweights/compiler/dummy.py +0 -0
  498. {programasweights-0.2.4 → programasweights-0.2.7}/programasweights/convert_peft_to_paw.py +0 -0
  499. {programasweights-0.2.4 → programasweights-0.2.7}/programasweights/paw_format.py +0 -0
  500. {programasweights-0.2.4 → programasweights-0.2.7}/programasweights/runtime/__init__.py +0 -0
  501. {programasweights-0.2.4 → programasweights-0.2.7}/programasweights/runtime/interpreter.py +0 -0
  502. {programasweights-0.2.4 → programasweights-0.2.7}/programasweights/runtime/interpreter_onnx.py +0 -0
  503. {programasweights-0.2.4 → programasweights-0.2.7}/tests/test_offline_cache.py +0 -0
  504. {programasweights-0.2.4 → programasweights-0.2.7}/tests/test_sdk.py +0 -0
  505. {programasweights-0.2.4 → programasweights-0.2.7}/tests/test_sdk.sh +0 -0
@@ -0,0 +1,14 @@
1
+ __pycache__/
2
+ *.pyc
3
+ *.egg-info/
4
+ dist/
5
+ build/
6
+ .eggs/
7
+ *.egg
8
+ .venv/
9
+ venv/
10
+ .env
11
+ .mypy_cache/
12
+ .pytest_cache/
13
+ .ruff_cache/
14
+ *.so
@@ -3,7 +3,7 @@
3
3
  PAW compiles natural language specifications into tiny neural functions that run locally. Each function takes a single text input and returns a single text output. Use it when you need fuzzy text processing — classification, extraction, format repair, search, triage — that regex can't handle but a full LLM is overkill for.
4
4
 
5
5
  Website: https://programasweights.com
6
- Docs: https://programasweights.readthedocs.io
6
+ Full documentation: https://programasweights.readthedocs.io
7
7
 
8
8
  ## Install
9
9
 
@@ -20,7 +20,7 @@ import programasweights as paw
20
20
  # "email-triage" is an official pre-compiled program (slug)
21
21
  fn = paw.function("email-triage")
22
22
  fn("Urgent: server is down!") # "immediate"
23
- fn("Newsletter: spring picnic") # "wait"
23
+ fn("Newsletter: spring picnic") # "can wait"
24
24
 
25
25
  # Compile your own from a description
26
26
  program = paw.compile(
@@ -37,16 +37,8 @@ fn("I love this!") # "positive"
37
37
 
38
38
  ## Two Compilers
39
39
 
40
- | | Standard (Qwen3 0.6B) | Compact (GPT-2 124M) |
41
- |---|---|---|
42
- | Compiler name | `paw-4b-qwen3-0.6b` | `paw-4b-gpt2` |
43
- | Accuracy | Higher | Lower |
44
- | Base model size | 594 MB | 105 MB |
45
- | Program size | ~22 MB | ~5 MB |
46
- | Inference speed | ~90ms (server) | ~50ms (server) |
47
- | Runs in browser | No | Yes (must use this compiler) |
48
-
49
- Default is Standard. Use Compact for smaller files or browser deployment.
40
+ - **Standard** (`paw-4b-qwen3-0.6b`) higher accuracy, 594 MB base + ~22 MB/program. Default.
41
+ - **Compact** (`paw-4b-gpt2`) — smaller (105 MB base + ~5 MB/program), runs in browser via WebAssembly.
50
42
 
51
43
  ## When to Use PAW
52
44
 
@@ -60,7 +52,9 @@ Default is Standard. Use Compact for smaller files or browser deployment.
60
52
 
61
53
  ## Writing Good Specs
62
54
 
63
- Description + examples. Use `Input: ... Output: ...` format.
55
+ **The #1 practice: iterate with test cases.** Do not accept low performance on the first try. Build a test suite of input/output pairs, measure accuracy, then iteratively adjust wording and formatting until performance is good enough. Treat spec writing like software engineering: test, debug specific failures, fix the wording, retest.
56
+
57
+ A good spec has a description plus `Input: ... Output: ...` examples.
64
58
 
65
59
  ```python
66
60
  fn = paw.compile_and_load("""
@@ -77,9 +71,59 @@ Output: delete
77
71
  """)
78
72
  ```
79
73
 
80
- - State output constraints explicitly if any: "Return ONLY one of: X, Y, Z"
81
- - Each function is stateless: one input, one output. No conversation history.
82
- - Write a few test inputs with expected outputs, then try different spec phrasings and pick the one that passes the most.
74
+ **Spec-tuning tips:**
75
+
76
+ - Each function is stateless: one text input, one text output. No conversation history.
77
+ - **State output constraints explicitly**: "Return ONLY one of: X, Y, Z". Without this the model may produce free-form text.
78
+ - **Include examples from your actual data**: Examples outperform prose-only descriptions.
79
+ - **Debug failures before sweeping**: Look at specific failing examples and understand WHY before trying many variants.
80
+
81
+ ## Chaining Functions
82
+
83
+ Multiple PAW functions can be composed for multi-step tasks:
84
+
85
+ ```python
86
+ classifier = paw.compile_and_load("Classify the bug type. Return ONLY one of: off-by-one, type-error, other")
87
+ fixer = paw.compile_and_load("Fix the bug described in the first line. Return only the corrected code.")
88
+
89
+ label = classifier(code_snippet)
90
+ if label != "other":
91
+ fix = fixer(f"{label}: {code_snippet}")
92
+ ```
93
+
94
+ Chain them with regular Python logic.
95
+
96
+ ## Case Studies
97
+
98
+ Production examples with iterative spec-tuning walkthroughs: [site navigation](https://programasweights.readthedocs.io/en/latest/case-studies/site-navigation/) (5-program pipeline, Cmd+K helper) and [semantic search](https://programasweights.readthedocs.io/en/latest/case-studies/semantic-search/) (reranking without a vector database).
99
+
100
+ ## Event-Driven Monitoring
101
+
102
+ PAW functions can classify log output. Compile once with examples from your specific logs, then reuse the function locally forever:
103
+
104
+ ```python
105
+ program = paw.compile("""
106
+ Classify log lines. Return ONLY one word: ALERT or QUIET.
107
+
108
+ Input: [step 100] loss=0.05 lr=0.0001
109
+ Output: QUIET
110
+
111
+ Input: [Checkpoint] Saved model at step 1000
112
+ Output: ALERT
113
+
114
+ Input: Traceback (most recent call last):
115
+ Output: ALERT
116
+
117
+ Input: Training complete. Final loss: 0.11
118
+ Output: ALERT
119
+ """)
120
+
121
+ fn = paw.function(program.id) # reuse with saved program.id
122
+ fn("[step 200] loss=0.04") # "QUIET"
123
+ fn("[Checkpoint] Saved model") # "ALERT"
124
+ ```
125
+
126
+ Full tool with file watching, truncation, and stall detection: [examples/paw_monitor.py](https://github.com/programasweights/programasweights-python/blob/main/examples/paw_monitor.py)
83
127
 
84
128
  ## Browser / JavaScript SDK
85
129
 
@@ -114,19 +158,7 @@ Generate API keys at https://programasweights.com/settings.
114
158
 
115
159
  ## CLI
116
160
 
117
- ```bash
118
- paw compile --spec "Classify sentiment" --json
119
- paw run --program <program_id> --input "I love this!" --json
120
- paw info <program_id> # show program metadata
121
- paw rename <program_id> my-slug # name a program (requires auth)
122
- paw login # save API key
123
- ```
124
-
125
- `--json` gives structured output. Example:
126
-
127
- ```json
128
- {"program_id": "a6b454023d41ac9ca845", "slug": null, "status": "ready", "error": null, "timings": {"total_ms": 2800}}
129
- ```
161
+ Commands: `paw compile --spec "..." --json`, `paw run --program <id> --input "..."`, `paw info <id>`, `paw rename <id> <slug>`, `paw login`. All support `--json` for structured output.
130
162
 
131
163
  ## Full API Reference
132
164
 
@@ -143,7 +175,7 @@ fn = paw.function(program) # accepts Program object, hash ID, or sl
143
175
  fn = paw.function("a6b454023d41ac9ca845")
144
176
  fn = paw.function("da03/my-classifier")
145
177
 
146
- result: str = fn(input_text: str, max_tokens=512, temperature=0.0)
178
+ result: str = fn(input_text: str, max_tokens=None, temperature=0.0)
147
179
 
148
180
  fn = paw.compile_and_load(spec, compiler="paw-4b-qwen3-0.6b")
149
181
 
@@ -156,18 +188,19 @@ paw.login()
156
188
 
157
189
  | Error | Cause | Fix |
158
190
  |-------|-------|-----|
159
- | `httpx.HTTPStatusError: 404` on download | Program still uploading to CDN | SDK retries automatically. If persistent, recompile. |
191
+ | `RuntimeError: assets not ready` on download | Program still generating after compile | SDK polls automatically for up to 30s. If persistent, recompile. |
160
192
  | `httpx.HTTPStatusError: 422` on compile | Spec too short (<10 chars) | Adjust spec length. |
161
193
  | `httpx.HTTPStatusError: 429` | Rate limit exceeded | Wait, or sign in for higher limits. |
162
194
 
163
195
  ## Performance
164
196
 
165
- - **First call** ~500ms (loads base model). Subsequent calls ~50-90ms.
166
- - **Base model shared** across functions. Each LoRA adapter adds ~22 MB.
167
- - **Thread-safe** and **blocking**.
197
+ - **First call** ~5-15s (loads base model). Subsequent calls 0.5-5s depending on input length.
198
+ - **Base model shared** across functions on disk. Each LoRA adapter adds ~22 MB.
168
199
  - **Cache**: `~/.cache/programasweights/`. Override with `PAW_CACHE_DIR`.
169
200
  - **Offline** after first download.
170
201
 
171
- ## Browse Programs
202
+ ## Limits
203
+
204
+ - Spec + input + output share a ~2048 token context window. Inputs that exceed it will error.
205
+ - `max_tokens` defaults to `None`: generation runs until EOS or the context limit.
172
206
 
173
- https://programasweights.com/hub
@@ -1,5 +1,16 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.2.4 (2026-04-01)
4
+
5
+ - Download reliability: asset endpoints return 202 Retry-After when program is still generating, eliminating 404 race conditions
6
+ - Guard local cleanup on HF upload success: files persist locally if upload fails
7
+ - Stderr suppression now covers LoRA adapter loading (fixes CPU_REPACK warnings on 0.2.3)
8
+ - Browser: fix LoRA switching bug (free old adapter + clear KV before loading new program)
9
+
10
+ ## 0.2.3 (2026-04-01)
11
+
12
+ - Python 3.9 compatibility fix (`from __future__ import annotations`)
13
+
3
14
  ## 0.2.2 (2026-03-19)
4
15
 
5
16
  - Add `paw.compile_and_load()` convenience method (compile + load in one call)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: programasweights
3
- Version: 0.2.4
3
+ Version: 0.2.7
4
4
  Summary: Compile natural language specifications into neural programs that run locally via llama.cpp.
5
5
  Project-URL: Homepage, https://programasweights.com
6
6
  Project-URL: Repository, https://github.com/programasweights/programasweights-python
@@ -23,7 +23,7 @@ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
23
23
  Classifier: Topic :: Software Development :: Libraries :: Python Modules
24
24
  Requires-Python: >=3.9
25
25
  Requires-Dist: httpx<1.0,>=0.27.0
26
- Requires-Dist: llama-cpp-python<=0.3.18,>=0.3.0
26
+ Requires-Dist: llama-cpp-python<=0.3.19,>=0.3.0
27
27
  Provides-Extra: test
28
28
  Requires-Dist: pytest; extra == 'test'
29
29
  Description-Content-Type: text/markdown
@@ -48,7 +48,7 @@ import programasweights as paw
48
48
  # Use a pre-compiled function (downloads once, runs locally forever)
49
49
  fn = paw.function("email-triage")
50
50
  fn("Urgent: the server is down!") # "immediate"
51
- fn("Newsletter: spring picnic") # "wait"
51
+ fn("Newsletter: spring picnic") # "can wait"
52
52
 
53
53
  # Compile your own from a description
54
54
  program = paw.compile(
@@ -18,7 +18,7 @@ import programasweights as paw
18
18
  # Use a pre-compiled function (downloads once, runs locally forever)
19
19
  fn = paw.function("email-triage")
20
20
  fn("Urgent: the server is down!") # "immediate"
21
- fn("Newsletter: spring picnic") # "wait"
21
+ fn("Newsletter: spring picnic") # "can wait"
22
22
 
23
23
  # Compile your own from a description
24
24
  program = paw.compile(
@@ -0,0 +1,113 @@
1
+ # ProgramAsWeights
2
+
3
+ **Compile natural language specs into tiny neural functions that run locally.**
4
+
5
+ Define what a function should do in plain English. PAW compiles it into a small neural program that runs on your machine — no API keys at runtime, no internet needed after setup, fully deterministic.
6
+
7
+ ## Install
8
+
9
+ ```bash
10
+ pip install programasweights
11
+ ```
12
+
13
+ ## Quick Start
14
+
15
+ ```python
16
+ import programasweights as paw
17
+
18
+ # Use a pre-compiled function (downloads once, runs locally forever)
19
+ fn = paw.function("email-triage")
20
+ fn("Urgent: the server is down!") # "immediate"
21
+ fn("Newsletter: spring picnic") # "can wait"
22
+
23
+ # Compile your own from a description
24
+ program = paw.compile(
25
+ "Fix malformed JSON: repair missing quotes and trailing commas",
26
+ compiler="paw-4b-qwen3-0.6b" # or "paw-4b-gpt2" for smaller/faster
27
+ )
28
+ fn = paw.function(program.id)
29
+ fn("{name: 'Alice',}") # '{"name": "Alice"}'
30
+ ```
31
+
32
+ ## Two Compilers
33
+
34
+ | | Standard (Qwen3 0.6B) | Compact (GPT-2 124M) |
35
+ |--------------------|-------------------------|------------------------|
36
+ | Compiler name | `paw-4b-qwen3-0.6b` | `paw-4b-gpt2` |
37
+ | Accuracy | Higher | Lower |
38
+ | Base model size | 594 MB | 105 MB |
39
+ | Program size | ~22 MB | ~5 MB |
40
+ | Inference speed | ~90ms (server) | ~50ms (server) |
41
+ | Runs in browser | No | Yes |
42
+
43
+ Default is Standard (Qwen3 0.6B). Use Compact (GPT-2) when you need smaller files or browser deployment.
44
+
45
+ ## Browser SDK
46
+
47
+ Programs compiled with GPT-2 also run entirely in the browser via WebAssembly — no server needed, data never leaves the user's device.
48
+
49
+ ```bash
50
+ npm install @programasweights/web
51
+ ```
52
+
53
+ ```javascript
54
+ import paw from '@programasweights/web';
55
+
56
+ const fn = await paw.function('programasweights/email-triage');
57
+ const result = await fn('Urgent: the server is down!');
58
+ // result: "immediate"
59
+ ```
60
+
61
+ See the [browser SDK repo](https://github.com/programasweights/programasweights-js) for full documentation.
62
+
63
+ ## Use with AI Agents
64
+
65
+ PAW works with Cursor, Claude, Codex, and other AI coding assistants. Paste this into your agent's chat:
66
+
67
+ > I want to use ProgramAsWeights (PAW) to create fuzzy text functions that run locally. Read the instructions at https://programasweights.com/agents and help me integrate it.
68
+
69
+ Or save [`AGENTS.md`](https://programasweights.com/agents) to your project root — agents read it automatically.
70
+
71
+ ## When to Use PAW
72
+
73
+ - **Fuzzy search** — typo-tolerant matching, semantic search, near-duplicate detection
74
+ - **Format repair** — fix broken JSON, normalize dates, repair malformed inputs
75
+ - **Classification** — sentiment, urgency, categories defined in your own words
76
+ - **Extraction** — emails, names, dates from messy unstructured text
77
+ - **Log triage** — extract errors from verbose output, filter noise
78
+ - **Intent routing** — map user descriptions to the closest URL, menu item, or setting
79
+ - **Agent preprocessing** — parse tool calls, validate outputs, route tasks
80
+
81
+ ## Authentication
82
+
83
+ ```bash
84
+ # Option 1: environment variable (recommended)
85
+ export PAW_API_KEY=paw_sk_...
86
+
87
+ # Option 2: CLI login (opens browser to generate key)
88
+ paw login
89
+ ```
90
+
91
+ Generate API keys at [programasweights.com/settings](https://programasweights.com/settings). Authenticated users get higher rate limits.
92
+
93
+ ## CLI
94
+
95
+ ```bash
96
+ paw compile --spec "Extract error lines from logs" --json
97
+ paw run --program <program_id> --input "[ERROR] timeout" --json
98
+ paw login
99
+ ```
100
+
101
+ `--json` gives structured output for programmatic use.
102
+
103
+ ## Links
104
+
105
+ - **Website**: [programasweights.com](https://programasweights.com)
106
+ - **Documentation**: [programasweights.readthedocs.io](https://programasweights.readthedocs.io)
107
+ - **Python SDK**: [github.com/programasweights/programasweights-python](https://github.com/programasweights/programasweights-python)
108
+ - **Browser SDK**: [github.com/programasweights/programasweights-js](https://github.com/programasweights/programasweights-js)
109
+ - **Program Hub**: [programasweights.com/hub](https://programasweights.com/hub)
110
+
111
+ ## License
112
+
113
+ MIT
@@ -32,15 +32,17 @@ Loads a compiled program and returns a callable. Downloads the program and base
32
32
  The returned callable:
33
33
 
34
34
  ```python
35
- output: str = fn(input_text, max_tokens=512, temperature=0.0)
35
+ output: str = fn(input_text, max_tokens=None, temperature=0.0)
36
36
  ```
37
37
 
38
38
  | Parameter | Description |
39
39
  |-----------|-------------|
40
40
  | `input_text` | Input string for the program. |
41
- | `max_tokens` | Maximum tokens to generate (default `512`). |
41
+ | `max_tokens` | Maximum tokens to generate. `None` (default) = use all remaining context window. |
42
42
  | `temperature` | Sampling temperature (default `0.0`). |
43
43
 
44
+ **Context limits:** Spec + input + output share a ~2048 token window. If input + output together exceed the window, generation will error. For short inputs, high `max_tokens` is safe (stops at EOS). For long inputs, set `max_tokens` conservatively.
45
+
44
46
  ## `paw.compile`
45
47
 
46
48
  ```python
@@ -0,0 +1,146 @@
1
+ # Semantic Search Without a Vector Database
2
+
3
+ Most websites rely on keyword search — PostgreSQL full-text search, Elasticsearch, or similar. These work for exact terms but miss intent: a search for "something that works in the browser" won't match a program described as "runs client-side via WebAssembly." Adding semantic understanding normally requires vector databases, embedding pipelines, and external services. PAW lets you add intent-aware reranking on top of your existing search — no infrastructure changes, no embeddings, no external dependencies.
4
+
5
+ **Try it live:** Search at [programasweights.com/hub](https://programasweights.com/hub) — try queries like "something that works in the browser" or "not a classifier."
6
+
7
+ ## How we built it
8
+
9
+ ### Attempt 1: Numeric relevance scoring (1–10)
10
+
11
+ The obvious approach: compile a scorer that rates each search result on a 1–10 scale.
12
+
13
+ ```
14
+ Rate the relevance of this search result to the query on a scale of 1-10.
15
+ Query: "counting tasks"
16
+ ```
17
+
18
+ **Result:** The model clustered everything at 8–10. A search for "counting tasks" gave 9/10 to a sentiment classifier because it vaguely involved processing text. No discrimination.
19
+
20
+ **Lesson:** Small models can't produce fine-grained numeric scores. They don't have a calibrated sense of what "7 vs 8" means.
21
+
22
+ ### Attempt 2: Binary yes/no
23
+
24
+ Simplify to binary: is this result relevant or not?
25
+
26
+ ```
27
+ Is this search result relevant to the query? Return YES or NO.
28
+ ```
29
+
30
+ **Result:** Better discrimination, but couldn't distinguish "perfect match" from "vaguely related." Everything relevant got YES, so the top results were still unordered.
31
+
32
+ **Lesson:** Binary lacks granularity. You need at least 3–4 buckets to produce a meaningful ranking.
33
+
34
+ ### Attempt 3: Discrete categories
35
+
36
+ Use 3–4 named categories that map to sort order:
37
+
38
+ ```
39
+ Rate how well the candidate matches the query.
40
+ Return ONLY one of: exact_match, highly_relevant, somewhat_relevant, not_relevant
41
+ ```
42
+
43
+ **Result:** Much better. The model could reliably distinguish "this is exactly what they asked for" from "this is tangentially related." Mapping `exact_match=3, highly_relevant=2, somewhat_relevant=1, not_relevant=0` produced clean rankings.
44
+
45
+ **Lesson:** Discrete named categories work where numeric scales fail. The names give the model clear semantic anchors.
46
+
47
+ ### Attempt 4: Explicit exclusion rules
48
+
49
+ A search for "not a classifier" still returned classifiers ranked highly. The model ignored the negation.
50
+
51
+ **Fix:** Add an explicit rule for exclusions in the spec:
52
+
53
+ ```
54
+ If the query excludes something, those candidates are not_relevant.
55
+ ```
56
+
57
+ **Result:** Negation queries started working. "Not a classifier" correctly demoted classifiers.
58
+
59
+ **Lesson:** State rules explicitly. Don't assume the model infers constraints from the query — spell them out in the spec.
60
+
61
+ ## The solution
62
+
63
+ ### Spec template
64
+
65
+ ```python
66
+ SCORER_SPEC = """
67
+ You are a search matcher. Rate how well the candidate matches the query.
68
+ Match all constraints: {constraint_types}.
69
+ If the query excludes something, those candidates are not_relevant.
70
+
71
+ Query: "{query}"
72
+
73
+ Return ONLY one of: exact_match, highly_relevant, somewhat_relevant, not_relevant
74
+ """
75
+
76
+ scorer = paw.compile(SCORER_SPEC.format(
77
+ constraint_types="topic, author, and category",
78
+ query="counting tasks by da03",
79
+ ))
80
+ ```
81
+
82
+ Replace `constraint_types` with whatever metadata your search results have (topic, author, date, category, price range, etc.).
83
+
84
+ ### Architecture
85
+
86
+ ```
87
+ User query
88
+
89
+
90
+ Keyword search (FTS / Elasticsearch / etc.)
91
+ │ returns top N candidates
92
+
93
+ Compile PAW scorer for this query (cached by query text)
94
+
95
+
96
+ Score each candidate ──► exact_match / highly_relevant / somewhat / not_relevant
97
+ │ │
98
+ ▼ ▼
99
+ Map to integers Sort descending
100
+
101
+
102
+ Return reranked results
103
+ ```
104
+
105
+ ### Candidate formatting
106
+
107
+ Each candidate is passed to the scorer as a text block. Include the fields that matter for your domain:
108
+
109
+ ```python
110
+ SCORE_MAP = {"exact_match": 3, "highly_relevant": 2, "somewhat_relevant": 1, "not_relevant": 0}
111
+
112
+ def rerank(query: str, candidates: list[dict]) -> list[dict]:
113
+ scorer = paw.compile_and_load(SCORER_SPEC.format(
114
+ constraint_types="topic, author, and category",
115
+ query=query,
116
+ ))
117
+
118
+ scored = []
119
+ for c in candidates:
120
+ text = f"Name: {c['name']}\nAuthor: {c['author']}\nDescription: {c['description']}"
121
+ label = scorer(text)
122
+ scored.append((SCORE_MAP.get(label, 0), c))
123
+
124
+ scored.sort(key=lambda x: x[0], reverse=True)
125
+ return [c for _, c in scored]
126
+ ```
127
+
128
+ ### Progressive UX
129
+
130
+ Show keyword results immediately. If the server isn't busy, fire the reranking in the background and update the results once scoring completes. Users see instant results that get refined — no loading spinner.
131
+
132
+ ## Adapting this for your site
133
+
134
+ 1. **Start with your existing search.** PAW reranking is a layer on top — it doesn't replace your keyword search.
135
+ 2. **Pick your constraint types.** What metadata do your results have? Topic, author, price, date, location?
136
+ 3. **Compile a scorer** with the template above, replacing `constraint_types` and `query`.
137
+ 4. **Score your top 10–20 results.** Don't score everything — just the candidates that keyword search already found promising.
138
+ 5. **Build a test set** of 10–20 queries with known-good rankings. Iterate on the spec until it discriminates well.
139
+ 6. The scorer is cached by query text — repeated searches are instant.
140
+
141
+ ## Takeaways
142
+
143
+ - **Discrete categories beat numeric scales** for small models. Use 3–4 named buckets.
144
+ - **State constraints and exclusions explicitly** in the spec. The model won't infer them from the query alone.
145
+ - **Rerank, don't replace.** Layer PAW scoring on top of existing keyword search for the best of both worlds.
146
+ - **Test with adversarial queries** — negations, ambiguous terms, author-specific searches — to find spec weaknesses early.
@@ -0,0 +1,127 @@
1
+ # Natural Language Site Navigation
2
+
3
+ Every website with more than a handful of pages forces users to click through menus and navigation layers to find what they need. A Cmd+K / "Quick Find" helper that understands natural language can route users instantly — but normally requires a full LLM backend. PAW lets you build this with a pipeline of tiny compiled functions.
4
+
5
+ **Try it live:** Press Cmd+K (or Ctrl+K) on [programasweights.com](https://programasweights.com) and type something like "how do I run in the browser" or "where do I get an API key."
6
+
7
+ ## How we built it
8
+
9
+ ### Attempt 1: Generate the URL directly
10
+
11
+ The simplest idea: compile one program with all your pages listed in the spec, ask it to output the matching URL.
12
+
13
+ ```
14
+ Given a user query, return the URL of the most relevant page.
15
+ Pages: /playground, /hub, /browser, /docs, /settings, /about
16
+ ```
17
+
18
+ **Result:** The model hallucinated plausible-sounding but wrong paths (`/programs`, `/SDK`, `/api`). Small models are unreliable at generating precise strings from memory.
19
+
20
+ **Lesson:** Don't ask the model to generate structured output like URLs. It will hallucinate.
21
+
22
+ ### Attempt 2: Reframe as classification
23
+
24
+ Instead of generating URLs, output a digit: 1 = Playground, 2 = Hub, 3 = Browser, etc. The frontend maps digits to actual routes.
25
+
26
+ ```
27
+ Classify the user's intent. Return ONLY a single digit.
28
+ 1 = Create or compile a new program
29
+ 2 = Browse or search existing programs
30
+ 3 = Run a program in the browser
31
+ ...
32
+ 0 = None of the above
33
+ ```
34
+
35
+ **Result:** Accuracy jumped from ~67% to ~88%. Classification is far more reliable than generation for routing.
36
+
37
+ **Lesson:** Reframe generation tasks as classification whenever possible. Output a label or digit, map it to the real value in your code.
38
+
39
+ ### Attempt 3: Add Q&A support
40
+
41
+ Users don't only navigate — they also ask questions ("is PAW free?", "what languages are supported?"). We tried adding Q&A to the same program.
42
+
43
+ **Result:** Cramming routing + Q&A into one spec degraded both tasks. The model couldn't handle the complexity.
44
+
45
+ **Lesson:** One program, one job. When accuracy drops, split the task.
46
+
47
+ ### Attempt 4: Multi-program pipeline
48
+
49
+ Split into specialized programs, each doing one thing well:
50
+
51
+ 1. **Page classifier** — routes to a page or says "this is a question"
52
+ 2. **Question-type classifier** — is it a yes/no question or a how/what question?
53
+ 3. **Yes/no answerer** — answers factual yes/no questions (facts baked into the spec)
54
+ 4. **How/what answerer** — answers descriptive questions
55
+ 5. **Answer validator** — checks "does this answer actually address the question?"
56
+
57
+ The validator was the key final addition. Without it, the pipeline would sometimes produce answers like "yes" for "what is the license?" — grammatically fine but useless. The validator catches these.
58
+
59
+ **Result:** The pipeline handles navigation, FAQ, and edge cases reliably. Each program compiles in seconds and runs in milliseconds.
60
+
61
+ ## The solution
62
+
63
+ ```python
64
+ import programasweights as paw
65
+
66
+ router = paw.function("my-page-router")
67
+ q_type = paw.function("my-question-type")
68
+ yes_no = paw.function("my-yes-no-answerer")
69
+ howto = paw.function("my-howto-answerer")
70
+ validator = paw.function("my-answer-validator")
71
+
72
+ def handle_query(user_query: str):
73
+ destination = router(user_query)
74
+ if destination != "0":
75
+ return {"action": "navigate", "page": PAGES[int(destination)]}
76
+
77
+ category = q_type(user_query)
78
+ if category == "yes_no":
79
+ answer = yes_no(user_query)
80
+ elif category == "how_what":
81
+ answer = howto(user_query)
82
+ else:
83
+ return {"action": "fallback", "message": "Try browsing the docs."}
84
+
85
+ if validator(f"Q: {user_query}\nA: {answer}") != "valid":
86
+ return {"action": "fallback", "message": "I'm not sure. Try the docs."}
87
+
88
+ return {"action": "answer", "text": answer}
89
+ ```
90
+
91
+ Each program has a focused spec. For example, the page classifier:
92
+
93
+ ```python
94
+ router = paw.compile("""
95
+ Classify the user's intent. Return ONLY a single digit.
96
+ 1 = Create or compile something new
97
+ 2 = Browse or search existing items
98
+ 3 = Run something in the browser
99
+ 4 = Read documentation
100
+ 5 = Manage account or API keys
101
+ 0 = None of the above (likely a question)
102
+
103
+ Input: how do I get started
104
+ Output: 4
105
+
106
+ Input: browse community programs
107
+ Output: 2
108
+
109
+ Input: is it free?
110
+ Output: 0
111
+ """)
112
+ ```
113
+
114
+ ## Adapting this for your site
115
+
116
+ 1. **List your pages** with short descriptions of what users do there
117
+ 2. **Compile a classifier** that maps intents to page numbers
118
+ 3. **Test with 20-30 real queries** your users would type — iterate on the spec wording
119
+ 4. If users also ask questions, add Q&A programs and a validator
120
+ 5. Each program compiles once and is cached forever — the pipeline runs locally with no API calls
121
+
122
+ ## Takeaways
123
+
124
+ - **Classification beats generation** for routing. Output a label, map it in code.
125
+ - **Multiple small programs beat one complex program.** When accuracy drops, split.
126
+ - **A validator catches failures** the other programs miss — cheap insurance.
127
+ - **Iterate with real queries.** Build a small test set, measure, adjust wording, repeat.
@@ -20,7 +20,7 @@ result = fn("Thesis defense committee needs your signature by EOD")
20
20
  print(result) # "immediate"
21
21
 
22
22
  result = fn("Department newsletter: spring picnic next Friday")
23
- print(result) # "wait"
23
+ print(result) # "can wait"
24
24
  ```
25
25
 
26
26
  ## Compile Your Own