DS and OpenAI DS in same conversation

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
User avatar
nathanj
Posts: 303
Joined: Sat May 28, 2016 12:30 am

DS and OpenAI DS in same conversation

Post by nathanj »

Hi Again, Tony

This question is about the Open AI addon.

Is it possible to integrate the OpenAI responses, I'm thinking freeform text, into an existing conversation tree?

Basically, I would like to have two options from a conversation. A is the assigning of a quest through standard Dialogue System and the other branch of the conversation would be a joke generated in runtime through the AI addon.

My only experience with the Open AI addon is a very specific use case that the demo project provided a perfect template to build from. But now I am trying to get a hybrid usage with both systems.

Is this possible?

As always, thank you again.
Nathan
User avatar
Tony Li
Posts: 21676
Joined: Thu Jul 18, 2013 1:27 pm

Re: DS and OpenAI DS in same conversation

Post by Tony Li »

Hi Nathan,

It takes a little bit of scripting. Write a method that:

1. Records the current conversation title and entry ID.
2. Stops the current conversation.
3. Starts the OpenAI conversation.
4. Hooks into DialogueManager.instance.conversationEnded to know when the OpenAI conversation is done.
5. Resumes the previous conversation.

Then call this method from your standard conversation.

Code: Select all

private string conversationTitle;
private int entryID;
private Transform actor, conversant;

void TellJoke()
{
    conversationTitle = DialogueManager.lastConversationStarted;
    entryID = DialogueManager.currentConversationState.subtitle.dialogueEntry.id;
    actor = DialogueManager.currentActor;
    conversant = DialogueManager.currentConversant;
    DialogueManager.StopConversation();
    DialogueManager.instance.conversationEnded += ResumePreviousConversation;
    yourRuntimeAIConversation.Play();
}

void ResumePreviousConversation(Transform actor)
{
    DialogueManager.StartConversation(conversationTitle, actor, conversant, entryID);
}
Post Reply