Understand property.json

This file contains the orchestration of extensions. It is the main runtime configuration file.

Overview of Graph

The property.json file contains the following orchestration information:

  • Graphs

  • Nodes

  • Connections

Graph

The predefined_graphs property comprises a collection of available graphs, each specifying the agent's behavior in a particular scenario. Every graph is uniquely identified by its name property, allowing precise selection and reference.

Each graph is structured with nodes and connections properties, defining its components and the interactions between them.

Nodes

The predefined_graphs property encapsulates a set of predefined graphs, each outlining the agent's behavior for a specific scenario. Each graph is distinguished by a unique name property, enabling clear identification and selection.

Graphs are composed of two key elements: nodes, representing individual components, and connections, which define the relationships and interactions between these components.

Node Property The property section within a node encapsulates the configuration settings specific to the associated extension. These properties are tailored to the extension and are detailed in the manifest.json file located within the corresponding extension folder. Developers can define runtime properties to customize the extension's behavior according to their needs.

Below is an example demonstrating the configuration of the chatgpt_openai_python extension:

{
  "name": "chatgpt_openai_python",
  "addon": "chatgpt_openai_python",
  "property": {
    "api_key": "${env:OPENAI_API_KEY|}",
    "model": "gpt-3.5-turbo",
    "temperature": 0.5,
    "max_tokens": 100,
    "prompt": "You are a helpful assistant"
  }
}
Property JSON nodes

Read environment variables

It is common for extensions to require an api_key for proper functionality. To avoid hardcoding sensitive values like the api_key directly in the property.json file, environment variables can be utilized. The syntax ${env:<env_var_name>|<default_value>} allows dynamic retrieval of environment variables, with the option to specify a fallback default value.

Below is an example demonstrating how to retrieve the OPENAI_API_KEY environment variable:

{
  "name": "chatgpt_openai_python",
  "addon": "chatgpt_openai_python",
  "property": {
    "api_key": "${env:OPENAI_API_KEY|}"
  }
}

Connections

The connections section defines the links between nodes, specifying both the source and destination nodes. Each connection is characterized by its extension_group and extension properties, which identify the source node and determine the supported multimodal data protocols (e.g., audio_frame, video_frame, data, cmd) enabled by the Nyra Framework.

For each data protocol, the connection includes a list of destination definitions. Each destination definition contains:

  • A name property, representing the key for the property data.

  • A dest property, specifying a list of target nodes.

Below is an example illustrating how to establish a connection between two nodes:

{
  "extension_group": "default",
  "extension": "agora_rtc",
  "audio_frame": [
    {
      "name": "pcm_frame",
      "dest": [{
        "extension_group": "default",
        "extension": "deepgram_asr"
      }]
    }
  ]
}
Property JSON Connections

In the example above, the agora_rtc extension is connected to the deepgram_asr extension, where the agora_rtc extension transmits pcm_frame data to the deepgram_asr extension.

Last updated