microsoft / botbuilder-tools

Welcome to the Bot Framework Tools repository, which is the home for a set of tools for developers building bots with the Microsoft Bot Framework
https://github.com/Microsoft/botframework
MIT License
444 stars 262 forks source link

LuisGen cannot create a C# class when json has sub entities #1500

Closed manish-chitre closed 3 years ago

manish-chitre commented 3 years ago

Tool

Name: LuisGen Version: 2.2.0 OS: Windows 10

Describe the bug

LuisGen doesn't create a C# class when I use a exported LUIS file that has sub entities.

To Reproduce

Steps to reproduce the behavior:

  1. Create Sub Entity Under Entity image
  2. Publish the LUIS App, Export the .json file
  3. Use Luis gen to create a C# class using LUISGen {Your export json file} -cs {your C# file name}
  4. You get below error. image

Any log messages given by the failure

Unhandled Exception: System.ArgumentException: Can not convert Object to String. at Newtonsoft.Json.Linq.JToken.op_Explicit(JToken value) at System.Dynamic.UpdateDelegates.UpdateAndExecute1[T0,TRet](CallSite site, T0 arg0) at CallSite.Target(Closure , CallSite , Object ) at LUISGen.Utils.EntityApply(JObject entity, Action1 action) in D:\a\1\s\packages\LUISGen\src\Utils.cs:line 94 at System.Dynamic.UpdateDelegates.UpdateAndExecuteVoid5[T0,T1,T2,T3,T4](CallSite site, T0 arg0, T1 arg1, T2 arg2, T3 arg3, T4 arg4) at LUISGen.CSharp.Entities(Object app, Writer w) in D:\a\1\s\packages\LUISGen\src\CSharp.cs:line 161 at System.Dynamic.UpdateDelegates.UpdateAndExecuteVoid3[T0,T1,T2](CallSite site, T0 arg0, T1 arg1, T2 arg2) at LUISGen.CSharp.Generate(String description, Object app, String className, String space, String outPath) in D:\a\1\s\packages\LUISGen\src\CSharp.cs:line 289 at System.Dynamic.UpdateDelegates.UpdateAndExecuteVoid6[T0,T1,T2,T3,T4,T5](CallSite site, T0 arg0, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5) at LUISGen.Program.Main(String[] args) in D:\a\1\s\packages\LUISGen\src\Program.cs:line 182`

Expected/desired behavior

The command must create a C# LUIS Recognizer class.

Versions

Microsoft.Bot.Builder.AI.Luis 4.11.1 Microsoft.Bot.Builder 4.11.1

Zerryth commented 3 years ago

@Chitma you're right, when trying to use LUISGen CLI with a LUIS model that contains subentities, you'll get the error that you have posted. This is because the CLI is a legacy CLI now, the Bot Framework team has moved onto replacing the multiple, separate CLIs we had with the new BF CLI. You can see note of this switchover in the LUISGen readme as well as in the BF CLI Porting Map.

LUISGen, I believe should only work for v2 of LUIS API, however the current API version is v3.


To generate a strongly typed C# class from an exported v3 LUIS model use bf luis:generate:cs command in BF CLI.

Example: