Add WithDescription
method to Function
struct
Extend the `Function` struct with a `WithDescription` method to allow setting descriptions fluently.
This commit is contained in:
@@ -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)
|
||||
|
Reference in New Issue
Block a user