SangramMCP
Posts: 57
Joined: Wed Jul 26, 2017 7:41 pm

Invoking Dialogs

Sun Oct 15, 2017 2:23 am

Hi,

Is there a way to invoke dialogs programmatically.
For ex: My application has 5 dialogs, and 1 root dialog.
I don't want to initialize all the dialogs before hand (performance issue)
Based on the user conversation, I want to invoke a dialog.
Bot: How Can I help you today.
User: I want to book a train ticket => TrainDialog will be invoked
User: I want to book pizza => foodDialog will be invoked.

User avatar
Leslie
Lead Software Architect
Posts: 353
Joined: Fri Sep 14, 2012 12:20 pm
Contact: Website

Re: Invoking Dialogs

Sun Oct 15, 2017 4:09 pm

I am doubtful if this approach would yield any benefit in your case. Oscova only scans the metadata of the instantiated Dialog class and stores Dialog properties and Intent information. It doesn't go any deeper.

So if the initialization of Dialogs is causing a performance issue then its the implementation that has to be addressed as all Dialogs are just classes and all Intents are just methods decorated with attributes so you should be able to load 1000s of Dialogs without any performance penalty.

Even if we "lazy" initialized a Dialog as per your suggestion then in theory there will be moment in time when all the Dialogs would have been initialized thence taking the same amount of memory or utilizing the same amount of CPU cycles as it would have been in the case where you would have initialized all of them at one go.

On a side note, Oscova needs to peek at Dialog structure prior to training so late initialization is not option at the moment. There maybe a way around this. Probably you could move the "performance hogging" code into a static method and manually call it by checking Intent names.

SangramMCP
Posts: 57
Joined: Wed Jul 26, 2017 7:41 pm

Re: Invoking Dialogs

Mon Oct 16, 2017 12:44 am

Hi Leslie,

I do agree, But at the same time, there may be instances where other dialog, may not be invoked at all. Kindly throw some light on the same.

Secondly, I want to log the events based on user request. Is there any way to log oscova events, based on each user request?

User avatar
Leslie
Lead Software Architect
Posts: 353
Joined: Fri Sep 14, 2012 12:20 pm
Contact: Website

Re: Invoking Dialogs

Mon Oct 16, 2017 4:49 pm

In that case we still have to go by design and the language construct that the "Add" method expects an instant of Dialog class. This unfortunately cannot be changed as a method that expects an object cannot be given a type. So as aforementioned you would have to do some performance profiling and if the constructor these Dialogs are instantiating something else then you could move them to a static method.

Oscova has a static logger for all components.

CSharp Code

OscovaBot.Logger.LogReceived += (sender, args) =>
{
	File.AppendAllText("Some_File.log", args.Log.ToString());
};

Return to “General Discussion”

Who is online

Users browsing this forum: No registered users and 2 guests