-
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] Inject LG templates as a global expression function #3802
Conversation
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
tests/Microsoft.Bot.Builder.LanguageGeneration.Tests/Examples/InjectionTest/inject.lg
Outdated
Show resolved
Hide resolved
tests/Microsoft.Bot.Builder.LanguageGeneration.Tests/Examples/InjectionTest/inject.lg
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.
🕐
Will this apply for the dialogs under dialog having this lg or all dialogs? Thanks |
@xieofxie, all dialogs |
So we will load all lgs when bot is starting? And if it is for all lgs, it means we could use another lg's function without import it? |
Yes, all LGs are loaded when bot starting. All exported templates can be used as a prebuilt functions under all dialogs. |
tests/Microsoft.Bot.Builder.LanguageGeneration.Tests/TemplatesTest.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
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.
@cosmicshuai let's make sure our options are not case-sensitive before we take this in |
close: #3652
In this PR, users can register namespace for a lg file. Also, they can register some templates as a expression functions, which can be applied easily in dialog.
Here is an example to use these options,
After registration, in a dialog file, such usage
"property": "=foo.template1()"
is enabled, foo.template1() just behaves like a customized function.The limitation is this kind of 'LG template function' can not read any scope from dialogStateManager, which is the same as prebuilt functions.
For example,
we have a memory in dialogStateManager:
user.tasks: [ "car", "washing", "food", "laundry" ]
if you to join the list of user.tasks, you have to define the LG file as
Then call the function as