gcf-python 0.2.0__py3-none-any.whl → 0.3.1__py3-none-any.whl
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.
- gcf/generic.py +4 -0
- {gcf_python-0.2.0.dist-info → gcf_python-0.3.1.dist-info}/METADATA +14 -12
- {gcf_python-0.2.0.dist-info → gcf_python-0.3.1.dist-info}/RECORD +6 -6
- {gcf_python-0.2.0.dist-info → gcf_python-0.3.1.dist-info}/WHEEL +0 -0
- {gcf_python-0.2.0.dist-info → gcf_python-0.3.1.dist-info}/entry_points.txt +0 -0
- {gcf_python-0.2.0.dist-info → gcf_python-0.3.1.dist-info}/licenses/LICENSE +0 -0
gcf/generic.py
CHANGED
|
@@ -59,6 +59,10 @@ def _encode_array(items: list, name: str, lines: list[str], depth: int) -> None:
|
|
|
59
59
|
|
|
60
60
|
if _is_uniform_dict_list(items):
|
|
61
61
|
_encode_tabular(items, name, lines, depth)
|
|
62
|
+
elif all(not isinstance(item, (dict, list)) for item in items):
|
|
63
|
+
# Primitive array: inline as comma-separated values.
|
|
64
|
+
vals = ",".join(_format_value(item) for item in items)
|
|
65
|
+
lines.append(f"{prefix}{name}[{len(items)}]: {vals}")
|
|
62
66
|
else:
|
|
63
67
|
lines.append(f"{prefix}## {name} [{len(items)}]")
|
|
64
68
|
for i, item in enumerate(items):
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: gcf-python
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.3.1
|
|
4
4
|
Summary: Python implementation of GCF (Graph Compact Format): token-optimized wire format for LLM tool responses
|
|
5
5
|
Project-URL: Homepage, https://github.com/blackwell-systems/gcf-python
|
|
6
6
|
Project-URL: Documentation, https://blackwell-systems.github.io/gcf/
|
|
@@ -32,7 +32,7 @@ Description-Content-Type: text/markdown
|
|
|
32
32
|
|
|
33
33
|
Python implementation of [GCF (Graph Compact Format)](https://gcformat.com/) — the most token-efficient wire format for LLMs. A drop-in alternative to JSON and TOON for any structured data.
|
|
34
34
|
|
|
35
|
-
**79% fewer input tokens than JSON. 75% fewer output tokens. 52% smaller than TOON. 100% LLM comprehension at 500 symbols, where JSON
|
|
35
|
+
**79% fewer input tokens than JSON. 75% fewer output tokens. 52% smaller than TOON. 100% LLM comprehension at 500 symbols, where JSON scores 76.9% and TOON scores 92.3%.**
|
|
36
36
|
|
|
37
37
|
Docs: [gcformat.com](https://gcformat.com/) · [Playground](https://gcformat.com/playground.html) · [GCF vs TOON](https://gcformat.com/guide/vs-toon.html)
|
|
38
38
|
|
|
@@ -189,15 +189,17 @@ Works on dicts, lists, and primitives. Lists of uniform dicts get tabular rows.
|
|
|
189
189
|
|
|
190
190
|
## Comprehension Eval
|
|
191
191
|
|
|
192
|
-
Rigorous 3-way benchmark (GCF vs TOON vs JSON) at 500 symbols, 200 edges.
|
|
192
|
+
Rigorous 3-way benchmark (GCF vs TOON vs JSON) at 500 symbols, 200 edges. 13 structured extraction questions sent to an LLM with zero format instructions:
|
|
193
193
|
|
|
194
194
|
| Format | Accuracy | Tokens | vs JSON |
|
|
195
195
|
|--------|----------|--------|---------|
|
|
196
|
-
| **GCF** | **100%** (
|
|
197
|
-
| TOON |
|
|
198
|
-
| JSON |
|
|
196
|
+
| **GCF** | **100%** (13/13) | **11,090** | **79% fewer** |
|
|
197
|
+
| TOON | 92.3% (12/13) | 16,378 | 69% fewer |
|
|
198
|
+
| JSON | 76.9% (10/13) | 53,341 | baseline |
|
|
199
199
|
|
|
200
|
-
|
|
200
|
+
GCF is the only format with perfect accuracy at scale, at 32% fewer tokens than TOON.
|
|
201
|
+
|
|
202
|
+
Reproduce: `git clone https://github.com/blackwell-systems/gcf-go && cd gcf-go/eval && GOWORK=off go test -run TestComprehension -v -timeout 0`
|
|
201
203
|
|
|
202
204
|
## Token Efficiency (TOON's Own Benchmark)
|
|
203
205
|
|
|
@@ -205,13 +207,13 @@ Running [TOON's benchmark harness](https://github.com/blackwell-systems/toon/tre
|
|
|
205
207
|
|
|
206
208
|
| Track | GCF | TOON | Result |
|
|
207
209
|
|-------|-----|------|--------|
|
|
208
|
-
| Mixed-structure (nested, semi-uniform) |
|
|
209
|
-
| Flat-only (tabular) | 66,
|
|
210
|
-
| Semi-uniform event logs |
|
|
210
|
+
| Mixed-structure (nested, semi-uniform) | 170,367 | 227,896 | **GCF 34% smaller** |
|
|
211
|
+
| Flat-only (tabular) | 66,029 | 67,837 | **GCF 3% smaller** |
|
|
212
|
+
| Semi-uniform event logs | 108,158 | 154,032 | **GCF 42% smaller** |
|
|
211
213
|
|
|
212
|
-
GCF wins
|
|
214
|
+
GCF wins all 6 datasets. On semi-uniform data (the most common real-world pattern), GCF uses 42% fewer tokens than TOON.
|
|
213
215
|
|
|
214
|
-
|
|
216
|
+
Reproduce: `git clone https://github.com/blackwell-systems/toon && cd toon && git checkout gcf-comparison && cd benchmarks && pnpm install && pnpm benchmark:tokens`
|
|
215
217
|
|
|
216
218
|
## Links
|
|
217
219
|
|
|
@@ -4,11 +4,11 @@ gcf/constants.py,sha256=cmZ8YJSOB0im_eyfN8v4UvrLpBC6Fuf4cfcKZGbutxY,638
|
|
|
4
4
|
gcf/decode.py,sha256=48G6XmBilGYl0-c_Xy7MX0iTwOxGW9bn3wC4UyNApc4,5465
|
|
5
5
|
gcf/delta.py,sha256=xU0ujtSq1iF7yU8yk_WNQKh8iove-WUV_nKSuvW1XVk,1656
|
|
6
6
|
gcf/encode.py,sha256=Oljb1r5b7SHmng1XYvcvuJMpaRfJVJ81VOyocPf_kAs,2915
|
|
7
|
-
gcf/generic.py,sha256=
|
|
7
|
+
gcf/generic.py,sha256=Nf1Ii0pYS0dgZ4o2ghl-3Qhnms-kCKY2D3q-3-oGpe8,5454
|
|
8
8
|
gcf/session.py,sha256=4_ARRL06Tg2CI8D2eyi0V5nFphFAFMfOKBXYnAbI6Nk,4690
|
|
9
9
|
gcf/types.py,sha256=AWm-LQoSqLHAYtEjcAxWQZqJ4JXqNreLUKO2mJFgNMA,1465
|
|
10
|
-
gcf_python-0.
|
|
11
|
-
gcf_python-0.
|
|
12
|
-
gcf_python-0.
|
|
13
|
-
gcf_python-0.
|
|
14
|
-
gcf_python-0.
|
|
10
|
+
gcf_python-0.3.1.dist-info/METADATA,sha256=xQxbAQEk1jr_c_GTsFQM1zyCmuz_MmgcbSxc1hNcKz0,8127
|
|
11
|
+
gcf_python-0.3.1.dist-info/WHEEL,sha256=mffPy8wBnZQn2VnJUU5jE99KsxaSfiyMHV9Yt0aLVxs,87
|
|
12
|
+
gcf_python-0.3.1.dist-info/entry_points.txt,sha256=aFT6gqlkh8iGfM8cblE-LUMxHH08_v71IIoZtDdRIVA,37
|
|
13
|
+
gcf_python-0.3.1.dist-info/licenses/LICENSE,sha256=txSvg3E4LugiB7MOOTci6WKd6wMOrOJTvaITeFJ2SgU,1074
|
|
14
|
+
gcf_python-0.3.1.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|