Constant.chain_answer.value: None,
        }
[docs]class NarrativeChain(_BaseStoryElementChain):
    """Decompose the narrative into its story elements
    - causal model
    - query
    - intervention
    """
    pydantic_model: ClassVar[Type[pydantic.BaseModel]] = NarrativeModel
    template: ClassVar[str] = narrative_template
[docs]class CausalChain(_BaseStoryElementChain):
    """Translate the causal narrative into a stack of operations."""
    pydantic_model: ClassVar[Type[pydantic.BaseModel]] = CausalModel
    template: ClassVar[str] = causal_template
[docs]class InterventionChain(_BaseStoryElementChain):
    """Set the hypothetical conditions for the causal model."""
    pydantic_model: ClassVar[Type[pydantic.BaseModel]] = InterventionModel
    template: ClassVar[str] = intervention_template
[docs]class QueryChain(_BaseStoryElementChain):
    """Query the outcome table using SQL.
    *Security note*: This class implements an AI technique that generates SQL code.
        If those SQL commands are executed, it's critical to ensure they use credentials
        that are narrowly-scoped to only include the permissions this chain needs.
        Failure to do so may result in data corruption or loss, since this chain may
        attempt commands like `DROP TABLE` or `INSERT` if appropriately prompted.
        The best way to guard against such negative outcomes is to (as appropriate)
        limit the permissions granted to the credentials used with this chain.
    """
    pydantic_model: ClassVar[Type[pydantic.BaseModel]] = QueryModel
    template: ClassVar[str] = query_template  # TODO: incl. table schema
[docs]class CPALChain(_BaseStoryElementChain):