Package 

Class VoiceContextInfo


  • 
    public final class VoiceContextInfo
    
                        

    Represents a piece of contextual information that an external application wants to communicate to the voice assistant.

    Unlike se.cpacsystems.voiceassistcapabilities.voicetool.VoiceTool, which defines a callable function, a VoiceContextInfo provides descriptive metadata that is injected into the voice assistant's system prompt to give the LLM a better understanding of the environment and the applications it interacts with.

    VoiceContextInfo(
        key = "unit_system",
        description = "The operator's preferred unit system is imperial (pounds, feet, Fahrenheit)."
    )
    
    VoiceContextInfo(
        key = "app_purpose",
        description = "The On Board Weighing application manages materials, work orders, and truck assignments for loading operations."
    )
    
    VoiceContextInfo(
        key = "active_work_order",
        description = "The operator is currently working on work order WO-2024-0042 delivering Gravel 0-18 to Site B."
    )

    The key field acts as a unique identifier within each provider application. If the same key is registered twice from the same app, the newer entry replaces the older one. Different applications may use the same key without conflict since entries are namespaced by package.

    Registered context entries are collected by the voice assistant app and appended to the Gemini system prompt as a dedicated section. This means changes to context require a session reconnection to take effect, since the system prompt is sent once at WebSocket setup.

    • Method Summary

      Modifier and Type Method Description
      final String getKey()
      final String getDescription()
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait