toFunctionSchema method

Map<String, dynamic> toFunctionSchema()

Convert to JSON Schema format used by LLM function calling APIs.

Implementation

Map<String, dynamic> toFunctionSchema() {
  return {
    'name': name,
    'description': description,
    'parameters': {
      'type': 'object',
      'properties': parameters.map(
        (key, param) => MapEntry(key, param.toJsonSchema()),
      ),
      'required': required,
    },
  };
}