hep-llm-helpers
Small reusable helpers for HEP analysis code generated with large language models.
Install
python -m pip install hep-llm-helpers
The xAOD helper module is imported as:
from hep_llm_helpers.xaod_hints import make_a_tool, make_tool_accessor
xAOD tool example
make_a_tool adds the C++ tool initialization metadata to a func_adl query and
returns a ToolInfo handle. Pass that handle to make_tool_accessor to expose a
tool operation as a Python function that can be used inside a query. The accessor's
source_code is C++ and must assign its result to the variable named result.
Here is a complete ATLAS PHYSLITE b-tagging example. It configures the
BTaggingSelectionTool at the FixedCutBEff_77 operating point and returns both a
tag decision and a tag weight:
from func_adl_servicex_xaodr25 import FuncADLQueryPHYSLITE
from func_adl_servicex_xaodr25.xAOD.jet_v1 import Jet_v1
from hep_llm_helpers.xaod_hints import make_a_tool, make_tool_accessor
base_query = FuncADLQueryPHYSLITE()
# The tool name must be unique if a query uses more than one tool instance.
query_with_tool, tag_tool = make_a_tool(
base_query,
tool_name="btag_tool",
tool_type="BTaggingSelectionTool",
include_files=["xAODBTaggingEfficiency/BTaggingSelectionTool.h"],
link_libraries=["xAODBTaggingEfficiencyLib"],
init_lines=[
'ANA_CHECK(asg::setProperty({tool_name}, "OperatingPoint", "FixedCutBEff_77"));',
"ANA_CHECK({tool_name}->initialize());",
],
)
jet_is_tagged = make_tool_accessor(
tag_tool,
function_name="jet_is_tagged",
source_code=[
"result = static_cast<bool>({tool_name}->accept(*jet));",
],
arguments=[("jet", Jet_v1)],
return_type_cpp="bool",
return_type_python="bool",
)
tag_weight = make_tool_accessor(
tag_tool,
function_name="tag_weight",
source_code=[
"ANA_CHECK({tool_name}->getTaggerWeight(*jet, result, false));",
],
arguments=[("jet", Jet_v1)],
return_type_cpp="double",
return_type_python="float",
)
# Continue building the query from query_with_tool, not base_query, so the
# injected tool metadata is retained during ServiceX translation.
query = query_with_tool.Select(
lambda event: {
"jet_is_tagged": event.Jets().Select(lambda jet: jet_is_tagged(jet)),
"tag_weight": event.Jets().Select(lambda jet: tag_weight(jet)),
}
)
The same pattern applies to other xAOD tools: initialize the tool once with
make_a_tool, create one or more accessors from its ToolInfo, and call those
accessors only in the query derived from the returned query object. Use a different
tool_name for each independently configured tool instance.
Development
This project uses Hatch:
hatch run test:run
hatch build
The local Hatch environments derive a development version from Git automatically. A release build derives the package version from the GitHub release tag.
Releases
Create a draft GitHub release with a tag such as v0.1.0, then publish the release.
The release.yml workflow builds the distributions and publishes them to PyPI using
GitHub OIDC trusted publishing. The repository must have a protected pypi environment
and a matching PyPI trusted publisher configuration before the first release.
Metadata
Release files for hep-llm-helpers 1.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| hep_llm_helpers-1.0.0.tar.gz | 4.6 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| hep_llm_helpers-1.0.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 9.7 kB
Release files / hep_llm_helpers-1.0.0.tar.gz
| Download URL | hep_llm_helpers-1.0.0.tar.gz |
|---|---|
| Size | 4.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
eb6adc4ef09276fd86763a5fc1935da369b9b65a9674b7f48eed72efe8f4ffbb
|
|
BLAKE2b-256 checksum How to use checksums |
da00e7b92ba8abd95fb34232df5ae8ac7fc9ccdf569401bf9347d72301de310e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 7, 2026.
Transparency logRelease files / hep_llm_helpers-1.0.0-py3-none-any.whl
| Download URL | hep_llm_helpers-1.0.0-py3-none-any.whl |
|---|---|
| Size | 5.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
77c035e751e7c79c155a4c39bad378bb7eecd914a7ee63a5501fb1e8f5576022
|
|
BLAKE2b-256 checksum How to use checksums |
39cfa66988b7205b8074133a8f65bd69979f39c1fcc2490f0b4c1340d382e654
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 7, 2026.
Transparency log