def get_and_update_stateful_components(
    query_component: QueryComponent, state: Dict[str, Any]
) -> List[BaseStatefulComponent]:
    """
    Get and update stateful components.

    Assign all stateful components in the query component with the state.

    """
    stateful_components = get_stateful_components(query_component)
    update_stateful_components(stateful_components, state)
    return stateful_components

    Get and update stateful components.

    Assign all stateful components in the query component with the state.

    
llama-index-core/llama_index/core/query_pipeline/query.py