Add WithDescription method to Function struct

Extend the `Function` struct with a `WithDescription` method to allow setting descriptions fluently.
This commit is contained in:
2025-07-31 01:51:28 -04:00
parent 31766134ef
commit 07a04d08a9

View File

@@ -47,6 +47,11 @@ func (f Function) WithSyntheticFields(fieldsAndDescriptions map[string]string) F
return f
}
func (f Function) WithDescription(description string) Function {
f.Description = description
return f
}
func (f Function) Execute(ctx *Context, input string) (any, error) {
if !f.fn.IsValid() {
return "", fmt.Errorf("function %s is not implemented", f.Name)