Skip to content

Curated parametrized queries as LLM tools / execute whitelisted reports #40

Description

@AlexanderF123

Problem

For recurring questions, the model composes the retrieval logic from scratch each time. This causes (a) extra round-trips (schema diagnosis + retry) and (b) subtle correctness errors. Observed failure patterns in production:

  • Reading a convenient but empty custom field instead of computing a value from the ledger.
  • Under-counting list results when a filter must go through a linked table (e.g. address/city via Dynamic Link).
  • Searching the wrong field for an entity name and then giving up instead of falling back.

Proposal

  1. A mechanism to register curated, parametrized functions as first-class LLM tools (function calling), e.g. bank_balance(company), units_of_property(property), suppliers_by_city(cities). The query is written and tested once by a human.
  2. Additionally/alternatively: let the chat execute whitelisted Query Reports and read their rows (today it can only list/link to reports). This turns ERPNext's existing, tested reports into a callable API.

Benefit

Deterministic, correct results in 1–2 instead of 3–5 round-trips. It also makes a faster/cheaper model reliable for the hard questions, reducing the need for a strong (slower) model.

Context

Feedback from production use with ERPNext v15 + Aakvatech PropMS. In an A/B test a smaller model was ~2.7x faster but failed exactly the questions that required composing retrieval logic; curated tools would remove that class of error.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions