Constructor LMFunctionAttribute
LMFunctionAttribute(string, string)
Creates a new LMFunctionAttribute with the specified name and description.
public LMFunctionAttribute(string name, string description)
Parameters
namestringThe stable identifier for the tool. Recommended: lowercase snake_case. Leading/trailing quotes and dots are automatically trimmed.
descriptionstringA short, imperative summary of what the tool does (under 200 characters recommended). Leading/trailing quotes and dots are automatically trimmed.
Examples
Example: Applying the attribute
public class WeatherService
{
[LMFunction("get_weather", "Get current weather conditions for a location")]
public string GetWeather(string location, bool includeForecast = false)
{
// Implementation...
}
[LMFunction("get_forecast", "Get weather forecast for the next several days")]
public string GetForecast(string location, int days = 5)
{
// Implementation...
}
}
Exceptions
- ArgumentNullException
Thrown when
nameordescriptionis null, empty, or consists only of whitespace.