programasweights 0.3.0__tar.gz → 0.3.1__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 (61) hide show
  1. {programasweights-0.3.0 → programasweights-0.3.1}/AGENTS.md +5 -3
  2. {programasweights-0.3.0 → programasweights-0.3.1}/PKG-INFO +17 -14
  3. {programasweights-0.3.0 → programasweights-0.3.1}/PYPI_README.md +16 -13
  4. {programasweights-0.3.0 → programasweights-0.3.1}/docs/index.md +2 -2
  5. {programasweights-0.3.0 → programasweights-0.3.1}/programasweights/__init__.py +7 -6
  6. {programasweights-0.3.0 → programasweights-0.3.1}/pyproject.toml +1 -1
  7. {programasweights-0.3.0 → programasweights-0.3.1}/.gitignore +0 -0
  8. {programasweights-0.3.0 → programasweights-0.3.1}/.readthedocs.yaml +0 -0
  9. {programasweights-0.3.0 → programasweights-0.3.1}/CHANGELOG.md +0 -0
  10. {programasweights-0.3.0 → programasweights-0.3.1}/LICENSE +0 -0
  11. {programasweights-0.3.0 → programasweights-0.3.1}/README.md +0 -0
  12. {programasweights-0.3.0 → programasweights-0.3.1}/docs/adr/001-llama-cpp-over-pytorch.md +0 -0
  13. {programasweights-0.3.0 → programasweights-0.3.1}/docs/adr/002-q4_0-adapter-format.md +0 -0
  14. {programasweights-0.3.0 → programasweights-0.3.1}/docs/adr/003-single-spec-field.md +0 -0
  15. {programasweights-0.3.0 → programasweights-0.3.1}/docs/adr/004-compiler-naming.md +0 -0
  16. {programasweights-0.3.0 → programasweights-0.3.1}/docs/adr/005-vllm-hidden-states.md +0 -0
  17. {programasweights-0.3.0 → programasweights-0.3.1}/docs/adr/006-email-api-key-auth.md +0 -0
  18. {programasweights-0.3.0 → programasweights-0.3.1}/docs/advanced/adrs.md +0 -0
  19. {programasweights-0.3.0 → programasweights-0.3.1}/docs/advanced/architecture.md +0 -0
  20. {programasweights-0.3.0 → programasweights-0.3.1}/docs/api-reference/cli.md +0 -0
  21. {programasweights-0.3.0 → programasweights-0.3.1}/docs/api-reference/python-sdk.md +0 -0
  22. {programasweights-0.3.0 → programasweights-0.3.1}/docs/api-reference/rest-api.md +0 -0
  23. {programasweights-0.3.0 → programasweights-0.3.1}/docs/architecture.md +0 -0
  24. {programasweights-0.3.0 → programasweights-0.3.1}/docs/case-studies/log-monitoring.md +0 -0
  25. {programasweights-0.3.0 → programasweights-0.3.1}/docs/case-studies/semantic-search.md +0 -0
  26. {programasweights-0.3.0 → programasweights-0.3.1}/docs/case-studies/site-navigation.md +0 -0
  27. {programasweights-0.3.0 → programasweights-0.3.1}/docs/case-studies/tool-calling.md +0 -0
  28. {programasweights-0.3.0 → programasweights-0.3.1}/docs/getting-started/first-program.md +0 -0
  29. {programasweights-0.3.0 → programasweights-0.3.1}/docs/getting-started/installation.md +0 -0
  30. {programasweights-0.3.0 → programasweights-0.3.1}/docs/getting-started/naming-programs.md +0 -0
  31. {programasweights-0.3.0 → programasweights-0.3.1}/docs/guide/browser-inference.md +0 -0
  32. {programasweights-0.3.0 → programasweights-0.3.1}/docs/guide/how-it-works.md +0 -0
  33. {programasweights-0.3.0 → programasweights-0.3.1}/docs/guide/local-inference.md +0 -0
  34. {programasweights-0.3.0 → programasweights-0.3.1}/docs/guide/writing-good-specs.md +0 -0
  35. {programasweights-0.3.0 → programasweights-0.3.1}/docs/hub/browsing-programs.md +0 -0
  36. {programasweights-0.3.0 → programasweights-0.3.1}/docs/hub/feedback-cases.md +0 -0
  37. {programasweights-0.3.0 → programasweights-0.3.1}/docs/hub/publishing-programs.md +0 -0
  38. {programasweights-0.3.0 → programasweights-0.3.1}/docs/requirements.txt +0 -0
  39. {programasweights-0.3.0 → programasweights-0.3.1}/examples/flask_app.py +0 -0
  40. {programasweights-0.3.0 → programasweights-0.3.1}/examples/jupyter_notebook.py +0 -0
  41. {programasweights-0.3.0 → programasweights-0.3.1}/examples/langchain_integration.py +0 -0
  42. {programasweights-0.3.0 → programasweights-0.3.1}/examples/paw_monitor.py +0 -0
  43. {programasweights-0.3.0 → programasweights-0.3.1}/examples/replace_openai.py +0 -0
  44. {programasweights-0.3.0 → programasweights-0.3.1}/mkdocs.yml +0 -0
  45. {programasweights-0.3.0 → programasweights-0.3.1}/programasweights/_output.py +0 -0
  46. {programasweights-0.3.0 → programasweights-0.3.1}/programasweights/artifacts.py +0 -0
  47. {programasweights-0.3.0 → programasweights-0.3.1}/programasweights/cache.py +0 -0
  48. {programasweights-0.3.0 → programasweights-0.3.1}/programasweights/cli.py +0 -0
  49. {programasweights-0.3.0 → programasweights-0.3.1}/programasweights/client.py +0 -0
  50. {programasweights-0.3.0 → programasweights-0.3.1}/programasweights/compiler/__init__.py +0 -0
  51. {programasweights-0.3.0 → programasweights-0.3.1}/programasweights/compiler/dummy.py +0 -0
  52. {programasweights-0.3.0 → programasweights-0.3.1}/programasweights/config.py +0 -0
  53. {programasweights-0.3.0 → programasweights-0.3.1}/programasweights/convert_peft_to_paw.py +0 -0
  54. {programasweights-0.3.0 → programasweights-0.3.1}/programasweights/paw_format.py +0 -0
  55. {programasweights-0.3.0 → programasweights-0.3.1}/programasweights/runtime/__init__.py +0 -0
  56. {programasweights-0.3.0 → programasweights-0.3.1}/programasweights/runtime/interpreter.py +0 -0
  57. {programasweights-0.3.0 → programasweights-0.3.1}/programasweights/runtime/interpreter_onnx.py +0 -0
  58. {programasweights-0.3.0 → programasweights-0.3.1}/programasweights/runtime_llamacpp.py +0 -0
  59. {programasweights-0.3.0 → programasweights-0.3.1}/tests/test_offline_cache.py +0 -0
  60. {programasweights-0.3.0 → programasweights-0.3.1}/tests/test_sdk.py +0 -0
  61. {programasweights-0.3.0 → programasweights-0.3.1}/tests/test_sdk.sh +0 -0
@@ -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") # "can wait"
23
+ fn("Newsletter: spring picnic") # "wait"
24
24
 
25
25
  # Compile your own from a description
26
26
  program = paw.compile(
@@ -28,7 +28,7 @@ program = paw.compile(
28
28
  compiler="paw-4b-qwen3-0.6b" # or "paw-4b-gpt2" for smaller/faster
29
29
  )
30
30
  fn = paw.function(program.id)
31
- fn("{name: 'Alice',}") # '{"name": "Alice"}'
31
+ fn("{name: 'Alice',}") # '{"name":"Alice"}'
32
32
 
33
33
  # Or compile and load in one step
34
34
  fn = paw.compile_and_load("Classify sentiment as positive or negative")
@@ -211,10 +211,12 @@ paw.login()
211
211
  | `RuntimeError: assets not ready` on download | Program still generating after compile | SDK polls automatically for up to 30s. If persistent, recompile. |
212
212
  | `httpx.HTTPStatusError: 422` on compile | Spec too short (<10 chars) | Adjust spec length. |
213
213
  | `httpx.HTTPStatusError: 429` | Rate limit exceeded | Wait, or sign in for higher limits. |
214
+ | GPU/Metal errors on load | GPU backend not available or incompatible | Set `PAW_GPU_LAYERS=0` or pass `n_gpu_layers=0` to force CPU. |
214
215
 
215
216
  ## Performance
216
217
 
217
- - **First call** ~5-15s (loads base model). Subsequent calls 0.5-5s depending on input length.
218
+ - **GPU acceleration** enabled by default (`n_gpu_layers=-1`). Uses Metal on Mac, CUDA on Linux, falls back to CPU automatically. If GPU causes issues, set `PAW_GPU_LAYERS=0` or pass `n_gpu_layers=0`.
219
+ - **First call** ~1-5s (loads base model). Subsequent calls ~0.05-0.5s depending on input length and GPU availability.
218
220
  - **Base model shared** across functions on disk. Each LoRA adapter adds ~22 MB.
219
221
  - **Cache**: `~/.cache/programasweights/`. Override with `PAW_CACHE_DIR`.
220
222
  - **Offline** after first download.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: programasweights
3
- Version: 0.3.0
3
+ Version: 0.3.1
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
@@ -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") # "can wait"
51
+ fn("Newsletter: spring picnic") # "wait"
52
52
 
53
53
  # Compile your own from a description
54
54
  program = paw.compile(
@@ -57,7 +57,7 @@ program = paw.compile(
57
57
  slug="json-fixer" # optional: creates username/json-fixer handle
58
58
  )
59
59
  fn = paw.function(program.slug) # or paw.function(program.id)
60
- fn("{name: 'Alice',}") # '{"name": "Alice"}'
60
+ fn("{name: 'Alice',}") # '{"name":"Alice"}'
61
61
 
62
62
  # Or compile and load in one step
63
63
  fn = paw.compile_and_load("Classify sentiment as positive or negative")
@@ -66,17 +66,20 @@ fn("I love this!") # "positive"
66
66
 
67
67
  ## Two Compilers
68
68
 
69
- | | Standard (Qwen3 0.6B) | Compact (GPT-2 124M) |
70
- |--------------------|-------------------------|------------------------|
71
- | Compiler name | `paw-4b-qwen3-0.6b` | `paw-4b-gpt2` |
72
- | Accuracy | Higher | Lower |
73
- | Base model size | 594 MB | 105 MB |
74
- | Program size | ~22 MB | ~5 MB |
75
- | Inference speed | ~90ms (server) | ~50ms (server) |
76
- | Runs in browser | No | Yes |
69
+
70
+ | | Standard (Qwen3 0.6B) | Compact (GPT-2 124M) |
71
+ | --------------- | --------------------- | -------------------- |
72
+ | Compiler name | `paw-4b-qwen3-0.6b` | `paw-4b-gpt2` |
73
+ | Accuracy | Higher | Lower |
74
+ | Base model size | 594 MB | 105 MB |
75
+ | Program size | ~22 MB | ~5 MB |
76
+ | Local inference | ~0.05-0.5s per call | ~0.03-0.3s per call |
77
+ | Runs in browser | No | Yes (WebAssembly) |
77
78
 
78
79
  Default is Standard (Qwen3 0.6B). Use Compact (GPT-2) when you need smaller files or browser deployment.
79
80
 
81
+ GPU acceleration is enabled by default (Metal on Mac, CUDA on Linux, falls back to CPU). Set `PAW_GPU_LAYERS=0` to force CPU if GPU causes issues.
82
+
80
83
  ## Browser SDK
81
84
 
82
85
  Programs compiled with GPT-2 also run entirely in the browser via WebAssembly — no server needed, data never leaves the user's device.
@@ -99,9 +102,9 @@ See the [browser SDK repo](https://github.com/programasweights/programasweights-
99
102
 
100
103
  PAW works with Cursor, Claude, Codex, and other AI coding assistants. Paste this into your agent's chat:
101
104
 
102
- > 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.
105
+ > I want to use ProgramAsWeights (PAW) to create fuzzy text functions that run locally. Read the instructions at [https://programasweights.com/AGENTS.md](https://programasweights.com/AGENTS.md) and help me integrate it.
103
106
 
104
- Or save [`AGENTS.md`](https://programasweights.com/agents) to your project root — agents read it automatically.
107
+ Or save `[AGENTS.md](https://programasweights.com/agents)` to your project root — agents read it automatically.
105
108
 
106
109
  ## When to Use PAW
107
110
 
@@ -145,4 +148,4 @@ paw login
145
148
 
146
149
  ## License
147
150
 
148
- MIT
151
+ MIT
@@ -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") # "can wait"
21
+ fn("Newsletter: spring picnic") # "wait"
22
22
 
23
23
  # Compile your own from a description
24
24
  program = paw.compile(
@@ -27,7 +27,7 @@ program = paw.compile(
27
27
  slug="json-fixer" # optional: creates username/json-fixer handle
28
28
  )
29
29
  fn = paw.function(program.slug) # or paw.function(program.id)
30
- fn("{name: 'Alice',}") # '{"name": "Alice"}'
30
+ fn("{name: 'Alice',}") # '{"name":"Alice"}'
31
31
 
32
32
  # Or compile and load in one step
33
33
  fn = paw.compile_and_load("Classify sentiment as positive or negative")
@@ -36,17 +36,20 @@ fn("I love this!") # "positive"
36
36
 
37
37
  ## Two Compilers
38
38
 
39
- | | Standard (Qwen3 0.6B) | Compact (GPT-2 124M) |
40
- |--------------------|-------------------------|------------------------|
41
- | Compiler name | `paw-4b-qwen3-0.6b` | `paw-4b-gpt2` |
42
- | Accuracy | Higher | Lower |
43
- | Base model size | 594 MB | 105 MB |
44
- | Program size | ~22 MB | ~5 MB |
45
- | Inference speed | ~90ms (server) | ~50ms (server) |
46
- | Runs in browser | No | Yes |
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
+ | Local inference | ~0.05-0.5s per call | ~0.03-0.3s per call |
47
+ | Runs in browser | No | Yes (WebAssembly) |
47
48
 
48
49
  Default is Standard (Qwen3 0.6B). Use Compact (GPT-2) when you need smaller files or browser deployment.
49
50
 
51
+ GPU acceleration is enabled by default (Metal on Mac, CUDA on Linux, falls back to CPU). Set `PAW_GPU_LAYERS=0` to force CPU if GPU causes issues.
52
+
50
53
  ## Browser SDK
51
54
 
52
55
  Programs compiled with GPT-2 also run entirely in the browser via WebAssembly — no server needed, data never leaves the user's device.
@@ -69,9 +72,9 @@ See the [browser SDK repo](https://github.com/programasweights/programasweights-
69
72
 
70
73
  PAW works with Cursor, Claude, Codex, and other AI coding assistants. Paste this into your agent's chat:
71
74
 
72
- > 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.
75
+ > I want to use ProgramAsWeights (PAW) to create fuzzy text functions that run locally. Read the instructions at [https://programasweights.com/AGENTS.md](https://programasweights.com/AGENTS.md) and help me integrate it.
73
76
 
74
- Or save [`AGENTS.md`](https://programasweights.com/agents) to your project root — agents read it automatically.
77
+ Or save `[AGENTS.md](https://programasweights.com/agents)` to your project root — agents read it automatically.
75
78
 
76
79
  ## When to Use PAW
77
80
 
@@ -115,4 +118,4 @@ paw login
115
118
 
116
119
  ## License
117
120
 
118
- MIT
121
+ MIT
@@ -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) # "can wait"
23
+ print(result) # "wait"
24
24
  ```
25
25
 
26
26
  ## Compile Your Own
@@ -35,7 +35,7 @@ program = paw.compile(
35
35
 
36
36
  # Use the compiled program
37
37
  fn = paw.function(program.id)
38
- fn("{name: 'Alice', age: 30,}") # '{"name": "Alice", "age": 30}'
38
+ fn("{name: 'Alice', age: 30,}") # '{"name":"Alice","age":30}'
39
39
  ```
40
40
 
41
41
  ## What Can You Build?
@@ -12,7 +12,7 @@ Quick start:
12
12
  # Compile your own from a description
13
13
  program = paw.compile("Fix malformed JSON: repair missing quotes and trailing commas")
14
14
  fn = paw.function(program.id)
15
- fn("{name: 'Alice',}") # '{"name": "Alice"}'
15
+ fn("{name: 'Alice',}") # '{"name":"Alice"}'
16
16
 
17
17
  API reference:
18
18
  paw.compile(spec) Compile a spec on the server, returns Program
@@ -27,7 +27,7 @@ try:
27
27
  from importlib.metadata import version as _meta_version
28
28
  __version__ = _meta_version("programasweights")
29
29
  except Exception:
30
- __version__ = "0.3.0"
30
+ __version__ = "0.3.1"
31
31
 
32
32
  from .config import get_api_url, get_api_key, set_api_key
33
33
 
@@ -65,7 +65,7 @@ def compile(
65
65
  ... )
66
66
  >>> fn = paw.function(program.slug) # or paw.function(program.id)
67
67
  >>> fn("{name: 'Alice',}")
68
- '{"name": "Alice"}'
68
+ '{"name":"Alice"}'
69
69
  """
70
70
  from .client import PAWClient
71
71
  from ._output import status
@@ -101,8 +101,9 @@ def function(
101
101
  program_id: Program ID (str), slug (``da03/my-program``), pinned version
102
102
  (``da03/my-program@v3``), or a ``Program`` object from compile().
103
103
  n_ctx: Context window size for llama.cpp.
104
- n_gpu_layers: GPU layers (-1 = all, 0 = CPU only). Defaults to CPU.
105
- Set ``PAW_GPU_LAYERS`` env var or pass explicitly for GPU acceleration.
104
+ n_gpu_layers: GPU layers (-1 = all GPU, 0 = CPU only). Defaults to -1
105
+ (auto-uses Metal/CUDA if available, safe fallback to CPU).
106
+ Set ``PAW_GPU_LAYERS=0`` env var to force CPU-only.
106
107
  verbose: Print llama.cpp debug output.
107
108
  offline: Skip server check for slug resolution and use local cache only.
108
109
  Also set via ``PAW_OFFLINE=1`` env var.
@@ -125,7 +126,7 @@ def function(
125
126
  from .runtime_llamacpp import PawFunction
126
127
 
127
128
  if n_gpu_layers is None:
128
- n_gpu_layers = int(os.environ.get("PAW_GPU_LAYERS", "0"))
129
+ n_gpu_layers = int(os.environ.get("PAW_GPU_LAYERS", "-1"))
129
130
 
130
131
  from ._output import status
131
132
 
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "programasweights"
7
- version = "0.3.0"
7
+ version = "0.3.1"
8
8
  description = "Compile natural language specifications into neural programs that run locally via llama.cpp."
9
9
  readme = "PYPI_README.md"
10
10
  requires-python = ">=3.9"