Register
Login
Resources
Docs Blog Datasets Glossary Case Studies Tutorials & Webinars
Product
Data Engine LLMs Platform Enterprise
Pricing Explore
Connect to our Discord channel

BaseLuisAction.cs 1.1 KB

You have to be logged in to leave a comment. Sign In
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
  1. namespace Microsoft.Cognitive.LUIS.ActionBinding
  2. {
  3. using System;
  4. using System.Collections.Generic;
  5. using System.ComponentModel.DataAnnotations;
  6. using System.Linq;
  7. using System.Threading.Tasks;
  8. [Serializable]
  9. public abstract class BaseLuisAction : ILuisAction
  10. {
  11. public abstract Task<object> FulfillAsync();
  12. public virtual bool IsValid(out ICollection<ValidationResult> validationResults)
  13. {
  14. var context = new ValidationContext(this, null, null);
  15. validationResults = new List<ValidationResult>();
  16. var result = Validator.TryValidateObject(this, context, validationResults, true);
  17. // do order properties
  18. validationResults = validationResults
  19. .OrderBy(r =>
  20. {
  21. var paramAttrib = LuisActionResolver.GetParameterDefinition(this, r.MemberNames.First());
  22. return paramAttrib != null ? paramAttrib.Order : int.MaxValue;
  23. })
  24. .ThenBy(r => r.MemberNames.First())
  25. .ToList();
  26. return result;
  27. }
  28. }
  29. }
Tip!

Press p or to see the previous file or, n or to see the next file

Comments

Loading...