isFunctionCallStart static method

bool isFunctionCallStart(
  1. String buffer, {
  2. ModelType? modelType,
})

Check if buffer starts with function call indicators Uses ModelType for explicit format detection

Implementation

static bool isFunctionCallStart(String buffer, {ModelType? modelType}) {
  final clean = buffer.trim();
  if (clean.isEmpty) return false;

  return switch (modelType) {
    ModelType.functionGemma => clean.startsWith(functionGemmaStartCall),
    _ => clean.startsWith('{') ||
         clean.startsWith('```json') ||
         clean.startsWith('```') ||
         clean.startsWith('<tool_code>'),
  };
}