Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[PORT] make custom function easier #1931

Closed
tomlm opened this issue Mar 19, 2020 · 0 comments · Fixed by #1981
Closed

[PORT] make custom function easier #1931

tomlm opened this issue Mar 19, 2020 · 0 comments · Fixed by #1981
Labels
R9 Release 9 - May 15th, 2020
Milestone

Comments

@tomlm
Copy link
Contributor

tomlm commented Mar 19, 2020

Port this change from botbuilder-dotnet/master branch:
microsoft/botbuilder-dotnet#3595

Make customized function in LG and expression easier by accepting just a lambda.

At the cost of expose FunctionTable instead of a generic IDictionary.

Now you can do

            Expression.Functions.Add("contoso.sqrt", (args) =>
            {
                object retValue = null;
                if (args[0] != null)
                {
                    double dblValue;
                    if (double.TryParse(args[0], out dblValue))
                    {
                        retValue = Math.Sqrt(dblValue);
                    }
                }

                return retValue;
            });

to add a new function

Changed projects

  • AdaptiveExpressions
  • Microsoft.Bot.Builder.LanguageGeneration.Tests
@github-actions github-actions bot added the 0 label Mar 19, 2020
@Danieladu Danieladu added lg R9 Release 9 - May 15th, 2020 labels Mar 23, 2020
@stevengum stevengum removed the 0 label Apr 1, 2020
@munozemilio munozemilio added this to the R9 milestone Jul 1, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
R9 Release 9 - May 15th, 2020
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants