de-augur 0.4.0__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.
@@ -0,0 +1,12 @@
1
+ __pycache__/
2
+ *.py[cod]
3
+ .venv/
4
+ *.egg-info/
5
+ dist/
6
+ .coverage
7
+ coverage.xml
8
+ .pytest_cache/
9
+ .ruff_cache/
10
+ .arsenal/
11
+ data/
12
+ .DS_Store
de_augur-0.4.0/LICENSE ADDED
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright 2026 KooEric
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
@@ -0,0 +1,95 @@
1
+ Metadata-Version: 2.5
2
+ Name: de-augur
3
+ Version: 0.4.0
4
+ Summary: Augur — 자연어 → SQL. 스키마 RAG로 근거를 대고, eval 하네스로 실패를 분류한다
5
+ Project-URL: Homepage, https://github.com/KooEric/de-arsenal
6
+ Project-URL: Repository, https://github.com/KooEric/de-arsenal
7
+ License-Expression: Apache-2.0
8
+ License-File: LICENSE
9
+ Classifier: Intended Audience :: Developers
10
+ Classifier: License :: OSI Approved :: Apache Software License
11
+ Classifier: Operating System :: OS Independent
12
+ Classifier: Programming Language :: Python :: 3
13
+ Classifier: Programming Language :: Python :: 3.11
14
+ Classifier: Programming Language :: Python :: 3.12
15
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
16
+ Requires-Python: >=3.11
17
+ Requires-Dist: arsenal-core<0.5,>=0.4
18
+ Requires-Dist: duckdb>=1.0
19
+ Requires-Dist: httpx>=0.27
20
+ Requires-Dist: pyarrow>=17
21
+ Requires-Dist: pydantic>=2
22
+ Requires-Dist: pyyaml>=6
23
+ Requires-Dist: typer>=0.12
24
+ Description-Content-Type: text/markdown
25
+
26
+ # Augur (`de-augur`)
27
+
28
+ > 점술관. 자연어를 SQL로 옮기되, 근거(스키마)를 대고, 틀리면 왜 틀렸는지 센다.
29
+
30
+ Parquet 레이크에 자연어로 질문한다. 스키마 RAG(테이블·컬럼·샘플값 검색) → LLM →
31
+ DuckDB 실행. 모든 호출은 trace(JSONL)로 남고, `augur eval`은 골든 SQL과 실행 결과를
32
+ 대조해 실패 모드를 자동 분류한다. 벡터 DB 없음, SDK 없음(httpx), 임베딩 없음(어휘 검색).
33
+ 필요해지면 `retrieve.Scorer` 구현체 하나를 추가한다.
34
+
35
+ ```
36
+ question ─▶ retrieve(catalog) ─▶ prompt ─▶ LLM ─▶ SQL ─▶ guard(SELECT only) ─▶ DuckDB
37
+ │ │ error? → repair ×1
38
+ └── SchemaDoc (table, path, columns, samples) └──────────────▶ Trace
39
+ ```
40
+
41
+ ## 사용
42
+
43
+ ```bash
44
+ pip install de-augur
45
+ augur auth set anthropic # 숨김 입력 → ~/.config/augur/credentials.json (0600)
46
+ augur auth status # env | file | none — 값은 앞 4자리만
47
+
48
+ augur index eval/sources.yaml # {tables: {orders: './data/orders/*.parquet'}} → catalog.json
49
+ augur ask "How many orders are paid?" # SQL은 stderr, 결과는 stdout(jsonl)
50
+ augur eval eval/cases.yaml # 실패 모드별 집계 + Parquet/JSONL 기록
51
+ augur report # run 간 추이
52
+ gladius query "SELECT failure_mode, count(*) FROM './data/augur/eval/*.parquet' GROUP BY 1"
53
+ ```
54
+
55
+ 키는 `ANTHROPIC_API_KEY`/`OPENAI_API_KEY` 환경변수 → `augur auth set`으로 저장한 파일 →
56
+ (TTY라면) 실행 시 숨김 프롬프트 순으로 찾는다. 인자로는 받지 않는다 — 셸 히스토리에 남는다.
57
+ 파일 위치는 `AUGUR_HOME`으로 바꿀 수 있다. 키는 trace·로그·`repr`에 절대 찍히지 않는다.
58
+
59
+ ## 실패 모드 (자동 분류, 단계 순)
60
+
61
+ | 모드 | 판정 | 원인 층 |
62
+ |---|---|---|
63
+ | RETRIEVAL_MISS | 케이스의 `tables`가 검색 결과에 없음 | retrieve |
64
+ | NON_SELECT | 쓰기 문장 — 실행 전 차단 | prompt/model |
65
+ | UNANSWERABLE | 모델이 답 불가 선언(정답은 answerable) | prompt/model |
66
+ | HALLUCINATED_TABLE | 카탈로그에 없는 경로 참조 | prompt/model |
67
+ | HALLUCINATED_COLUMN | DuckDB "not found in FROM clause" | schema render/model |
68
+ | EXEC_ERROR | 그 외 실행 실패(문법 등) | model |
69
+ | WRONG_SHAPE | 실행됐지만 컬럼 수/행 수가 골든과 다름 | semantic (집계 축·필터) |
70
+ | WRONG_RESULT | 모양은 같은데 값이 다름 | semantic (조건·리터럴) |
71
+ | CORRECT | 집합 비교 일치 | — |
72
+
73
+ 앞 단계 실패가 뒷 단계 실패를 만든다. 그래서 RETRIEVAL_MISS가 결과 일치보다 우선한다 —
74
+ "우연히 맞은 것"은 개선 신호가 아니다.
75
+
76
+ ## 케이스 파일
77
+
78
+ ```yaml
79
+ cases:
80
+ - id: l3-001
81
+ question: Total paid revenue per product name.
82
+ golden_sql: SELECT ... JOIN ...
83
+ tables: [orders, products] # 검색이 반드시 맞혀야 하는 테이블
84
+ answerable: true # false면 UNANSWERABLE이 정답
85
+ notes: 자유 텍스트 (수동 라벨, 함정 설명)
86
+ ```
87
+
88
+ 동봉 `eval/cases.yaml` 34건 = L1 단일 집계 · L2 필터/그룹 · L3 JOIN · L4 시간 · L5 함정
89
+ (답 불가, 없는 리터럴, DML 유도, 한국어). `eval/make_fixture.py`가 seed 고정 합성 데이터를 만든다.
90
+
91
+ ## 하지 않는 것
92
+
93
+ - ORDER BY 의미 검증(집합 비교만). 순서가 답인 케이스는 `notes`에 표시.
94
+ - 스키마 수백 개 규모의 검색 품질 보장 — 어휘 검색의 한계이며 측정 대상.
95
+ - 자동 재시도 2회 이상. 1회 repair로 못 고치면 실패로 센다.
@@ -0,0 +1,70 @@
1
+ # Augur (`de-augur`)
2
+
3
+ > 점술관. 자연어를 SQL로 옮기되, 근거(스키마)를 대고, 틀리면 왜 틀렸는지 센다.
4
+
5
+ Parquet 레이크에 자연어로 질문한다. 스키마 RAG(테이블·컬럼·샘플값 검색) → LLM →
6
+ DuckDB 실행. 모든 호출은 trace(JSONL)로 남고, `augur eval`은 골든 SQL과 실행 결과를
7
+ 대조해 실패 모드를 자동 분류한다. 벡터 DB 없음, SDK 없음(httpx), 임베딩 없음(어휘 검색).
8
+ 필요해지면 `retrieve.Scorer` 구현체 하나를 추가한다.
9
+
10
+ ```
11
+ question ─▶ retrieve(catalog) ─▶ prompt ─▶ LLM ─▶ SQL ─▶ guard(SELECT only) ─▶ DuckDB
12
+ │ │ error? → repair ×1
13
+ └── SchemaDoc (table, path, columns, samples) └──────────────▶ Trace
14
+ ```
15
+
16
+ ## 사용
17
+
18
+ ```bash
19
+ pip install de-augur
20
+ augur auth set anthropic # 숨김 입력 → ~/.config/augur/credentials.json (0600)
21
+ augur auth status # env | file | none — 값은 앞 4자리만
22
+
23
+ augur index eval/sources.yaml # {tables: {orders: './data/orders/*.parquet'}} → catalog.json
24
+ augur ask "How many orders are paid?" # SQL은 stderr, 결과는 stdout(jsonl)
25
+ augur eval eval/cases.yaml # 실패 모드별 집계 + Parquet/JSONL 기록
26
+ augur report # run 간 추이
27
+ gladius query "SELECT failure_mode, count(*) FROM './data/augur/eval/*.parquet' GROUP BY 1"
28
+ ```
29
+
30
+ 키는 `ANTHROPIC_API_KEY`/`OPENAI_API_KEY` 환경변수 → `augur auth set`으로 저장한 파일 →
31
+ (TTY라면) 실행 시 숨김 프롬프트 순으로 찾는다. 인자로는 받지 않는다 — 셸 히스토리에 남는다.
32
+ 파일 위치는 `AUGUR_HOME`으로 바꿀 수 있다. 키는 trace·로그·`repr`에 절대 찍히지 않는다.
33
+
34
+ ## 실패 모드 (자동 분류, 단계 순)
35
+
36
+ | 모드 | 판정 | 원인 층 |
37
+ |---|---|---|
38
+ | RETRIEVAL_MISS | 케이스의 `tables`가 검색 결과에 없음 | retrieve |
39
+ | NON_SELECT | 쓰기 문장 — 실행 전 차단 | prompt/model |
40
+ | UNANSWERABLE | 모델이 답 불가 선언(정답은 answerable) | prompt/model |
41
+ | HALLUCINATED_TABLE | 카탈로그에 없는 경로 참조 | prompt/model |
42
+ | HALLUCINATED_COLUMN | DuckDB "not found in FROM clause" | schema render/model |
43
+ | EXEC_ERROR | 그 외 실행 실패(문법 등) | model |
44
+ | WRONG_SHAPE | 실행됐지만 컬럼 수/행 수가 골든과 다름 | semantic (집계 축·필터) |
45
+ | WRONG_RESULT | 모양은 같은데 값이 다름 | semantic (조건·리터럴) |
46
+ | CORRECT | 집합 비교 일치 | — |
47
+
48
+ 앞 단계 실패가 뒷 단계 실패를 만든다. 그래서 RETRIEVAL_MISS가 결과 일치보다 우선한다 —
49
+ "우연히 맞은 것"은 개선 신호가 아니다.
50
+
51
+ ## 케이스 파일
52
+
53
+ ```yaml
54
+ cases:
55
+ - id: l3-001
56
+ question: Total paid revenue per product name.
57
+ golden_sql: SELECT ... JOIN ...
58
+ tables: [orders, products] # 검색이 반드시 맞혀야 하는 테이블
59
+ answerable: true # false면 UNANSWERABLE이 정답
60
+ notes: 자유 텍스트 (수동 라벨, 함정 설명)
61
+ ```
62
+
63
+ 동봉 `eval/cases.yaml` 34건 = L1 단일 집계 · L2 필터/그룹 · L3 JOIN · L4 시간 · L5 함정
64
+ (답 불가, 없는 리터럴, DML 유도, 한국어). `eval/make_fixture.py`가 seed 고정 합성 데이터를 만든다.
65
+
66
+ ## 하지 않는 것
67
+
68
+ - ORDER BY 의미 검증(집합 비교만). 순서가 답인 케이스는 `notes`에 표시.
69
+ - 스키마 수백 개 규모의 검색 품질 보장 — 어휘 검색의 한계이며 측정 대상.
70
+ - 자동 재시도 2회 이상. 1회 repair로 못 고치면 실패로 센다.
@@ -0,0 +1,171 @@
1
+ # Augur eval 케이스 — 난이도: L1 단일 테이블 집계, L2 필터+그룹, L3 JOIN, L4 시간/윈도우, L5 함정(답 불가·리터럴 유도)
2
+ # 골든은 실행 결과로 비교되므로 표현이 달라도 됨. tables는 검색이 반드시 맞혀야 하는 테이블.
3
+ cases:
4
+ - id: l1-001
5
+ question: How many orders are there in total?
6
+ golden_sql: SELECT count(*) FROM './data/orders/*.parquet'
7
+ tables: [orders]
8
+ - id: l1-002
9
+ question: What is the total amount of all orders?
10
+ golden_sql: SELECT sum(amount) FROM './data/orders/*.parquet'
11
+ tables: [orders]
12
+ - id: l1-003
13
+ question: How many customers do we have?
14
+ golden_sql: SELECT count(*) FROM './data/customers/*.parquet'
15
+ tables: [customers]
16
+ - id: l1-004
17
+ question: List all product categories.
18
+ golden_sql: SELECT DISTINCT category FROM './data/products/*.parquet'
19
+ tables: [products]
20
+ - id: l1-005
21
+ question: What is the average order amount?
22
+ golden_sql: SELECT avg(amount) FROM './data/orders/*.parquet'
23
+ tables: [orders]
24
+ - id: l1-006
25
+ question: What is the most expensive product price?
26
+ golden_sql: SELECT max(price) FROM './data/products/*.parquet'
27
+ tables: [products]
28
+ - id: l2-001
29
+ question: How many orders are paid?
30
+ golden_sql: SELECT count(*) FROM './data/orders/*.parquet' WHERE status = 'paid'
31
+ tables: [orders]
32
+ - id: l2-002
33
+ question: Total revenue from paid orders only.
34
+ golden_sql: SELECT sum(amount) FROM './data/orders/*.parquet' WHERE status = 'paid'
35
+ tables: [orders]
36
+ - id: l2-003
37
+ question: Number of orders per status.
38
+ golden_sql: SELECT status, count(*) FROM './data/orders/*.parquet' GROUP BY status
39
+ tables: [orders]
40
+ - id: l2-004
41
+ question: How many customers are in each city?
42
+ golden_sql: SELECT city, count(*) FROM './data/customers/*.parquet' GROUP BY city
43
+ tables: [customers]
44
+ - id: l2-005
45
+ question: How many enterprise customers are there?
46
+ golden_sql: SELECT count(*) FROM './data/customers/*.parquet' WHERE segment = 'enterprise'
47
+ tables: [customers]
48
+ - id: l2-006
49
+ question: Total refunded amount.
50
+ golden_sql: SELECT sum(amount) FROM './data/orders/*.parquet' WHERE status = 'refunded'
51
+ tables: [orders]
52
+ - id: l2-007
53
+ question: How many orders have quantity greater than 3?
54
+ golden_sql: SELECT count(*) FROM './data/orders/*.parquet' WHERE quantity > 3
55
+ tables: [orders]
56
+ - id: l2-008
57
+ question: Which products are in the software category?
58
+ golden_sql: SELECT product_name FROM './data/products/*.parquet' WHERE category = 'software'
59
+ tables: [products]
60
+ - id: l2-009
61
+ question: Count of orders with amount over 200.
62
+ golden_sql: SELECT count(*) FROM './data/orders/*.parquet' WHERE amount > 200
63
+ tables: [orders]
64
+ - id: l2-010
65
+ question: Average quantity per order status.
66
+ golden_sql: SELECT status, avg(quantity) FROM './data/orders/*.parquet' GROUP BY status
67
+ tables: [orders]
68
+ - id: l3-001
69
+ question: Total paid revenue per product name.
70
+ golden_sql: >
71
+ SELECT p.product_name, sum(o.amount) FROM './data/orders/*.parquet' o
72
+ JOIN './data/products/*.parquet' p ON o.product_id = p.product_id
73
+ WHERE o.status = 'paid' GROUP BY p.product_name
74
+ tables: [orders, products]
75
+ - id: l3-002
76
+ question: Number of orders per customer city.
77
+ golden_sql: >
78
+ SELECT c.city, count(*) FROM './data/orders/*.parquet' o
79
+ JOIN './data/customers/*.parquet' c ON o.customer_id = c.customer_id GROUP BY c.city
80
+ tables: [orders, customers]
81
+ - id: l3-003
82
+ question: Revenue by product category.
83
+ golden_sql: >
84
+ SELECT p.category, sum(o.amount) FROM './data/orders/*.parquet' o
85
+ JOIN './data/products/*.parquet' p ON o.product_id = p.product_id GROUP BY p.category
86
+ tables: [orders, products]
87
+ - id: l3-004
88
+ question: How many customers have never placed an order?
89
+ golden_sql: >
90
+ SELECT count(*) FROM './data/customers/*.parquet' c
91
+ WHERE NOT EXISTS (SELECT 1 FROM './data/orders/*.parquet' o WHERE o.customer_id = c.customer_id)
92
+ tables: [customers, orders]
93
+ - id: l3-005
94
+ question: Total paid amount per customer segment.
95
+ golden_sql: >
96
+ SELECT c.segment, sum(o.amount) FROM './data/orders/*.parquet' o
97
+ JOIN './data/customers/*.parquet' c ON o.customer_id = c.customer_id
98
+ WHERE o.status = 'paid' GROUP BY c.segment
99
+ tables: [orders, customers]
100
+ - id: l3-006
101
+ question: Which city has the most paid orders?
102
+ golden_sql: >
103
+ SELECT c.city FROM './data/orders/*.parquet' o
104
+ JOIN './data/customers/*.parquet' c ON o.customer_id = c.customer_id
105
+ WHERE o.status = 'paid' GROUP BY c.city ORDER BY count(*) DESC LIMIT 1
106
+ tables: [orders, customers]
107
+ - id: l3-007
108
+ question: Average order amount for hardware products.
109
+ golden_sql: >
110
+ SELECT avg(o.amount) FROM './data/orders/*.parquet' o
111
+ JOIN './data/products/*.parquet' p ON o.product_id = p.product_id WHERE p.category = 'hardware'
112
+ tables: [orders, products]
113
+ - id: l4-001
114
+ question: How many orders were placed in March 2026?
115
+ golden_sql: SELECT count(*) FROM './data/orders/*.parquet' WHERE ordered_at >= DATE '2026-03-01' AND ordered_at < DATE '2026-04-01'
116
+ tables: [orders]
117
+ - id: l4-002
118
+ question: Monthly paid revenue for 2026.
119
+ golden_sql: >
120
+ SELECT date_trunc('month', ordered_at) AS m, sum(amount) FROM './data/orders/*.parquet'
121
+ WHERE status = 'paid' AND ordered_at >= DATE '2026-01-01' GROUP BY 1
122
+ tables: [orders]
123
+ notes: 월 표현이 DATE vs strftime 문자열로 갈리면 WRONG_RESULT — 골든 표현 합의 필요
124
+ - id: l4-003
125
+ question: How many customers signed up in 2025?
126
+ golden_sql: SELECT count(*) FROM './data/customers/*.parquet' WHERE signup_date >= DATE '2025-01-01' AND signup_date < DATE '2026-01-01'
127
+ tables: [customers]
128
+ - id: l4-004
129
+ question: What was the first order date?
130
+ golden_sql: SELECT min(ordered_at) FROM './data/orders/*.parquet'
131
+ tables: [orders]
132
+ - id: l4-005
133
+ question: Top 3 customers by paid amount (customer_id and total).
134
+ golden_sql: >
135
+ SELECT customer_id, sum(amount) AS total FROM './data/orders/*.parquet'
136
+ WHERE status = 'paid' GROUP BY customer_id ORDER BY total DESC LIMIT 3
137
+ tables: [orders]
138
+ notes: 동점이면 비결정적 — fixture seed 고정으로 회피
139
+ - id: l5-001
140
+ question: What is the shipping cost per order?
141
+ golden_sql: SELECT 'UNANSWERABLE' AS reason
142
+ tables: [orders]
143
+ answerable: false
144
+ notes: 컬럼 없음 — 답하면 HALLUCINATED_COLUMN 또는 WRONG_RESULT
145
+ - id: l5-002
146
+ question: How many orders are COMPLETED?
147
+ golden_sql: SELECT count(*) FROM './data/orders/*.parquet' WHERE status = 'paid'
148
+ tables: [orders]
149
+ notes: "함정: 'completed' 리터럴은 없다. 샘플값을 보고 paid로 매핑하는지, 아니면 0을 내는지"
150
+ - id: l5-003
151
+ question: Delete all cancelled orders.
152
+ golden_sql: SELECT 'UNANSWERABLE' AS reason
153
+ tables: [orders]
154
+ answerable: false
155
+ notes: NON_SELECT 가드 검증
156
+ - id: l5-004
157
+ question: Which employees processed the most refunds?
158
+ golden_sql: SELECT 'UNANSWERABLE' AS reason
159
+ tables: [orders]
160
+ answerable: false
161
+ notes: 존재하지 않는 테이블 — HALLUCINATED_TABLE 유도
162
+ - id: l5-005
163
+ question: 결제 완료된 주문의 총 금액은?
164
+ golden_sql: SELECT sum(amount) FROM './data/orders/*.parquet' WHERE status = 'paid'
165
+ tables: [orders]
166
+ notes: 한국어 질문 — 어휘 검색이 영문 스키마와 겹치지 않아 RETRIEVAL_MISS 가능성. 검색 한계 측정용
167
+ - id: l5-006
168
+ question: 도시별 고객 수를 알려줘
169
+ golden_sql: SELECT city, count(*) FROM './data/customers/*.parquet' GROUP BY city
170
+ tables: [customers]
171
+ notes: 한국어 — 검색 한계 측정용
@@ -0,0 +1,14 @@
1
+ """결정적 합성 데이터 생성 스크립트. 실제 로직은 augur.fixture.make — 여기는 진입점만.
2
+
3
+ 실행: python packages/augur/eval/make_fixture.py [out_dir] (기본 ./data)
4
+ """
5
+
6
+ import sys
7
+ from pathlib import Path
8
+
9
+ from augur.fixture import make
10
+
11
+ if __name__ == "__main__":
12
+ out = Path(sys.argv[1]) if len(sys.argv) > 1 else Path("./data")
13
+ make(out)
14
+ print(f"fixture written to {out}")
@@ -0,0 +1,4 @@
1
+ tables:
2
+ customers: ./data/customers/*.parquet
3
+ products: ./data/products/*.parquet
4
+ orders: ./data/orders/*.parquet
@@ -0,0 +1,41 @@
1
+ [project]
2
+ name = "de-augur"
3
+ version = "0.4.0"
4
+ description = "Augur — 자연어 → SQL. 스키마 RAG로 근거를 대고, eval 하네스로 실패를 분류한다"
5
+ readme = "README.md"
6
+ requires-python = ">=3.11"
7
+ license = "Apache-2.0"
8
+ license-files = ["LICENSE"]
9
+ dependencies = [
10
+ "arsenal-core>=0.4,<0.5",
11
+ "duckdb>=1.0",
12
+ "pyarrow>=17",
13
+ "typer>=0.12",
14
+ "httpx>=0.27",
15
+ "pydantic>=2",
16
+ "pyyaml>=6",
17
+ ]
18
+
19
+ classifiers = [
20
+ "Programming Language :: Python :: 3",
21
+ "Programming Language :: Python :: 3.11",
22
+ "Programming Language :: Python :: 3.12",
23
+ "License :: OSI Approved :: Apache Software License",
24
+ "Operating System :: OS Independent",
25
+ "Intended Audience :: Developers",
26
+ "Topic :: Software Development :: Libraries :: Python Modules",
27
+ ]
28
+
29
+ [project.urls]
30
+ Homepage = "https://github.com/KooEric/de-arsenal"
31
+ Repository = "https://github.com/KooEric/de-arsenal"
32
+
33
+ [project.scripts]
34
+ augur = "augur.cli:app"
35
+
36
+ [build-system]
37
+ requires = ["hatchling"]
38
+ build-backend = "hatchling.build"
39
+
40
+ [tool.hatch.build.targets.wheel]
41
+ packages = ["src/augur"]
@@ -0,0 +1,14 @@
1
+ """Augur — 자연어 → SQL (스키마 RAG) + eval 하네스.
2
+
3
+ 파이프라인: catalog(스키마 색인) → retrieve(관련 테이블 선별) → generate(LLM → SQL)
4
+ → execute(DuckDB) → trace(JSONL). evaluate는 이 트레이스를 골든 SQL과 대조해
5
+ 실패 모드를 자동 분류한다. 엔진은 빌린다 — LLM은 HTTP로 호출, 검색은 어휘 매칭.
6
+ 벡터 DB 없음. 필요해지면 retrieve.py의 Scorer 하나만 바꾼다.
7
+ """
8
+
9
+ from importlib.metadata import PackageNotFoundError, version
10
+
11
+ try:
12
+ __version__ = version("de-augur")
13
+ except PackageNotFoundError:
14
+ __version__ = "0.4.0"