Table of Contents

Code generation (llmcpp)

Code generation turns the prose request into statements accepted by the compiler. The repository's mock script makes that process concrete for a deposit method:

{
  "model": "mock-model",
  "functions": {
    "Account::deposit": [
      {
        "tool": "lookup",
        "arguments": {
          "name": "cents"
        }
      },
      {
        "tool": "submit",
        "arguments": {
          "body": "cents += amount;"
        }
      }
    ]
  }
}

This is the Account::deposit portion of the test script. The agent first checks a declaration and then submits a body using it. The compiler validates the submitted implementation rather than trusting the agent's success claim.

A live backend can inspect more context and try several candidates. Accepted statements replace the request, and caching can preserve them for future builds. The generated method then executes ordinary C++ without contacting a model.

Source: 06_tools.json.