-
Notifications
You must be signed in to change notification settings - Fork 479
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
[LG] Improve LG Options for replace null and markdown rendering #3743
Conversation
libraries/Microsoft.Bot.Builder.LanguageGeneration/LGOptions.cs
Outdated
Show resolved
Hide resolved
libraries/Microsoft.Bot.Builder.LanguageGeneration/Templates.cs
Outdated
Show resolved
Hide resolved
Also please add test cases lineBreak = markdown to make sure we handle all cases |
libraries/Microsoft.Bot.Builder.LanguageGeneration/EvaluationOptions.cs
Outdated
Show resolved
Hide resolved
libraries/Microsoft.Bot.Builder.LanguageGeneration/Evaluator.cs
Outdated
Show resolved
Hide resolved
libraries/Microsoft.Bot.Builder.LanguageGeneration/Templates.cs
Outdated
Show resolved
Hide resolved
tests/Microsoft.Bot.Builder.LanguageGeneration.Tests/TemplatesTest.cs
Outdated
Show resolved
Hide resolved
Add some reference tests |
libraries/Microsoft.Bot.Builder.LanguageGeneration/Templates.cs
Outdated
Show resolved
Hide resolved
libraries/Microsoft.Bot.Builder.LanguageGeneration/Evaluator.cs
Outdated
Show resolved
Hide resolved
libraries/Microsoft.Bot.Builder.LanguageGeneration/EvaluationOptions.cs
Outdated
Show resolved
Hide resolved
libraries/Microsoft.Bot.Builder.LanguageGeneration/EvaluationOptions.cs
Outdated
Show resolved
Hide resolved
libraries/Microsoft.Bot.Builder.LanguageGeneration/Evaluator.cs
Outdated
Show resolved
Hide resolved
libraries/Microsoft.Bot.Builder.LanguageGeneration/Templates.cs
Outdated
Show resolved
Hide resolved
libraries/Microsoft.Bot.Builder.LanguageGeneration/Templates.cs
Outdated
Show resolved
Hide resolved
libraries/Microsoft.Bot.Builder.LanguageGeneration/Templates.cs
Outdated
Show resolved
Hide resolved
libraries/Microsoft.Bot.Builder.LanguageGeneration/Templates.cs
Outdated
Show resolved
Hide resolved
libraries/Microsoft.Bot.Builder.LanguageGeneration/Templates.cs
Outdated
Show resolved
Hide resolved
libraries/Microsoft.Bot.Builder.LanguageGeneration/Templates.cs
Outdated
Show resolved
Hide resolved
Yes, the rule is options comes before imports, but it's a little bit complicated than this, there is the order we are defining
Here, by priority, we are talking about individual level, not the whole Options object, i mean if a individual option is not specified at the top level, we will still pick the lower-priority version. @cosmicshuai please make sure you add tests for all those cases. |
Just to be very precise about this, Assume a.lg imported b.lg then c.lg. And b.lg, c.lg don't import any lg files.
here is a mathematical representation to define it very clear
|
@chrimc62 @boydc2014 @Danieladu |
I get API trumping file, but I don't get 2.1. I think if you do anything but what I suggested it will be very confusing. I really think these are "global options" where the first file encountered while following the chain that defines them defines them for any file it imports. Otherwise it gets incredibly confusing especially if the same file is included on multiple paths. Because our LG is rooted in a single file, the rule I supplied ensures you can always control the global options in a predictable way for all imported files. In reply to: 615052805 [](ancestors = 615052805) |
It is way better to reply to a comment than to make a new comment. That way the connection is obvious and you can resolve the whole thing all at once. |
Is there a single evaluation options used for all evaluates of a given root template? If so, I don't think anything other than API and then top-level options make sense. If I do not define a null option and I import some file, I am not expecting all references in other templates to use that null option. If we rely only on the top-level file then we ignore what is in imported files and I think that is the right model in this case. On the other hand if evaluation options are used per-file and different files can have different options, then I think "parent" import files override whatever is in "child" import files. It should never be the case that child import files provide options for parents. In reply to: 615248909 [](ancestors = 615248909) |
I see, i think i get your proposal now, when you saying top file That do looks simple and clean. We were dealing with is the order of inheriting options from imported files, like this.
OK, i agree, it would be very simple and easy to reason if we simply don't consider the options in imported files. We only consider what the API passed in, and the options defined in root file, right? |
libraries/Microsoft.Bot.Builder.LanguageGeneration/EvaluationOptions.cs
Outdated
Show resolved
Hide resolved
libraries/Microsoft.Bot.Builder.LanguageGeneration/Templates.cs
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
closes: #3646
In LG, now user can add two more options in LG file.
the value
${path} is undefined
will create a delegate for replacing null value in evaluating expression. ${path} represents the name of variables.for example, in this case,
hi ${user.name}
will be evaluated tohi user.name is undefined
Currently, we support two mode, the normal text mode and markdown mode.
In markdown mode , the line break in multiline text will be automatically converted to two lines to create a newline.
Original Issue about markdown mode: #3364