core/parsing/function_gemma_wire library
FunctionGemma's wire format, in one place.
Both halves of the protocol live here: the tokens, and the format_argument
macro of the model's own chat_template.jinja. Declarations (chat.dart)
and tool responses (extensions.dart) both render through it, so the two
cannot drift apart the way the encoder and decoder once did.
Constants
- functionGemmaEndCall → const String
- functionGemmaEndDecl → const String
- functionGemmaEndResp → const String
- functionGemmaEscape → const String
- functionGemmaStartCall → const String
- functionGemmaStartDecl → const String
- functionGemmaStartResp → const String
Functions
-
functionGemmaArgument(
dynamic value, {bool escapeKeys = true}) → String -
The template's
format_argumentmacro: strings are escape-wrapped, booleans and numbers stay bare, lists and maps recurse. -
functionGemmaDictsort(
Iterable< String> keys) → List<String> -
Jinja's
dictsort, which defaults tocase_sensitive=False. A plain.sort()would putBetabeforealpha; the template does the reverse. -
functionGemmaDouble(
double value) → String -
Python's
str(float). The template is Jinja, so every number in the prompt was formatted by Python. Both languages print the shortest round-trip digits, but they switch to exponent notation at different magnitudes: Python below1e-4and from1e16, Dart below1e-6and from1e21. -
functionGemmaFold(
String key) → String -
Python's
str.lower(), which Jinja'sdictsortfolds keys with. Dart mapsİ(U+0130) to a plaini; Python appends a combining dot, which sorts after it. -
functionGemmaResponseBody(
Object? response) → String -
The body of
response:NAME{...}. -
functionGemmaScalar(
dynamic value) → String -
Jinja renders a bare
{{ value }}through Python'sstr(), so booleans capitalise,nullbecomesNone, and floats follow Python's notation.