hermes.systems

Systems

A system turns a question into SPARQL over a knowledge graph. Systems register by name, so experiments swap them without code changes.

Contract

def system(question, kg, context):
    return {"sparql": "..."}

kg is a KnowledgeGraph. context is a Context or None: free text, example question and query pairs, and, for ablations only, reference answers. The result has at least sparql; systems may add traces and counters. hermes.ask(question, kg_or_path, context, system=..., **params) runs one. Source: systems/__init__.py.

Shipped systems

NameMethodParameters
training-freeOne prompted draft, fixed stages, one repair. Details.llm
uniqgenUniQGen (Wang et al., arXiv:2605.00845): a constraint table, then Chase and Backchase against reference answers.beam_width 5, max_depth 5, threshold 1.0, alpha 0.5, hops 2, oracle (LLM, "gold", or a callable), llm
algebra-agentAn LLM plans over the algebra with execution feedback.max_steps 15, sample_size 5, max_entities 10, llm
proverThe algebra agent with the verifier and goals.as algebra-agent

The UniQGen reimplementation differs from the paper in two documented ways: queries are rendered from constraints deterministically, and candidates are scored by comparing answer sets with the reference answers. That keeps it at two model calls per question. Aggregates, ORDER BY, and LIMIT are not handled.

Register a system

import hermes

@hermes.systems.register("my-system")
class MySystem:
    def __init__(self, llm=None, depth=3):   # config params arrive here
        self.llm = llm

    def __call__(self, question, kg, context):
        return {"sparql": "SELECT * WHERE { ?s ?p ?o } LIMIT 1"}

A class receives its parameters from systems.create(name, **params), which is how experiment configs pass them; a function takes none. A name can be registered once. hermes.systems.available() lists the names, and hermes systems prints them.

Plugins

Another package can add a system without touching Hermes by declaring an entry point in the hermes.systems group that points at the system.