Site Tools


llmcpp-llm-modifier

Table of Contents

__llm__ modifier (llmcpp)

The __llm__ modifier marks a C++ definition whose body should be generated from a request. The declaration still specifies the interface, while the body supplies plain-language instructions:

__llm__ int twice(int value)
{
    Return twice value.
}

llmcpp discovers the annotation, checks its placement, and generates ordinary C++ statements for the body. Bare __llm__ and __llm__() select the driver's defaults. Parenthesized settings can override generation behavior for one definition.

The modifier supports functions, methods, and lambdas in the main source file. The current implementation rejects annotations inside included headers. Templates receive one generated body rather than a separate generation for every specialization.

The body is a prompt, so its text need not be valid C++ statements. The surrounding declaration still matters: parameters, return type, and enclosing scope constrain the implementation. Once accepted, the generated body follows ordinary C++ semantics. The modifier requests build-time generation; it does not introduce a new calling convention for the finished function.

llmcpp-llm-modifier.md · Last modified: by 127.0.0.1