Use Cases
Explore practical use cases for Dynamic Context and learn how it improves character responsiveness, relevance, and contextual awareness in conversations.
Beginner
Personalizing the Conversation
using System.Collections;
using System.Linq;
using Convai.Scripts;
using UnityEngine;
/// <summary>
/// Injects player identity into the active Convai session at session start.
/// The character receives this context before the first exchange and can
/// greet the player by name and class without any dashboard reconfiguration.
/// </summary>
public class PlayerGreeting : MonoBehaviour
{
[SerializeField] private string _playerName = "Aria";
[SerializeField] private string _playerClass = "Ranger";
private ConvaiRoomManager _roomManager;
private IEnumerator Start()
{
while (ConvaiRoomManager.Instance == null)
yield return null;
_roomManager = ConvaiRoomManager.Instance;
while (!_roomManager.IsConnectedToRoom)
yield return null;
// runLlm: "true" triggers an immediate character response.
// The full audio pipeline must be ready before sending — waiting for
// IsConnectedToRoom alone is not sufficient. The bot participant joins,
// publishes its audio track, and the AudioStream is initialised
// asynchronously after the room connects. Sending before all three
// stages complete causes the TTS response to be silently dropped.
while (_roomManager.NpcToParticipantMap == null ||
!_roomManager.NpcToParticipantMap.Values.Any(d => d.AudioStream != null))
{
yield return null;
}
SendGreeting();
}
private void SendGreeting()
{
string context =
$"You are speaking with {_playerName}, a level 1 {_playerClass}. " +
"Greet them warmly and welcome them to the world.";
// replace — ensures no stale context from a previous session carries over.
// runLlm: true — triggers an immediate greeting response.
bool sent = _roomManager.UpdateDynamicContext(context, mode: "replace", runLlm: "true");
if (!sent)
Debug.LogWarning("[PlayerGreeting] UpdateDynamicContext returned false.");
}
}Injecting the Learner Profile
Module Progression
Language Tutor Proficiency Level
Injecting Emotional State
Intermediate
Reactive Game State
Silent Event Accumulation
Performance-Driven Coaching Difficulty
Branching Compliance Scenario State
Medical Simulation Patient Vitals Monitor
Advanced
Cross-Scenario Competency Gap Tracker
Usage across scenarios:
Real-Time Procedural Assessment
Reactive Character with Autonomous Response Thresholds
Last updated
Was this helpful?