Flow variable definitions and retrieval methods

更新时间:
复制 MD 格式
Important

To provide more diverse orchestration options, the flow orchestration feature has been upgraded to workflow applications and agent orchestration applications. The flow orchestration feature will be gradually phased out. This change does not affect existing users of the feature. You can continue to use flow orchestration, or switch to workflow applications or agent orchestration applications for an improved experience. For more information, see workflow applications and agent orchestration applications.

This document defines the flow variables in flow orchestration and explains how to retrieve their values.

Variable definitions

Name

Definition

Type

Value retrieval method

Notes

systemVars

System parameters

json

${systemVars.uid}

System-preset parameters. Currently includes parameters such as uid and tenantid.

bizVars

Business input parameters

json

${bizVars.abc}

Parameters declared in the start node.

svcVars

Node execution result parameters

json

${svcVars.node_id.response.xxx}

Obtaining node input and output parameters

(1) LLM response parameter: svcVars.node_id.response.text (2) Plugin response parameter: svcVars.node_id.response.data.xxx (3) Script response parameter: svcVars.node_id.response.variable_name

Variable example

The following code shows an example of the svcVars response parameter:

{
    "svcVars":{
        "LLM_DGc2XV":{
            "params":{
                "modelId":"qwen-plus-v1",
                "prompt":"You are a music player. Based on the following description, recommend a song suitable for this weather: ${data}"
            },
            "response":{
                "text":"Based on your description, I recommend the song 'Hearing the Sound of Rain'. This is a classic song by Jay Chou. The lyrics describe a person's emotions and thoughts in the rain. The melody is beautiful and lyrical, making it very suitable for this weather and temperature. I hope you like this song!"
            }
        },
        "Script_szLxMn":{
            "response":{
                "temp":[
                    "a",
                    " ",
                    "c"
                ]
            }
        }
    }
}

Variable retrieval

In the prompt input area of an LLM node, enclose a variable in ${} to retrieve its value.

In the input area of a script node, you do not need to use the $ identifier. Instead, you can retrieve the variable value directly by its hierarchical path, such as bizVars.xxx.

1. Retrieve the user's query

systemVars.query

2. Retrieve variables declared in the start node

bizVars.xxx

3. Retrieve response parameters from nodes

(1) LLM node response parameter

svcVars.node_id.response.text

(2) API call node response parameter

a. The API returns a JSON object

svcVars.node_id.response.variable_name

b. The API returns a JSON array

svcVars.node_id.response.list[0].variable_name

c. The API returns a non-JSON response

svcVars.Api_xxx.response.text

(3) Script node response parameter

svcVars.node_id.response.variable_name

(4) Function Compute node response parameter

svcVars.node_id.custom_key.variable_name

4. Special usage

If the retrieved result is a list, such as in the following structure:

{
    "response":[
        {
            "text":"Hello 1",
            "description":"Hello 111"
        },
        {
            "text":"Hello 2",
            "description":"Hello 222"
        }
    ]
}

To retrieve the text field from all items in the list, use the expression response.#text#, which returns `["Hello 1","Hello 2"]`. In this expression, `response` is the key for the list, and the `##` syntax extracts the specified field from each item in the list.

To retrieve the value from a single item, use standard index notation, such as response[0].text.