set_semantic_state
set_semantic_state
Set the semantic state that semantic gates read as
semantic_state, alongside the conversation. The state is stored at
global_data.semantic_state.
Each call replaces the whole state. To change one field, send the whole state with
that field changed; send {} to reset it. Keep it to what your application has
established, such as a total it computed or an order the caller confirmed, rather
than what the caller claims. No other global data reaches the decision model as
state, though a gate question can still bring in a value with a ${global_data...}
variable.
A change starts a proposal: the dialogue that a gate with dialogue="proposal"
judges. The proposal dates from the start of the result’s action list, so a
say() anywhere in the same result, such as the read-back, falls inside
it. Set the state before the say all the same. When the caller talks over a
say, the platform skips the rest of the result’s actions, so a state set after
it could be lost. Older platform releases date a proposal from its own action,
which the same order also covers.
This is shorthand for update_global_data({"semantic_state": state}).
Parameters
state
The new semantic state.
Returns
FunctionResult — self, for chaining.