rgeval 0.1.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.
- rgeval-0.1.0/.gitignore +262 -0
- rgeval-0.1.0/LICENSE +21 -0
- rgeval-0.1.0/PKG-INFO +158 -0
- rgeval-0.1.0/README.md +119 -0
- rgeval-0.1.0/pyproject.toml +80 -0
- rgeval-0.1.0/src/rgeval/__init__.py +15 -0
- rgeval-0.1.0/src/rgeval/_version.py +24 -0
- rgeval-0.1.0/src/rgeval/add_clean_schema.py +206 -0
- rgeval-0.1.0/src/rgeval/app.py +39 -0
- rgeval-0.1.0/src/rgeval/check_truncation.py +11 -0
- rgeval-0.1.0/src/rgeval/claude_evaluation.py +176 -0
- rgeval-0.1.0/src/rgeval/clean_new_dataset.py +198 -0
- rgeval-0.1.0/src/rgeval/compare_utils.py +131 -0
- rgeval-0.1.0/src/rgeval/config.yaml +3 -0
- rgeval-0.1.0/src/rgeval/emnlp_evaluation.py +227 -0
- rgeval-0.1.0/src/rgeval/evalExec.py +109 -0
- rgeval-0.1.0/src/rgeval/eval_2024.py +177 -0
- rgeval-0.1.0/src/rgeval/eval_2026.py +219 -0
- rgeval-0.1.0/src/rgeval/pipeline/AST.py +139 -0
- rgeval-0.1.0/src/rgeval/pipeline/Graph.py +74 -0
- rgeval-0.1.0/src/rgeval/pipeline/__init__.py +5 -0
- rgeval-0.1.0/src/rgeval/pipeline/compare_jsons.py +98 -0
- rgeval-0.1.0/src/rgeval/pipeline/cycles.py +143 -0
- rgeval-0.1.0/src/rgeval/pipeline/graphNet.py +96 -0
- rgeval-0.1.0/src/rgeval/pipeline/newRed.py +141 -0
- rgeval-0.1.0/src/rgeval/pipeline/normalizeAST.py +200 -0
- rgeval-0.1.0/src/rgeval/pipeline/preProcessor.py +530 -0
- rgeval-0.1.0/src/rgeval/scoring.py +69 -0
- rgeval-0.1.0/src/rgeval/utils.py +24 -0
- rgeval-0.1.0/tests/test_scoring.py +57 -0
- rgeval-0.1.0/tests/test_split_keying.py +98 -0
rgeval-0.1.0/.gitignore
ADDED
|
@@ -0,0 +1,262 @@
|
|
|
1
|
+
# Byte-compiled / optimized / DLL files
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.py[codz]
|
|
4
|
+
*$py.class
|
|
5
|
+
|
|
6
|
+
# C extensions
|
|
7
|
+
*.so
|
|
8
|
+
|
|
9
|
+
# Distribution / packaging
|
|
10
|
+
.Python
|
|
11
|
+
build/
|
|
12
|
+
develop-eggs/
|
|
13
|
+
dist/
|
|
14
|
+
downloads/
|
|
15
|
+
eggs/
|
|
16
|
+
.eggs/
|
|
17
|
+
lib/
|
|
18
|
+
lib64/
|
|
19
|
+
parts/
|
|
20
|
+
sdist/
|
|
21
|
+
var/
|
|
22
|
+
wheels/
|
|
23
|
+
share/python-wheels/
|
|
24
|
+
*.egg-info/
|
|
25
|
+
.installed.cfg
|
|
26
|
+
*.egg
|
|
27
|
+
MANIFEST
|
|
28
|
+
|
|
29
|
+
# PyInstaller
|
|
30
|
+
# Usually these files are written by a python script from a template
|
|
31
|
+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
|
32
|
+
*.manifest
|
|
33
|
+
*.spec
|
|
34
|
+
|
|
35
|
+
# Installer logs
|
|
36
|
+
pip-log.txt
|
|
37
|
+
pip-delete-this-directory.txt
|
|
38
|
+
|
|
39
|
+
# Unit test / coverage reports
|
|
40
|
+
htmlcov/
|
|
41
|
+
.tox/
|
|
42
|
+
.nox/
|
|
43
|
+
.coverage
|
|
44
|
+
.coverage.*
|
|
45
|
+
.cache
|
|
46
|
+
nosetests.xml
|
|
47
|
+
coverage.xml
|
|
48
|
+
*.cover
|
|
49
|
+
*.py.cover
|
|
50
|
+
*.lcov
|
|
51
|
+
.hypothesis/
|
|
52
|
+
.pytest_cache/
|
|
53
|
+
cover/
|
|
54
|
+
|
|
55
|
+
# Translations
|
|
56
|
+
*.mo
|
|
57
|
+
*.pot
|
|
58
|
+
|
|
59
|
+
# Django stuff:
|
|
60
|
+
*.log
|
|
61
|
+
local_settings.py
|
|
62
|
+
db.sqlite3
|
|
63
|
+
db.sqlite3-journal
|
|
64
|
+
|
|
65
|
+
# Flask stuff:
|
|
66
|
+
instance/
|
|
67
|
+
.webassets-cache
|
|
68
|
+
|
|
69
|
+
# Scrapy stuff:
|
|
70
|
+
.scrapy
|
|
71
|
+
|
|
72
|
+
# Sphinx documentation
|
|
73
|
+
docs/_build/
|
|
74
|
+
|
|
75
|
+
# PyBuilder
|
|
76
|
+
.pybuilder/
|
|
77
|
+
target/
|
|
78
|
+
|
|
79
|
+
# Jupyter Notebook
|
|
80
|
+
.ipynb_checkpoints
|
|
81
|
+
|
|
82
|
+
# IPython
|
|
83
|
+
profile_default/
|
|
84
|
+
ipython_config.py
|
|
85
|
+
|
|
86
|
+
# pyenv
|
|
87
|
+
# For a library or package, you might want to ignore these files since the code is
|
|
88
|
+
# intended to run in multiple environments; otherwise, check them in:
|
|
89
|
+
# .python-version
|
|
90
|
+
|
|
91
|
+
# pipenv
|
|
92
|
+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
|
|
93
|
+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
|
|
94
|
+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
|
|
95
|
+
# install all needed dependencies.
|
|
96
|
+
# Pipfile.lock
|
|
97
|
+
|
|
98
|
+
# uv
|
|
99
|
+
# Similar to Pipfile.lock, it is generally recommended to include uv.lock in version control.
|
|
100
|
+
# This is especially recommended for binary packages to ensure reproducibility, and is more
|
|
101
|
+
# commonly ignored for libraries.
|
|
102
|
+
# uv.lock
|
|
103
|
+
|
|
104
|
+
# poetry
|
|
105
|
+
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
|
|
106
|
+
# This is especially recommended for binary packages to ensure reproducibility, and is more
|
|
107
|
+
# commonly ignored for libraries.
|
|
108
|
+
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
|
|
109
|
+
# poetry.lock
|
|
110
|
+
# poetry.toml
|
|
111
|
+
|
|
112
|
+
# pdm
|
|
113
|
+
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
|
|
114
|
+
# pdm recommends including project-wide configuration in pdm.toml, but excluding .pdm-python.
|
|
115
|
+
# https://pdm-project.org/en/latest/usage/project/#working-with-version-control
|
|
116
|
+
# pdm.lock
|
|
117
|
+
# pdm.toml
|
|
118
|
+
.pdm-python
|
|
119
|
+
.pdm-build/
|
|
120
|
+
|
|
121
|
+
# pixi
|
|
122
|
+
# Similar to Pipfile.lock, it is generally recommended to include pixi.lock in version control.
|
|
123
|
+
# pixi.lock
|
|
124
|
+
# Pixi creates a virtual environment in the .pixi directory, just like venv module creates one
|
|
125
|
+
# in the .venv directory. It is recommended not to include this directory in version control.
|
|
126
|
+
.pixi/*
|
|
127
|
+
!.pixi/config.toml
|
|
128
|
+
|
|
129
|
+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
|
|
130
|
+
__pypackages__/
|
|
131
|
+
|
|
132
|
+
# Celery stuff
|
|
133
|
+
celerybeat-schedule*
|
|
134
|
+
celerybeat.pid
|
|
135
|
+
|
|
136
|
+
# Redis
|
|
137
|
+
*.rdb
|
|
138
|
+
*.aof
|
|
139
|
+
*.pid
|
|
140
|
+
|
|
141
|
+
# RabbitMQ
|
|
142
|
+
mnesia/
|
|
143
|
+
rabbitmq/
|
|
144
|
+
rabbitmq-data/
|
|
145
|
+
|
|
146
|
+
# ActiveMQ
|
|
147
|
+
activemq-data/
|
|
148
|
+
|
|
149
|
+
# SageMath parsed files
|
|
150
|
+
*.sage.py
|
|
151
|
+
|
|
152
|
+
# Environments
|
|
153
|
+
.env
|
|
154
|
+
.envrc
|
|
155
|
+
.venv
|
|
156
|
+
env/
|
|
157
|
+
venv/
|
|
158
|
+
ENV/
|
|
159
|
+
env.bak/
|
|
160
|
+
venv.bak/
|
|
161
|
+
|
|
162
|
+
# Spyder project settings
|
|
163
|
+
.spyderproject
|
|
164
|
+
.spyproject
|
|
165
|
+
|
|
166
|
+
# Rope project settings
|
|
167
|
+
.ropeproject
|
|
168
|
+
|
|
169
|
+
# mkdocs/Zensical documentation
|
|
170
|
+
/site
|
|
171
|
+
|
|
172
|
+
# mypy
|
|
173
|
+
.mypy_cache/
|
|
174
|
+
.dmypy.json
|
|
175
|
+
dmypy.json
|
|
176
|
+
|
|
177
|
+
# Pyre type checker
|
|
178
|
+
.pyre/
|
|
179
|
+
|
|
180
|
+
# pytype static type analyzer
|
|
181
|
+
.pytype/
|
|
182
|
+
|
|
183
|
+
# Cython debug symbols
|
|
184
|
+
cython_debug/
|
|
185
|
+
|
|
186
|
+
# PyCharm
|
|
187
|
+
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
|
|
188
|
+
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
|
|
189
|
+
# and can be added to the global gitignore or merged into this file. For a more nuclear
|
|
190
|
+
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
|
|
191
|
+
# .idea/
|
|
192
|
+
|
|
193
|
+
# Abstra
|
|
194
|
+
# Abstra is an AI-powered process automation framework.
|
|
195
|
+
# Ignore directories containing user credentials, local state, and settings.
|
|
196
|
+
# Learn more at https://abstra.io/docs
|
|
197
|
+
.abstra/
|
|
198
|
+
|
|
199
|
+
# Visual Studio Code
|
|
200
|
+
# Visual Studio Code specific template is maintained in a separate VisualStudioCode.gitignore that
|
|
201
|
+
# can be found at https://github.com/github/gitignore/blob/main/Global/VisualStudioCode.gitignore
|
|
202
|
+
# and can be added to the global gitignore or merged into this file. However, if you prefer, you
|
|
203
|
+
# could uncomment the following to ignore the entire vscode folder
|
|
204
|
+
# .vscode/
|
|
205
|
+
# Temporary file for partial code execution
|
|
206
|
+
tempCodeRunnerFile.py
|
|
207
|
+
|
|
208
|
+
# Ruff stuff:
|
|
209
|
+
.ruff_cache/
|
|
210
|
+
|
|
211
|
+
# PyPI configuration file
|
|
212
|
+
.pypirc
|
|
213
|
+
|
|
214
|
+
# Marimo
|
|
215
|
+
marimo/_static/
|
|
216
|
+
marimo/_lsp/
|
|
217
|
+
__marimo__/
|
|
218
|
+
|
|
219
|
+
# Streamlit
|
|
220
|
+
.streamlit/secrets.toml
|
|
221
|
+
|
|
222
|
+
# ---------------------------------------------------------------------------
|
|
223
|
+
# Project-specific
|
|
224
|
+
# ---------------------------------------------------------------------------
|
|
225
|
+
# Generated at build time by hatch-vcs from the git tag. Committing it makes the
|
|
226
|
+
# tree dirty after every build, and setuptools_scm then reports a .dev version
|
|
227
|
+
# instead of the tag.
|
|
228
|
+
src/rgeval/_version.py
|
|
229
|
+
|
|
230
|
+
# No datasets or model predictions in this repo. Datasets live in
|
|
231
|
+
# https://github.com/nl2graphql-bench/datasets; predictions are an input the
|
|
232
|
+
# user supplies, and scoring writes its own output directories.
|
|
233
|
+
*.jsonl
|
|
234
|
+
*.jsonl.gz
|
|
235
|
+
*.xlsx
|
|
236
|
+
*.parquet
|
|
237
|
+
*.csv
|
|
238
|
+
2026_evals/
|
|
239
|
+
2026_input/
|
|
240
|
+
2026_results/
|
|
241
|
+
2024_evals/
|
|
242
|
+
2024_input/
|
|
243
|
+
2024_results/
|
|
244
|
+
emnlp_inputs/
|
|
245
|
+
emnlp_outputs/
|
|
246
|
+
every_prediction/
|
|
247
|
+
review_evals/
|
|
248
|
+
test_input_files/
|
|
249
|
+
test_output_files/
|
|
250
|
+
|
|
251
|
+
# The 2,100-row hidden benchmark must never be committed anywhere, public or
|
|
252
|
+
# private: it is what leaderboard submissions are scored against.
|
|
253
|
+
secret_data.jsonl
|
|
254
|
+
secret_dataset*
|
|
255
|
+
secret_*
|
|
256
|
+
*hidden*
|
|
257
|
+
|
|
258
|
+
# Credentials
|
|
259
|
+
credentials.json
|
|
260
|
+
config.local.yaml
|
|
261
|
+
*.pem
|
|
262
|
+
*.key
|
rgeval-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 NL2GraphQL Bench contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
rgeval-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: rgeval
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Semantic-equivalence scoring for generated GraphQL queries
|
|
5
|
+
Project-URL: Homepage, https://nl2graphql-bench.github.io/
|
|
6
|
+
Project-URL: Repository, https://github.com/nl2graphql-bench/evaluation
|
|
7
|
+
Project-URL: Datasets, https://github.com/nl2graphql-bench/datasets
|
|
8
|
+
Project-URL: Issues, https://github.com/nl2graphql-bench/evaluation/issues
|
|
9
|
+
Author: Keya Battu, Parth Mehta, Harikrishnan Balagopal, Manish Kesarwani
|
|
10
|
+
License-Expression: MIT
|
|
11
|
+
License-File: LICENSE
|
|
12
|
+
Keywords: benchmark,evaluation,graphql,nl2graphql,text-to-graphql
|
|
13
|
+
Classifier: Development Status :: 4 - Beta
|
|
14
|
+
Classifier: Intended Audience :: Science/Research
|
|
15
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
16
|
+
Classifier: Programming Language :: Python :: 3
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
22
|
+
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
|
23
|
+
Requires-Python: >=3.9
|
|
24
|
+
Requires-Dist: graphql-core<3.3,>=3.2
|
|
25
|
+
Requires-Dist: matplotlib>=3.5
|
|
26
|
+
Requires-Dist: networkx<3,>=2.8
|
|
27
|
+
Requires-Dist: pyyaml>=6.0
|
|
28
|
+
Provides-Extra: datasets
|
|
29
|
+
Requires-Dist: openpyxl>=3.1; extra == 'datasets'
|
|
30
|
+
Requires-Dist: pandas>=2.0; extra == 'datasets'
|
|
31
|
+
Provides-Extra: dev
|
|
32
|
+
Requires-Dist: build>=1.0; extra == 'dev'
|
|
33
|
+
Requires-Dist: pytest>=7; extra == 'dev'
|
|
34
|
+
Requires-Dist: twine>=5.0; extra == 'dev'
|
|
35
|
+
Provides-Extra: ui
|
|
36
|
+
Requires-Dist: fastapi>=0.100; extra == 'ui'
|
|
37
|
+
Requires-Dist: uvicorn>=0.23; extra == 'ui'
|
|
38
|
+
Description-Content-Type: text/markdown
|
|
39
|
+
|
|
40
|
+
# rgeval
|
|
41
|
+
|
|
42
|
+
Semantic-equivalence scoring for generated GraphQL queries. The scorer behind
|
|
43
|
+
the [NL2GraphQL Bench leaderboard](https://nl2graphql-bench.github.io/).
|
|
44
|
+
|
|
45
|
+
A generated GraphQL query can be correct without matching the reference text:
|
|
46
|
+
field order varies, aliases rename things, fragments can be inlined. RGEval
|
|
47
|
+
parses and validates both queries against the schema, normalises them, and
|
|
48
|
+
compares them as graphs, so it scores meaning rather than string equality.
|
|
49
|
+
|
|
50
|
+
## Install
|
|
51
|
+
|
|
52
|
+
```bash
|
|
53
|
+
pip install rgeval
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
Reading the benchmark `.xlsx` files needs the extra:
|
|
57
|
+
|
|
58
|
+
```bash
|
|
59
|
+
pip install "rgeval[datasets]"
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
## Use as a library
|
|
63
|
+
|
|
64
|
+
```python
|
|
65
|
+
from rgeval import score_pair
|
|
66
|
+
|
|
67
|
+
schema = """
|
|
68
|
+
type Query { city(id: Int!): City }
|
|
69
|
+
type City { id: Int! name: String population: Float }
|
|
70
|
+
"""
|
|
71
|
+
gold = 'query { city(id: 1) { name population } }'
|
|
72
|
+
pred = 'query { city(id: 1) { population name } }' # different field order
|
|
73
|
+
|
|
74
|
+
score_pair(schema, gold, pred) # True
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
`score_pair` returns `False` rather than raising for a query that cannot be
|
|
78
|
+
parsed or does not validate against the schema: an invalid prediction scores 0.
|
|
79
|
+
|
|
80
|
+
```python
|
|
81
|
+
score_pair(schema, gold, pred, variables='{"cityId": 1}')
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
## Score the public benchmark
|
|
85
|
+
|
|
86
|
+
Get the data from
|
|
87
|
+
[nl2graphql-bench/datasets](https://github.com/nl2graphql-bench/datasets):
|
|
88
|
+
|
|
89
|
+
```bash
|
|
90
|
+
gunzip -k test_data.jsonl.gz
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
Use the `CleanSchema` field. `OriginalGraphQLSchema` and
|
|
94
|
+
`RefinedGraphQLSchema` are truncated at 32,767 characters in some rows and will
|
|
95
|
+
not build.
|
|
96
|
+
|
|
97
|
+
Predictions are JSONL, one object per instance, with the model output in a field
|
|
98
|
+
starting with `pred_`:
|
|
99
|
+
|
|
100
|
+
```json
|
|
101
|
+
{"id": 1, "gold": "query { ... }", "pred_mymodel": "query { ... }"}
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
```bash
|
|
105
|
+
mkdir -p 2026_input/myrun
|
|
106
|
+
cp predictions.jsonl 2026_input/myrun/test_main_predictions.jsonl
|
|
107
|
+
rgeval-score-2026 --input_folder myrun
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
Results land in `2026_results/myrun/results.json` with an overall score and a
|
|
111
|
+
per-category breakdown.
|
|
112
|
+
|
|
113
|
+
Name prediction files `test_main_*` or `test_part2_*`. The scorer reads the part
|
|
114
|
+
from the filename, because the two parts of the public benchmark number their
|
|
115
|
+
rows from 1 each and a `DataID` alone does not say which part a row is from.
|
|
116
|
+
|
|
117
|
+
## How scoring works
|
|
118
|
+
|
|
119
|
+
| stage | module |
|
|
120
|
+
|---|---|
|
|
121
|
+
| parse and validate against the schema | `rgeval.pipeline.AST` |
|
|
122
|
+
| AST normalisation | `rgeval.pipeline.normalizeAST` |
|
|
123
|
+
| graph construction | `rgeval.pipeline.graphNet` |
|
|
124
|
+
| cycle handling | `rgeval.pipeline.cycles` |
|
|
125
|
+
| reduction | `rgeval.pipeline.newRed` |
|
|
126
|
+
| comparison | `rgeval.pipeline.compare_jsons` |
|
|
127
|
+
|
|
128
|
+
`rgeval.score_pair` runs all six in order. Import a stage directly only to
|
|
129
|
+
inspect or replace it.
|
|
130
|
+
|
|
131
|
+
## Requirements
|
|
132
|
+
|
|
133
|
+
Python 3.9+. `networkx` is pinned below 3.0: the graph code uses APIs removed in
|
|
134
|
+
3.x.
|
|
135
|
+
|
|
136
|
+
## What is not here
|
|
137
|
+
|
|
138
|
+
No datasets and no model predictions. Datasets are in
|
|
139
|
+
[nl2graphql-bench/datasets](https://github.com/nl2graphql-bench/datasets);
|
|
140
|
+
predictions are an input you supply.
|
|
141
|
+
|
|
142
|
+
The 2,100-instance hidden benchmark is not published anywhere. It is what
|
|
143
|
+
submissions are scored against, so if it were public a model could be tuned on
|
|
144
|
+
it and the score would mean nothing.
|
|
145
|
+
|
|
146
|
+
## Citation
|
|
147
|
+
|
|
148
|
+
AutoGraphQL: A Bring-Your-Own-Schema Framework for Adapting Open-Weight LLMs to
|
|
149
|
+
GraphQL APIs. EMNLP 2026, Industry Track.
|
|
150
|
+
<https://openreview.net/forum?id=NcuPXBFKAO>
|
|
151
|
+
|
|
152
|
+
## License
|
|
153
|
+
|
|
154
|
+
MIT, see `LICENSE`. `NOTICE` records why: the source repository carried
|
|
155
|
+
CC BY-NC-ND 4.0, which is not an OSI-approved open-source license and bars both
|
|
156
|
+
commercial use and derivative works, neither of which suits a package people
|
|
157
|
+
install and extend. The other NL2GraphQL Bench components and the upstream
|
|
158
|
+
StepZen dataset are all MIT.
|
rgeval-0.1.0/README.md
ADDED
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
# rgeval
|
|
2
|
+
|
|
3
|
+
Semantic-equivalence scoring for generated GraphQL queries. The scorer behind
|
|
4
|
+
the [NL2GraphQL Bench leaderboard](https://nl2graphql-bench.github.io/).
|
|
5
|
+
|
|
6
|
+
A generated GraphQL query can be correct without matching the reference text:
|
|
7
|
+
field order varies, aliases rename things, fragments can be inlined. RGEval
|
|
8
|
+
parses and validates both queries against the schema, normalises them, and
|
|
9
|
+
compares them as graphs, so it scores meaning rather than string equality.
|
|
10
|
+
|
|
11
|
+
## Install
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
pip install rgeval
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
Reading the benchmark `.xlsx` files needs the extra:
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
pip install "rgeval[datasets]"
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## Use as a library
|
|
24
|
+
|
|
25
|
+
```python
|
|
26
|
+
from rgeval import score_pair
|
|
27
|
+
|
|
28
|
+
schema = """
|
|
29
|
+
type Query { city(id: Int!): City }
|
|
30
|
+
type City { id: Int! name: String population: Float }
|
|
31
|
+
"""
|
|
32
|
+
gold = 'query { city(id: 1) { name population } }'
|
|
33
|
+
pred = 'query { city(id: 1) { population name } }' # different field order
|
|
34
|
+
|
|
35
|
+
score_pair(schema, gold, pred) # True
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
`score_pair` returns `False` rather than raising for a query that cannot be
|
|
39
|
+
parsed or does not validate against the schema: an invalid prediction scores 0.
|
|
40
|
+
|
|
41
|
+
```python
|
|
42
|
+
score_pair(schema, gold, pred, variables='{"cityId": 1}')
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
## Score the public benchmark
|
|
46
|
+
|
|
47
|
+
Get the data from
|
|
48
|
+
[nl2graphql-bench/datasets](https://github.com/nl2graphql-bench/datasets):
|
|
49
|
+
|
|
50
|
+
```bash
|
|
51
|
+
gunzip -k test_data.jsonl.gz
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
Use the `CleanSchema` field. `OriginalGraphQLSchema` and
|
|
55
|
+
`RefinedGraphQLSchema` are truncated at 32,767 characters in some rows and will
|
|
56
|
+
not build.
|
|
57
|
+
|
|
58
|
+
Predictions are JSONL, one object per instance, with the model output in a field
|
|
59
|
+
starting with `pred_`:
|
|
60
|
+
|
|
61
|
+
```json
|
|
62
|
+
{"id": 1, "gold": "query { ... }", "pred_mymodel": "query { ... }"}
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
```bash
|
|
66
|
+
mkdir -p 2026_input/myrun
|
|
67
|
+
cp predictions.jsonl 2026_input/myrun/test_main_predictions.jsonl
|
|
68
|
+
rgeval-score-2026 --input_folder myrun
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
Results land in `2026_results/myrun/results.json` with an overall score and a
|
|
72
|
+
per-category breakdown.
|
|
73
|
+
|
|
74
|
+
Name prediction files `test_main_*` or `test_part2_*`. The scorer reads the part
|
|
75
|
+
from the filename, because the two parts of the public benchmark number their
|
|
76
|
+
rows from 1 each and a `DataID` alone does not say which part a row is from.
|
|
77
|
+
|
|
78
|
+
## How scoring works
|
|
79
|
+
|
|
80
|
+
| stage | module |
|
|
81
|
+
|---|---|
|
|
82
|
+
| parse and validate against the schema | `rgeval.pipeline.AST` |
|
|
83
|
+
| AST normalisation | `rgeval.pipeline.normalizeAST` |
|
|
84
|
+
| graph construction | `rgeval.pipeline.graphNet` |
|
|
85
|
+
| cycle handling | `rgeval.pipeline.cycles` |
|
|
86
|
+
| reduction | `rgeval.pipeline.newRed` |
|
|
87
|
+
| comparison | `rgeval.pipeline.compare_jsons` |
|
|
88
|
+
|
|
89
|
+
`rgeval.score_pair` runs all six in order. Import a stage directly only to
|
|
90
|
+
inspect or replace it.
|
|
91
|
+
|
|
92
|
+
## Requirements
|
|
93
|
+
|
|
94
|
+
Python 3.9+. `networkx` is pinned below 3.0: the graph code uses APIs removed in
|
|
95
|
+
3.x.
|
|
96
|
+
|
|
97
|
+
## What is not here
|
|
98
|
+
|
|
99
|
+
No datasets and no model predictions. Datasets are in
|
|
100
|
+
[nl2graphql-bench/datasets](https://github.com/nl2graphql-bench/datasets);
|
|
101
|
+
predictions are an input you supply.
|
|
102
|
+
|
|
103
|
+
The 2,100-instance hidden benchmark is not published anywhere. It is what
|
|
104
|
+
submissions are scored against, so if it were public a model could be tuned on
|
|
105
|
+
it and the score would mean nothing.
|
|
106
|
+
|
|
107
|
+
## Citation
|
|
108
|
+
|
|
109
|
+
AutoGraphQL: A Bring-Your-Own-Schema Framework for Adapting Open-Weight LLMs to
|
|
110
|
+
GraphQL APIs. EMNLP 2026, Industry Track.
|
|
111
|
+
<https://openreview.net/forum?id=NcuPXBFKAO>
|
|
112
|
+
|
|
113
|
+
## License
|
|
114
|
+
|
|
115
|
+
MIT, see `LICENSE`. `NOTICE` records why: the source repository carried
|
|
116
|
+
CC BY-NC-ND 4.0, which is not an OSI-approved open-source license and bars both
|
|
117
|
+
commercial use and derivative works, neither of which suits a package people
|
|
118
|
+
install and extend. The other NL2GraphQL Bench components and the upstream
|
|
119
|
+
StepZen dataset are all MIT.
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["hatchling>=1.21", "hatch-vcs>=0.4"]
|
|
3
|
+
build-backend = "hatchling.build"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "rgeval"
|
|
7
|
+
# Version comes from the git tag via hatch-vcs, so a release cannot publish a
|
|
8
|
+
# number that disagrees with the tag it was cut from. Do not hardcode it here.
|
|
9
|
+
dynamic = ["version"]
|
|
10
|
+
description = "Semantic-equivalence scoring for generated GraphQL queries"
|
|
11
|
+
readme = "README.md"
|
|
12
|
+
requires-python = ">=3.9"
|
|
13
|
+
license = "MIT"
|
|
14
|
+
license-files = ["LICENSE"]
|
|
15
|
+
authors = [
|
|
16
|
+
{ name = "Keya Battu" },
|
|
17
|
+
{ name = "Parth Mehta" },
|
|
18
|
+
{ name = "Harikrishnan Balagopal" },
|
|
19
|
+
{ name = "Manish Kesarwani" },
|
|
20
|
+
]
|
|
21
|
+
keywords = ["graphql", "nl2graphql", "evaluation", "benchmark", "text-to-graphql"]
|
|
22
|
+
classifiers = [
|
|
23
|
+
"Development Status :: 4 - Beta",
|
|
24
|
+
"Intended Audience :: Science/Research",
|
|
25
|
+
"License :: OSI Approved :: MIT License",
|
|
26
|
+
"Programming Language :: Python :: 3",
|
|
27
|
+
"Programming Language :: Python :: 3.9",
|
|
28
|
+
"Programming Language :: Python :: 3.10",
|
|
29
|
+
"Programming Language :: Python :: 3.11",
|
|
30
|
+
"Programming Language :: Python :: 3.12",
|
|
31
|
+
"Programming Language :: Python :: 3.13",
|
|
32
|
+
"Topic :: Scientific/Engineering :: Artificial Intelligence",
|
|
33
|
+
]
|
|
34
|
+
dependencies = [
|
|
35
|
+
# networkx must stay below 3.0: the graph code uses APIs removed in 3.x.
|
|
36
|
+
"networkx>=2.8,<3",
|
|
37
|
+
# graphql-core must stay below 3.3: from 3.3 a node's `directives` is None
|
|
38
|
+
# when absent, where 3.2 gave [], and pipeline/normalizeAST.py iterates it
|
|
39
|
+
# directly (TypeError: 'NoneType' object is not iterable).
|
|
40
|
+
"graphql-core>=3.2,<3.3",
|
|
41
|
+
# pipeline/newRed.py and pipeline/preProcessor.py read YAML config.
|
|
42
|
+
"pyyaml>=6.0",
|
|
43
|
+
# pipeline/graphNet.py and pipeline/Graph.py import pyplot at module level.
|
|
44
|
+
"matplotlib>=3.5",
|
|
45
|
+
]
|
|
46
|
+
|
|
47
|
+
[project.optional-dependencies]
|
|
48
|
+
# Reading the benchmark xlsx files and running the dataset preparation scripts.
|
|
49
|
+
datasets = ["pandas>=2.0", "openpyxl>=3.1"]
|
|
50
|
+
# app.py, the local UI for inspecting a scored run.
|
|
51
|
+
ui = ["fastapi>=0.100", "uvicorn>=0.23"]
|
|
52
|
+
dev = ["pytest>=7", "build>=1.0", "twine>=5.0"]
|
|
53
|
+
|
|
54
|
+
[project.urls]
|
|
55
|
+
Homepage = "https://nl2graphql-bench.github.io/"
|
|
56
|
+
Repository = "https://github.com/nl2graphql-bench/evaluation"
|
|
57
|
+
Datasets = "https://github.com/nl2graphql-bench/datasets"
|
|
58
|
+
Issues = "https://github.com/nl2graphql-bench/evaluation/issues"
|
|
59
|
+
|
|
60
|
+
[project.scripts]
|
|
61
|
+
rgeval-score-2026 = "rgeval.eval_2026:main"
|
|
62
|
+
rgeval-score-2024 = "rgeval.eval_2024:main"
|
|
63
|
+
|
|
64
|
+
[tool.hatch.version]
|
|
65
|
+
source = "vcs"
|
|
66
|
+
# Tags are v-prefixed: v0.1.0 -> 0.1.0
|
|
67
|
+
tag-pattern = "v(?P<version>.+)"
|
|
68
|
+
|
|
69
|
+
[tool.hatch.build.hooks.vcs]
|
|
70
|
+
# Generated at build time; the package reads its version from here.
|
|
71
|
+
version-file = "src/rgeval/_version.py"
|
|
72
|
+
|
|
73
|
+
[tool.hatch.build.targets.wheel]
|
|
74
|
+
packages = ["src/rgeval"]
|
|
75
|
+
|
|
76
|
+
[tool.hatch.build.targets.sdist]
|
|
77
|
+
include = ["src/rgeval", "tests", "README.md", "LICENSE", "pyproject.toml"]
|
|
78
|
+
|
|
79
|
+
[tool.pytest.ini_options]
|
|
80
|
+
testpaths = ["tests"]
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"""RGEval: semantic-equivalence scoring for generated GraphQL queries.
|
|
2
|
+
|
|
3
|
+
Compares a generated query against a reference by normalising both against the
|
|
4
|
+
schema and comparing them as graphs, so a query that is correct but written
|
|
5
|
+
differently is not scored wrong.
|
|
6
|
+
"""
|
|
7
|
+
try:
|
|
8
|
+
# Written at build time by hatch-vcs from the git tag.
|
|
9
|
+
from ._version import __version__
|
|
10
|
+
except ImportError: # running from a source tree, not installed
|
|
11
|
+
__version__ = "0.0.0.dev0"
|
|
12
|
+
|
|
13
|
+
from .scoring import score_pair
|
|
14
|
+
|
|
15
|
+
__all__ = ["score_pair", "__version__"]
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# file generated by vcs-versioning
|
|
2
|
+
# don't change, don't track in version control
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
__all__ = [
|
|
6
|
+
"__version__",
|
|
7
|
+
"__version_tuple__",
|
|
8
|
+
"version",
|
|
9
|
+
"version_tuple",
|
|
10
|
+
"__commit_id__",
|
|
11
|
+
"commit_id",
|
|
12
|
+
]
|
|
13
|
+
|
|
14
|
+
version: str
|
|
15
|
+
__version__: str
|
|
16
|
+
__version_tuple__: tuple[int | str, ...]
|
|
17
|
+
version_tuple: tuple[int | str, ...]
|
|
18
|
+
commit_id: str | None
|
|
19
|
+
__commit_id__: str | None
|
|
20
|
+
|
|
21
|
+
__version__ = version = '0.1.0'
|
|
22
|
+
__version_tuple__ = version_tuple = (0, 1, 0)
|
|
23
|
+
|
|
24
|
+
__commit_id__ = commit_id = None
|