Scopes
The term "scope" describes how data is organized hierarchically. At the top level is the global scope, which encompasses the entire intermidiate data (i.e. state of Transformable). Nested within this global scope are inner scopes, corresponding to the values associated with specific keys in the dictionary.
Example of a Transformable state, where dictionary value is a global scope, and the keys "prompt", "messages", "images", "search_results" are inner scopes:
All components manipulate the global scope of input data, which refers to the complete state of Transformable. Additionally, Actions and Executables have the capability to manipulate inner scopes using ActionExecutor and ExecutableExecutor, respectively. These executors are created upon the use method call and retain the context of execution, which includes the following parameters:
get_key (Optional[str], optional): Specifies which key value of input_data will be utilized (i.e., the scope to be used).
set_key (Optional[str], optional): Determines which key will be used to set the result value. If set_key is set to None:
if the result is of type Dict[str, Any], it updates the root dict.
otherwise, it sets the result to the default_key. (i.e., the scope where the data is placed)
default_key (str, optional): Denotes the default key used for results that are not of type Dict. If the data is not a Dict, a new default scope is created or used.
replace (ReplacingScope, optional): Specifies the strategy for replacing data within the executor. It defines how and when data should be placed in the scope. Refer to description here.
See more:
Last updated