Open AI topic when using Freeform Text Input

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

Open AI topic when using Freeform Text Input

Post by nathanj »

Hi Tony,

Sorry to bother you but there is something I can not figure out with the Open AI integration. When a player submits a reply with FreeformTextInputConversation, RuntimeAIConversationSettings detects the Input with

Code: Select all

public StandardUIInputField ChatInputField => chatInputField;
but I can not figure out what this is triggering to prompt a response.
What is happening is even though I am changing the topic with an external command, the original topic is always restated through the AIs text.
So for example, the RuntimeAIConversation Topic starts with "Welcome the player" and then after the player responds the topic is changed to "Ask the player..." but every time the second conversation starts it welcomes the player and then asks the player. It's like there is a list of Topics that get cached and recalled in every conversation.

If this makes sense, can you think of a way around this?

Thank you,
Nathan
User avatar
nathanj
Posts: 303
Joined: Sat May 28, 2016 12:30 am

Re: Open AI topic when using Freeform Text Input

Post by nathanj »

I feel like if I could not trigger a response right away after submitting a response and then calling RuntimeAIConversation.Play it might behave like I am hoping?
User avatar
Tony Li
Posts: 22118
Joined: Thu Jul 18, 2013 1:27 pm

Re: Open AI topic when using Freeform Text Input

Post by Tony Li »

Hi Nathan,

Are you setting the RuntimeAIConversation component's Topic property?

You can temporarily set the Dialogue Manager's Debug Level to Info. This will log what prompts it's sending. The example Runtime Demo scene's prompt is "about acquiring the launch codes." When I played the scene and clicked the Text Input Conversation button, the Console logged:

Dialogue System: Sending to OpenAI: The Player controls a soldier sent to intercept the evil space emperor's launch codes to prevent him from attacking your planet. Private Hart is a kind-hearted soldier who offers the quest to hack the emperor's computer to get the launch codes. Write an initial line of dialogue spoken by Private Hart to Player about acquiring the launch codes.
Dialogue System: Received from OpenAI: "Listen up, soldier. We've got a mission to save our planet. I need someone with hacking skills to get us those launch codes. Think you're up for it?"

Then I ended the conversation but didn't exit play mode. I set the Topic in the inspector to "about the meaning of life" (which is the same as setting the Topic property in C#) and clicked the button again. The Console logged:

Dialogue System: Sending to OpenAI: The Player controls a soldier sent to intercept the evil space emperor's launch codes to prevent him from attacking your planet. Private Hart is a kind-hearted soldier who offers the quest to hack the emperor's computer to get the launch codes. Write an initial line of dialogue spoken by Private Hart to Player about the meaning of life.
Dialogue System: Received from OpenAI: "Hey, soldier. While we're on this mission to save our planet, have you ever pondered the meaning of life?"
User avatar
nathanj
Posts: 303
Joined: Sat May 28, 2016 12:30 am

Re: Open AI topic when using Freeform Text Input

Post by nathanj »

Ok, this helps alot. Thanks for pointing out the debug too again :oops: It really helped with understanding how the result is determined.

I found that if I add all of my player's conversations to a single variable and then use a different AI character to summarize variable value I can get the result that I need. Its a little convoluted but it works.

Thank you again,
Nathan
User avatar
Tony Li
Posts: 22118
Joined: Thu Jul 18, 2013 1:27 pm

Re: Open AI topic when using Freeform Text Input

Post by Tony Li »

One thing I've found with this is that there's definitely an art to writing prompts, especially when using GPT-3.5 since it's limited to 4096 tokens. Fortunately if your conversations are long or complex, you can now switch to the GPT-3.5-16K model for 4x the tokens.
User avatar
nathanj
Posts: 303
Joined: Sat May 28, 2016 12:30 am

Re: Open AI topic when using Freeform Text Input

Post by nathanj »

That is also really helpful to know, thanks again. Yeah, I'm slowly learning how to refine my prompts.
Post Reply