How do I get my character to say the exact words I want them to?

Original Discord Post by tyke_18 | 2024-09-02 10:46:57

Hi :slightly_smiling_face:

I would like my character to say things sometimes that are very specific. For example I would like them to respond accurately to the user asking the question, “what is the time?”. I think I can detect for the user asking this with narrative graph (or would it be Actions)? - I’ve not delved into these yet, but will do. When I’ve detected the user asking for the time what does the process look like to make the character repeat verbatim what I specify i.e. the time (which would be the time that I’ve got from the system clock)?

Reply by k3kalinix | 2024-09-03 07:34:23

Hello <@708608540763357234>,

Reply by k3kalinix | 2024-09-03 07:34:32

Yes you can use our Narrative Design Feature.

Reply by k3kalinix | 2024-09-03 07:36:31

cc: <@&1163218322200989806> for details.

Reply by saurav0037 | 2024-09-03 07:44:16

In case of narrative design you can use the tags. Anything inside speak tag would output the exact lines.

Reply by tyke_18 | 2024-09-03 07:45:12

<@1023671043287699568> <@368669084952428554> fantastic, thankyou, I will do that :+1:

Reply by saurav0037 | 2024-09-03 07:47:45

Also do look into narrative Template keys for your above use case. It takes variable value map as input. You’ll be able to use variables in narrative design for (Dates times etc)

Reply by k3kalinix | 2024-09-03 07:51:07

Yes, but it is not currently implemented for Unity.

Reply by tyke_18 | 2024-09-03 07:52:33

Ah ok, as long as I can use the tags then that is enough, I can get the users correct time and date for their respective timezone, just need a way of passing that in so it can be repeated verbatim.

Reply by tyke_18 | 2024-09-06 12:29:16

Ah, as you have said <@1023671043287699568> the narrative template keys that take a variable value has not been implemented in Unity, tags would not do I want because I need to pass in the current time and date. I don’t suppose this feature is being worked on or planned for Unity?

Reply by tyke_18 | 2024-09-06 12:30:37

<@368669084952428554>

Reply by k3kalinix | 2024-09-06 12:33:20

<@433610960725344267> Could you please help?

Reply by raghuvanshagarwal | 2024-09-06 12:39:01

It’s being worked on and will be a part of next release, for now we can help you with a custom implementation but we do not guarantee that it will work properly, I will ping you after I have come up with a solution. Meanwhile can you give me the version number you are using

Replying to raghuvanshagarwal’s Message

Reply by raghuvanshagarwal | 2024-09-06 12:39:01
It’s being worked on and will be a part of next release, for now we can help you with a custom implementation but we do not guarantee that it will work properly, I will ping you after I have come up with a solution. Meanwhile can you give me the version number you are using

Reply by tyke_18 | 2024-09-06 13:12:18

Hi, I’m using Convai SDK 3.1.0, if you can provide me with something then that’s great but my requirement isn’t urgent I can wait until the next version release no problem, I have other things to do in the meantime :+1:

Reply by tyke_18 | 2024-09-10 08:20:11

Hi <@433610960725344267> I don’t suppose there’s any progress on providing the say exact words functionality in Unity as described here? I don’t mean to be impatient, if I have to wait until the next official SDK update which afaik is next month then that’s ok, just wondering if you have a workaround for it in the meantime? No problem if not.

Reply by raghuvanshagarwal | 2024-09-10 08:23:49

Hi sorry <@708608540763357234> I forgot to respond to you, I am sending you a file which is a Unity Component you need to add to your gameobject to send the ND template keys and also sending you a modified function inside GRPC to actually send it to the server

Reply by raghuvanshagarwal | 2024-09-10 08:24:56

Attachments:

Reply by raghuvanshagarwal | 2024-09-10 08:27:44

And replace CreateGetResponseRequest function in ConvaiGRPC.cs with

private GetResponseRequest CreateGetResponseRequest(bool isActionActive, bool isLipSyncActive, int recordingFrequency, string characterID, ActionConfig actionConfig = null,
    FaceModel faceModel = FaceModel.OvrModelName, string speakerID = "", ConvaiNPC npc = null)
{
    GetResponseRequest getResponseConfigRequest = new()
    {
        GetResponseConfig = new GetResponseConfig
        {
            CharacterId = characterID,
            ApiKey = _apiKey, // Assumes apiKey is available
            SessionId = npc?.sessionID ?? _activeConvaiNPC?.sessionID ?? "-1", // Assumes _activeConvaiNPC would not be null, else this will throw NullReferenceException
            SpeakerId = speakerID,
            AudioConfig = new AudioConfig
            {
                SampleRateHertz = recordingFrequency,
                EnableFacialData = isLipSyncActive,
                FaceModel = faceModel
            },
        }
    };
    if (_activeConvaiNPC != null)
    {
        if (_activeConvaiNPC.TryGetComponent(out ConvaiNarrativeDesignTemplateKeyController component))
        {
            foreach(KeyValuePair<string,string> keyValuePair in component.GetTemplateKeys())
            {
                getResponseConfigRequest.GetResponseConfig.NarrativeTemplateKeys.Add(keyValuePair.Key, keyValuePair.Value);
            }
        }
    }
    if (isActionActive || _activeConvaiNPC != null) getResponseConfigRequest.GetResponseConfig.ActionConfig = actionConfig;
    return getResponseConfigRequest;
}

Reply by raghuvanshagarwal | 2024-09-10 08:32:34

Let me know if it fulfills your requirement

Replying to raghuvanshagarwal’s Message

Reply by raghuvanshagarwal | 2024-09-10 08:32:34
Let me know if it fulfills your requirement

Reply by tyke_18 | 2024-09-10 08:40:35

Thanks so much, I will try it and let you know how I got on.